Search Results

Search found 13135 results on 526 pages for 'actor model'.

Page 155/526 | < Previous Page | 151 152 153 154 155 156 157 158 159 160 161 162  | Next Page >

  • DataContext as Source for Converter Binding Within Resources

    - by loafofbread
    <Style TargetType="{x:Type local:SomeControl}"> <Canvas.DataContext> <ViewModels:VMSomeControl Model="{Binding RelativeSource={RelativeSource TemplatedParent}}" /> </Canvas.DataContext> <Canvas.Resources> <!-- is there a way to use a binding that points to the datacontext within the resources ? --> <Converters:SomeConverter x:Key="someConverter" SomeProperty="{Binding Path=Model.SomeProperty}" /> <!-- is there a way to point Directly to the TemplatedParent ? --> <Converters:SomeConverter x:Key="someConverter" SomeProperty="{TemplateBinding Path=SomeProperty}" /> </Canvas.Resources> <SomeFrameworkElement SomeProperty="{Binding Path=Model.SomeOtherProperty, Converter={StaticResource someConverter}}" /> </Canvas> is it possible to use bindings that use either the dataContext or the TemplatedParent Within a ControlTemplate's Root Visuals resourecs ?

    Read the article

  • Maintaining Project with Git

    - by gkrdvl
    Hi All, I have 2 project, and actually these 2 project is about 80% same each other, the mainly difference is just about language and business model, one is for larger audience using english language and have a 9$/month business model, another is using local language with freemium business model. Sometime when I want to add new feature/functionality, I want to add it in both of the project, but also sometime I want to add feature especially just for the local project. My question is, how do I maintain these 2 project with git ? Maintain 2 git repository for each project or Maintain single git repository with 2 mainly branch or Any other suggestion ?

    Read the article

  • Best way of implementing DropDownList in ASP.NET MVC 2?

    - by Kelsey
    I am trying to understand the best way of implementing a DropDownList in ASP.NET MVC 2 using the DropDownListFor helper. This is a multi-part question. First, what is the best way to pass the list data to the view? Pass the list in your model with a SelectList property that contains the data Pass the list in via ViewData How do I get a blank value in the DropDownList? Should I build it into the SelectList when I am creating it or is there some other means to tell the helper to auto create an empty value? Lastly, if for some reason there is a server side error and I need to redisplay the screen with the DropDownList, do I need to fetch the list values again to pass into the view model? This data is not maintained between posts (at least not when I pass it via my view model) so I was going to just fetch it again (it's cached). Am I going about this correctly?

    Read the article

  • Dajano admin site foreign key fields

    - by user292652
    hi i have the following models setup class Player(models.Model): #slug = models.slugField(max_length=200) Player_Name = models.CharField(max_length=100) Nick = models.CharField(max_length=100, blank=True) Jersy_Number = models.IntegerField() Team_id = models.ForeignKey('Team') Postion_Choices = ( ('M', 'Manager'), ('P', 'Player'), ) Poistion = models.CharField(max_length=1, blank=True, choices =Postion_Choices) Red_card = models.IntegerField( blank=True, null=True) Yellow_card = models.IntegerField(blank=True, null=True) Points = models.IntegerField(blank=True, null=True) #Pic = models.ImageField(upload_to=path/for/upload, height_field=height, width_field=width, max_length=100) class PlayerAdmin(admin.ModelAdmin): list_display = ('Player_Name',) search_fields = ['Player_Name',] admin.site.register(Player, PlayerAdmin) class Team(models.Model): """Model docstring""" #slug = models.slugField(max_length=200) Team_Name = models.CharField(max_length=100,) College = models.CharField(max_length=100,) Win = models.IntegerField(blank=True, null=True) Loss = models.IntegerField(blank=True, null=True) Draw = models.IntegerField(blank=True, null=True) #logo = models.ImageField(upload_to=path/for/upload, height_field=height, width_field=width, max_length=100) class Meta: pass #def __unicode__(self): # return Team_Name #def save(self, force_insert=False, force_update=False): # pass @models.permalink def get_absolute_url(self): return ('view_or_url_name') class TeamAdmin(admin.ModelAdmin): list_display = ('Team_Name',) search_fields = ['Team_Name',] admin.site.register(Team, TeamAdmin) my question is how do i get to the admin site to show Team_name in the add player form Team_ID field currently it is only showing up as Team object in the combo box

    Read the article

  • What class should manage/control the CALayers in my view using proper MVC?

    - by wanderlust
    I have a ViewController with a view (UIView). I need to handle touches, run some logic, check against model data, and and add and remove sublayers to the view based on those touches. Then I need to update the model based on the results. Should I have: ViewController - manage touches, get/set model data, add/remove sublayers UIView CALayer Sublayers or Controller (NSObject) - get/set data ViewController - manage touches, add/remove sublayers UIView CALayer Sublayers or Controller (NSObject) - get/set data CustomView - manage touches, add/remove sublayers CALayer Sublayers Or is it something else all together? No matter what I try, it "feels" awkward. SVN is my friend. Can you guys help a girl (with architectural issues) out?

    Read the article

  • Django Grouping Query

    - by Matt
    I have the following (simplified) models: class Donation(models.Model): entry_date = models.DateTimeField() class Category(models.Model): name = models.CharField() class Item(models.Model): donation = models.ForeignKey(Donation) category = models.ForeignKey(Category) I'm trying to display the total number of items, per category, grouped by the donation year. I've tried this: Donation.objects.extra(select={'year': "django_date_trunc('year', %s.entry_date)" % Donation._meta.db_table}).values('year', 'item__category__name').annotate(items=Sum('item__quantity')) But I get a Field Error on item__category__name. I've also tried: Item.objects.extra(select={"year": "django_date_trunc('year', entry_date)"}, tables=["donations_donation"]).values("year", "category__name").annotate(items=Sum("quantity")).order_by() Which generally gets me what I want, but the item quantity count is multiplied by the number of donation records. Any ideas? Basically I want to display this: 2010 - Category 1: 10 items - Category 2: 17 items 2009 - Category 1: 5 items - Category 3: 8 items

    Read the article

  • Using Entity Framework for SQL Compact Edition 3.5 does not respect mode=exclusive property of conne

    - by AJ
    I am using SQL Server Compact 3.5 edition with Entity Framework and I want to have exclusive lock on the database as documented here http://msdn.microsoft.com/en-us/library/ms171817.aspx. However when you pass this in a connection string to Entity Framework it does not respect this at all. An example of the connection string as following private static readonly string _ConnectionStringFormat = @"metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl; provider=System.Data.SqlServerCe.3.5; provider connection string='Data Source={0};Mode=Exclusive'"; If anyone has come across this issue before and have found out how to resolve this, then please let me know. Thanks Aj

    Read the article

  • Django says the "id may not be NULL" but why is it?

    - by Oli
    I'm going crazy today. I just tried to insert a new record and it threw back a "post_blogpost.id may not be NULL" error. Here's my model: class BlogPost(models.Model): title = models.CharField(max_length=100) slug = models.SlugField(max_length=100) who = models.ForeignKey(User, default=1) when = models.DateTimeField() intro = models.TextField(blank=True, null=True) content = models.TextField(blank=True, null=True) counter = models.PositiveIntegerField(default=0) published = models.BooleanField(default=False) css = models.TextField(blank=True, null=True) class Meta: ordering = ('-when', 'id') There are a number of functions beneath the model too but I won't include them in full here. Their names are: content_cache_key, clear_cache, __unicode__, reads, read, processed_content. I'm adding through the admin... And I'm running out of hair.

    Read the article

  • Prepopulate drop-box according to another drop-box choice in Django Admin

    - by onorua
    I have models like this: class User(models.Model): Switch = models.ForeignKey(Switch, related_name='SwitchUsers') Port = models.ForeignKey(Port) class Switch(models.Model): Name = models.CharField(max_length=50) class Port(models.Model): PortNum = models.PositiveIntegerField() Switch = models.ForeignKey(Switch, related_name = "Ports") When I'm in Admin interface and choose Switch from Switches available, I would like to have Port prepopulated accordingly with Ports from the related Switch. As far as I understand I need to create some JS script to prepopulate it. Unfortunately I don't have this experience, and I would like to keep things simple as it possible and don't rewrite all Django admin interface. Just add this functionality for one Field. Could you please help me with my problem? Thank you.

    Read the article

  • how to change display text in django admin foreignkey dropdown

    - by FurtiveFelon
    Hi all, I have a task list, with ability to assign users. So i have foreignkey to User model in the database. However, the default display is username in the dropdown menu, i would like to display full name (first last) instead of the username. If the foreignkey is pointing to one of my own classes, i can just change the str function in the model, but User is a django authentication model, so i can't easily change it directly right? Anyone have any idea how to accomplish this? Thanks a lot!

    Read the article

  • Mapping one to one foreign key relationships in Entity Framework 4.0?

    - by John K.
    Hello all, I'm sure I'm missing something very simple, but let's say I have two entities, Employee and EmployeeType. Employee type would contain values like 'Full time', 'Contractor', 'Intern', etc. An Employee entity would contain one, and only one EmployeeType value. So I am designing a new .edmx model using the Model-First approach and generating my actual sql server data schema from the model. I want to add an integer type foreign key id into my Employee entity, EmployeeTypeId, which will map to the primary key of the EmployeeType entity. So I've gone ahead and done that in my Employee entity. Where I'm stuck is how, though the Entity Framework designer, to enforce the 1:1 referential constraint on that EmployeeTypeId property? Or does the EF handle that automatically behind the scenes? thanks in advance, John

    Read the article

  • YII Mail Generate unwanted ascii character in HTML mail

    - by CedSha
    I use YII-Mail just by copying the sample but I always get some ascii charcters in my generated links Where they come from and how to avoid them ? $message = new YiiMailMessage; $message->view = 'mail'; $message->setBody(array('model'=>$model), 'text/html'); $message->subject = Yii::t('tr','my subject'); $message->addTo('[email protected]'); $message->from = '[email protected]'; Yii::app()->mail->send($message); and in view file 'mail' <h1><?php echo(Yii::t('tr','This is HTML mail')); ?></h1> <?php echo CHtml::link('Mylink', array('controller/view', 'id'=>$model->id)); ?> The resulted email source looks like this <h1>This is HTML mail</h1> <a href=3D"/testdrive/index.php?r=3D ....

    Read the article

  • Beginform is not working in Asp.net mvc control whenI am trying to send the values

    - by kumar
    Hello friends i have a beginform is soemthing like this, <% using (Html.BeginForm("edit", (Model.ExceptionCategoryID == "EXP") ? "expense" : "pricing", FormMethod.Post, new { @id="exc-" + Model.ExceptionID})) { %> <input type="hidden" id="Status" runat="server"/> <%= Html.ValidationSummary(true)%> input submit button <input id="bSubmit" type="submit" class="button" value="Save" /> <script type="text/javascript"> $(document).ready(function() { $('#bSubmit').click(function() { var Status = "<%=Model.ExceptionStatus.Trim()%>"; alert(Status); $('#1_Status').attr('value',Status); }); </script> on sbmit I am trying to send the Status value.. on controler var sta = Request.Form[0]; I am getting something like 3%24Status in the From key.. why its hapeening ? thanks

    Read the article

  • Explanation of contribute_to_class

    - by anon.
    I'm attempted to extend code, and have come across an issue, I don't understand a line of code. I know the outcome of it - but I don't understand how it happens and am naturally enough scared to change it. The line of code I've come across is this: MyGenericRelation().contribute_to_class(model, 'field_name') The result of this code is a field with 'field_name' is added to the 'model' and from what I gather the objects inside the field are a list of type X (part of MyGenericRelation). I'm wondering if anyone can explain how this works. As in, why do I get a list of X objects attached to 'field_name' and if does it have to be generic relations prior to contribute_to_class or would using an actual model type, say 'Y' just give me a list of Y's. To be honest, I am more interested in the affect and functionality of the contribute_to_class method.

    Read the article

  • Django QuerySet ordering by expression

    - by Andrew
    How can i use order_by like order_by('field1'*'field2') For example i have items with price listed in different currencies, so to order items - i have to make currency conversion. class Currency(models.Model): code = models.CharField(max_length=3, primary_key=True) rateToUSD = models.DecimalField(max_digits=20,decimal_places=10) class Item(models.Model): priceRT = models.DecimalField(max_digits=15, decimal_places=2, default=0) cur = models.ForeignKey(Currency) I would like to have something like: Item.objects.all().order_by(F('priceRT')*F('cur__rateToUSD')) But unfortunately it doesnt work, i also faild with annotate. How can i permorm QuerySet ordering by result of value multiplication of 2 model's fields.

    Read the article

  • Asp .Net MVC Viewmodel should be class or struct?

    - by Jonas Everest
    Hey guys, I have just been thinking about the concept of view model object we create in asp.net MVC. Our purpose is to instantiate it and pass it from controller to view and view read it and display the data. Those view model are usually instantiated through constructor. We won't need to initialize the members, we may not need to redefine/override parameterless constructor and we don't need inheritance feature there. So, why don't we use struct type for our view model instead of class. It will enhance the performance.

    Read the article

  • How can I compare Core Data models?

    - by Don
    I noticed while doing system testing that a feature of our app had been removed. It looks like at some point, an older version of a file was checked into SVN that was missing a property. This specific file was generated from the Core Data model, and sure enough, the latest version of the model in SVN is missing the same attribute. I need to find out if any other attributes are missing, or if anything else in the model changed. However, the elements file in the .xcodedatamodel folder appears to binary and I can't compare the revisions. Is there a way to find the differences between two Core Data models in SVN? Barring that, what would be the best way to accomplish this task?

    Read the article

  • Smack API - How to display loop jxTaskpane for expand and collapse roster list

    - by MYE
    Hello everybody ! i have problem to display Taskpane for loop. i have a code to get the groups of roster (Groups : Friends - Business - Company, so on) my code is : Roster rost = xmppcon.getRoster(); Collection<RosterGroup> groups = rost.getGroups(); for(RosterGroup group : groups){ DefaultListModel model = new DefaultListModel(); model.addElement(group.getEntries()); String GroupNameCount = group.getName() + "("+group.getEntryCount()+")"; jXTaskPane1.setTitle(GroupNameCount); jXList1.setModel(model); } but jxTaskpane not loop, but when i print group name it print 2 line (because in database user A have two group is Friends and NIIT) sample print System.out.println(group.getName()); result: Friends NIIT

    Read the article

  • How many layers is too many?

    - by Nathan
    As I have been learning about software development the last 2 years the more I learn, it seems the more gray areas I am running into. One gray area I have issues with right now is trying to decide how many layers an application should have. For example, in a WPF MVVM application what fashion of layering is ok? Is the following too separated? When I mention layering I mean creating a new class library for each layer. Presentation (View) View Model Business Layer Data Access Model Layer Utility Layer Or for a non MVVM application is this too separated? Presenation Business Data Access Model Layer Utility Layer Is acceptable to run layers together and just create folders for each layer? Any coloring of this gray area would be appreciated.

    Read the article

  • Grails Unit testing a function with session object

    - by Suganthan
    I having a Controller like def testFunction(testCommand cmdObj) { if (cmdObj.hasErrors()) { render(view: "testView", model: [cmdObj:cmdObj]) return } else { try { testService.testFunction(cmdObj.var1, cmdObj.var2, session.user.username as String) flash.message = message(code: 'message') redirect url: createLink(mapping: 'namedUrl') } catch (GeneralException error) { render(view: "testView", model: [cmdObj:cmdObj]) return } } } For the above controller function I having a Unit test function like: def "test function" () { controller.session.user.username = "testUser" def testCommandOj = new testCommand( var1:var1, var2:var2, var3:var3, var4:var4 ) testService service = Mock(testService) controller.testService = service service.testFunction(var2,var3,var4) when: controller.testFunction(testCommandOj) then: view == "testView" assertTrue model.cmdObj.hasErrors() where: var1 | var2 | var3 | var4 "testuser" | "word@3" | "word@4" | "word@4" } When running this test function I getting the error like Cannot set property 'username' on null object, means I couldn't able to set up the session object. Can someone help to fix this. Thanks in advance

    Read the article

  • advantages of Zend_Db_Table vs raw (My)SQL?

    - by sunwukung
    Currently working on a new Zend application and developing the Model. Having worked with Zend_Db_Table before, I opted to replace references in the Model to the Table API with a custom SQL script to take care of data access duties. Now I'm looking at developing a new application/domain model, and I wanted to get some feedback from people re: their experiences with Zend_Db API vs raw SQL, and use cases where it would be preferable to use the API. From a project perspective, the DB platform is unlikely to change from MySQL - so it doesn't need to be particularly abstract - and I assume writing a custom SQL API will be more performant than the assorted classes the Zend DB API requires.

    Read the article

  • Django: Geocoding an address on form submission?

    - by User
    Trying to wrap my head around django forms and the django way of doing things. I want to create a basic web form that allows a user to input an address and have that address geocoded and saved to a database. I created a Location model: class Location(models.Model): address = models.CharField(max_length=200) city = models.CharField(max_length=100) state = models.CharField(max_length=100, null=True) postal_code = models.CharField(max_length=100, null=True) country = models.CharField(max_length=100) latitude = models.DecimalField(max_digits=18, decimal_places=10, null=True) longitude = models.DecimalField(max_digits=18, decimal_places=10, null=True) And defined a form: class LocationForm(forms.ModelForm): class Meta: model = models.Location exclude = ('latitude','longitude') In my view I'm using form.save() to save the form. This works and saves an address to the database. I created a module to geocode an address. I'm not sure what the django way of doing things is, but I guess in my view, before I save the form, I need to geocode the address and set the lat and long. How do I set the latitude and longitude before saving?

    Read the article

  • How RPG characters are made

    - by user365314
    If RPG with the ability to change armors and clothes are made, how is it done? I mean the 3d side mostly If i make normal character, that has flat clothes, it would be easy, just change textures, but question is about armors, which have totally different models. So are only armor models recreated or character model with armor? How is it imported into game engine, only armor or character model with new armor? If person changes armor in game, will game swap the hole model or only the armor part? if only the armor part, then how the movement animations are done, are armor models animated on characters in 3d programs or what... :D

    Read the article

  • Ajax foreign key filter in Django admin interface

    - by Googol
    http://blog.philippmetzler.com/?p=52 Just tried django-ajax-filtered-fields and like it very much. I’m looking for a solution for this problem: My model looks like this: class Song(models.Model): Album = models.ForeignKey(Album) class Artist(models.Model): album = models.ForeignKey(Album) song = models.ForeignKey(Song, blank=True, null=True) So the user has to define a topic. He can also define a subtopic but doesn’t have to. The subtopic belongs to a topic. In the admin interface I’d like to limit the choices for subtopic based upon what he selects in topics. That should change dynamically with AJAX. I will have a closer look to django-ajax-filtered-fields but didn’t find a solution to that specific problem. Perhaps it’s another usecase for django-ajax-filtered-fields in general? Or do you know another solution to my specific requirements?

    Read the article

  • Creating a gallery in Rails

    - by raphael_turtle
    I'm creating a simple site with a gallery. I have a photos model which has a page for each photo with it's info and an image. I'm unsure how to create a gallery from the photo's. The gallery model has_many photos, the photos model has_and_belongs_to_many galleries. I thought of adding a gallery.title field on each photo page so I'd have a list of photo's for each gallery then display them in a view. Is this a good way to make a gallery? (I've looked through the code on some gallery apps on github, but most are outdated are too complicated for my needs.)

    Read the article

< Previous Page | 151 152 153 154 155 156 157 158 159 160 161 162  | Next Page >