Search Results

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

Page 135/526 | < Previous Page | 131 132 133 134 135 136 137 138 139 140 141 142  | Next Page >

  • rendering html to png (server-side)

    - by jonny
    Hi! I have a workflow model. Internet Explorer doesn't support some features required for model editing functionality (and regular user doesn't need it). I want a read-only preview of my model. Is it possible to server-side render my html to image?

    Read the article

  • Subprocess with variables & Command from different class

    - by Pastelinux
    source: http://pastebin.com/utL7Ebeq My thinking is that if i run from controller class "main" it will allow me to take the "data" from Class "model", def "filename". It doesn't seem to work. As you can see below what i mean class Controller: def __init__(self): self.model = Model() self.view = View() def main(self): data = self.model.filename() self.view.tcpdump(data) class View: def tcpdump(self, command): subprocess.call(command.split(), shell=False) When i run my code i get this error: subprocess.call(command.split(), shell=False) AttributeError: 'NoneType' object has no attribute 'split' My guess means that its not picking up command (look at source for reference) or that its not getting command with variables. But i know the error when variables are not being picked up so i don't think it is that. My question is, from what i have thus far, how do i from "class view" grab "command" for my subprocesses to run. Thanks~ John Riselvato

    Read the article

  • MVC Validator.TryValidateObject does not validate custom atrribute, validateAllProperties = true

    - by nealsu
    When calling Validator.TryValidateObject with validateAllProperties = true my custom validation attribute does not get triggered. The ValidationResult does not contain an entry for my erroneous property value. Below is the model, attribute and code used to test this. //Model public class Model { [AmountGreaterThanZero] public int? Amount { get; set; } } //Attribute public sealed class AmountGreaterThanZero: ValidationAttribute { private const string errorMessage = "Amount should be greater than zero."; public AmountGreaterThanZero() : base(errorMessage) { } public override string FormatErrorMessage(string name) { return errorMessage; } protected override ValidationResult IsValid(object value, ValidationContext validationContext) { if (value != null) { if ((int)value <= 0) { var message = FormatErrorMessage(validationContext.DisplayName); return new ValidationResult(message); } } return null; } } //Validation Code var container = new Container(); container.ModelList = new List<Model>() { new Model() { Amount = -5 } }; var validationContext = new ValidationContext(container, null, null); var validationResults = new List<ValidationResult>(); var modelIsValid = Validator.TryValidateObject(container, validationContext, validationResults, true); Note: That the validation works fine and ValidationResult returns with correct error message if I use the TryValidateProperty method.

    Read the article

  • Where do I put constants file for Codeigniter (PHP)?

    - by wag2639
    I have a list of constants (I'm using them as an enum), some are define statements, and some are just global variables. Where am I suppose to put them in the MVC framework so I can use them for both my model and my controller that needs to reference it? I'd rather not stick it into config/constants.php since they shouldn't be called except for by this model and the controllers that use it. Edit 1: Clarification To be more specific, I have my message_model model and it has a bunch of constants that I need that are stored in message_model_constants.php. Where should I put message_model_constants.php and is there a way to have it automatically included by the controller that loads message_model when message_model is not (and I don't want it to be) auto-loaded. Edit 2: I really don't want to have the constants auto-loaded except for when I use the model

    Read the article

  • ManyToManyField error when having recursive structure. How to solve it?

    - by luc
    Hello, I have the following table in the model with a recursive structure (a page can have children pages) class DynamicPage(models.Model): name = models.CharField("Titre",max_length=200) parent = models.ForeignKey('self',null=True,blank=True) I want to create another table with manytomany relation with this one: class UserMessage(models.Model): name = models.CharField("Nom", max_length=100) page = models.ManyToManyField(DynamicPage) The generated SQL creates the following constraint: ALTER TABLE `website_dynamicpage` ADD CONSTRAINT `parent_id_refs_id_29c58e1b` FOREIGN KEY (`parent_id`) REFERENCES `website_dynamicpage` (`id`); I would like to have the ManyToMany with the page itself (the id) and not with the parent field. How to modify the model to make the constraint using the id and not the parent? Thanks in advance

    Read the article

  • Access: Expression too complex to be evaluated

    - by user2502964
    I'm trying to sort out values from a database by the weekending date. The script I'm using functions on 6 of my 7 databases (they are all constructed identically). The 7th database doesn't function. I get the expression too complex error. any help figuring out why?? Here is my code: SELECT UPC_Test.Type, UPC_Test.[Model No], UPC_Test.[Model Desc], UPC_Test.[Serial No], Format(DateValue([UPC_Test].[Test Date]+7-Weekday([UPC_Test].[Test Date],0)),"m/d/yyyy") AS [Test Date], UPC_Test.Parameter, UPC_Test.[Failure Symptom], UPC_Test.[Repair Action], UPC_Test.[Factory Select], UPC_Test.[Test Station] FROM UPC_Test GROUP BY UPC_Test.Type, UPC_Test.[Model No], UPC_Test.[Model Desc], UPC_Test.[Serial No], Format(DateValue([UPC_Test].[Test Date]+7-Weekday([UPC_Test].[Test Date],0)),"m/d/yyyy"), UPC_Test.Parameter, UPC_Test.[Failure Symptom], UPC_Test.[Repair Action], UPC_Test.[Factory Select], UPC_Test.[Test Station] HAVING (((UPC_Test.Type)="Production") AND ((Format(DateValue([UPC_Test].[Test Date]+7-Weekday([UPC_Test].[Test Date],0)),"m/d/yyyy"))=[Enter]) AND ((UPC_Test.[Failure Symptom])<>"") AND ((UPC_Test.[Repair Action])<>"") AND ((UPC_Test.[Test Station])="UPC RF Test")) ORDER BY Format(DateValue([UPC_Test].[Test Date]+7-Weekday([UPC_Test].[Test Date],0)),"m/d/yyyy");

    Read the article

  • Entity framework: Need a easy going, clean database migration solution.

    - by user469652
    I'm using entity framework model first development, and I need to do database migration often, The EF database generation power pack doesn't help a lot, because that data migration never worked here. The database migration here I mean, change the model, and then I can update the existing database from the model, but creating a new one. Is there any free of charge tool here invented here yet? Or would this going to be a new feature of next EF release? PS: I love django's ORM.

    Read the article

  • how to copy from one column to another but with different format

    - by Bob
    I hv a table like this:- Item Model Remarks ----------------------------------------- A 10022009 B 10032006 C 05081997 I need to copy the info from "Model" to "Remarks" with the following format:- Item Model Remarks ----------------------------------------- A 10022009 20090210 B 10032006 20060310 C 05081997 19970805 Thanks

    Read the article

  • What is the meaning of @ModelAttribute annotation at method argument level?

    - by beemaster
    Spring 3 reference teaches us: When you place it on a method parameter, @ModelAttribute maps a model attribute to the specific, annotated method parameter I don't understand this magic spell, because i sure that model object's alias (key value if using ModelMap as return type) passed to the View after executing of the request handler method. Therefore when request handler method executes the model object's name can't be mapped to the method parameter. To solve this contradiction i went to stackoverflow and found this detailed example. The author of example said: // The "personAttribute" model has been passed to the controller from the JSP It seems, he is charmed by Spring reference... To dispel the charms i deployed his sample app in my environment and cruelly cut @ModelAttribute annotation from method MainController.saveEdit. As result the application works without any changes! So i conclude: the @ModelAttribute annotation is not needed to pass web form's field values to the argument's fields. Then i stuck to the question: what is the mean of @ModelAttribute annotation? If the only mean is to set alias for model object in View, then why this way better than explicitly adding of object to ModelMap?

    Read the article

  • Spring MVC - Set an actionURL parameter with Javascript

    - by jeffl8n
    Is it possible to dynamically set a Spring MVC portlet:actionURL portlet:param using javascript? I have tried with the following code, but the id value always comes across as null to the controller. I have verified that setting the portlet:param manually passes the value correctly: <portlet:param name="id" value="2" /> I have also verified the value in the javascript is being set correctly and is not null. (Note: I've changed the variable names, etc. from the original code to simplify it and obfuscate it since it is my employer's code.) JSP: <portlet:actionURL var="modifyURL"> <portlet:param name="do" value="modify" /> <portlet:param name="id" value="${model.id}" /> </portlet:actionURL> ... <form:form action="${modifyURL}" id="modifyForm" modelAttribute="model"> <form:hidden path="id" id="id" /> </form:form> Javascript called when the update URL is clicked: function update() { document.forms[0]["id"].value = selectedId; document.forms[0].submit(); } Controller: @RequestMapping(params = {"do=modify"}) public void modify(@ModelAttribute("model") Model model, @RequestParam(value = "id", required=true) Long id, ActionRequest request, ActionResponse response, SessionStatus sessionStatus, ModelMap modelMap) { ....

    Read the article

  • movedown method not saving new position - cakephp tree

    - by Ryan
    Hi everyone, I am experiencing a problem that has popped up recently and is causing quite a bit of trouble for our system. The app we have relies on using the movedown method to organize content, but as of late it has stopped working and began to generate the following warning: Warning (2): array_values() [<a href='function.array-values'>function.array-values</a>]: The argument should be an array in [/usr/local/home/cake/cake_0_2_9/cake/libs/model/behaviors/tree.php, line 459] The line being referenced: list($node) = array_values($Model->find('first', array( 'conditions' => array($scope, $Model->escapeField() => $id), 'fields' => array($Model->primaryKey, $left, $right, $parent), 'recursive' => $recursive ))); The line calling the method: $this->movedown($id,abs((int)$position)); I have exhausted every idea I could come up with. Has anyone else crossed this issue before? Any help, or pointing in a direction would be much appreciated!

    Read the article

  • How to make paging start from 1 instead of 0 in ASP.NET MVC

    - by ssx
    I used the paging example of the Nerddinner tutorial. But I also wanted to add page Numbers, somehting like that: <<< 1 2 3 4 5 6 The code below works if i start my paging from 0, but not from 1. How can I fix this ? Here is my code: PaginatedList.cs public class PaginatedList<T> : List<T> { public int PageIndex { get; private set; } public int PageSize { get; private set; } public int TotalCount { get; private set; } public int TotalPages { get; private set; } public PaginatedList(IQueryable<T> source, int pageIndex, int pageSize) { PageIndex = pageIndex; PageSize = pageSize; TotalCount = source.Count(); TotalPages = (int) Math.Ceiling(TotalCount / (double)PageSize); this.AddRange(source.Skip(PageIndex * PageSize).Take(PageSize)); } public bool HasPreviousPage { get { return (PageIndex > 0); } } public bool HasNextPage { get { return (PageIndex+1 < TotalPages); } } } UserController.cs public ActionResult List(int? page) { const int pageSize = 20; IUserRepository userRepository = new UserRepository(); IQueryable<User> listUsers = userRepository.GetAll(); PaginatedList<User> paginatedUsers = new PaginatedList<User>(listUsers, page ?? 0, pageSize); return View(paginatedUsers); } List.cshtml @if (Model.HasPreviousPage) { @Html.RouteLink(" Previous ", "PaginatedUsers", new { page = (Model.PageIndex - 1) }) } @for (int i = 1; i <= Model.TotalPages; i++) { @Html.RouteLink(@i.ToString(), "PaginatedUsers", new { page = (@i ) }) } @if (Model.HasNextPage) { @Html.RouteLink(" Next ", "PaginatedUsers", new { page = (Model.PageIndex + 1) }) }

    Read the article

  • Should I create a new extension for an xml file?

    - by macleojw
    I'm working with a data model stored in XML files. I want to create some metadata for the model and store it alongside, but would like to be able to distinguish between the two. The data model is imported into some software from time to time and we don't want it to try to import the meta data files. To get round this, I've been thinking of creating a new extension for the metadata xml files (say .mdml). Is this good practice?

    Read the article

  • Django call function when an object gets added

    - by dotty
    Hay, i have a simple model class Manufacturer(models.Model): name = models.CharField() car_count = models.IntegerField() class Car(models.Model): maker = ForeignKey(Manufacturer) I want to update the car_count field when a car is added to a manufacturer, I'm aware i could just count the Manufacturer.car_set() to get the value, but i want the value to be stored within that car_count field. How would i do this? EDIT Would something like this work? def save(self): if self.id: car_count = self.car_set.count() self.save()

    Read the article

  • Modifying Django's pre_save/post_save Data

    - by Rodrogo
    Hi, I'm having a hard time to grasp this post_save/pre_save signals from django. What happens is that my model has a field called status and when a entry to this model is added/saved, it's status must be changed accordingly with some condition. My model looks like this: class Ticket(models.Model): (...) status = models.CharField(max_length=1,choices=OFFERT_STATUS, default='O') And my signal handler, configured for pre_save: def ticket_handler(sender, **kwargs): ticket = kwargs['instance'] (...) if someOtherCondition: ticket.status = 'C' Now, what happens if I put aticket.save() just bellow this last line if statement is a huge iteration black hole, since this action calls the signal itself. And this problem happens in both pre_save and post_save. Well... I guess that the capability of altering a entry before (or even after) saving it is pretty common in django's universe. So, what I'm doing wrong here? Is the Signals the wrong approach or I'm missing something else here? Also, would it be possible to, once this pre_save/post_save function is triggered, to access another model's instance and change a specific row entry on that? Thanks

    Read the article

  • Question about architecting asp.net mvc application ?

    - by Misnomer
    I have read little bit about architecture and also patterns in order to follow the best practices. So this is the architecture we have and I wanted to know what you think of it and any proposed changes or improvements to it - Presentation Layer - Contains all the views,controllers and any helper classes that the view requires also it containes the reference to Model Layer and Business Layer. Business Project - Contains all the business logic and validation and security helper classes that are being used by it. It contains a reference to DataAccess Layer and Model Layer. Data Access Layer - Contains the actual queries being made on the entity classes(CRUD) operations on the entity classes. It contains reference to Model Layer. Model Layer - Contains the entity framework model,DTOs,Enums.Does not really have a reference to any of the above layers. What are your thoughts on the above architecture ? The problem is that I am getting confused by reading about like say the repository pattern, domain driven design and other design patterns. The architecture we have although not that strict still is relatively alright I think and does not really muddle things but I maybe wrong. I would appreciate any help or suggestions here. Thanks !

    Read the article

  • [Django] One single page to create a Parent object and its associated child objects

    - by ahmoo
    Hi all, This is my very first post on this awesome site, from which I have been finding answers to a handful of challenging questions. Kudos to the community! I am new to the Django world, so am hoping to find help from some Django experts here. Thanks in advance. Item model: class Item(models.Model): name = models.CharField(max_length=50) ItemImage model: class ItemImage(models.Model): image = models.ImageField(upload_to=get_unique_filename) item = models.ForeignKey(Item, related_name='images') As you can tell from the model definitions above, every Item object can have many ItemImage objects. My requirements are as followings: A single web page that allows users to create a new Item while uploading the images associated with the Item. The Item and the ItemImages objects should be created in the database all together, when the "Save" button on the page is clicked. I have created a variable in a custom config file, called NUMBER_OF_IMAGES_PER_ITEM. It is based on this variable that the system generates the number of image fields per item. Questions: What should the forms and the template be like? Can ModelForm be used to achieve the requirements? For the view function, what do I need to watch out other than making sure to save Item before ItemImage objects?

    Read the article

  • @Html.Label won't allow string concatination

    - by MrGrigg
    I'm building dynamic forms based on a partial view. My view inherits a model with a single property: CatalogName { get; set; }. I have tried this: @Html.Label(Model.CatalogName + "-ProductNumber", "Product Number") @Html.TextBox(Model.CatalogName + "-ProductNumber") The HTML renders like this though: <label for>Product Number</label> <input name="CatatalogName-ProductNumber" type="text" /> If I write my code like this: @Html.Label("ProductNumber-" + Model.CatalogName", "Product Number") It will render the way I expect <label for="ProductNumber-CatalogName">Product Number</label> Is this a bug with MVC? Are there any answers to why my concatenation won't work the way I want it in the label, but works fine with the TextBox?

    Read the article

  • Is LocalDB supported by Visual Studio 2010 in Entity Framework 5?

    - by Mathias Lykkegaard Lorenzen
    Is LocalDB supported by Visual Studio 2010 in Entity Framework 5, on .NET 4.0? Or am I doing it wrong? I'm getting a "The network path can't be found" issue when instantiating my model container with a connection string for LocalDB. Here's the connection string: var connectionString = "metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string=\"data source=(localdb)\v11.0;initial catalog=fablelane_com_db;integrated security=SSPI;multipleactiveresultsets=True;App=EntityFramework\""; Edit 1 I'm receiving the following error when connecting, more specifically: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server). Edit 2 I just figured out that changing to Visual Studio 11 beta doesn't work either. Still receiving the same error-message.

    Read the article

  • MVC more specified models should be populated by more precise query too?

    - by KevinUK
    If you have a Car model with 20 or so properties (and several table joins) for a carDetail page then your LINQ to SQL query will be quite large. If you have a carListing page which uses under 5 properties (all from 1 table) then you use a CarSummary model. Should the CarSummary model be populated using the same query as the Car model? Or should you use a separate LINQ to SQL query which would be more precise? I am just thinking of performance but LINQ uses lazy loading anyway so I am wondering if this is an issue or not.

    Read the article

  • Pass parameter to controller from @Html.ActionLink MVC 4

    - by NetraSW
    Hello All, @Html.ActionLink("Reply", "BlogReplyCommentAdd", "Blog", new { blogPostId = blogPostId, replyblogPostmodel = Model, captchaValid = Model.AddNewComment.DisplayCaptcha }) In above line: I get error on blogPostId. The parameters dictionary contains a null entry for parameter 'blogPostId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult BlogReplyCommentAdd(Int32, Nop.Web.Models.Blogs.BlogPostModel, Boolean)' in 'Nop.Web.Controllers.BlogController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters I have already assign a value for this on top such as @{ var blogPostId = Model.Id; } My Controller : public ActionResult BlogReplyCommentAdd(int blogPostId, BlogPostModel model, bool captchaValid) {} M i doing something wrong? Please give me an example on this. Thanks

    Read the article

  • Is this a good approach to dealing with tagging?

    - by Mel
    Can this code be optimized or re-factored? Is this an optimal approach to tagging? The following code is a callback in my posts model. It creates a record that associates a tag with a post in a QuestionsTags joiner table. When necessary, if a given tag does not already exist in the tags table, the function creates it, then uses its id to create the new record in the QuestionsTags table. The difficulty with this approach is the QuestionsTags table depends on data in the tags table which may or may not exist. The function assumes the following tables: tags(id, tagName), posts(tags) // Comma delimited list questionsTags(postId, tagId) The idea is to loop over a delimited list of tags submitted with a post and check to see if each tag already exists in the tags table If tag exists: Check to see if there's already a QuestionTag record for this post and this tag in the QuestionTags table. If yes, do nothing (the association already exists) If no, create a new QuestionTag record using the id of the existing tag and the postId If tag does not already exist: Create the new tag in the tags table Use its id to create a new QuestionsTags record Code /** * @hint Sets tags for a given question. **/ private function setTags() { // Loop over the comma and space delmited list of tags for (local.i = 1; local.i LTE ListLen(this.tags, ", "); local.i = (local.i + 1)) { // Check if the tag already exists in the database local.tag = model("tag").findOneByTagName(local.i); // If the tag exists, look for an existing association between the tag and the question in the QuestionTag table if (IsObject(local.tag)) { local.questionTag = model("questionTag").findOneByPostIdAndTagId(values="#this.postId#,#local.tag.id#"); // If no assciatione exists, create a new QuestionTag record using the tagId and the postId if (! IsObject(local.questionTag)) { local.newQuestionTag = model("questionTag").new(postId = this.id, tagId = local.tag.id); // Abort if the saving the new QuestionTag is unsuccesful if (! local.newQuestionTag.save()) { return false; } } } // If the tag does not exist create it else { local.newTag = model("tag").new(tagName = local.i, userId = this.ownerUserId); // Abort if the the new tag is not saved successfully if (! local.newTag.save()) { return false; } // Otherwise create a new association in the QuestionTags table using the id of the newly created tag and the postId local.newQuestionTag = model("questionTag").new(postId = this.id, tagId = local.newTag.id); // Abort if the new QuestionTag does not save correctly if (! local.newQuestionTag.save()) { return false; } } } } FYI: I'm using CFWheels in my application, which explains the ORM functions used.

    Read the article

  • Conditional on WebClient

    - by CarryFlag
    Given: thin client (JS) model services client use services. services use model. Model consists of (for sample): Rect Circle ... Ellipse services: class CanvasProviger { public Canvas getCanvas() { return new Canvas(); } } model: class Canvas ... { private List < Figure > figures = new List < Figure >; ... } class Circle extends Figure { private int x, y, r; } class Rect extends Figure { private x, y, w, h; } client: ... var figure = MyJSRPCImpl.getCanvas().nextFigure(); if(figure == JSLocalModel.Rect) { drawRect(figure); } else if(figure == JSLocalModel.Circle) { drawCircle(figure); } ... How else can do way conditional? In rich client I used pattern Visitor. // my bad english, I know =(

    Read the article

  • Getting an argument list for a class method

    - by Chris T
    What I'd like is for this class class Car { public function __construct(Engine $engine, Make $make, Model $model) { // stuff } } Get an array that has the types needed to construct this car (Engine, Make, Model) in the order they are needed for the constructor. I'm using this for a Dependency Injection-esque thing I'm making.

    Read the article

  • Getting the last member of a group on an intermediary M2M

    - by rh0dium
    If we look at the existing docs, what is the best way to get the last member added? This is similar to this but what I want to do is to be able to do this. group = Group.objects.get(id=1) group.get_last_member_added() #This is by ('-date_added') <Person: FOO> I think the best way is through a manager but how do you do this on an intermediary model? class Person(models.Model): name = models.CharField(max_length=128) def __unicode__(self): return self.name class Group(models.Model): name = models.CharField(max_length=128) members = models.ManyToManyField(Person, through='Membership') def __unicode__(self): return self.name class Membership(models.Model): person = models.ForeignKey(Person) group = models.ForeignKey(Group) date_joined = models.DateField() invite_reason = models.CharField(max_length=64)

    Read the article

< Previous Page | 131 132 133 134 135 136 137 138 139 140 141 142  | Next Page >