Search Results

Search found 15231 results on 610 pages for 'presentation model'.

Page 111/610 | < Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >

  • MVVM- How would I go about propagating settings between my main view-model (and other view-models) a

    - by Justin
    I am building a settings dialog for my application and right now all of the settings correspond with settings on the main view-model, but as I add more view's and view-models some may not. I need to know what the best practice is for loading the current settings into the settings dialog and then saving the settings to thier corresponding view-models if the user clicks okay. I will not be using the Properties.Settings.Default system to store settings since I want my application to be as portable as possible and this would store user scoped settings in the directory: C:\Users\ username \Local Settings\Application Data\ ApplicationName Instead of in my application's directory. In case it makes any difference I am using the MVVM Light Toolkit by Laurent Bugnion.

    Read the article

  • Create unordered list tree menu from data stored in an table with the adjacency list model...php

    - by Ronedog
    I need to create a tree menu of "nth" subcategories. I settled on using the adjacency list model for my table structure, because I won't be updating this table very much and this seemed the easiest to implement for my use. I want to style the output using "ul" and "li" tags...I already have a css and jquery solution to do the styling. My problem comes from pulling the data out of the database and using a recursive function via PHP to build the list ... the list is a concatenated string that gets parsed to build the tree. I'm really having a hard time getting the closing "ul" and "li" tags to line up just where they need to be. Is this the best way to do this? Are there other better ways using arrays or something like that to do this? Any examples you can point me to of "best practices" for building a list like this will be appreciated. Thanks.

    Read the article

  • How does the Licenses.licx based .Net component licensing model work?

    - by Gishu
    I've encountered multiple third part .Net component-vendors use a licensing scheme. On an evaluation copy, the components show up with a nag-screen or watermark or some such indicator. On a licensed machine, a Licenses.licx is created - with what appears to be just the assembly full name/identifiers. This file has to be included when the client assembly is built. How does this model work? Both from component-vendors' and users' perspective. What is the .licx file used for? Should it be checked in? We've had a number of issues with the wrong/right .licx file being checked in and what not

    Read the article

  • How do I create a controller and action without a model?

    - by Angela
    I have several models: Email Letter Call All three belong to a model Campaign. And a Campaign has_many Contacts I envision being able to see a schedule for Today by going to domain/schedule/today What I'd like it to do would be to show all the Events (Email, Letter, Call) that have to happen today for each campaign. I tried the following, but have some challenges in putting it into a controller versus into a View. There are many emails in campaign. Email.days is the number of days from the contact.start_date that an email should be sent to the Contact. ScheduleController < def index campaigns.each do |campaign| #goes through each campaign for contacts in campaign.contacts Email.find(:all).reject { |email| email.contact.start_date + email.days <= Date.now } end end end

    Read the article

  • How should I model the database for this problem? And which ORM can handle it?

    - by Kristof Claes
    I need to build some sort of a custom CMS for a client of ours. These are some of the functional requirements: Must be able to manage the list of Pages in the site Each Page can contain a number of ColumnGroups A ColumnGroup is nothing more than a list of Columns in a certain ColumnGroupLayout. For example: "one column taking up the entire width of the page", "two columns each taking up half of the width", ... Each Column can contain a number ContentBlocks Examples of a ContentBlock are: TextBlock, NewsBlock, PictureBlock, ... ContentBlocks can be given a certain sorting within a Column A ContentBlock can be put in different Columns so that content can be reused without having to be duplicated. My first quick draft of how this could look like in C# code (we're using ASP.NET 4.0 to develop the CMS) can be found at the bottom of my question. One of the technical requirements is that it must be as easy as possible to add new types of ContentBlocks to the CMS. So I would like model everything as flexible as possible. Unfortunately, I'm already stuck at trying to figure out how the database should look like. One of the problems I'm having has to do with sorting different types of ContentBlocks in a Column. I guess each type of ContentBlock (like TextBlock, NewsBlock, PictureBlock, ...) should have it's own table in the database because each has it's own different fields. A TextBlock might only have a field called Text whereas a NewsBlock might have fields for the Text, the Summary, the PublicationDate, ... Since one Column can have ContentBlocks located in different tables, I guess I'll have to create a many-to-many association for each type of ContentBlock. For example: ColumnTextBlocks, ColumnNewsBlocks and ColumnPictureBlocks. The problem I have with this setup is the sorting of the different ContentBlocks in a column. This could be something like this: TextBlock NewsBlock TextBlock TextBlock PictureBlock Where do I store the sorting number? If I store them in the associaton tables, I'll have to update a lot of tables when changing the sorting order of ContentBlocks in a Column. Is this a good approach to the problem? Basically, my question is: What is the best way to model this keeping in mind that it should be easy to add new types of ContentBlocks? My next question is: What ORM can deal with that kind of modeling? To be honest, we are ORM-virgins at work. I have been reading a bit about Linq-to-SQL and NHibernate, but we have no experience with them. Because of the IList in the Column class (see code below) I think we can rule out Linq-to-SQL, right? Can NHibernate handle the mapping of data from many different tables to one IList? Also keep in mind that this is just a very small portion of the domain. Other parts are Users belonging to a certain UserGroup having certain Permissions on Pages, ColumnGroups, Columns and ContentBlocks. The code (just a quick first draft): public class Page { public int PageID { get; set; } public string Title { get; set; } public string Description { get; set; } public string Keywords { get; set; } public IList<ColumnGroup> ColumnGroups { get; set; } } public class ColumnGroup { public enum ColumnGroupLayout { OneColumn, HalfHalf, NarrowWide, WideNarrow } public int ColumnGroupID { get; set; } public ColumnGroupLayout Layout { get; set; } public IList<Column> Columns { get; set; } } public class Column { public int ColumnID { get; set; } public IList<IContentBlock> ContentBlocks { get; set; } } public interface IContentBlock { string GetSummary(); } public class TextBlock : IContentBlock { public string GetSummary() { return "I am a piece of text."; } } public class NewsBlock : IContentBlock { public string GetSummary() { return "I am a news item."; } }

    Read the article

  • How do I correctly model data in SQL-based databases that have some columns in common, but also have

    - by Brandon Weiss
    For instance, let's say I have a User model. Users have things like logins, passwords, e-mail addresses, avatars, etc. But there are two types of Users that will be using this site, let's say Parents and Businesses. I need to store some different information for the Parents (e.g. childrens' names, domestic partner, salaries, etc.) than for the Businesses (e.g. industry, number of employees, etc.), but also some of it is the same, like logins and passwords. How do I correctly structure this in a SQL-based database? Thanks!

    Read the article

  • Do you know of a free .Net component for visual flow model graph design and editing?

    - by Ivan
    An app (C#4, WinForms, Entity Framework, SQL Server 2008) of mine maintains a graph of interconnected objects, each having some simple member fields and a set of many directed (in and out) one-to-one links to other objects. I'd like to offer a user an ability to view and edit this graph visually some way, creating and removing connections, modifying objects attributes values and introducing/dropping objects. I suppose there has to be a framework (at list a primitive kind of) for this as visual model design tools are pretty common to meet. Do you know one?

    Read the article

  • R: ggplot2, how to get the parameters from a plotted linear model smoother?

    - by John
    I have a data.frame with 3 time series in it, shown below. When I plot them with a smoother time series, I want to be able to get the parameters of the linear model that I plot, but I can't see how to do that? > data day od series_id 1 1 0.10 A1 2 3 1.00 A1 3 5 0.50 A1 4 7 0.70 A1 5 1 1.70 B1 6 3 1.60 B1 7 5 1.75 B1 8 7 1.70 B1 9 1 2.10 C1 10 3 2.30 C1 11 5 2.50 C1 12 7 2.70 C1 data = data.frame (day = c(1,3,5,7,1,3,5,7,1,3,5,7), od = c(0.1,1.0,0.5,0.7 ,1.7,1.6,1.75,1.7 ,2.1,2.3,2.5,2.7), series_id = c("A1", "A1", "A1","A1", "B1", "B1","B1", "B1", "C1","C1", "C1", "C1")) r <- ggplot(data = data, aes(x = day, y = od)) r + stat_smooth(aes(group = series_id, color = series_id),method="lm")

    Read the article

  • How to render the properties of the view model's base class first when using ViewData.ModelMetadata.

    - by Martin R-L
    When I use the ViewData.ModelMetadata.Properties in order to loop the properties (with an additional Where(modelMetadata => modelMetadata.ShowForEdit && !ViewData.TemplateInfo.Visited(modelMetadata))), and thereby create a generic edit view, the properties of the view model's base class are rendered last. Is it possible to use a clever OrderBy() or is there another way to first get the properties of the base class, and then the sub class'? Reverse won't do the trick since the ordering of each class' properties is perfectly fine. A workaround would of course be composition + delegation, but since we don't have mixins, it's too un-DRY IMHO, why I seek a better solution if possible.

    Read the article

  • Limit JavaScript and CSS files on ASP.NET MVC 2 Master Page based on Model and View content

    - by Zack Peterson
    I want to include certain .js and .css files only on pages that need them. For example, my EditorTemplate DateTime.ascx needs files anytimec.js and anytimec.css. That template is applied whenever I use either the EditorFor or EditorForModel helper methods in a view for a model with a DateTime type value. I've put this condition into the <head> section of my master page. It checks for a DateTime type property in the ModelMetadata. <% if (this.ViewData.ModelMetadata.Properties.Any(p => p.ModelType == typeof(DateTime))) { %> <link href="../../Content/anytimec.css" rel="stylesheet" type="text/css" /> <script src="../../Scripts/anytimec.js" type="text/javascript"></script> <% } %> This has two problems: Fails if I have nested child models of type DateTime Unnecessarily triggered by views without EditorFor or EditorForModel methods (example: DisplayForModel) How can I improve this technique?

    Read the article

  • CakePHP: Same model, set up per form validation rules?

    - by mwaterous
    I have a single model in CakePHP that has multiple forms on different pages of the site that I would like to validate differently even where the field name is the same - I have discovered that you can set 'on' to create|update which has been a handy discovery but I am wondering if there is any other way of explicitly declaring rules based on the form that was submitted? Just to rephrase for clarity, form a and form b contain fields of the same name, but if form a is submitted the fields in question should be validated differently than if they were submitted from form b. Possible?

    Read the article

  • ruby on rails: How do I access variable data in a url parameter passed to a model?

    - by bandhunt
    I have a variable called "account_type" passed from a rails form and need to access the value in the corresponding model. I can check if :account_type exists as a symbol, but where does the stored data come into play? Is there something I need to do in the controller? This code gives an undefined method 'account_type' error. validates_format_of :name, :with => /^[a-z0-9_]+$/i, :on => :create if account_type == 2 If I use a symbol then it doesn't give an error, but a symbol will never equal 2 validates_format_of :name, :with => /^[a-z0-9_]+$/i, :on => :create if :account_type == 2 It's confusing that you can validate the format of a symbol (like :name above) when :name only seems to be a reference with nothing stored in it. Thanks!

    Read the article

  • How to register a model in django-tagging anywhere not in the applications?

    - by culebrón
    Is it possible to register a model in django-tagging not in tagging app, nor in my app? The standard way is to edit apps/myapp/models.py this way: from apps import tagging tagging.register(MyModel) I want to keep both applications without changes, for example, to be able to pull new versions and just replace them. So I tried putting this into project settings.py, in the end, but of course this fails. from apps.myapp.models import MyModel from apps import tagging tagging.register(MyModel) (This fails when importing MyModel.) Any other way?

    Read the article

  • [Django] How to find out whether a model's column is a foreign key?

    - by codethief
    I'm dynamically storing information in the database depending on the request: // table, id and column are provided by the request table_obj = getattr(models, table) record = table_obj.objects.get(pk=id) setattr(record, column, request.POST['value']) The problem is that request.POST['value'] sometimes contains a foreign record's primary key (i.e. an integer) whereas Django expects the column's value to be an object of type ForeignModel: Cannot assign "u'122'": "ModelA.b" must be a "ModelB" instance. Now, is there an elegant way to dynamically check whether b is a column containing foreign keys and what model these keys are linked to? (So that I can load the foreign record by it's primary key and assign it to ModelA?) Or doesn't Django provide information like this to the programmer so I really have to get my hands dirty and use isinstance() on the foreign-key column?

    Read the article

  • How Do I insert Data in a table From the Model MVC?

    - by user54197
    I have data coming into my Model, how do I setup to insert the data in a table? public string Name { get; set; } public string Address { get; set; } public string City { get; set; } public string State { get; set; } public string Zip { get; set; } public Info() { using (SqlConnection connect = new SqlConnection(connections)) { string query = "Insert Into Personnel_Data (Name, StreetAddress, City, State, Zip, HomePhone, WorkPhone)" + "Values('" + Name + "','" + Address + "','" + City + "','" + State + "','" + Zip + "','" + ContactHPhone + "','" + ContactWPhone + "')"; SqlCommand command = new SqlCommand(query, connect); connect.Open(); command.ExecuteNonQuery(); } } The Name, Address, City, and so on is null when the query is being run. How do I set this up?

    Read the article

  • When saving to a model, created and modified aren't automatically populated by CakePHP. Using SQL Se

    - by bakerjr
    Hi when saving to a model, my created and modified fields aren't automatically populated by CakePHP. It was automatically populated when I was using MySQL but now it isn't. I'm not using NOW() back when I was still using MySQL. Why is it? Also when a field's value is not set 'NULL' (with quotes) is inserted causing errors because SQL Server says I can't insert a string to a field of type smallint/date etc. How do I fix this? Thanks in advance!

    Read the article

  • Building a wiki like data model in rails question.

    - by lillq
    I have a data model in which I would like to have an item that has a description that can be edited. I would like to also keep track of all edits to the item. I am running into issues with my current strategy, which is: class Item < ActiveRecord::Base has_one :current_edit, :class_name => "Edit", :foreign_key => "current_edit_id" has_many :edits end class Edit < ActiveRecord::Base belongs_to :item end Can the Item have multiple associations to the same class like this? I was thinking that I should switch to keeping track of the edit version in the Edit object and then just sorting the has_many relationship base on this version.

    Read the article

  • Ruby on Rails: How best to escape a string in a model?

    - by williamjones
    I want my application to sanitize html on input rather than on display, so that the fields saved into the database are sanitized. I've been doing this with strip_tags, and it was working great. However, this has the downside that it means the user can't input anything that's bracketed with < and . How can I tell Rails in the model to securely escape tags before saving them to the database? I'd like to not have to call h on the sanitized fields again before using them in the views.

    Read the article

  • Ruby on Rails: Simple way to select all records of a nested model?

    - by Josh Pinter
    Just curious, I spent an embarrassing amount of time trying to get an array of all the records in a nested model. I just want to make sure there is not a better way. Here is the setup: I have three models that are nested under each other (Facilities Tags Inspections), producing code like this for routes.rb: map.resources :facilities do |facilities| facilities.resources :tags, :has_many => :inspections end I wanted to get all of the inspections for a facility and here is what my code ended up being: def facility_inspections @facility = Facility.find(params[:facility_id]) @inspections = [] @facility.tags.each do |tag| tag.inspections.each do |inspection| @inspections << inspection end end end It works but is this the best way to do this - I think it's cumbersome. Thanks in advance. Josh

    Read the article

  • Does retrieving an object from Doctrine2 cause __construct() of the model class to run?

    - by jiewmeng
    When I retrieve an object say by $em->find('Application\Models\User', 1); or other methods like DQL, findBy*() cause the __construct() of the model class to run? I am having a problem where I set variables there like reference to EntityManager and I find that its not set. I tried putting a die() in __construct() and it doesn't halt the application. Can I say that if I want to set other properties/fields like EntityManager $em I have to do it some other way? Perhaps something like protected function getEm() { if (!isset($this->em)) { $this->em = \Zend_Registry::get('em'); } return $this->em; }

    Read the article

  • Is there any reason why someone would want to create an Core Data model programmatically?

    - by mystify
    I wonder in which cases it would be good to make an NSManagedObjectModel completely programmatically, with NSEntityDescription instances and all this stuff. I'm that kind of person who prefers to code programmatically, rejecting Interface Builder. But when it comes to Core Data, I have a hard time figuring out why I should kill my time NOT using the nice Xcode Data Modeler tool. And since data models are stuck to a given state (except when you want to do some ugly migration operations where thinks probably go wrong and users get mad, really mad), I see no big sense in a data model that's made programmatically for the purpose of changing it all the time. Did I miss something?

    Read the article

  • How do I construct a 3D model of a room from 2 stereo cameras? What is the determining factor to an

    - by yasumi
    Currently, I have extracted depth points to construct a 3D model from 2 stereo cameras. The methods I have used are openCV graphCut method and a software from http://sourceforge.net/projects/reconststereo/. However, the generated 3D models are not very accurate, which leads me to question: 1) What is the problem with pixel-based method? 2) Should I change my pixel-based method to feature-based or object-recognition-based method? Is there a best method? 3) Are there any other ways to do such reconstruction? Additionally, the depth extracted comes only from 2 images. What if I am turning the camera 360 degrees to obtain a video? Looking forward to suggestion on how to combine this depth information. Thank you very much :)

    Read the article

  • How do I create a collection_select in the View of a model that belongs_to another?

    - by Angela
    In the _form for creating a new Contact, I want to be able to create a drop-down which allows the User to select the Campaign the Contact will belong to. In the controller, I created a collection called @campaigns. And I tried to use the following but not getting it to work: <p> <%= f.label :campaign_id %><br /> <%= f.collection_select(:contact, :campaign_id, @campaigns, :id, :name) %> </p> Basically, I want to display the available :name of the campaigns, and then submit the campaign_id associated with the selected campaign to the Contact model when it gets saved.

    Read the article

  • Model View Presenter plus ASP.NET Web Service; where does the asmx live?

    - by Dirk
    I've been slowly transitioning from a traditional web forms architecture to the MVP pattern (Passive View). So far, it's been fairly easy to implement b/c the views I've dealt with have all employed a classic PostBack model. However, I've come across my first view that will refresh portions of itself via web services. I can't grok where the web service should live (Presenter I think) or how to expose that asmx end point to my View while still maintaining the clean separation of concerns/testability that MVP affords me. I've searched far and wide for some examples on how this might be implemented and have come up with nothing. Please help!

    Read the article

  • Is there an difference between transient properties defined in the data model, or in the custom subc

    - by mystify
    I was reading that setting the value of a transient property always results in marking the managed object as "dirty". However, what I don't get is this: If I make a subclass of NSManagedObject and use some extra properties which I don't need to be persistet, how does Core Data know about them and how can it mark the object as dirty when I access these? Again, they're not defined in the data model, so Core Data has no really good hint that they are there. Or does Core Data use some kind of introspection to analyze my custom class and figure out what properties I have in there?

    Read the article

< Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >