Search Results

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

Page 80/610 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • Ignoring a model with all blank fields in Ruby on Rails

    - by aguynamedloren
    I am trying to create multiple items (each with a name value and a content value) in a single form. The code I have is functioning, but I cannot figure out how to ignore items that are blank. Here's the code: #item.rb class Item < ActiveRecord::Base attr_accessible :name, :content validates_presence_of :name, :content end #items_controller.rb class ItemsController < ApplicationController def new @items = Array.new(3){ Item.new } end def create @items = params[:items].values.collect{|item|Item.new(item)} if @items.each(&:save!) flash[:notice] = "Successfully created item." redirect_to root_url else render :action => 'new' end end #new.html.erb <% form_tag :action => 'create' do %> <%@items.each_with_index do |item, index| %> <% fields_for "items[#{index}]", item do |f| %> <p> Name: <%= f.text_field :name %> Content: <%= f.text_field :content %> </p> <% end %> <% end %> <%= submit_tag %> <% end %> This code works when all fields for all items are filled out in the form, but fails if any fields are left blank (due to validations). The goal is that 1 or 2 items could be saved, even if others are left blank. I'm sure there is a simple solution to this, but I've been tinkering for hours with no avail. Any help is appreciated!

    Read the article

  • Generate XSD from my model

    - by Coppermill
    I am writing a WCF REST service, and I am needing to generate my XSD's which provide the information for my models. What is the easiest way of doing this? It would be nice to have it generate the validation within the XSD too, if possible?

    Read the article

  • Android: DOM-Model to XML

    - by poeschlorn
    Hey Guys, analogue to this one (http://stackoverflow.com/questions/2788345/replacing-xml-in-file-from-document-in-java or http://www.exampledepot.com/egs/javax.xml.transform/WriteDom.html) I try to use it under Android... The problem is, that I can't use the suggested solution under android, because it throws java.lang.verifyError... After reading a little bit, I found out, that the class that was used to store the data to file, is not usable in android... can you suggest another solution, which is similar easy to use?

    Read the article

  • ER Data Model - confused by diagram.

    - by Khou
    Hi im a little confused by this diagram http://www.b-eye-network.com/images/content/i030ht0104.gif (Last diagram in the article) 1 - In the "ACCOUNTING ENTRY" table it shows "DebitEntry" and "CreditEntry" i) is this two column or ii) is this two rows of data? or iii) is it two separate tables on its own, Acounting_entry_credit and Accounting_entry_debit? Same question with the "ACCOUNT" table, it shows asset account, livabilities account, equaity account? are they 3 columns or are they 3 rows? Source: http://www.tdan.com/view-articles/5227/

    Read the article

  • Entity Framework - in model first, how do I get my EF classes to be based on the existing domain cla

    - by Greg
    Hi, If I already have domain classes, and I want to be able persist them using EF via a model first approach how do I do this? For example do I go to the EF designer (in VS2010) and create the model and generate the classes, then go to these EF classes and somehow manually modify them? But then would there be an issue if I needed to change the model and re-create database TSQL from the model for updates? What's the easiest approach?

    Read the article

  • Modifying a model and texture mid-game code

    - by MicroPirate
    Just have a question for anyone out there who knows some sort of game engine pretty well. What I am trying to implement is some sort of script or code that will allow me to make a custom game character and textures mid-game. A few examples would be along the lines of changing facial expressions and body part positions in the game SecondLife. I don't really need a particular language, feel free to use your favorite, I'm just really looking for an example on how to go about this. Also I was wondering if there is anyway to combine textures for optimization; for example if i wanted to add a tattoo to a character midgame, is there any code that could combine his body texture and the tattoo texture into one texture to use (this way I can simply just render one texture per body.) Any tips would be appreciated, sorry if the question is a wee bit to vauge.

    Read the article

  • Automatically generate buddy classes from model in C#

    - by JohnnyO
    I use Linq to Sql (although this is equally applicable in Entity Framework) for my models, and I'm finding myself creating buddy classes for my models all the time. I find this time consuming and repetitive. Is there an easy way to automatically generate these buddy classes based on the models? Perhaps a visual studio macro? An example of a buddy class that I'd like to create: [MetadataType(typeof(PersonMetadata))] public partial class Person { } public class PersonMetadata { public object Id { get; set; } public object FirstName { get; set; } } Thanks in advance.

    Read the article

  • Difference between KeywordQuery, FullTextQuerySearch type for Object Model and Web service Query

    - by Raghu
    Initially I believed these 3 to be doing more or less the same thing with just the notation being different. Until recently, when i noticed that their does exists a big difference between the results of the KeyWordQuery/FullTextQuerySearch and Web service Query. I used both KeywordQuery and FullText method to search of the the value of a customColumn XYZ with value (ASDSADA-21312ASD-ASDASD):- When I run this query as:- FullTextSqlQuery:- FullTextSqlQuery myQuery = new FullTextSqlQuery(site); { // Construct query text String queryText = "Select title, path, author, isdocument from scope() where freetext('ASDSADA-21312ASD-ASDASD') "; myQuery.QueryText = queryText; myQuery.ResultTypes = ResultType.RelevantResults; }; // execute the query and load the results into a datatable ResultTableCollection queryResults = myQuery.Execute(); ResultTable resultTable = queryResults[ResultType.RelevantResults]; // Load table with results DataTable queryDataTable = new DataTable(); queryDataTable.Load(resultTable, LoadOption.OverwriteChanges); I get the following result representing the document. * Title: TestPDF * path: http://SharepointServer/Shared Documents/Forms/DispForm.aspx?ID=94 * author: null * isDocument: false Do note the Path and isDocument fields of the above result. Web Service Method Then I tried a Web Service Query method. I used Sharepoint Search Service Tool available at http://sharepointsearchserv.codeplex.com/ and ran the same query i.e. Select title, path, author, isdocument from scope() where freetext('ASDSADA-21312ASD-ASDASD'). This time I got the following results:- * Title: TestPDF * path: http://SharepointServer/Shared Documents/TestPDF.pdf * author: null * isDocument: true Again note the path. While the search results from 2nd method are useful as they provide me the file path exactly, I can't seem to understand why is the method 1 not giving me the same results? Why is there a discrepancy between the two results?

    Read the article

  • Updating Model with entity collection

    - by jean27
    There are a group of entities named Book and Magazine which inherits from the abstract class PublishedItem. PublishedItem have these properties: ID, Name, Publisher, List of Authors, List of Genres. The Book entity has the ISBN property and the Magazine entity has the ISSN property. I just want to ask how I can update the book's or magazine's list of genres or list of authors?

    Read the article

  • Using Hidden Markov Model for designing AI mp3 player

    - by Casper Slynge
    Hey guys. Im working on an assignment, where I want to design an AI for a mp3 player. The AI must be trained and designed with the use of a HMM method. The mp3 player shall have the functionality of adapting to its user, by analyzing incoming biological sensor data, and from this data the mp3 player will choose a genre for the next song. Given in the assignment is 14 samples of data: One sample consist of Heart Rate, Respiration, Skin Conductivity, Activity and finally the output genre. Below is the 14 samples of data, just for you to get an impression of what im talking about. Sample HR RSP SC Activity Genre S1 Medium Low High Low Rock S2 High Low Medium High Rock S3 High High Medium Low Classic S4 High Medium Low Medium Classic S5 Medium Medium Low Low Classic S6 Medium Low High High Rock S7 Medium High Medium Low Classic S8 High Medium High Low Rock S9 High High Low Low Classic S10 Medium Medium Medium Low Classic S11 Medium Medium High High Rock S12 Low Medium Medium High Classic S13 Medium High Low Low Classic S14 High Low Medium High Rock My time of work regarding HMM is quite low, so my question to you is if I got the right angle on the assignment. I have three different states for each sensor: Low, Medium, High. Two observations/output symbols: Rock, Classic In my own opinion I see my start probabilities as the weightened factors for either a Low, Medium or High state in the Heart Rate. So the ideal solution for the AI is that it will learn these 14 sets of samples. And when a users sensor input is received, the AI will compare the combination of states for all four sensors, with the already memorized samples. If there exist a matching combination, the AI will choose the genre, and if not it will choose a genre according to the weightened transition probabilities, while simultaniously updating the transition probabilities with the new data. Is this a right approach to take, or am I missing something ? Is there another way to determine the output probability (read about Maximum likelihood estimation by EM, but dont understand the concept)? Best regards, Casper

    Read the article

  • When to use which mysql partitioning model

    - by Industrial
    Ok guys, just starting out with partitioning some tables in mySQL. There's a couple of different ways describing this, but what I cant find is a more practical approach. - Which type of data does each way of partitioning have the best effect on? Or doesn't it really matter?

    Read the article

  • Mocking using 'traditional' Record/Replay vs Moq model

    - by fung
    I'm new to mocks and am deciding on a mock framework. The Moq home quotes Currently, it's the only mocking library that goes against the generalized and somewhat unintuitive (especially for novices) Record/Reply approach from all other frameworks. Can anyone explain simply what the Record/Replay approach is and how Moq differs? What are the pros and cons of each especially from the point of deciding a framework? Thanks.

    Read the article

  • Perceptron Classification and Model Training

    - by jake pinedo
    I'm having an issue with understanding how the Perceptron algorithm works and implementing it. cLabel = 0 #class label: corresponds directly with featureVectors and tweets for m in range(miters): for point in featureVectors: margin = answers[cLabel] * self.dot_product(point, w) if margin <= 0: modifier = float(lrate) * float(answers[cLabel]) modifiedPoint = point for x in modifiedPoint: if x != 0: x *= modifier newWeight = [modifiedPoint[i] + w[i] for i in range(len(w))] w = newWeight self._learnedWeight = w This is what I've implemented so far, where I have a list of class labels in answers and a learning rate (lrate) and a list of feature vectors. I run it for the numbers of iterations in miter and then get the final weight at the end. However, I'm not sure what to do with this weight. I've trained the perceptron and now I have to classify a set of tweets, but I don't know how to do that. EDIT: Specifically, what I do in my classify method is I go through and create a feature vector for the data I'm given, which isn't a problem at all, and then I take the self._learnedWeight that I get from the earlier training code and compute the dot-product of the vector and the weight. My weight and feature vectors include a bias in the 0th term of the list so I'm including that. I then check to see if the dotproduct is less than or equal to 0: if so, then I classify it as -1. Otherwise, it's 1. However, this doesn't seem to be working correctly.

    Read the article

  • Many-To-Many dimensional model

    - by Mevdiven
    Folks, I have a dimension table called DIM_FILE which holds information of the files we received from customers. Each file has detail records which constitutes my FACT table, CUST_DETAIL. In the main process, file is gone through several stages and each stage tags a status to it. Long in a short, I have many-to-many relationship. Any ideas around star schema dimensional modeling. A customer record only belong to a single file and a file can have multiple statuses. FACT ---- CustID FileID AmountDue DIM_FILE -------- FileID FileName DateReceived FILE_STATUS ----------- FileID StatusDateTime StatusCode

    Read the article

  • Ejb Update Model from selectOneMenu

    - by Ignacio
    Can anyone please tell me why the following isn't working? h:selectOneMenu value="#{modelosController.selected.idMarca}" f:selectItems value="#{marcasController.itemsAvailableSelectOne}" / /h:selectOneMenu h:commandButton action="#{modelosController.createByMarcas}" value="Buscar" / public String createByMarcas() { current = new Modelos(selectedItemIndex, current.getIdMarca()); items =(DataModel)ejbFacade.findByMarcas(); getPagination().getItemsCount(); recreateModel(); return "List"; } public List<Modelos> findByMarcas(){ CriteriaQuery cq = (CriteriaQuery) em.createNamedQuery("SELECT m FROM Modelos WHERE m.id_marca :id_marca"); cq.select(cq.from(Modelos.class)); return em.createQuery(cq).getResultList(); } Thank you very much!

    Read the article

  • Database model for saving random boolean expressions

    - by zarko.susnjar
    I have expressions like this: (cat OR cats OR kitten OR kitty) AND (dog OR dogs) NOT (pigeon OR firefly) Anyone having idea how to make tables to save those? Before I got request for usage of brackets, I limited usage of operators to avoid ambiguous situations. So only ANDs and NOTs or only ORs and saved those in this manner: operators id | name 1 | AND 2 | OR 3 | NOT keywords id | keyword 1 | cat 2 | dog 3 | firefly expressions id | operator | keywordId 1 | 0 | 1 1 | 1 | 2 1 | 3 | 3 which was: cat AND dog NOT firefly But now, I'm really puzzled...

    Read the article

  • Java paint speed relative to color model

    - by Jon
    I have a BufferedImage with an IndexColorModel. I need to paint that image onto the screen, but I've noticed that this is slow when using an IndexColorModel. However, if I run the BufferedImage through an identity affine transform it creates an image with a DirectColorModel and the painting is significantly faster. Here's the code I'm using AffineTransformOp identityOp = new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_BILINEAR); displayImage = identityOp.filter(displayImage, null); I have three questions 1. Why is painting the slower on an IndexColorModel? 2. Is there any way to speed up the painting of an IndexColorModel? 3. If the answer to 2. is no, is this the most efficient way to convert from an IndexColorModel to a DirectColorModel? I've noticed that this conversion is dependent on the size of the image, and I'd like to remove that dependency. Thanks for the help

    Read the article

  • Reloading the model of a TTTableViewController

    - by user341338
    My problem is that I have a Register Controller and a Login Controller. The Login Screen displays a Login Screen or a Logout Screen depending if a user is logged in. Now when a user registers, does not close the app, and then goes to the Login Screen it will still display a Login Screen, although there is a logged in user already. This is because the Screen is created when the application loads and does not change afterwards. I tried doing this: - (id)init { if (self = [super init]) { [self invalidateModel]; [self reload]; but that did not work, since it is only called on the first init. then i tried: - (void)viewDidLoad { [self invalidateModel]; [self reload]; } But that method had the same problem. Then I found this method: - (TTNavigationMode)navigationModeForURL:(NSString*)URL; with the following options: typedef enum { TTNavigationModeNone, TTNavigationModeCreate, // a new view controller is created each time TTNavigationModeShare, // a new view controller is created, cached and re-used TTNavigationModeModal, // a new view controller is created and presented modally TTNavigationModeExternal, // an external app will be opened } TTNavigationMode; It seems like TTNavigationModeCreate would be the right thing to use, but I have no clue how to use it. Any help? Thnx.

    Read the article

  • 'e-Commerce' scalable database model

    - by Ruben Trancoso
    I would like to understand database scalability so I've just heard a talk about Habits of Highly Scalable Web Applications http://techportal.ibuildings.com/2010/03/02/habits-of-highly-scalable-web-applications/ On it, the presenter mainly talk about relational database scalability. I also have read something about MapReduce and Column oriented tables, big tables, hypertable etc... trying to understand which are the most up to date methods to scale web application data. But the second group, to me, is being hard to understand where it fits. It serves as transactional, reliable data store? or not, its just for large access and processing and to handle fine graned operations we will ever need to rely on RDBMSs? Could someone give a comprehensive landscape for those new technologies and how to use it?

    Read the article

  • Back Orders for ERP: data model references ?

    - by Patrick Honorez
    I have built an ERP using Sql Server as a back-end. These are the different types of Client documents (there are also Supplier Docs): Order -- impact: BO Delivery Note (also used for returns, with negative quantity) --impact: BO, Stock Invoice --impact: accounting only Credit Note --impact: accounting, BO I use a complex system of self joins (at detail level) to find out the quantities in each OrderDetail that still have a backorder (BO). It'd like to simplify this using a [group] field that could be used through all detail line related to an original order. There are many difficult things to trace: a Return of a product may be due to a defect and thus increase the BO, or it can be just a return, joined with a Credit Note, and then has no impact on BO. My question is: do you know of any real good reference (book, web) for this matter ?

    Read the article

  • Why can't I save my model with a generic relation twice in Django?

    - by e-satis
    I got a model TrackedItem with a generic relation linking to any model it is supposed to track. If I do that: t = TrackedItem(content_object=MyModel) t.save() t.save() I get : IntegrityError: (1062, "Duplicate entry '1' for key 'PRIMARY'") Indeed, the first save has created an entry with "1" as a PK. But the second save should not insert, it should update. How am I suppose to update a model I can't save twice? With an ordinary model I can save as much as I want.

    Read the article

  • rails semi-complex STI with ancestry data model planning the routes and controllers

    - by ere
    I'm trying to figure out the best way to manage my controller(s) and models for a particular use case. I'm building a review system where a User may build a review of several distinct types with a Polymorphic Reviewable. Country (has_many reviews & cities) Subdivision/State (optional, sometimes it doesnt exist, also reviewable, has_many cities) City (has places & review) Burrow (optional, also reviewable ex: Brooklyn) Neighborhood (optional & reviewable, ex: williamsburg) Place (belongs to city) I'm also wondering about adding more complexity. I also want to include subdivisions occasionally... ie for the US, I might add Texas or for Germany, Baveria and have it be reviewable as well but not every country has regions and even those that do might never be reviewed. So it's not at all strict. I would like it to as simple and flexible as possible. It'd kinda be nice if the user could just land on one form and select either a city or a country, and then drill down using data from say Foursquare to find a particular place in a city and make a review. I'm really not sure which route I should take? For example, what happens if I have a Country, and a City... and then I decide to add a Burrow? Could I give places tags (ie Williamsburg, Brooklyn) belong_to NY City and the tags belong to NY? Tags are more flexible and optionally explain what areas they might be in, the tags belong to a city, but also have places and be reviewable? So I'm looking for suggestions for anyone who's done something related. Using Rails 3.2, and mongoid.

    Read the article

  • which iphone data model to choose?

    - by Tronic
    i need to get some data somewhere to put in a timeline. the data strcture is like this: - Item - Name - Year - ShortInfo (mainly keywords and short texts) - LongInfo (much text with videos/audios (urls) a friend of mine told me i should you a plist and get all that stuff in there, but what about a sqlite database? any advice? regards

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >