Search Results

Search found 214 results on 9 pages for 'genre'.

Page 1/9 | 1 2 3 4 5 6 7 8 9  | Next Page >

  • Freshen the RTS genre

    - by William Michael Thorley
    This isn't really a question, but a request for feedback. RPS (Rock, Paper, Scissors) RTS (Real Time Strategy) Demo version is out: The game is simple. It is an RTS. Why has it been made? Many if not most RTS’s are about economy and large numbers of unit types. The genre hasn’t actually developed the gameplay drastically from the very first RTS’s produced, some lesson have been learned, but the games are really very similar to how they have always been. RPS brings new gameplay to the RTS genre. Through three means: • New combat mechanics: RPS has two unique modes (as well as the old favourite) of resolving weapon fire. These change how combat happens, and make application of the correct units vital to success. From this comes the requirement to run Intel on your enemies. • Fixed Resource Economy: Each player has a fixed amount of energy, This means that there is a definite end to the game. You can attrition your enemy and try to outlast them, or try to outspend your opponent and destroy them. There is a limit to how fast ships can be built, through the generation of construction blocks, but energy is the fast limit on economy. • Game Modes: Game modes add victory conditions and new game pieces. The game is overseen by a controller which literally runs the game. Games are no longer line them up, gun them down. This means that new tactics must be played making skirmish games fresh with novel tactics without adding huge amounts of new game units to learn. I’ve produced RPS from the ground. I will be running a kickstarter in the near future, but right now I want feedback and input from the game developing community. Regarding the concepts, where RPS is going, the game modes, the combat mechanics. How it plays. RPS will give fresh gameplay to the genre so it must be right. It works over the internet or a LAN and supports single player games. Get it. Play it. Tell me about your games. Thank you Demo: https://dl.dropbox.com/u/51850113/RPS%20Playtest.zip Tutorials: https://dl.dropbox.com/u/51850113/RPSGamePlay.zip

    Read the article

  • Download lastfm tags into mp3 comment or genre tag

    - by Meng Tian
    for a long time I dream to have a songs lastfm tags in my music library, so I can use them to quickly generate playlists. There used to be a way to do that in amarok 1.4, but it never was stable. Than there is MusicBrainz Picard's lastfm/lastfmplus plugin. It is partially fine, but I cannot manage to make it look ONLY for the lastfm tags and put them into comments/genre/whatever but it always hast to tag everything. And it isn't particularly good with it, especially with small bands, songs without album etc. My music library is rather well organised. Most of the tags are correct. I also have quite some songs without an album. And I don't want it to find the albums for those songs, since it'd mess up my album view. So it must not touch the fields track name, track number, artist and album. All I want is that the most popular lastfm tags get into the genre or comments tag of the mp3, separated by semicolons, commas or whatever. I think I remember a script that did this job, but I cannot find. Does anybody know if there is anything like this? Would it be to hard to write this, for example as Banshee plugin? Thank you

    Read the article

  • Good 3D Game Engine for the Horror Genre [on hold]

    - by James Wassall
    I am starting to think about and design (pencil drawings) a simple, horror game. I'm in need of a good engine which supports features like Dynamic Lighting (for a characters flashlight) and dynamic shadows. My first choice was obviously Unity3D, as its free and is (supposedly) the easiest to use. However, I believe that a lot of features are locked for the Pro version (a $1500 investment). Is there any good, free engines that support dynamic events? I have read a lot of posts recommending the Source engine but I don't want to make a mod, I would like to make a fully featured standalone game. I'm not looking for opinions on "Which engine you prefer" or "Which engine do you use", all I would like is to be presented with the facts. -James

    Read the article

  • Multithreading for a mixed-genre game in Python?

    - by arrogantc
    So here's the situation. I'm making a game that mixes two genres; arcade shooter and puzzler. They don't intertwine TOO much; all the interaction that really goes on is that every time an enemy is destroyed, a block is created. The blocks aren't even a part of the main collision detection system; they have their own more suited to their needs. What I want to ask is this; might it be a good idea to have the arcade shooter portion run on one thread, and the puzzle game portion run on another?

    Read the article

  • PHP Detect Pages Genre/Category

    - by Alexwhin
    Hey, I was wondering if their was any sort of way to detect a pages genre/category. Possibly their is a way to find keywords or something? Unfortunately I don't have any idea so far, so I don't have any code to show you. But if anybody has any ideas at all, let me know. Thanks! EDIT @Nican Perhaps their is a way to set, let's say 10 category's (Entertainment, Funny, Tech). Then creating keywords for these category's (Funny = Laughter, Funny, Joke etc). Then searching through a webpage (maybe using a cUrl) for these keywords and assigning it to the right category. Hope that makes sense.

    Read the article

  • scheme struct question

    - by qzar
    ;; definition of the structure "book" ;; author: string - the author of the book ;; title: string - the title of the book ;; genre: symbol - the genre (define-struct book (author title genre)) (define lotr1 (make-book "John R. R. Tolkien" "The Fellowship of the Ring" 'Fantasy)) (define glory (make-book "David Brin" "Glory Season" 'ScienceFiction)) (define firstFamily (make-book "David Baldacci" "First Family" 'Thriller)) (define some-books (list lotr1 glory firstFamily)) ;; count-books-for-genre: symbol (list of books) -> number ;; the procedure takes a symbol and a list of books and produces the number ;; of books from the given symbol and genre ;; example: (count-books-for-genre 'Fantasy some-books) should produce 1 (define (count-books-for-genre genre lob) (if (empty? lob) 0 (if (symbol=? (book-genre (first lob)) genre) (+ 1 (count-books-for-genre (rest lob) genre)) (count-books-for-genre (rest lob) genre) ) ) ) (count-books-for-genre 'Fantasy some-books) It produce following exception first: expected argument of type non-empty list; given 'Fantasy, I don't understand whats the problem. Can somebody give me some explanation ? Thank you very much !

    Read the article

  • Simplifying data search using .NET

    - by Peter
    An example on the asp.net site has an example of using Linq to create a search feature on a Music album site using MVC. The code looks like this - public ActionResult Index(string movieGenre, string searchString) { var GenreLst = new List<string>(); var GenreQry = from d in db.Movies orderby d.Genre select d.Genre; GenreLst.AddRange(GenreQry.Distinct()); ViewBag.movieGenre = new SelectList(GenreLst); var movies = from m in db.Movies select m; if (!String.IsNullOrEmpty(searchString)) { movies = movies.Where(s => s.Title.Contains(searchString)); } if (!string.IsNullOrEmpty(movieGenre)) { movies = movies.Where(x => x.Genre == movieGenre); } return View(movies); } I have seen similar examples in other tutorials and I have tried them in a real-world business app that I develop/maintain. In practice this pattern doesn't seem to scale well because as the search criteria expands I keep adding more and more conditions which looks and feels unpleasant/repetitive. How can I refactor this pattern? One idea I have is to create a column in every table that is "searchable" which could be a computed column that concatenates all the data from the different columns (SQL Server 2008). So instead of having movie genre and title it would be something like. if (!String.IsNullOrEmpty(searchString)) { movies = movies.Where(s => s.SearchColumn.Contains(searchString)); } What are the performance/design/architecture implications of doing this? I have also tried using procedures that use dynamic queries but then I have just moved the ugliness to the database. E.g. CREATE PROCEDURE [dbo].[search_music] @title as varchar(50), @genre as varchar(50) AS -- set the variables to null if they are empty IF @title = '' SET @title = null IF @genre = '' SET @genre = null SELECT m.* FROM view_Music as m WHERE (title = @title OR @title IS NULL) AND (genre LIKE '%' + @genre + '%' OR @genre IS NULL) ORDER BY Id desc OPTION (RECOMPILE) Any suggestions? Tips?

    Read the article

  • La force du mot de passe serait corrélée au genre d'un individu, d'après une étude, les informaticiens choisiraient des mots de passe forts

    La force du mot de passe serait corrélée au genre d'un individu d'après une récente étudeLe mot de passe est un des éléments essentiels de la sécurité des systèmes d'information. Il constitue très souvent le premier obstacle que doit franchir un hacker pour avoir accès aux informations personnelles d'un utilisateur lambda.Une récente étude vient d'être menée sur quasiment l'ensemble de la population de l'université américaine de Carnegie Mellon. Elle a porté sur l'analyse des mots de passe de 25000...

    Read the article

  • SQL command to get field of a maximum value, without making two select

    - by António Capelo
    I'm starting to learn SQL and I'm working on this exercise: I have a "books" table which holds the info on every book (including price and genre ID). I need to get the name of the genre which has the highest average price. I suppose that I first need to group the prices by genre and then retrieve the name of the highest.. I know that I can get the results GENRE VS COST with the following: select b.genre, round(avg(b.price),2) as cost from books b group by b.genre; My question is, to get the genre with the highest AVG price from that result, do I have to make: select aux.genre from ( select b.genre, round(avg(b.price),2) as cost from books b group by b.genre ) aux where aux.cost = (select max(aux.cost) from ( select b.genre, round(avg(b.price),2) as cost from books l group by b.genre ) aux); Is it bad practice or isn't there another way? I get the correct result but I'm not confortable with creating two times the same selection. I'm not using PL SQL so I can't use variables or anything like that.. Any help will be appreciated. Thanks in advance!

    Read the article

  • Entity Framework looking for wrong column

    - by m.edmondson
    I'm brand new to the Entity Framework and trying to learn all it can offer. I'm currently working my way through the MVC Music Store tutorial which includes the following code: public ActionResult Browse(string genre) { // Retrieve Genre and its Associated Albums from database var genreModel = storeDB.Genres.Include("Albums") .Single(g => g.Name == genre); return View(genreModel); } as I'm working in VB I converted it like so: Function Browse(ByVal genre As String) As ActionResult 'Retrieve Genre and its Associated Albums from database Dim genreModel = storeDB.Genres.Include("Albums"). _ Single(Function(g) g.Name = genre) Return(View(genreModel)) End Function The problem is I'm getting the following exception: Invalid column name 'GenreGenreId'. Which I know is true, but I can't for the life of my work out where it's getting 'GenreGenreId' from. Probably a basic question but I'll appreciate any help in the right direction. As per requested here is the source for my classes: Album.vb Public Class Album Private _title As String Private _genre As Genre Private _AlbumId As Int32 Private _GenreId As Int32 Private _ArtistId As Int32 Private _Price As Decimal Private _AlbumArtUrl As String Public Property Title As String Get Return _title End Get Set(ByVal value As String) _title = value End Set End Property Public Property AlbumId As Int16 Get Return _AlbumId End Get Set(ByVal value As Int16) _AlbumId = value End Set End Property Public Property GenreId As Int16 Get Return _GenreId End Get Set(ByVal value As Int16) _GenreId = value End Set End Property Public Property ArtistId As Int16 Get Return _ArtistId End Get Set(ByVal value As Int16) _ArtistId = value End Set End Property Public Property AlbumArtUrl As String Get Return _AlbumArtUrl End Get Set(ByVal value As String) _AlbumArtUrl = value End Set End Property Public Property Price As Decimal Get Return _Price End Get Set(ByVal value As Decimal) _Price = value End Set End Property Public Property Genre As Genre Get Return _genre End Get Set(ByVal value As Genre) _genre = value End Set End Property End Class Genre.vb Public Class Genre Dim _genreId As Int32 Dim _Name As String Dim _Description As String Dim _Albums As List(Of Album) Public Property GenreId As Int32 Get Return _genreId End Get Set(ByVal value As Int32) _genreId = value End Set End Property Public Property Name As String Get Return _Name End Get Set(ByVal value As String) _Name = value End Set End Property Public Property Description As String Get Return _Description End Get Set(ByVal value As String) _Description = value End Set End Property Public Property Albums As List(Of Album) Get Return _Albums End Get Set(ByVal value As List(Of Album)) _Albums = value End Set End Property End Class MusicStoreEntities.vb Imports System.Data.Entity Namespace MvcApplication1 Public Class MusicStoreEntities Inherits DbContext Public Property Albums As DbSet(Of Album) Public Property Genres As DbSet(Of Genre) End Class End Namespace

    Read the article

  • Fastest way to parse big json android

    - by jem88
    I've a doubt that doesn't let me sleep! :D I'm currently working with big json files, with many levels. I parse these object using the 'default' android way, so I read the response with a ByteArrayOutputStream, get a string and create a JSONObject from the string. All fine here. Now, I've to parse the content of the json to get the objects of my interest, and I really can't find a better way that parse it manually, like this: String status = jsonObject.getString("status"); Boolean isLogged = jsonObject.getBoolean("is_logged"); ArrayList<Genre> genresList = new ArrayList<Genre>(); // Get jsonObject with genres JSONObject jObjGenres = jsonObject.getJSONObject("genres"); // Instantiate an iterator on jsonObject keys Iterator<?> keys = jObjGenres.keys(); // Iterate on keys while( keys.hasNext() ) { String key = (String) keys.next(); JSONObject jObjGenre = jObjGenres.getJSONObject(key); // Create genre object Genre genre = new Genre( jObjGenre.getInt("id_genre"), jObjGenre.getString("string"), jObjGenre.getString("icon") ); genresList.add(genre); } // Get languages list JSONObject jObjLanguages = jsonObject.getJSONObject("languages"); Iterator jLangKey = jObjLanguages.keys(); List<Language> langList = new ArrayList<Language>(); while (jLangKey.hasNext()) { // Iterate on jlangKey obj String key = (String) jLangKey.next(); JSONObject jCurrentLang = (JSONObject) jObjLanguages.get(key); Language lang = new Language( jCurrentLang.getString("id_lang"), jCurrentLang.getString("name"), jCurrentLang.getString("code"), jCurrentLang.getString("active").equals("1") ); langList.add(lang); } I think this is really ugly, frustrating, timewaster, and fragile. I've seen parser like json-smart and Gson... but seems difficult to parse a json with many levels, and get the objects! But I guess that must be a better way... Any idea? Every suggestion will be really appreciated. Thanks in advance!

    Read the article

  • Need help searching a MySQL db using a SELECT DISTINCT result

    - by user1695645
    So I am new to MySQL and am having a bit of trouble. I have one table called book_genres and another called books. book_genres +-------+---------+ |book_id| genre | +-------+---------+ | 1 | Horror | | 1 | Comedy | | 2 | Romance | | 2 | Comedy | +-------+---------+ books +-------+---------+ |book_id| title | +-------+---------+ | 1 | A Book | | 2 | B Book | | 3 | C Book | +-------+---------+ I am using the following command to pull all the book_ids that have 3 selected genres: SELECT DISTINCT a.book_id, b.genre AS genre1, c.genre AS genre2, d.genre AS genre3 FROM book_genres a JOIN book_genres b ON a.book_id = b.book_id AND b.genre LIKE 'Romance' JOIN book_genres c ON a.book_id = c.book_id AND c.genre LIKE 'Action' JOIN book_genres d ON a.book_id = d.book_id AND d.genre LIKE 'Comedy' GROUP BY book_id What I want to do is now pull all of the book titles from the books table using the book_ids found in this search. I'm not sure if there is an easier way to do this or not, but this was all that I could come up with. Thank you for anyone who can help!

    Read the article

  • Google, Microsoft et Facebook sont-ils comparables ? Ou bien ces entreprises sont-elles trop uniques en leur genre ?

    Google, Microsoft et Facebook sont-ils comparables ? Ou bien ces entreprises sont-elles trop uniques en leur genre ? Don Dodge, un passionné d'économie numérique travaillant chez Google et ayant travaillé pour Microsoft, se demande si trois grandes firmes de l'IT peuvent être comparables. En effet, Microsoft, Google et Facebook sont toutes trois très importantes, pour ne pas dire colossales, et elles sont toutes apparues comme innovantes à leur création. A leurs débuts, elles étaient nettement moins imposantes et les investisseurs hésitaient même à y investir. C'est un peu le cas de Facebook aujourd'hui, la firme surévaluée à outrance. Tous en veulent leur part, mais peu sont sûr de ce que cela va leur rapporter.

    Read the article

  • Understanding Eager Loading & How to use it? (specific issue)

    - by Elliot
    I have the following relation in my rails app: genre - has many - authors authors - belong to genre and has many books books - belongs to authors and belongs to users (users can add books to the db) in my controller I have: @books=current_user.books(:include => [:author => :genre], :order => 'books.created_at DESC')--- -- In my controller I used to have: @authors = Author.All @genres = Genre.All etc. -- In my view I have @genres.each do |genre| @authors.each do |author| if author.genre_id == genre.id stuff end end end Now that I'm using eager loading, I can't imagine this is the best way to do this (nor does it work as I don't have the @ variables) - I was wondering if anyone could shed some light on how to approach this?

    Read the article

  • [Cocoa] CoreData bindings for NSPopupButton

    - by ndg
    I'm looking to use a dropdown menu (possibly an NSPopupButton object) to represent the hierarchical results of two Core Data entities (Genre and Movie) and their relationships. In my current data model, my Genre entity has a one-to-many relationship with my Movie entity. What I'm now looking to do is generate the contents of an NSPopupButton to show a hierarchical list of Genres and the Movies associated with them, like so: Genre 1 Film 1 Film 2 Genre 2 Film 3 Film 4 Note that, in the above example, only Movie objects are to be selectable by the user (Genre objects will appear, but be unselectable). Also, to complicate matters slightly, I have an additional NSPopupButton which lists Movie Rental locations. The location selected by the user ultimately impacts on the genres and films available in the second dropdown. I imagine that bindings will only take me so far with this problem and that, ultimately, I'll have to populate the contents of the dropdown menu myself. I'm posting here for thoughts and opinions on the best way to go about this.

    Read the article

  • How do I Order on common attribute of two models in the DB?

    - by Will
    If i have two tables Books, CDs with corresponding models. I want to display to the user a list of books and CDs. I also want to be able to sort this list on common attributes (release date, genre, price, etc.). I also have basic filtering on the common attributes. The list will be large so I will be using pagination in manage the load. items = [] items << CD.all(:limit => 20, :page => params[:page], :order => "genre ASC") items << Book.all(:limit => 20, :page => params[:page], :order => "genre ASC") re_sort(items,"genre ASC") Right now I am doing two queries concatenating them and then sorting them. This is very inefficient. Also this breaks down when I use paging and filtering. If I am on page 2 of how do I know what page of each table individual table I am really on? There is no way to determine this information without getting all items from each table. I have though that if I create a new Class called items that has a one to one relationship with either a Book or CD and do something like Item.all(:limit => 20, :page => params[:page], :include => [:books, :cds], :order => "genre ASC") However this gives back an ambiguous error. So can only be refined as Item.all(:limit => 20, :page => params[:page], :include => [:books, :cds], :order => "books.genre ASC") And does not interleave the books and CDs in a way that I want. Any suggestions.

    Read the article

  • Generating EF Code First model classes from an existing database

    - by Jon Galloway
    Entity Framework Code First is a lightweight way to "turn on" data access for a simple CLR class. As the name implies, the intended use is that you're writing the code first and thinking about the database later. However, I really like the Entity Framework Code First works, and I want to use it in existing projects and projects with pre-existing databases. For example, MVC Music Store comes with a SQL Express database that's pre-loaded with a catalog of music (including genres, artists, and songs), and while it may eventually make sense to load that seed data from a different source, for the MVC 3 release we wanted to keep using the existing database. While I'm not getting the full benefit of Code First - writing code which drives the database schema - I can still benefit from the simplicity of the lightweight code approach. Scott Guthrie blogged about how to use entity framework with an existing database, looking at how you can override the Entity Framework Code First conventions so that it can work with a database which was created following other conventions. That gives you the information you need to create the model classes manually. However, it turns out that with Entity Framework 4 CTP 5, there's a way to generate the model classes from the database schema. Once the grunt work is done, of course, you can go in and modify the model classes as you'd like, but you can save the time and frustration of figuring out things like mapping SQL database types to .NET types. Note that this template requires Entity Framework 4 CTP 5 or later. You can install EF 4 CTP 5 here. Step One: Generate an EF Model from your existing database The code generation system in Entity Framework works from a model. You can add a model to your existing project and delete it when you're done, but I think it's simpler to just spin up a separate project to generate the model classes. When you're done, you can delete the project without affecting your application, or you may choose to keep it around in case you have other database schema updates which require model changes. I chose to add the Model classes to the Models folder of a new MVC 3 application. Right-click the folder and select "Add / New Item..."   Next, select ADO.NET Entity Data Model from the Data Templates list, and name it whatever you want (the name is unimportant).   Next, select "Generate from database." This is important - it's what kicks off the next few steps, which read your database's schema.   Now it's time to point the Entity Data Model Wizard at your existing database. I'll assume you know how to find your database - if not, I covered that a bit in the MVC Music Store tutorial section on Models and Data. Select your database, uncheck the "Save entity connection settings in Web.config" (since we won't be using them within the application), and click Next.   Now you can select the database objects you'd like modeled. I just selected all tables and clicked Finish.   And there's your model. If you want, you can make additional changes here before going on to generate the code.   Step Two: Add the DbContext Generator Like most code generation systems in Visual Studio lately, Entity Framework uses T4 templates which allow for some control over how the code is generated. K Scott Allen wrote a detailed article on T4 Templates and the Entity Framework on MSDN recently, if you'd like to know more. Fortunately for us, there's already a template that does just what we need without any customization. Right-click a blank space in the Entity Framework model surface and select "Add Code Generation Item..." Select the Code groupt in the Installed Templates section and pick the ADO.NET DbContext Generator. If you don't see this listed, make sure you've got EF 4 CTP 5 installed and that you're looking at the Code templates group. Note that the DbContext Generator template is similar to the EF POCO template which came out last year, but with "fix up" code (unnecessary in EF Code First) removed.   As soon as you do this, you'll two terrifying Security Warnings - unless you click the "Do not show this message again" checkbox the first time. It will also be displayed (twice) every time you rebuild the project, so I checked the box and no immediate harm befell my computer (fingers crossed!).   Here's the payoff: two templates (filenames ending with .tt) have been added to the project, and they've generated the code I needed.   The "MusicStoreEntities.Context.tt" template built a DbContext class which holds the entity collections, and the "MusicStoreEntities.tt" template build a separate class for each table I selected earlier. We'll customize them in the next step. I recommend copying all the generated .cs files into your application at this point, since accidentally rebuilding the generation project will overwrite your changes if you leave them there. Step Three: Modify and use your POCO entity classes Note: I made a bunch of tweaks to my POCO classes after they were generated. You don't have to do any of this, but I think it's important that you can - they're your classes, and EF Code First respects that. Modify them as you need for your application, or don't. The Context class derives from DbContext, which is what turns on the EF Code First features. It holds a DbSet for each entity. Think of DbSet as a simple List, but with Entity Framework features turned on.   //------------------------------------------------------------------------------ // <auto-generated> // This code was generated from a template. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace EF_CodeFirst_From_Existing_Database.Models { using System; using System.Data.Entity; public partial class Entities : DbContext { public Entities() : base("name=Entities") { } public DbSet<Album> Albums { get; set; } public DbSet<Artist> Artists { get; set; } public DbSet<Cart> Carts { get; set; } public DbSet<Genre> Genres { get; set; } public DbSet<OrderDetail> OrderDetails { get; set; } public DbSet<Order> Orders { get; set; } } } It's a pretty lightweight class as generated, so I just took out the comments, set the namespace, removed the constructor, and formatted it a bit. Done. If I wanted, though, I could have added or removed DbSets, overridden conventions, etc. using System.Data.Entity; namespace MvcMusicStore.Models { public class MusicStoreEntities : DbContext { public DbSet Albums { get; set; } public DbSet Genres { get; set; } public DbSet Artists { get; set; } public DbSet Carts { get; set; } public DbSet Orders { get; set; } public DbSet OrderDetails { get; set; } } } Next, it's time to look at the individual classes. Some of mine were pretty simple - for the Cart class, I just need to remove the header and clean up the namespace. //------------------------------------------------------------------------------ // // This code was generated from a template. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace EF_CodeFirst_From_Existing_Database.Models { using System; using System.Collections.Generic; public partial class Cart { // Primitive properties public int RecordId { get; set; } public string CartId { get; set; } public int AlbumId { get; set; } public int Count { get; set; } public System.DateTime DateCreated { get; set; } // Navigation properties public virtual Album Album { get; set; } } } I did a bit more customization on the Album class. Here's what was generated: //------------------------------------------------------------------------------ // // This code was generated from a template. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace EF_CodeFirst_From_Existing_Database.Models { using System; using System.Collections.Generic; public partial class Album { public Album() { this.Carts = new HashSet(); this.OrderDetails = new HashSet(); } // Primitive properties public int AlbumId { get; set; } public int GenreId { get; set; } public int ArtistId { get; set; } public string Title { get; set; } public decimal Price { get; set; } public string AlbumArtUrl { get; set; } // Navigation properties public virtual Artist Artist { get; set; } public virtual Genre Genre { get; set; } public virtual ICollection Carts { get; set; } public virtual ICollection OrderDetails { get; set; } } } I removed the header, changed the namespace, and removed some of the navigation properties. One nice thing about EF Code First is that you don't have to have a property for each database column or foreign key. In the Music Store sample, for instance, we build the app up using code first and start with just a few columns, adding in fields and navigation properties as the application needs them. EF Code First handles the columsn we've told it about and doesn't complain about the others. Here's the basic class: using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Web.Mvc; using System.Collections.Generic; namespace MvcMusicStore.Models { public class Album { public int AlbumId { get; set; } public int GenreId { get; set; } public int ArtistId { get; set; } public string Title { get; set; } public decimal Price { get; set; } public string AlbumArtUrl { get; set; } public virtual Genre Genre { get; set; } public virtual Artist Artist { get; set; } public virtual List OrderDetails { get; set; } } } It's my class, not Entity Framework's, so I'm free to do what I want with it. I added a bunch of MVC 3 annotations for scaffolding and validation support, as shown below: using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Web.Mvc; using System.Collections.Generic; namespace MvcMusicStore.Models { [Bind(Exclude = "AlbumId")] public class Album { [ScaffoldColumn(false)] public int AlbumId { get; set; } [DisplayName("Genre")] public int GenreId { get; set; } [DisplayName("Artist")] public int ArtistId { get; set; } [Required(ErrorMessage = "An Album Title is required")] [StringLength(160)] public string Title { get; set; } [Required(ErrorMessage = "Price is required")] [Range(0.01, 100.00, ErrorMessage = "Price must be between 0.01 and 100.00")] public decimal Price { get; set; } [DisplayName("Album Art URL")] [StringLength(1024)] public string AlbumArtUrl { get; set; } public virtual Genre Genre { get; set; } public virtual Artist Artist { get; set; } public virtual List<OrderDetail> OrderDetails { get; set; } } } The end result was that I had working EF Code First model code for the finished application. You can follow along through the tutorial to see how I built up to the finished model classes, starting with simple 2-3 property classes and building up to the full working schema. Thanks to Diego Vega (on the Entity Framework team) for pointing me to the DbContext template.

    Read the article

  • How do I break down MySQL query results into categories, each with a specific number of rows?

    - by Mel
    Hello, Problem: I want to list n number of games from each genre (order not important) The following MySQL query resides inside a ColdFusion function. It is meant to list all games under a platform (for example, list all PS3 games; list all Xbox 360 games; etc...). The variable for PlatformID is passed through the URL. I have 9 genres, and I would like to list 10 games from each genre. SELECT games.GameID AS GameID, games.GameReleaseDate AS rDate, titles.TitleName AS tName, titles.TitleShortDescription AS sDesc, genres.GenreName AS gName, platforms.PlatformID, platforms.PlatformName AS pName, platforms.PlatformAbbreviation AS pAbbr FROM (((games join titles on((games.TitleID = titles.TitleID))) join genres on((genres.GenreID = games.GenreID))) join platforms on((platforms.PlatformID = games.PlatformID))) WHERE (games.PlatformID = '#ARGUMENTS.PlatformID#') ORDER BY GenreName ASC, GameReleaseDate DESC Once the query results come back I group them in ColdFusion as follows: <cfoutput query="ListGames" group="gName"> (first loop which lists genres) #ListGames.gName# <cfoutput> (nested loop which lists games) #ListGames.tName# </cfoutput> </cfoutput> The problem is that I only want 10 games from each genre to be listed. If I place a "limit" of 50 in the SQL, I will get ~ 50 games of the same genre (depending on how much games of that genre there are). The second issue is I don't want the overload of querying the database for all games when each person will only look at a few. What is the correct way to do this? Many thanks!

    Read the article

  • Example with Visitor Pattern

    - by devoured elysium
    public class Song { public string Genre { get; protected set; } public string Name { get; protected set; } public string Band { get; protected set; } public Song(string name, string band, string genre) { Name = name; Genre = genre; Band = band; } } public interface IMusicVisistor { void Visit(List<Song> items); } public class MusicLibrary { List<Song> _songs = new List<Song> { ...songs ... }; public void Accept(IMusicVisitor visitor) { visitor.Visit(_songs); } } and now here's one Visitor I made: public class RockMusicVisitor : IMusicVisitor { public List<Song> Songs { get; protected set; } public void Visit(List<Song> items) { Songs = items.Where(x => x.Genre == "Rock").ToList(); } } Why is this any better than just putting a public property Songs and then letting any kind of class do with it anything that it wants to? This example comes from this post.

    Read the article

  • How to make custom join query with Django ?

    - by xRobot
    I have these 2 models: genre = ( ('D', 'Dramatic'), ('T', 'Thriller'), ('L', 'Love'), ) class Book(models.Model): title = models.CharField(max_length=100) genre = models.CharField(max_length=1, choices=genre) class Author(models.Model): user = models.ForeignKey(User, unique=True) born = models.DateTimeField('born') book = models.ForeignKey(Book) I need to retrieve first_name and last_name of all authors of dramatic's books. How can I do this in django ?

    Read the article

  • Database Design Primay Key, ID vs String

    - by LnDCobra
    Hi, I am currently planning to develop a music streaming application. And i am wondering what would be better as a primary key in my tables on the server. An ID int or a Unique String. Methods 1: Songs Table: SongID(int), Title(string), Artist*(string), Length(int), Album*(string) Genre Table Genre(string), Name(string) SongGenre: SongID*(int), Genre*(string) Method 2 Songs Table: SongID(int), Title(string), ArtistID*(int), Length(int), AlbumID*(int) Genre Table GenreID(int), Name(string) SongGenre: SongID*(int), GenreID*(int) Key: Bold = Primary Key, Field* = Foreign Key I'm currently designing using method 2 as I believe it will speed up lookup performance and use less space as an int takes a lot less space then a string. Is there any reason this isn't a good idea? Is there anything I should be aware of?

    Read the article

  • Problem with JSTL and weblogic

    - by Jeune
    I get the following error when I run my java ee app on weblogic, javax.servlet.jsp.el.ELException: Cannot find PropertyDescriptor for 'name' for bean 'class java.lang.String' I want to print a list of artists with the following class, public class Artist { private int id; private String name; private String genre; public Artist() { } public Artist(String name){ this.name=name; } public void setId(int id) { this.id = id; } public int getId() { return id; } public void setName(String name) { this.name = name; } public String getName() { return name; } public String getGenre() { return genre; } public void setGenre(String genre) { this.genre = genre; } } The following lines of code seem to be causing the problem because when I remove it I don't get the error anymore. <c:forEach items="artists" var="artist"> <c:out value="${artist.name}"></c:out><br/> </c:forEach> When I use PrintWriter to print, it works: for (Artist artist:artists){ resp.getWriter().println(artist.getName()); } I am using java ee 2.4 and weblogic 9.2

    Read the article

1 2 3 4 5 6 7 8 9  | Next Page >