Search Results

Search found 17734 results on 710 pages for 'values'.

Page 40/710 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • Type for use in template object to compare double values

    - by DaClown
    I got this n-dimensional point object: template <class T, unsigned int dimension> class Obj { protected: T coords[dimension]; static const unsigned int size = dimension; public: Obj() { }; Obj(T def) { for (unsigned int i = 0; i < size; ++i) coords[i]=def; }; Obj(const Obj& o) { for (unsigned int i = 0; i < size; ++i) coords[i] = o.coords[i]; } const Obj& operator= (const Obj& rhs) { if (this != &rhs) for (unsigned int i = 0; i < size; ++i) coords[i] = rhs.coords[i]; return *this; } virtual ~Obj() { }; T get (unsigned int id) { if (id >= size) throw std::out_of_range("out of range"); return coords[id]; } void set (unsigned int id, T t) { if (id >= size) throw std::out_of_range("out of range"); coords[id] = t; } }; and a 3D point class which uses Obj as base class: template <class U> class Point3DBase : public Obj<U,3> { typedef U type; public: U &x, &y, &z; public: Point3DBase() : x(Obj<U,3>::coords[0]), y(Obj<U,3>::coords[1]), z(Obj<U,3>::coords[2]) { }; Point3DBase(U def) : Obj<U,3>(def), x(Obj<U,3>::coords[0]), y(Obj<U,3>::coords[1]), z(Obj<U,3>::coords[2]) { }; Point3DBase(U x_, U y_, U z_) : x(Obj<U,3>::coords[0]), y(Obj<U,3>::coords[1]), z(Obj<U,3>::coords[2]) { x = x_; y = y_; z= z_; }; Point3DBase(const Point3DBase& other) : x(Obj<U,3>::coords[0]), y(Obj<U,3>::coords[1]), z(Obj<U,3>::coords[2]) { x = other.x; y = other.y; z = other.z; } // several operators ... }; The operators, basically the ones for comparison, use the simple compare-the-member-object approach like: virtual friend bool operator== (const Point3DBase<U> &lhs, const Point3DBase<U> rhs) { return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z); } Then it occured to me that for the comparion of double values the simply equality approach is not very useful since double values should be compared with an error margin. What would be the best approach to introduce an error margin into the point? I thought about an epsDouble type as template parameter but I can't figure out how to achieve this.

    Read the article

  • ComboBox values disappears after selected when objects used for display

    - by Gakk
    I have a combobox where I want to display objects and have enum values returned. When first opened the combobox displays the items as supposed, but after a value is chosen it seems to disappear from the list. But if the combobox is active I can use the keyboard to navigate up and down between the other values, so they are in the list but only invisible. I have created a little test application to show my problem. When started the application shows the combobox with all the choices (the two first are type of Object, the third is a String): After the blue line is selected and when the combobox is opened again this line is missing: When the line with the text "Green" is selected that line is still showing: If I had chosen the red line the only thing that would still be in the list is the test "Green". I am using .NET Framework 3.5. Any hints or tips to why the elements disappears? Here are all the code needed after starting a blank project in Visual Studio. MainWindow.xaml.cs: using System; using System.Collections.Generic; using System.Diagnostics; namespace Test { public partial class MainWindow { public MainWindow() { InitializeComponent(); } private ColorComboBoxValue _activeColor; public ColorComboBoxValue ActiveColor { get { return _activeColor; } set { _activeColor = value; Debug.WriteLine("ActiveColor: " + _activeColor.Color); } } } public class ColorList : List<ColorComboBoxValue> { } public class ColorComboBoxValue { public Color Color { get; set; } public Object Object { get; set; } } public enum Color { Red, Blue, Green } } MainWindow.xaml: <Window x:Class="Test.MainWindow" x:Name="window" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib" xmlns:local="clr-namespace:Test" Title="ComboBoxTest" Height="100" Width="200"> <Window.Resources> <local:ColorList x:Key="ColorList"> <local:ColorComboBoxValue Color="Red"> <local:ColorComboBoxValue.Object> <Path Data="M0,0 L0,30 60,30 60,0 Z" Fill="Red"/> </local:ColorComboBoxValue.Object> </local:ColorComboBoxValue> <local:ColorComboBoxValue Color="Blue"> <local:ColorComboBoxValue.Object> <Path Data="M0,0 L0,30 60,30 60,0 Z" Fill="Blue"/> </local:ColorComboBoxValue.Object> </local:ColorComboBoxValue> <local:ColorComboBoxValue Color="Green"> <local:ColorComboBoxValue.Object> <System:String>Green</System:String> </local:ColorComboBoxValue.Object> </local:ColorComboBoxValue> </local:ColorList> </Window.Resources> <ComboBox ItemsSource="{Binding Source={StaticResource ColorList}}" SelectedItem="{Binding ActiveColor, ElementName=window}"> <ComboBox.ItemTemplate> <DataTemplate> <ContentPresenter Content="{Binding Path=Object}"/> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> </Window>

    Read the article

  • java arraylist : same values to a new arraylist

    - by j0hns3n
    public static void rechnung(List<String> array) { for (int i = 0; i < array.size(); i++) { for (int j = 0; j < array.size(); j++) { if (i != j) { System.out.println(array.get(i) + " gleich " + array.get(j) + " " + (array.get(i).substring(0, 9).equals(array.get(j) .substring(0, 9)))); } } } } My Intension is to put the same values with the same date from a List in a new List. At the end I've for example three new Lists. List content: 03.07.2007 00001.tif 03.07.2007 00002.tif 18.02.2008 00003.tif 18.02.2008 00004.tif 18.02.2008 00005.tif 11.03.2009 00004.tif 11.03.2009 00005.tif

    Read the article

  • MS Access 2003 - ordering the string values for a chart not alphabetical

    - by Justin
    Here is a silly question. Lets say I have a query that produces for a list box, and it produces values for three stores Store A 18 Store B 32 Store C 54 Now if I ORDER BY in the sql statement the only thing it will do is descending or ascending alphabetically but I want a certain order (only because THEY WANT A CERTAIN ORDER) .....so is there a way for me to add something to the SQL to get Store B Store C Store A i.e. basically row by row what i want. thanks!

    Read the article

  • Django Forms, Foreign Key and Initial retuen all associated values

    - by gramware
    I a working with Django forms. The issue I have is that Foreign Key fields and those using initial take all associated entries (all records associated with that record other then the one entry i wanted e.g instead of getting a primary key, i get the primary key, post subject, post body and all other values attributed with that record). The form and the other associated queries still work well, but this behaviour is clogging my database. How do i get the specific field i want instead of all records. An example of my models is here: A form field for childParentId returns postID, postSubject and postBody instead of postID alone. Also form = ForumCommentForm(initial = {'postSubject':forum.objects.get(postID = postID), }) returns all records related to postID. class forum(models.Model): postID = models.AutoField(primary_key=True) postSubject = models.CharField(max_length=25) postBody = models.TextField() postPoster = models.ForeignKey(UserProfile) postDate = models.DateTimeField(auto_now_add=True) child = models.BooleanField() childParentId = models.ForeignKey('self',blank=True, null=True) deleted = models.BooleanField() def __unicode__(self): return u'%s %s %s %s %s' % (self.postSubject, self.postBody, self.postPoster, self.postDate, self.postID

    Read the article

  • Add 2 values to 1 key in a PHP array

    - by Mike Munroe
    I have a result set of data that I want to write to an array in php. Here is my sample data: **Name** **Abbrev** Mike M Tom T Jim J Using that data, I want to create an array in php that is of the following: 1|Mike|M 2|Tom|T 3|Jim|j I tried array_push($values, 'name', 'abbreviation') [pseudo code], which gave me the following: 1|Mike 2|M 3|Tom 4|T 5|Jim 6|J I need to do a look up against this array to get the same key value, if I look up "Mike" or "M". What is the best way to write my result set into an array as set above where name and abbreviation share the same key?

    Read the article

  • Drupal Views Duplicate values being returned when using a relationship

    - by Linda
    I am having a problem with views. I have a view and am passing it a taxonomy term by name to it. I then have a relationship to a related node. For my output fields I am returning the related Title and related Body. I however have duplicates in my results. I have turned distinct to yes but believe this is working on the nodes being return and not the related node. Any ideas how I can remove the duplicates? Update Below is the query being run when I only get the title SELECT DISTINCT(node.nid) AS nid, node_node_data_field_wine_company.title AS node_node_data_field_wine_company_title, node_node_data_field_wine_company.nid AS node_node_data_field_wine_company_nid FROM node node LEFT JOIN content_type_wine node_data_field_wine_company ON node.vid = node_data_field_wine_company.vid INNER JOIN node node_node_data_field_wine_company ON node_data_field_wine_company.field_wine_company_nid = node_node_data_field_wine_company.nid LEFT JOIN term_node term_node ON node.vid = term_node.vid INNER JOIN term_data term_data ON term_node.tid = term_data.tid WHERE term_data.name = 'test' GROUP BY nid It looks like I should be grouping by node_node_data_field_wine_company_nid or selecting distinct values from there. Any ideas?

    Read the article

  • Django Forms, Foreign Key and Initial return all associated values

    - by gramware
    I a working with Django forms. The issue I have is that Foreign Key fields and those using initial take all associated entries (all records associated with that record other then the one entry i wanted e.g instead of getting a primary key, i get the primary key, post subject, post body and all other values attributed with that record). The form and the other associated queries still work well, but this behaviour is clogging my database. How do i get the specific field i want instead of all records. An example of my models is here: A form field for childParentId returns postID, postSubject and postBody instead of postID alone. Also form = ForumCommentForm(initial = {'postSubject':forum.objects.get(postID = postID), }) returns all records related to postID. class forum(models.Model): postID = models.AutoField(primary_key=True) postSubject = models.CharField(max_length=25) postBody = models.TextField() postPoster = models.ForeignKey(UserProfile) postDate = models.DateTimeField(auto_now_add=True) child = models.BooleanField() childParentId = models.ForeignKey('self',blank=True, null=True) deleted = models.BooleanField() def __unicode__(self): return u'%s %s %s %s %s' % (self.postSubject, self.postBody, self.postPoster, self.postDate, self.postID

    Read the article

  • DevExpress ASP.NET MVC Combobox not showing the values

    - by Taskos George
    In my PartialView I add a grid with a column that I need to be a combobox in this way. settings.Columns.Add(column => { column.FieldName = "TheFieldName"; column.Caption = ""ACaption; column.ColumnType = MVCxGridViewColumnType.ComboBox; var comboBoxProperties = column.PropertiesEdit as ComboBoxProperties; comboBoxProperties.DataSource = ViewData["MyListOfObjects"]; comboBoxProperties.TextField = "Description"; comboBoxProperties.ValueField = "Description"; comboBoxProperties.ValueType = typeof(String); }); The ViewData is populated in the Index method of the Controller and I have checked that it is populated with objects that contain values. The Combobox in the PopupEditForm not showing anything. Any idea what could be wrong? Regards.

    Read the article

  • TCL array values updation based on command line argument

    - by Raj
    Hi, I am trying to substitute variable value inside array so as to update array values based on command line inputs. e.g. I am receiving IP address as command line argument for my TCL script and trying to update commands with recvd IP value. My array is: array set myArr { 1 myCmd1("192.268.2.1","abc.txt") 2 myCmd2("192.268.2.1","xyz.txt") 3 myCmd3("192.268.2.1","klm.txt") } Here, "192.268.2.1" will actually be supplied as command line argument. I tried doing array set myArr { 1 myCmd1($myIP,"abc.txt") 2 myCmd2($myIP,"xyz.txt") 3 myCmd3($myIP,"klm.txt") } and other combinations like ${myIP}, {[set $myIP]} but none is working. Thanks in advance for any help/inputs.

    Read the article

  • pdb show different variable values than print statements

    - by martin
    Hi, everyone. I am debugging a python module with homemade c extensions. The output seems correct when I print it with 'p' in pdb. But if I use a normal print statement or pickle it, the output is wrong. What could be causing pdb to show different values than normal execution? I can even step to the print statement in debug mode, and pdb will show the correct value but the program will print the wrong one. The problem seems to happen only when I have called a certain c extension earlier. Glad to post code if that helps. Thank you.

    Read the article

  • Django: Summing values of records grouped by foreign key

    - by Dan0
    Hi there In django, given the following models (slightly simplified), I'm struggling to work out how I would get a view including sums of groups class Client(models.Model): api_key = models.CharField(unique=True, max_length=250, primary_key=True) name = models.CharField(unique=True, max_length=250) class Purchase(models.Model): purchase_date = models.DateTimeField() client = models.ForeignKey(SavedClient, to_field='api_key') amount_to_invoice = models.FloatField(null=True) For a given month, I'd like to see e.g. April 2010 For Each Client that purchased this month: * CLient: Name * Total amount of Purchases for this month * Total cost of purchases for this month For each Purchase made by client: * Date * Amount * Etc I've been looking into django annotation, but can't get my head around how to sum values of a field for a particular group over a particular month and send the information to a template as a variable/tag. Any info would be appreciated

    Read the article

  • Enumerations and String values in ASP.NET

    - by Jason
    I'm looking for some best practice advice on enumerations and retrieving an associated string value. Given this: public enum SerialKillers { TedBundy, EdGein, AlbertFish, GeorgeBush } What is the best way to get a related string value of the name? Eg. "Ted Bundy", given that the string value may not match the representation in the enumeration. eg "George W Bush" My current thinking is function accepting an enum and returning a string, but would that not mean hard coding the string values (which I prefer not to do)? Is using a resources file where the string can be retrieved via the enumeration too heavy handed? Should I accept the fact I am going to Hell for victimising Ted Bundy by associating him with George Bush?

    Read the article

  • NULL values in object properties in Entity Framework

    - by Tony
    Tables: Article, Author, Comment (1 article and 1 author can have * comments) In the database is 1 article, 1 author and 1 comment. The problem is, that code myBD my_bd = new myBD(); var articles = by_bd.Article; works OK, I can see that an Author and an Article has 1 comment. But that code var comm = (from u in my_bd.Comment where ...... select u); returns the comment but it has NULL values in property Article and Author. Why ?

    Read the article

  • jQuery datepicker onSelect set multiple row values

    - by d3020
    On the select event of the datepicker I need to add and set values in multiple rows. In other words, I have something like this... Days Value Row 1 1 Row 2 2 Row 3 3 I have the "Days" and "Value" columns as textboxes. When I select a date from the datepicker I need to add the "Days" value for each row to the date selected. That value is what goes into the "Value" column. Example, I select 4/20/2010. The value in each respective row would then be 4/21/2010, 4/22/2010, 4/23/2010. Hopefully this makes sense and thank you for the help in advance.

    Read the article

  • Creating an Excel 2007 bubble chart with date values in axis

    - by Shadowfoot
    I'm trying to create a graph showing the duration of issue resolution. I believe a bubble chart in excel will show what I want but I can't manage to get it working correctly. For each date I have a number of days (duration) and a number of issues (magnitude). Most dates have a duration of 1 with a large magnitude, and I want to avoid the outliers dominating the chart. e.g. 1-Feb, 1, 15 1-Feb, 2, 10 1-Feb, 9, 1 2-Feb, 1, 11 2-Feb, 2, 14 2-Feb, 6, 2 2-Feb, 18, 1 etc. I want the data in this example to give me 2 columns of bubbles. When I try to get excel to create the chart I can't get the date to appear at on the x axis; I get a count (representing the row of the data) instead, and as each row is a separate column, the values don't line up for the date. Can this be done in Excel 2007 without using VBA?

    Read the article

  • How to use NSPredicate for Key-Path values

    - by randombits
    Using an NSPredicate for an array is rather straight forward using filteredArrayUsingPredicate:. How is this done for key-path values? Meaning, I have an array of objects (in this case, the objects are of the same type). The objects each have an instance variable called name. As per the documentation, it says to do the following: NSPredicate *predicate = [NSPredicate predicateWithFormat: @"ANY employees.firstName like 'Matthew'"]; Is that -also- used in filteredArrayUsingPredicate? What if I have an array of People objects? does that mean I would use: NSArray *allPeopleObjects; // pre-populated NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY people.name like 'Foo'"]; NSArray *matching = [allPeopleObjects filteredArrayUsingPredicate:predicate]; Documentation is a bit lacking in that department.

    Read the article

  • Getting values from Multiple Text Entry using Pygtk and Python

    - by Webrsk
    On a click of a button named "Add Textbox" it calls a function which creates a single textbox using (gtk.Entry) function. So each time i click that button it creates a textbox. I have a submit button which should fetches all the values of the text boxes(say 10 textboxes) generated with the name of "entry". It works for one textbox but not for multiple. In php we can create dynamix textboxes mentioning as an array name=entry[]. Do we have similar functionality in python ? Enviroment : FC10 , Glade 3 , Python 2.5 , GTK.

    Read the article

  • null values from listbox, are not evaluated in the model binding of ASP.NET-MVC

    - by Jorge
    The model validation doesn't evaluates the attributes linked to listbox values if you don't select at least one of them. This way is not possible to do a model evaluation using DataAnnotations in order to inform required values. The controller: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using TestValidation.Models; namespace TestValidation.Controllers { [HandleError] public class HomeController : Controller { private SelectList list = new SelectList(new List<string>() { "Sao Paulo", "Toronto", "New York", "Vancouver" }); public ActionResult Index() { ViewData["ModelState"] = "NOT EVAL"; ViewData["ItemsList"] = list; return View(); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Index(MyEntity entity) { if (ModelState.IsValid) { ViewData["ModelState"] = "VALID"; } else { ViewData["ModelState"] = "NOT VALID!!!"; } ViewData["ItemsList"] = list; return View(); } public ActionResult About() { return View(); } } } The View: <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TestValidation.Models.MyEntity>" %> <asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server"> Home Page </asp:Content> <asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server"> <h2> Validation Test</h2> <p> <% using (Html.BeginForm()) {%> <fieldset> <p> ModelState: <%= Html.Encode((string)ViewData["ModelState"])%> </p> <p> <label for="Name"> Name:</label> <%= Html.TextBoxFor(m => m.Name)%> <%= Html.ValidationMessageFor(m => m.Name)%> </p> <p> <label for="ItemFromList"> Items (list):</label> <%= Html.ListBoxFor(m => m.ItemFromList, ViewData["ItemsList"] as SelectList)%> <%= Html.ValidationMessageFor(m => m.ItemFromList)%> </p> <p> <label for="ItemFromCombo"> Items (combo):</label> <%= Html.DropDownListFor(m => m.ItemFromCombo, ViewData["ItemsList"] as SelectList)%> <%= Html.ValidationMessageFor(m => m.ItemFromCombo)%> </p> <p> <input type="submit" value="Submit" /> </p> </fieldset> <% } %> </asp:Content> The Model: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ComponentModel.DataAnnotations; namespace TestValidation.Models { public class MyEntity_Validate : ValidationAttribute { public MyEntity_Validate() { this.ErrorMessage = "Validated!. Is <> Toronto"; } public override bool IsValid(object value) { return ((string)value == "Toronto"); } } public class MyEntity { [Required] public string Name { get; set; } [MyEntity_Validate] public string ItemFromList { get; set; } [MyEntity_Validate] public string ItemFromCombo { get; set; } } } Any help would be very much appreciated. Thank you.

    Read the article

  • Powershell: Setting values of a filtered array

    - by Alan T
    Hi All I want to read in a csv file, filter it based on the values of two of the fields and set the value of another field. Here's a simple example of what I'm trying to achieve: c:\somefile.csv contents: firstField,secondField,thirdField 1,2,"somevalue" 2,2,"avalue" 3,1,"somevalue" #Import file into array $csv = Import-Csv c:\somefile.csv # Where secondField = 2 and thirdField = "someValue" set thirdField = "anotherValue" $csv | where {$_secondField -eq 2 -and $_.thirdField = "somevalue"} | <set value of thirdField = "anotherValue"> How can I do this. As you can see, from the example about, I can read in and filter the array. But I don't know how to then set the value of the thirdField. I tried set-itemproperty but got the error: "The WriteObject and WriteError methods cannot be called after the pipeline has been closed". Any advice on how to achive this would be appreciated. Alan T

    Read the article

  • How t have the RDLC pie chart show ranges instead of individual values

    - by Emad
    I have some data coming from a custom dataset that look like the following example Person Age P1 20 P2 21 P3 30 P4 31 P5 40 And I want to develop a pie showing the age distribution against the age. The point is that I want this Age to be shown in ranges. (20-29, 30-39, etc for example So we have: Slice with total number =2 (P1 + P2) as age is 20-29 (one at 20 and another at 21) Slice with total number =3 (P3 + P4) as age is 30-39 (one at 30 and another at 31) Slice with total number =1 (P5) as age is 40 (one at 40). How can i customize the pie chart to aggregate values by ranges that I can define?

    Read the article

  • Adding values to a C# array

    - by Ross
    Probably a really simple one this - I'm starting out with C# and need to add values to an array, for example: int[] terms; for(int runs = 0; runs < 400; runs++) { terms[] = value; } For those who have used PHP, here's what I'm trying to do in C#: $arr = array(); for ($i = 0; $i < 10; $i++) { $arr[] = $i; } Thanks, Ross

    Read the article

  • all rows plus min / max values using a single stored procedure

    - by Rajeev
    I have a custom data source which pulls out data form a flat file. The flat file contains a timestamp , source and data. I can use sp_execute to execute a select query against the flat file. I'm currently using 2 stored procedures . - one which runs a select * from flat_file into a temp table - the other which does a select min/max from flat_file grouping by source into another temp file Im using the data retrieved using the stored procedures in a SSRS report Is is possible in a a single stored procedure to retrieve all the rows from the file within a date range and also identify the min/max values for each group retrieved ?e

    Read the article

  • R - find and calculate with unique combinations of values

    - by lecodesportif
    I would like to work with unique combinations of var1 and var2. foo <- data.frame(var1= c(1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4), var2=c(1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 3, 3)) As has been noted (+1 for answers), unique(foo) results in this: var1 var2 1 1 1 2 2 1 3 2 2 4 3 1 5 3 2 6 4 2 7 4 3 Based on the unique combinations, how do I get the number of occurrences of a var1 value and the sum (bla) of each var1 value's var2 values. The output could look like this: var1 n bla 1 1 1 1 2 2 2 3 3 3 2 3 4 4 2 5 edit: The question was too basic and probably duplicate so I extended it.

    Read the article

  • Modifying listbox values with jQuery in WebForm not posting back

    - by Peter
    When hitting a button, an error would occur: System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. --- System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. I then added EnableEventValidation="false" into my @Page directive, which fixed the error. Now after manipulating the listbox, the new values in the listbox are not posted back to the server. How can I solve this?

    Read the article

< Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >