Search Results

Search found 25123 results on 1005 pages for 'domain model'.

Page 165/1005 | < Previous Page | 161 162 163 164 165 166 167 168 169 170 171 172  | Next Page >

  • [C#] Creating standalone, console (shell) for domain-specific operations

    - by mr.b
    Say that I have a system service, and I want to offer a low-level maintenance access to it. For that purpose, I'd like to create a standalone, console application that somehow connects to server process and lets user type in commands, allow it to use auto-completion and auto-suggestion on single/double TAB press (just like linux bash shell, mysql cli, cmd.exe, and countless others), allow command line editing capabilities (history, cursor keys to move around text..), etc. Now, it's not that much of a problem to create something like that by rolling my own from scratch, handling user input, scanning pressed keys, and doing correct actions. But, why reinvent the wheel? Is there some library/framework that helps with this kind of problems, just like readline library that offers improved command-line editing capabilities under linux? Of course, this new "shell" would respond only to valid, domain-specific commands, and would suggest valid arguments, options, switches... Any ideas? Thanks!

    Read the article

  • How to design model for multi-tiered data?

    - by Chris
    Say I have three types of object: Area, Subarea and Topic. I want to be able to display an Area, which is just a list of Subareas and the Topics contained in those Subareas. I never want to be able to display Subareas separately - they're just for breaking up the Topics. Topics can, however, appear in multiple Areas (but probably under the same Subarea). How would I design a model for this? I could use ForeignKey from Topic to Subarea and from Subarea to Area, but it seems unnecessarily complex given that I never want to interact with subareas themselves. Also, none of these objects are ever altered or added to by the user. They're just for me to represent information. Maybe there is a better way to represent it all?

    Read the article

  • Partially parse C++ for a domain-specific language

    - by PierreBdR
    I would like to create a domain specific language as an augmented-C++ language. I will need mostly two types of contructs: Top-level constructs for specialized types or declarations In-code constructs, i.e. to add primitives to make functions calls or idiom easier The language will be used for scientific computing purposes, and will ultimately be translated into plain C++. C++ has been chosen as it seems to offer a good compromise between: ease of use, efficiency and availability of a wide range of libraries. A previous attempt using flex and bison failed due to the complexity of the C++ syntax. The existing parser can still fail on some constructs. So we want to start over, but on better bases. Do you know about similar projects? And if you attempted to do so, what tools would you use? What would be the main pitfalls? Would you have recommendations in term of syntax?

    Read the article

  • One model and Many edit views

    - by user179438
    Hi, I have a model I named User, and I want use two different Views to edit it: the usual edit view and another view I called edit_profile. I had no problem in creating routing, controller and views: I added edit_profile and update_profile views, and I added on routes.rb the line: map.resources :users ,:member => {:edit_profile => :get, :update_profile => :put} The problem is: when I submit the form in edit_profile and some error occur in some input fields, rails reload the edit_path page instead of edit_profile_path page ! This is the form on edit_profile.html.erb form_for(:user, @user, :url => {:action => :update_profile}, :html => { :method => :put} ) do |f| = f.text_field :description = f.text_area :description = f.error_message_on :description .... .... = f.submit 'Update profile' After clicking Update profile, if input errors occur I want to show edit_profile view instead of edit view Do You have some ideas ? many thanks

    Read the article

  • How to model localized items

    - by tweir
    I'm currently designing a e-commerce solution. One of the primary requirements is for the store to support localized item details. The same store must be able to support multiple languages via the user's language selection and/or browser preference. I have two tables: Item (id, sku, price, ...) ItemDetails (item_id, language, title, ...) For each Item, there will be multiple rows corresponding to the item, where the (item_id,language) pair will be unique. I would like to model this as: class Item { public string sku; public double price; public ItemDetails Details; } Based on the user's session, I would like the items returned to have the Details object corresponds to the user's selected language (from their session). What are some approaches for representing this?

    Read the article

  • Including a List<SpecificType> in a model, and how to populate it

    - by Ray Sülzer
    I currently have two Model classes: class Leaders: List<Leaders> { public string LeaderName { get; set; } public string PrecintName { get; set; } } public class MarketReport { //A list of activists public Leaders leaderlist { get; set; } } Now, I have no idea if I am doing the above correctly, but I want to populate the list within the MarketReport foreach (var store in stores) { MarketReport.leaderlist.AddItem //I want to add an item of type Leader to the list //so that I can pass it to MVC view }

    Read the article

  • Adding index key in Grails' Domain

    - by firnnauriel
    I tried following this reference and this is now my domain's code: class SnbrActVector { long nid String term double weight static mapping = { version false nid index:'Nid_Idx' } static constraints = { term(blank:false) } } What I want is to do is to add an index key for 'nid' column. I dropped the existing table and run the app again so the table is then recreated. However, when i check for list of indices, I can't see a 'Nid_Idx', only available is 'PRIMARY'. Do I have to manually create the index and name it 'Nid_idx in my mysql database? Thanks.

    Read the article

  • How to display model popup at first time page load only

    - by Guna Sundari
    I used the following code to display model popup for the first time page load, <script type="text/javascript"> function pageload() { var chkPostBack = '<%= Page.IsPostBack ? "true" : "false" %>'; if (chkPostBack == 'false') { var popup = $find('ModalPopupExtender1'); if (popup != null) { popup.show(); } } } I got the following error, Please help me. The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

    Read the article

  • Client validate non-model bound checkbox while using MVC 2 jQuery Validation

    - by Justin Saraceno
    Have: Using ASP.NET MVC 2, DataAnnotationsModel based server validation, and client validation with jQuery. Anything in my model is validated perfectly on the client with jQuery based validation (jQuery.validate and MicrosoftMvcJQueryValidation.js). Need: Adding an additional HTML <input type="checkbox" id="terms" /> to my form. I need jQuery validation to require that this checkbox is checked AND somehow hook it in with whatever jQuery client script MVC is automagically controlling. Yes, I know it won't validate on the server side, but I don't need or want it to. Seems like it should be simple but I'm new to MVC, a total beginner at jQuery, and my searches have been coming up blank. Any help would be appreciated!

    Read the article

  • google app engine db.Model in python only display user-defined fields

    - by MattM
    I'm a python newbie so I apologize in advance if this question has been asked before. I am building out an application in GAE and need to generate a report that contains the values for a user-defined subset of fields. For example, in my db model, CrashReport, I have the following fields: entry_type entry_date instance_id build_id crash_text machine_info I present a user with the above list as a checkbox group from which they select. Whichever fields the user selects, I then create a report showing all the values in the datastore, but only for the fields that they selected. For example, if from the above list, the user selects the build_id and crash_text fields, the output might look like this: build_id crash_text 0.8.2 blown gasket 0.8.2 boom! 0.8.1 crack! ... So the question is, how exactly do I only access the values for the fields which the user has defined?

    Read the article

  • Stop Entity Framework from updating edmx model with a column that isn't needed

    - by TMan
    I have rowguids in all my tables to help with change tracking in all my tables. I don't want/need these tables in my edmx or my entities. However, I do still need to make changes to other things sometimes so everytime i go to update model from database in the edmx it adds all the rowguids in all my tables everytime and i have to manually delete each one. Is there a way to handle this from happening? Is there a way I can maybe edit the T4 to maybe ignore that 'rowguid' column? Database first Entity framework

    Read the article

  • Pass a datatable model to controller action in MVC

    - by user2906420
    Code: @model System.Data.DataTable <button type="submit" class="btn btn-primary" data-dismiss="modal" aria-hidden="true"> Download</button> [HttpPost] public void getCSV(DataTable dt) { MemoryStream stream = Export.GetCSV(dt); var filename = "ExampleCSV.csv"; var contenttype = "text/csv"; Response.Clear(); Response.ContentType = contenttype; Response.AddHeader("content-disposition", "attachment;filename=" + filename); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(stream.ToArray()); Response.End(); } I want to allow the user to export a CSV file when the button is clicked on. the datatable should be passed to the method getCSV. Please can someone help me. thanks I do not mind using Tempdata to store the datatable and then access it in the controller

    Read the article

  • mod_rewrite: check if isn't a certain domain

    - by weingage
    I'm migrating some code from a working web app, but can't get it to work on the new server. Everything seems to be configured correctly, but I'm getting internal redirect limit errors in Apache2. Here are my rewrites and explanation This WORKS - any subdomains that aren't cdn. or manage. should be redirected to u.php RewriteCond %{HTTP_HOST} ^(^.*)\.mediasprk\.com$ [NC] RewriteCond ^(.*)$ !^(cdn|manage)$ RewriteCond %{REQUEST_URI} !\.(png|gif|jpg)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ u.php?uri=$1&hostName=%{HTTP_HOST} This is no longer working. Goal here is to handle CName pointing. So if it's not my app domain (mediasprk.com), then handle it by sending it to u.php. RewriteCond %{HTTP_HOST} !^mediasprk\.com$ [NC] RewriteCond %{REQUEST_URI) !\.(png|gif|jpg)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ u.php?uri=$1&hostName=%{HTTP_HOST} Can anyone see the issue here in the second block that would cause the redirect limit errors? Maybe something wrong in the rewrites? Thanks.

    Read the article

  • MVC Model architecture

    - by ATT
    I'm getting into CodeIgniter and trying to figure out the good architecture for my models. What kind of models would you create for the following simple example: list page of blog entries: shows part of the entry data, number of comments blog entry page: shows all the entry data, comment list (with part of the comment data) comment page: shows all the comment data I'm trying to get this right so that it's simple and effective. I don't want to load too much information (from the db) on the pages where I don't need them. E.g. should the same entry model handle both multiple entries as well as a single entry? And how should the comments be loaded? I only need the number of comments on the multiple entries (list) page but some of the comment data on the single entry page. How would you handle this?

    Read the article

  • javascript call url from different domain

    - by user246114
    Hi, I want to post some data via javascript to another domain. Something like: http://www.othersite.com/submitfunnyname?name=blah The other site (othersite.com) has a REST interface that you can call (well actually this is a get example) to submit a funny name to them. Can I do this already with javascript? I'm a little confused on this - I know if that service wants to return some data, I'd need to use something like JSON-P - even though here I'm submitting some data, I guess the service will return some message structure letting me know the result, so it would have to be JSON-P, right? Thanks

    Read the article

  • Ruby on Rails - can't access datetime model object

    - by NomadicRiley
    I've created a model that has 3 string columns and a datetime. Everything is running in SQLite3 and I can view the records in my table just fine using Lita. I'm trying to display the values in a page (index action) using code like this: <% @details.each do |lifeCycle| % <%= debug(lifeCycle)% <%= lifeCycle.lifeCycleId % <%= lifeCycle.eventType % <%= debug(lifeCycle.timeId) % <% end % From the debug I get a result like this: --- !ruby/object:LifeCycle attributes: eventType: Order created_at: "2111359287.23037" timeId: "2455364.89983796" eventId: "98765" updated_at: "2111359287.23037" lifeCycleId: "12345" id: "1" attributes_cache: {} But whenever I try to access the event timeId - i' getting a nil value. This is true if i try to run debug on just that field debug(lifeCycle.timeId), or call a function on it. Is there something obvious I'm missing here?

    Read the article

  • Replace url() relative path with full domain in css files

    - by deepwell
    I'd like to run a script on release that replaces all url() declarations in a css file with the full domain path, because images are hosted on a static web server. Example Current: background-image: url(/images/menu.gif); Desired: background-image: url(http://example.com/images/menu.gif); Current: background-image: url('/images/menu.gif'); Desired: background-image: url('http://example.com/images/menu.gif'); Current: background-image: url("/images/menu.gif"); Desired: background-image: url("http://example.com/images/menu.gif"); I have concocted a bash script using sed to do just that, but it does not handle url with quotes url(''), or urls that already have a full path. STATIC_HOST="http://example.com" sed -i '' "s|url(\([^)]*\)|url($STATIC_HOST\1|g" main.css

    Read the article

  • Django model data consistency

    - by Mark
    When creating a form, you can define a bunch of methods, clean_xyz, to make sure the data gets forced into the correct format. Is there any way to do this on a model level? Perhaps I can override the field setters somehow? I want it so that if I write something like my_address.postal_code = 'a1b2c3' It will automatically get formatted into A1B 2C3. Perhaps throw an exception if it can't be converted. That way I know I'll never have any malformed data in the database.

    Read the article

  • Rails valiation among a three model relationship

    - by Andrew
    I'm working on a three model relationship with one aspect that I'm not sure how to approach. Here's the basic relationship: class Taxonomy has_many :terms # attribute: `inclusive`, default => false end class Term belongs_to :taxonomy has_and_belongs_to_many :photos end class Photo has_and_belongs_to_many :terms end This is pretty straightforward stuff except for one thing: A Taxonomy can be either 'Inclusive' or 'Exclusive'. Exclusive means the terms are mutually exclusive, Inclusive means they're not. So, if a Taxonomy is exclusive ie. taxonomy.inclusive = false, then there can only be one term from that taxonomy attached to a given photo. Now, I can handle this on the client-side without a problem, but I am not quite sure how to set up a validation on Photos (or somewhere else) that says basically: "validate that no more than one term from an exclusive taxonomy is associated with this record." Any ideas on how to do that?

    Read the article

  • Should I split this model and table?

    - by regedarek
    I would like to create simple ResumeBank app. Issue: As user I would like to add only two Resumes. Forms for this both Resumes are different with only two fields. Resumes have 12 the same attributes but 2 are diferent. Question: Should I split that Resume model and tables to ex: PolishResume and EnglishResume, polish_remsumes and english_remsumes? Or maybe should I use STI and create PolishResume < Resume and use one table. What are disadvantages of splitting option?

    Read the article

  • Deleting files associated with model - django

    - by alexBrand
    I have the following code in one of my models class PostImage(models.Model): post = models.ForeignKey(Post, related_name="images") # @@@@ figure out a way to have image folders per user... image = models.ImageField(upload_to='images') image_infowindow = models.ImageField(upload_to='images') image_thumb = models.ImageField(upload_to='images') image_web = models.ImageField(upload_to='images') description = models.CharField(max_length=100) order = models.IntegerField(null=True) IMAGE_SIZES = { 'image_infowindow':(70,70), 'image_thumb':(100,100), 'image_web':(640,480), } def delete(self, *args, **kwargs): # delete files.. self.image.delete(save=False) self.image_thumb.delete(save=False) self.image_web.delete(save=False) self.image_infowindow.delete(save=False) super(PostImage, self).delete(*args, **kwargs) I am trying to delete the files when the delete() method is called on PostImage. However, the files are not being removed. As you can see, I am overriding the delete() method, and deleting each ImageField. For some reason however, the files are not being removed.

    Read the article

  • Asp.net with MVC multiple model in one view (create, update)

    - by Abdalmohaymen
    I have problem in asp.ne Mvc with multiple model in one view on create and update I 'm work on exams system class Questions and class Answers Question is aparent class and Answers is a child class [Bind(exclude("id"))] class Quesions { public string question{get; set;} public Datetime Timepostquestion{get; set;} } [Bind(exclude("id"))] class Answers { public string answer{get; set;} public Datetime Timepostanswer{get; set;} public questionId {get; set;} } in a view I use two classes how to use classes in insert and update what a way which I have to solve my problem

    Read the article

  • Core Data migration of to-one relationship to to-many relationship

    - by westsider
    I have a deployed app that samples measurements from sensors (e.g., Temp °C, Pressure kPa). The user can create Experiments and collect samples. Each sample is stored as a Run, such that there is a one-to-many relationship from Experiment to Run. In the interest of performance, Run has a to-one relationship with Data entity (which is where the actual raw data is stored); this allows some Run attributes to be loaded without necessarily loading lots of data. Most of our sensors have multiple measurements, so it would be nice to store all the data that is actually being sampled. But this means that the Run <--- Data relationship needs to become Run <-- Data (to use Xcode's convention). I am faced with trying to migrate data from old Run to-one Data model to new Run to-many Data model. Can this be done using Mapping Models? If so, does anyone have any pointers to examples? If not, does anyone have any pointers to examples of how to do that? Thanks for any pointers or advice.

    Read the article

  • EF4 Generate Database

    - by shaneseaton
    Hi, I am trying my hardest to find the simplest way to create a basic "model first" entity framework example. However I am struggling with the actually generation of the database, particularly the running of the SQL against the database. Tools Visual Studio 2010 SQL Server 2008 Express Process Create a new class project Add a new Server-Database item (mdf) named "Database1.mdf" to the project Add an empty ADO.net Entity Model Create a simple entity (Person: Id, Name) Generate the Script selecting the Database1 connection created for me by visual studio Right click the script editor and select the "Execute SQL..." option Log in to SQLEXPRESS This is where is falls over saying it cant find a database name "Database1". The "problem" is that the SQL server has not had Database1 attached to it. I am 100% positive that Visual Studio use to attach a database to SQLExpress when it created a new database (Step 2). This appears to not be the case any more (even the beta of VS2010 did it). Can someone confirm this? or tell me how to get this to happen? Is there a way that I can modify the TSQL script to use an un-attached database. ie a file. I know I can use SQL Management Studio or sqlcmd to attach the database, but I would ideally like to avoid the solutions as I would like to see the cleanest method of just using visual studio. Ideal Solutions (in order of most prefered) Get visual studio to attach the newly created database Modify the generated SQL to point to file Thanks in advance.

    Read the article

  • Cakephp Function in mode not executing

    - by Rixius
    I have a function in my Comic Model as such: <?php class Comic extends AppModel { var $name = "Comic"; // Methods for retriving information. function testFunc(){ $mr = $this->find('all'); return $mr; } } ?> And I am calling it in my controller as such: <?php class ComicController extends AppController { var $name = "Comic"; var $uses = array('Comic'); function index() { } function view($q) { $this->set('array',$this->Comic->testFunc()); } } ?> When I try to load up the page; I get the following error: Warning (512): SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'testFunc' at line 1 [CORE/cake/libs/model/datasources/dbo_source.php, line 525] Query: testFunc And the SQL dump looks like this: (default) 2 queries took 1 ms Nr Query Error Affected Num. rows Took (ms) 1 DESCRIBE comics 10 10 1 2 testFunc 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'testFunc' at line 1 0 So it looks like, instead of running the testFunc() function, it is trying to run a query of "testFunc" and failing...

    Read the article

< Previous Page | 161 162 163 164 165 166 167 168 169 170 171 172  | Next Page >