Search Results

Search found 10804 results on 433 pages for 'attribute keys'.

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

  • Unique keys for Sphinx along three vectors instead of two

    - by Brendon Muir
    I'm trying to implement thinking-sphinx across multiple 'sites' hosted under a single rails application. I'm working with the developer of thinking-sphinx to sort through the finer details and am making good progress, but I need help with a maths problem: Usually the formula for making a unique ID in a thinking-sphinx search index is to take the id, multiply it by the total number of models that are searchable, and add the number of the currently indexed model: id * total_models + current_model This works well, but now I also through an entity_id into the mix, so there are three vextors for making this ID unique. Could someone help me figure out the equation to gaurantee that the id's will never collide using these three variables: id, total_models, total_entities The entity ID is an integer. I thought of: id * (total_models + total_entities) + (current_model + current_entity) but that results in collisions. Any help would be greatly appreciated :)

    Read the article

  • Form File Upload with other TextBox Inputs + Creating Custom Form Action attribute

    - by Jonathan Stowell
    Hi All, I am attempting to create a form where a user is able to enter your typical form values textboxes etc, but also upload a file as part of the form submission. This is my View code it can be seen that the File upload is identified by the MCF id: <% using (Html.BeginForm("Create", "Problem", FormMethod.Post, new { id = "ProblemForm", enctype = "multipart/form-data" })) {%> <p> <label for="StudentEmail">Student Email (*)</label> <br /> <%= Html.TextBox("StudentEmail", Model.Problem.StudentEmail, new { size = "30", maxlength=26 })%> <%= Html.ValidationMessage("StudentEmail", "*") %> </p> <p> <label for="Type">Communication Type (*)</label> <br /> <%= Html.DropDownList("Type") %> <%= Html.ValidationMessage("Type", "*") %> </p> <p> <label for="ProblemDateTime">Problem Date (*)</label> <br /> <%= Html.TextBox("ProblemDateTime", String.Format("{0:d}", Model.Problem.ProblemDateTime), new { maxlength = 10 })%> <%= Html.ValidationMessage("ProblemDateTime", "*") %> </p> <p> <label for="ProblemCategory">Problem Category (* OR Problem Outline)</label> <br /> <%= Html.DropDownList("ProblemCategory", null, "Please Select...")%> <%= Html.ValidationMessage("ProblemCategory", "*")%> </p> <p> <label for="ProblemOutline">Problem Outline (* OR Problem Category)</label> <br /> <%= Html.TextArea("ProblemOutline", Model.Problem.ProblemOutline, 6, 75, new { maxlength = 255 })%> <%= Html.ValidationMessage("ProblemOutline", "*") %> </p> <p> <label for="MCF">Mitigating Circumstance Form</label> <br /> <input id="MCF" type="file" /> <%= Html.ValidationMessage("MCF", "*") %> </p> <p> <label for="MCL">Mitigating Circumstance Level</label> <br /> <%= Html.DropDownList("MCL") %> <%= Html.ValidationMessage("MCL", "*") %> </p> <p> <label for="AbsentFrom">Date Absent From</label> <br /> <%= Html.TextBox("AbsentFrom", String.Format("{0:d}", Model.Problem.AbsentFrom), new { maxlength = 10 })%> <%= Html.ValidationMessage("AbsentFrom", "*") %> </p> <p> <label for="AbsentUntil">Date Absent Until</label> <br /> <%= Html.TextBox("AbsentUntil", String.Format("{0:d}", Model.Problem.AbsentUntil), new { maxlength = 10 })%> <%= Html.ValidationMessage("AbsentUntil", "*") %> </p> <p> <label for="AssessmentID">Assessment Extension</label> <br /> <%= Html.DropDownList("AssessmentID") %> <%= Html.ValidationMessage("AssessmentID", "*") %> <%= Html.TextBox("DateUntil", String.Format("{0:d}", Model.AssessmentExtension.DateUntil), new { maxlength = 16 })%> <%= Html.ValidationMessage("DateUntil", "*") %> </p> <p> <label for="Details">Assessment Extension Details</label> <br /> <%= Html.TextArea("Details", Model.AssessmentExtension.Details, 6, 75, new { maxlength = 255 })%> <%= Html.ValidationMessage("Details", "*") %> </p> <p> <label for="RequestedFollowUp">Requested Follow Up</label> <br /> <%= Html.TextBox("RequestedFollowUp", String.Format("{0:d}", Model.Problem.RequestedFollowUp), new { maxlength = 16 })%> <%= Html.ValidationMessage("RequestedFollowUp", "*") %> </p> <p> <label for="StaffEmail">Staff</label> <br /> <%= Html.ListBox("StaffEmail", Model.StaffEmail, new { @class = "multiselect" })%> <%= Html.ValidationMessage("StaffEmail", "*")%> </p> <p> <input class="button" type="submit" value="Create Problem" /> </p> This is my controller code: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(Problem problem, AssessmentExtension assessmentExtension, Staff staffMember, HttpPostedFileBase file, string[] StaffEmail) { if (ModelState.IsValid) { try { Student student = studentRepository.GetStudent(problem.StudentEmail); Staff currentUserStaffMember = staffRepository.GetStaffWindowsLogon(User.Identity.Name); var fileName = Path.Combine(Request.MapPath("~/App_Data"), Path.GetFileName(file.FileName)); file.SaveAs(@"C:\Temp\" + fileName); if (problem.RequestedFollowUp.HasValue) { String meetingName = student.FirstName + " " + student.LastName + " " + "Mitigating Circumstance Meeting"; OutlookAppointment outlookAppointment = new OutlookAppointment(currentUserStaffMember.Email, meetingName, (DateTime)problem.RequestedFollowUp, (DateTime)problem.RequestedFollowUp.Value.AddMinutes(30)); } problemRepository.Add(problem); problemRepository.Save(); if (assessmentExtension.DateUntil != null) { assessmentExtension.ProblemID = problem.ProblemID; assessmentExtensionRepository.Add(assessmentExtension); assessmentExtensionRepository.Save(); } ProblemPrivacy problemPrivacy = new ProblemPrivacy(); problemPrivacy.ProblemID = problem.ProblemID; problemPrivacy.StaffEmail = currentUserStaffMember.Email; problemPrivacyRepository.Add(problemPrivacy); if (StaffEmail != null) { for (int i = 0; i < StaffEmail.Length; i++) { ProblemPrivacy probPrivacy = new ProblemPrivacy(); probPrivacy.ProblemID = problem.ProblemID; probPrivacy.StaffEmail = StaffEmail[i]; problemPrivacyRepository.Add(probPrivacy); } } problemPrivacyRepository.Save(); return RedirectToAction("Details", "Student", new { id = student.Email }); } catch { ModelState.AddRuleViolations(problem.GetRuleViolations()); } } return View(new ProblemFormViewModel(problem, assessmentExtension, staffMember)); } This form was working correctly before I had to switch to using a non-AJAX file upload, this was due to an issue with Flash when enabling Windows Authentication which I need to use. It appears that when I submit the form the file is not sent and I am unsure as to why? I have also been unsuccessful in finding an example online where a file upload is used in conjunction with other input types. Another query I have is that for Create, and Edit operations I have used a PartialView for my forms to make my application have higher code reuse. The form action is normally generated by just using: Html.BeginForm() And this populates the action depending on which Url is being used Edit or Create. However when populating HTML attributes you have to provide a action and controller value to pass HTML attributes. using (Html.BeginForm("Create", "Problem", FormMethod.Post, new { id = "ProblemForm", enctype = "multipart/form-data" })) Is it possible to somehow populate the action and controller value depending on the URL to maintain code reuse? Thinking about it whilst typing this I could set two values in the original controller action request view data and then just populate the value using the viewdata values? Any help on these two issues would be appreciated, I'm new to asp.net mvc :-) Thanks, Jon

    Read the article

  • Getting custom attribute from an Exception thrown during testing

    - by Amit Bhargava
    I'm using JUnit4 to test my code. Now, I'm aware that the following annotation allows me to expect an exception of a certain type @Test(expected = NipException.class) However, I have an 'errorCode' property in my exception class which I would also like to verify. This is because the same exception is thrown at three places in the same method with different error codes. How do I access 'errorCode' of the thrown exception?

    Read the article

  • @attribute elements in XML

    - by danit
    Here is my XML: ["link"]=> array(2) { [0]=> object(SimpleXMLElement)#244 (1) { ["@attributes"]=> array(3) { ["type"]=> string(9) "text/html" ["href"]=> string(48) "http://twitter.com/MoodleDan/statuses/1226112723" ["rel"]=> string(9) "alternate" } } [1]=> object(SimpleXMLElement)#245 (1) { ["@attributes"]=> array(3) { ["type"]=> string(9) "image/png" ["href"]=> string(59) "http://a3.twimg.com/profile_images/226895523/Dan_normal.png" ["rel"]=> string(5) "image" } } } ["author"]=> object(SimpleXMLElement)#246 (2) { ["name"]=> string(14) "Dan Humpherson" ["uri"]=> string(16) "http://vl3.co.uk" } The above XML is part of a larger array, but how do i get the href -> ["href"]=> string(59) "http://a3.twimg.com/profile_images/226895523/Dan_normal.png" Element to echo in PHP? This is what I tried (Wrong I know) foreach ($entry->link as $img) { echo $img->href; echo "<img src='". $img ."' />"; }

    Read the article

  • ValidateInput Attribute Doesn't Seem To Work in ASP.NET MVC

    - by JC Grubbs
    I'm trying to get around the "potentially dangerous Request.Form value" error and I'm having no luck. Yes, yes, I've read all the other StackOverflow related questions and none of them seem to get me closer to an answer. I am using [ValidateInput(false)] on all related controller actions...and I've checked many times. I'm using ValidateRequest='false' in all the related ASPX views. I am using ASP.NET MVC 2 Preview 1, but I don't think that's an issue since the error is being generated lower in the framework; Page.ProcessRequest to be exact. I can't see anything I'm doing wrong, I even set <page validateRequest='false'> in the web.config and that didn't solve it either. HELP!!!!!

    Read the article

  • C# Attribute XmlIgnore and XamlWriter class - XmlIgnore not working

    - by Horst Walter
    I have a class, containing a property Brush MyBrush marked as [XmlIgnore]. Nevertheless it is serialized in the stream causing trouble when trying to read via XamlReader. I did some tests, e.g. when changing the visibility (to internal) of the Property it is gone in the stream. Unfortunately I cannot do this in my particular scenario. Did anybody have the same issue and? Do you see any way to work around this? Remark: C# 4.0 as far I can tell This is a method from my Unit Test where I do test the XamlSerialization: // buffer to a StringBuilder StringBuilder sb = new StringBuilder(); XmlWriter writer = XmlWriter.Create(sb, settings); XamlDesignerSerializationManager manager = new XamlDesignerSerializationManager(writer) {XamlWriterMode = XamlWriterMode.Expression}; XamlWriter.Save(testObject, manager); xml = sb.ToString(); Assert.IsTrue(!String.IsNullOrEmpty(xml) && !String.IsNullOrEmpty(xml), "Xaml Serialization failed for " + testObject.GetType() + " no xml string available"); xml = sb.ToString(); MemoryStream ms = xml.StringToStream(); object root = XamlReader.Load(ms); Assert.IsTrue(root != null, "After reading from MemoryStream no result for Xaml Serialization"); In one of my classes I use the Property Brush. In the above code this Unit Tests fails because of a Brush object not serializable is the value. When I remove the Setter (as below, the Unit Test passes. Using the XmlWriter (basically same test as above) it works. In the StringBuffer sb I can see that Property Brush is serialized when the Setter is there and not when removed (most likely another check ignoring the Property because of no setter). Other Properties with [XmlIgnore] are ignored as intended. [XmlIgnore] public Brush MyBrush { get { ..... } // removed because of problem with Serialization // set { ... } }

    Read the article

  • mozilla browser hot keys? [closed]

    - by Roger22
    Hello, Where can i find the key combinations for some actions, in Mozilla Firefox? For example, Ctrl+L moves the cursor to the address bar. I wanna move the cursor in the Google search box, from the right-top position). Which key is associated with this? And some other key combinations? Thanks!

    Read the article

  • Jquery ID Attribute Contains With Selector and Variable

    - by User970008
    I would like to search for an image ID that contains a value AND a variable. I need the below script to be something like $("[id*='MYVALUE'+x]") but that does not work. for (x=0; x< imageList.length; x++) { var imageSRC = imageList[x]; //need this to be MYVALUE + the X val //search for IDs that contain MYVALUE + X $("[id*='MYVALUE']").attr('src', 'images/'+imageSRC); }; <!-- These images are replaced with images from the array imageList--> <img id="dkj958-MYVALUE0" src="images/imageplaceholder" /> <img id="mypage-MYVALUE1" src="images/imageplaceholder" /> <img id="onanotherpage-MYVALUE2-suffix" src="images/imageplaceholder" />

    Read the article

  • XPath: Nodes that have a child node that have an attribute

    - by Jonathan Allen
    XML Fragment <component name='Stipulations'> <group name='NoStipulations' required='N'> <field name='StipulationType' required='N' /> <field name='StipulationValue' required='N' /> </group> </component> <component name='NestedParties3'> <group name='NoNested3PartyIDs' required='N'> <field name='Nested3PartyID' required='N' /> <field name='Nested3PartyIDSource' required='N' /> <field name='Nested3PartyRole' required='N' /> <group name='NoNested3PartySubIDs' required='N'> <field name='Nested3PartySubID' required='N' /> <field name='Nested3PartySubIDType' required='N' /> </group> </group> </component> <component name='UnderlyingStipulations'> <group name='NoUnderlyingStips' required='N'> <field name='UnderlyingStipType' required='N' /> <field name='UnderlyingStipValue' required='N' /> </group> </component> What I want is all "group" nodes which have a child node of type "field" and a name "StipulationType". This is what I've tried so far: dictionary.XPathSelectElements("group[field[@name='StipulationType']]") dictionary.XPathSelectElements("group[./field[@name='StipulationType']]")

    Read the article

  • Model-binding an object from the repository by several keys

    - by Anton
    Suppose the following route: {region}/{storehouse}/{controller}/{action} These two parameters region and storehouse altogether identify a single entity - a Storehouse. Thus, a bunch of controllers are being called in the context of some storehouse. And I'd like to write actions like this: public ActionResult SomeAction(Storehouse storehouse, ...) Here I can read your thoughts: "Write custom model binder, man". I do. However, the question is How to avoid magic strings within custom model binder? Here is my current code: public class StorehouseModelBinder : IModelBinder { readonly IStorehouseRepository repository; public StorehouseModelBinder(IStorehouseRepository repository) { this.repository = repository; } public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { var region = bindingContext.ValueProvider.GetValue("region").AttemptedValue; var storehouse = bindingContext.ValueProvider.GetValue("storehouse").AttemptedValue; return repository.GetByKey(region, storehouse); } } If there was a single key, bindingContext.ModelName could be used... Probably, there is another way to supply all the actions with a Storehouse object, i.e. declaring it as a property of the controller and populating it in the Controller.Initialize.

    Read the article

  • Composite keys as Foreign Key?

    - by paulio
    I have the following table... TABLE: Accounts ID (int, PK, Identity) AccountType (int, PK) Username (varchar) Password (varchar) I have created a composite key out of ID and AccountType columns so that people can have the same username/password but different AccountTypes. Does this mean that for each foreign table that I try and link to I'll have to create two columns? I’m using SQL Server 2008

    Read the article

  • FluentNHibernate mapping of composite foreign keys

    - by Faron
    I have an existing database schema and wish to replace the custom data access code with Fluent.NHibernate. The database schema cannot be changed since it already exists in a shipping product. And it is preferable if the domain objects did not change or only changed minimally. I am having trouble mapping one unusual schema construct illustrated with the following table structure: CREATE TABLE [Container] ( [ContainerId] [uniqueidentifier] NOT NULL, CONSTRAINT [PK_Container] PRIMARY KEY ( [ContainerId] ASC ) ) CREATE TABLE [Item] ( [ItemId] [uniqueidentifier] NOT NULL, [ContainerId] [uniqueidentifier] NOT NULL, CONSTRAINT [PK_Item] PRIMARY KEY ( [ContainerId] ASC, [ItemId] ASC ) ) CREATE TABLE [Property] ( [ContainerId] [uniqueidentifier] NOT NULL, [PropertyId] [uniqueidentifier] NOT NULL, CONSTRAINT [PK_Property] PRIMARY KEY ( [ContainerId] ASC, [PropertyId] ASC ) ) CREATE TABLE [Item_Property] ( [ContainerId] [uniqueidentifier] NOT NULL, [ItemId] [uniqueidentifier] NOT NULL, [PropertyId] [uniqueidentifier] NOT NULL, CONSTRAINT [PK_Item_Property] PRIMARY KEY ( [ContainerId] ASC, [ItemId] ASC, [PropertyId] ASC ) ) CREATE TABLE [Container_Property] ( [ContainerId] [uniqueidentifier] NOT NULL, [PropertyId] [uniqueidentifier] NOT NULL, CONSTRAINT [PK_Container_Property] PRIMARY KEY ( [ContainerId] ASC, [PropertyId] ASC ) ) The existing domain model has the following class structure: The Property class contains other members representing the property's name and value. The ContainerProperty and ItemProperty classes have no additional members. They exist only to identify the owner of the Property. The Container and Item classes have methods that return collections of ContainerProperty and ItemProperty respectively. Additionally, the Container class has a method that returns a collection of all of the Property objects in the object graph. My best guess is that this was either a convenience method or a legacy method that was never removed. The business logic mainly works with Item (as the aggregate root) and only works with a Container when adding or removing Items. I have tried several techniques for mapping this but none work so I won't include them here unless someone asks for them. How would you map this?

    Read the article

  • Cryptography: best practices for keys in memory?

    - by Johan
    Background: I got some data encrypted with AES (ie symmetric crypto) in a database. A server side application, running on a (assumed) secure and isolated Linux box, uses this data. It reads the encrypted data from the DB, and writes back encrypted data, only dealing with the unencrypted data in memory. So, in order to do this, the app is required to have the key stored in memory. The question is, is there any good best practices for this? Securing the key in memory. A few ideas: Keeping it in unswappable memory (for linux: setting SHM_LOCK with shmctl(2)?) Splitting the key over multiple memory locations. Encrypting the key. With what, and how to keep the...key key.. secure? Loading the key from file each time its required (slow and if the evildoer can read our memory, he can probably read our files too) Some scenarios on why the key might leak: evildoer getting hold of mem dump/core dump; bad bounds checking in code leading to information leakage; The first one seems like a good and pretty simple thing to do, but how about the rest? Other ideas? Any standard specifications/best practices? Thanks for any input!

    Read the article

  • MySQL: Ignore the timestamp attribute

    - by Nique
    I have a timestamp column in my database, and i use it for almost every field, but now, i just want to update the hit counter.. and i do not want to update the timestamp column with it. I use the timestamp field to see the last 'content' update. Not for every hit. Is it possible to let mysql stop updating the timestamp column for just one query?

    Read the article

  • Automatically minifying attribute/element names when using XmlSerializer

    - by frou
    When serializing a C# class using XmlSerializer, the attributes/elements representing the properties of the class will have the same names as they do in the source code. I know you can override this by doing like so: [XmlAttribute("num")] public int NumberOfThingsThatAbcXyz { get; set; } I'd like the generated XML for my classes to be as compact as possible, but obviously still capable of being automatically deserialized on the other side. Is there a way to have these names minified as much as possible without having to manually think of and annotate everything with a short string? The resultant XML being easily human readable isn't a concern.

    Read the article

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