Search Results

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

Page 63/610 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • Suggestions on documentation of a DB model when using Entity Framework 4

    - by Junior Ewing
    Any experiences on how to document Entity Framework 4 based Database projects? There is the Document and Summary properties on the Entities, but if we want to regenerate the model from the database at some point, it will be lost! Is there some way to map documentation data inside SQL to the Entities in the EDMX file so it is safe. Suggestions of other best practices? Ideally I want to be able to augo generate html/helpfile documentation from the DB when we deploy.

    Read the article

  • Value Object and View Model Property

    - by William
    I am working on a solution that used DDD for architecture. I have a property in my ViewModel which points to a ValueObject, the view model also implements INotifyPropertyChanged interface. The value of the ValueObject will change as a user enters data on the front end. The problem I am running into is the value object is suppose to be immutable. How can I work around this issue? Thank you in advance.

    Read the article

  • Rails find_or_create by more than one attribute?

    - by tybro0103
    There is a handy dynamic attribute in active-record called find_or_create_by: Model.find_or_create_by_<attribute>(:<attribute> => "") But what if I need to find_or_create by more than one attribute? Say I have a model to handle a M:M relationship between Group and Member called GroupMember. I could have many instances where member_id = 4, but I don't ever want more than once instance where member_id = 4 and group_id = 7. I'm trying to figure out if it's possible to do something like this: GroupMember.find_or_create(:member_id => 4, :group_id => 7) I realize there may be better ways to handle this, but I like the convenience of the idea of find_or_create.

    Read the article

  • What is Erlang's concurrency model actually ?

    - by arun_suresh
    I was reading a paper recently Why Events are Bad. The paper is a comparative study of Event based and thread based highly concurrent servers and finally concludes stating that Threads are better than events in that scenario. I find that I am not able to classify what sort of concurrency model erlang exposes. Erlang provides Light Weight Processes, but those processes are suspended most of the time until it has received some event/message of some sort. /Arun

    Read the article

  • ActiveRecord field normalization

    - by Bill
    I feel bad asking this question, as I thought I knew enough about Activerecord to answer this myslef. But such is the way of having SO available ... I'm trying to remove the commas from a field in a model of mine, I want the user to be able to type a number , ie 10,000 and that number be stored in the database as 10000. I was hoping that I could do some model-side normalization to remove the comma. I don't want to depend on the view or controller to properly format my data. I tried ; before_validation :normalize def normalize self['thenumber'] = self['thenumber'].to_s.gsub(',','') end no worky :(

    Read the article

  • Model a Zero or One to Many Relationship

    - by John
    How should I model a zero or one to a many relationship in the database? For example, a user record may or may not have a parent. So should my user table have a t_user.parent_id or should I have an associative table called t_user_hierarchy with the columns t_user_hierarchy.parent_id and t_user_hierarchy.user_id?

    Read the article

  • How to isolate data per customer, Django powered website

    - by Sawwy
    I have recently started learning python and django and working on a project that includes building a website for collecting information from customers. I am currently trying to figure out best way to isolate the customer data (collected information is sensitive and should only be accessible by customer and the service provider). I found this post Postgresql - one database for everyone, or one-database per customer and my question is that can I automate the model inheritance with customer creation via admin? To be specific, when save() is called for adding customer via django admin, this should create the customer specific tables (create a new set of tables with 'company_name' -prefix). For more information of the environment, I have extended the basic user registration with custom UserProfile adding 'company' and 'role' fields for each user. Upon login, the 'company' of the user will be checked to filter out tables without the 'company_name' prefix. 'Role' will further filter the which company-specific tables and set rights (view, edit). will appreciate any suggestions if more elegant methods could be used to solve the data isolation problem than model inheritance.

    Read the article

  • Why my json_encode get corrupted

    - by Cullen SUN
    $model = new XUploadForm; $model->file = CUploadedFile::getInstance( $model, 'file' ); //We check that the file was successfully uploaded if( $model->file !== null ) { //Grab some data $model->mime_type = $model->file->getType( ); $model->size = $model->file->getSize( ); $model->name = $model->file->getName( ); $file_extention = $model->file->getExtensionName( ); //(optional) Generate a random name for our file $file_tem_name = md5(Yii::app( )->user->id.microtime( ).$model->name); $file_thumb_name = $file_tem_name.'_thumb.'.$file_extention; $file_image_name = $file_tem_name.".".$file_extention; if( $model->validate( ) ) { //Move our file to our temporary dir $model->file->saveAs( $path.$file_image_name ); if(chmod($path.$file_image_name, 0777 )){ // Yii::import("ext.EPhpThumb.EPhpThumb"); // $thumb_=new EPhpThumb(); // $thumb_->init(); // $thumb_->create($path.$file_image_name) // ->resize(110,80) // ->save($path.$file_thumb_name); } //here you can also generate the image versions you need //using something like PHPThumb //Now we need to save this path to the user's session if( Yii::app( )->user->hasState( 'images' ) ) { $userImages = Yii::app( )->user->getState( 'images' ); } else { $userImages = array(); } $userImages[] = array( "filename" => $file_image_name, 'size' => $model->size, 'mime' => $model->mime_type, "path" => $path.$file_image_name, // "thumb" => $path.$file_thumb_name, ); Yii::app( )->user->setState('images', $userImages); //Now we need to tell our widget that the upload was succesfull //We do so, using the json structure defined in // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup echo json_encode( array( array( "type" => $model->mime_type, "size" => $model->size, "url" => $publicPath.$file_image_name, //"thumbnail_url" => $publicPath.$file_thumb_name, //"thumbnail_url" => $publicPath."thumbs/$filename", "delete_url" => $this->createUrl( "upload", array( "_method" => "delete", "file" => $file_image_name ) ), "delete_type" => "POST" ) ) ); Above code give me correct response, [{"type":"image/jpeg","size":2266,"url":"/uploads/tmp/0b00cbaee07c6410241428c74aae1dca.jpeg","delete_url":"/api/imageUpload/upload?_method=delete&file=0b00cbaee07c6410241428c74aae1dca.jpeg","delete_type":"POST"}] but if I uncomment the following // Yii::import("ext.EPhpThumb.EPhpThumb"); // $thumb_=new EPhpThumb(); // $thumb_->init(); // $thumb_->create($path.$file_image_name) // ->resize(110,80) // ->save($path.$file_thumb_name); it gave me corrupted response: Mac OS X 2??ATTR?dA??Y?Ycom.apple.quarantine0001;50655994;Google\x20Chrome.app;2599ECF9-69C5-4386-B3D9-9F5CC7E0EE1D|com.google.ChromeThis resource fork intentionally left blank ??[{"type":"image/jpeg","size":1941,"url":"/uploads/tmp/409c5921c6d20944e1a81f32b12fc380.jpeg","delete_url":"/api/imageUpload/upload?_method=delete&file=409c5921c6d20944e1a81f32b12fc380.jpeg","delete_type":"POST"}]

    Read the article

  • Zend Framework modular app, can't load models for each module, autoloading models?

    - by EricP
    Is there a way to have models for each module? I have 3 modules, one is a "contacts" module. I created a model for it in modules/contacts/models/Codes.php Codes Controller class Contacts_CodesController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ $this->view->messages = $this->_helper->flashMessenger->getMessages(); } public function indexAction() { $codesTable = new Contacts_Model_Codes(); } Codes Model: class Contacts_Model_Codes extends Zend_Db_Table { protected $_name = 'codes'; } The error I get: Fatal error: Class 'Contacts_Model_Codes' not found in /Applications/MAMP/htdocs/zf_site/application/modules/contacts/controllers/CodesController.php on line 26 thanks

    Read the article

  • validate linqtosql mapping to a model

    - by Coppermill
    I have generated a LinqtoSQL mapping xml file, which I have a valid XSD schema that I check to make sure the XML is correct. Now I want to check that the field type match the Model/Interface for example: checking that the nullable fields are nullable that int are int etc anyone got any ideas if I can do this?

    Read the article

  • Django finding which field matched in a multiple OR query

    - by Greg Hinch
    I've got a couple models which are set up something like this: class Bar(models.Model): baz = models.CharField() class Foo(models.Model): bar1 = models.ForeignKey(Bar) bar2 = models.ForeignKey(Bar) bar3 = models.ForeignKey(Bar) And elsewhere in the code, I end up with an instance of Bar, and need to find the Foo it is attached to in some capacity. Right now I came up with doing a multiple OR query using Q, something like this: foo_inst = Foo.objects.get(Q(bar1=bar_inst) | Q(bar2=bar_inst) | Q(bar3=bar_inst)) What I need to figure out is, which of the 3 cases actually hit, at least the name of the member (bar1, bar2, or bar3). Is there a good way to do this? Is there a better way to structure the query to glean that information?

    Read the article

  • In partial view: "The model item passed into the dictionary is of type"

    - by Dave
    I lack understanding of some basic MVC concepts, despite all my searching. I created an MVC project in Visual Studio, which contains the partial view _LogOnPartial.shtml. I just want to access information within the view pertaining to the user, to put in a user dropdown menu. When I try to put this at the top of the partial view cshtml page I get the above error: @model MyProject_MVC.Models.UserRepository When I try this I also get an error: @Html.Partial("_LogOnPartial", MyProject_MVC.Models.UserRepository) 'MyProject_MVC.Models.UserRepository' is a 'type', which is not valid in the given context

    Read the article

  • Entity Data Model Wizzard not creating tables in EDMX file

    - by Shawn
    I'm trying the database first approach by creating an ADO.NET Entity Data Model using the Wizard with the Adventureworks2012 DB. Testing DB connection works, and the connection string is added to the App.Config. I'm selecting all the tables except the ones marked as (dbo) AWBuildVersion, DatabaseLog, and ErrorLog. When the Wizard finishes the .edmx file is blank, and if I view the file in XML view the EntityContainer is empty. I'm using VS 2010 & .NET Framework 4.0

    Read the article

  • PHP / Zend Framework: Which object would handle a complex table join?

    - by Thomas
    I think one of the more difficult concepts to understand in the Zend Framework is how the Table Data Gateway pattern is supposed to handle multi-table joins. Most of the suggestions I've seen claim that you simply handle the joins using a $db-select()... Zend DB Select with multiple table joins Joining Tables With Zend Framework PHP Joining tables wthin a model in Zend Php Zend Framework Db Select Join table help Zend DB Select with multiple table joins My question is: Which object is best suited to handle this kind of multi-table select statement? I feel like putting it in the model would break the 1-1 Table Data Gateway pattern between the class and the db table. Yet putting it in the controller seems wrong because why would a controller handle a SQL statement? Anyway, I feel like ZF makes handling datasets from multiple tables more difficult than it needs to be. Any help you can provide is great... Thanks!

    Read the article

  • populate CoreData data model from JSON files prior to app start

    - by johannes_d
    I am creating an iPad App that displays data I got from an API in JSON format. My Core Data model has several entities(Countries, Events, Talks, ...). For each entity I have one .json file that contains all instances of the entity and its attributes as well as its relationships. I would like to populate my Core Data data model with these entities before the start of the App (otherwise it takes about 15 minutes for the iPad to create all the instances of the entities from the several JSON files using factory methods). I am currently importing the data into CoreData like this: -(void)fetchDataIntoDocument:(UIManagedDocument *)document { dispatch_queue_t dataQ = dispatch_queue_create("Data import", NULL); dispatch_async(dataQ, ^{ //Fetching data from application bundle NSURL *tedxgroupsurl = [[NSBundle mainBundle] URLForResource:@"contries" withExtension:@"json"]; NSURL *tedxeventsurl = [[NSBundle mainBundle] URLForResource:@"events" withExtension:@"json"]; //converting the JSON files to NSDictionaries NSError *error = nil; NSDictionary *countries = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfURL:countriesurl] options:kNilOptions error:&error]; countries = [countries objectForKey:@"countries"]; NSDictionary *events = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfURL:eventsurl] options:kNilOptions error:&error]; events = [events objectForKey:@"events"]; //creating entities using factory methods in NSManagedObject Subclasses (Country / Event) [document.managedObjectContext performBlock:^{ NSLog(@"creating countries"); for (NSDictionary *country in countries) { [Country countryWithCountryInfo:country inManagedObjectContext:document.managedObjectContext]; //creating Country entities } NSLog(@"creating events"); for (NSDictionary *event in events) { [Event eventWithEventInfo:event inManagedObjectContext:document.managedObjectContext]; // creating Event entities } NSLog(@"done creating, saving document"); [document saveToURL:document.fileURL forSaveOperation:UIDocumentSaveForOverwriting completionHandler:NULL]; }]; }); dispatch_release(dataQ); } This combines the different JSON files into one UIManagedDocument which i can then perform fetchRequests on to populate tableViews, mapView, etc. I'm looking for a way to create this document outside my application & add it to the mainBundle. Then I could copy it once to the apps DocumentsDirectory and be able I use it (instead of creating the Document within the app from the original JSON files). Any help is appreciated!

    Read the article

  • Django save_m2m() and excluded field

    - by jul
    hi, in a ModelForm I replaced a field by excluding it and adding a new one with the same name, as shown below in AddRestaurantForm. When saving the form with the code shown below, I get an error in form.save_m2m() ("Truncated incorrect DOUBLE value"), which seems to be due to the function to attempt to save the tag field, while it is excluded. Is the save_m2m() function supposed to save excluded fields? Is there anything wrong in my code? Thanks Jul (...) new_restaurant = form.save(commit=False) new_restaurant.city = city new_restaurant.save() tags = form.cleaned_data['tag'] if(tags!=''): tags=tags.split(',') for t in tags: tag, created = Tag.objects.get_or_create(name = t.strip()) tag.save() new_restaurant.tag.add(tag) new_restaurant.save() form.save_m2m() models.py class Tag(models.Model): name = models.CharField(max_length=100, unique=True) class Restaurant(models.Model): name = models.CharField(max_length=50) city=models.ForeignKey(City) category=models.ManyToManyField(Category) tag=models.ManyToManyField(Tag, blank=True, null=True) forms.py class AddRestaurantForm(ModelForm): name = forms.CharField(widget=forms.TextInput(attrs=classtext)) city = forms.CharField(widget=forms.TextInput(attrs=classtext), max_length=100) tag = forms.CharField(widget=forms.TextInput(attrs=classtext), required=False) class Meta: model = Restaurant exclude = ('city','tag') Traceback: File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in get_response 92. response = callback(request, *callback_args, **callback_kwargs) File "/home/jul/atable/../atable/resto/views.py" in addRestaurant 498. form.save_m2m() File "/var/lib/python-support/python2.5/django/forms/models.py" in save_m2m 75. f.save_form_data(instance, cleaned_data[f.name]) File "/var/lib/python-support/python2.5/django/db/models/fields/ related.py" in save_form_data 967. setattr(instance, self.attname, data) File "/var/lib/python-support/python2.5/django/db/models/fields/ related.py" in set 627. manager.add(*value) File "/var/lib/python-support/python2.5/django/db/models/fields/ related.py" in add 430. self._add_items(self.source_col_name, self.target_col_name, *objs) File "/var/lib/python-support/python2.5/django/db/models/fields/ related.py" in _add_items 497. [self._pk_val] + list(new_ids)) File "/var/lib/python-support/python2.5/django/db/backends/util.py" in execute 19. return self.cursor.execute(sql, params) File "/var/lib/python-support/python2.5/django/db/backends/mysql/ base.py" in execute 84. return self.cursor.execute(query, args) File "/var/lib/python-support/python2.5/MySQLdb/cursors.py" in execute 168. if not self._defer_warnings: self._warning_check() File "/var/lib/python-support/python2.5/MySQLdb/cursors.py" in _warning_check 82. warn(w[-1], self.Warning, 3) File "/usr/lib/python2.5/warnings.py" in warn 62. globals) File "/usr/lib/python2.5/warnings.py" in warn_explicit 102. raise message Exception Type: Warning at /restaurant/add/ Exception Value: Truncated incorrect DOUBLE value: 'a'

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >