Search Results

Search found 9271 results on 371 pages for 'properties'.

Page 24/371 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • How to sum properties of the objects within an array in Ruby

    - by Ernst Fitschen
    I understand that in order to sum array elements in Ruby one can use the inject method, i.e. array = [1,2,3,4,5]; puts array.inject(0, &:+) But how do I sum the properties of objects within an object array e.g. There's an array of objects and each object has a property "cash" for example. So I want to sum their cash balances into one total. Something like... array.cash.inject(0, &:+) (but this doesn't work) I realise I could probably make a new array composed only of the property cash and sum this, but I'm looking for a cleaner method if possible!

    Read the article

  • Validation of dependent properties in a "live edit" WPF app

    - by Ryan Cromwell
    I'm working on an app which supports live editing. That is you update properties in one area and their impact is seen in another with hitting "apply". Happens to be a charting app. One such edit "group" allows specifying a range. A triple range in fact: High, Target and Low. Our validation is such that High must be greater than target, target must be greater than Low (rocket science). Our dilemma is that the visual experience is a bit jarring when someone wants to go from say 30,20,10 to 15,10,5. I'm curious if anyone has implemented a mechanism for this scenario that might fit well in our situation such that we don't "yell" at the user as they change the range values.

    Read the article

  • AVD Failed to Load ~ Failed to Parse Properties ~ Mac OSX

    - by C.D. OKeefe
    I'm going to say upfront, please forgive me. I'm a newbie to android development and fairly new to programming. Also on a Mac. You're going to have to talk...real...slow. I can't get an AVD to load. I've tried it from Eclipse and from the Android SDK Manager. Failed multiple times. Received the same error each time, "Failed to parse properties from Users/myname/.android/avd/nameIGaveEmulator/config.ini." I've the forum here and saw that others have had similar problems, but of the answers given, no one came back to say if they worked, and I don't see anyone with a similar problem on a Mac. If the path needs to be "changed" what exactly does that mean and how do I go about doing so?

    Read the article

  • Question about C# properties

    - by Impz0r
    Hey there, i bumped the other day into a little problem regarding C#'s properties. Let's say i do have this setup: public class Point { public float X; public float Y; } public class Control { protected Point m_Position = new Point(); public Position { get { return m_Position; } set { m_Position = value; } // reorganize internal structure.. reorganize(); } protected reorganize() { // do some stuff } } This is all fine, but when it comes to usage, i could write something like: Control myControl = new Control(); myControl.Position.X = 1.0f; The thing is, my Control class wont recognize that the Position has been changed because set hasn't been called. So i guess my question is, is there a way to make Control aware of any Position changes? Thanks in advance! Mfg Imp

    Read the article

  • Binding Properties.Settings to Textbox fails

    - by user268098
    I would like to define a key & value in Settings.settings and bind the value by declaration in the XAML (not in the code behind by command). Here's what I've been trying in vain: Create a WPF project "Exp1" with Visual Studio Express 2010. Set one key named "TextFromSettings" to the value "Some Text from Setting". Add the attribute xmlns:p="clr-namespace:Exp1.Properties;assembly=Exp1" to the tag. Add Text="{Binding Path=TextFromSettings, Mode=TwoWay, Source={x:Static p:Settings.Default}}" to the tag Now, the preview window shows the text, however, the compiler fails: "Error 1 Cannot find the type 'Settings'. Note that type names are case sensitive." Where am I going wrong?

    Read the article

  • Detect if PCRE was built without the --enable-unicode-properties or --enable-utf8 configuration switches

    - by Mark Baker
    I've a PHP library that uses a number of regular expressions featuring the \P expressions for multibyte strings, e.g. ((((?:\P{M}\p{M}*)+?)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d+) While this works on most builds, I've had a few reports of the regexp returning an error. Depending on Operating platform, the error messages from PCRE are: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset n or Compilation failed: support for \\P, \\p, and \\X has not been compiled at offset n I know that I can probably test a regexp at the beginning of my code that uses \P, and trap for a returned error, then use that response to set a compatibility flag and provide a degraded (non UTF-8) regexp without the \P within the main body of my code based on that compatibility flag; but I was wondering if there was any simpler way to identify whether PCRE had been built without the --enable-unicode-properties or --enable-utf8 configuration switches. PHP provides access to PCRE_VERSION constant, but that won't help identify whether \P support is enabled or not.

    Read the article

  • Find changed properties of a class

    - by Rohit
    I am using asp.net 3.5 I have a license class containing 10 properties and not marked as serializable. I have to log property changes to the database. License is an entity class,and it is not in my scope to modify it. So I cannot mark it as serializabel neither i can use IpropertyChanged Interface. Now i cannot store it in viewstate as it is not serializable. I wanted to store it so that i can compare it with new values and see which value has changed. How to proceed with this.

    Read the article

  • Is there any short way to load data to the properties of a class, for each column name matching the properties of the class?

    - by Ugur Gümüshan
    I want to load data to an instance of an object using its constructor and I write $this->property=$row["colname"] each time for each property. the mysql_fetch_object function fetches the data as an object but I am not sure if the instance of an object can be assigned to some object from inside. othwerwise I would use __construct($object) { $this=$object; } //doesn't give any syntax error Maybe I should look into iteration of properties and use foreach($object as $key => $value) $value=$object[$key]; or can I assign like $this=$object; within the constructor?

    Read the article

  • Assign values on multi-properties to a object

    - by Lu Lu
    I have a object which it was initialized before in a base class. In inherited class, I use this object and assign values on multi-properties to it. Example: this.Chart.X = 10; this.Chart.Y = 10; this.Chart.Width = 20; this.Chart.Height = 20; this.Chart.Background = Color.Red; However, I must repeat "this.Chart" many times. How to avoid this. Note that I don't want to re-create this object again because in the base class, it was initialized with some common values. Thanks.

    Read the article

  • Separate groups of objects based on their properties

    - by Bevin
    I want to separate an array of my custom object into several arrays, based on the values of their two properties. The struct looks like this: struct MyStruct { public string Person { get; set; } public string Command { get; set; } } Now, if I have an array with a few objects: {Person1, cmd1} {Person1, cmd3} {Person2, cmd3} {Person3, cmd2} {Person2, cmd4} I want to be able to place them into one array for each person, that lists all of the commands for that person: {Person1: cmd1, cmd3} {Person2: cmd3, cmd4} {Person3: cmd2} I hope I've made it clear with my descriptions. I would assume that there is an elegant way to do this with LINQ, but I have no idea where to start.

    Read the article

  • MATLAB: Can axes tick labels be accesed as text objects?

    - by yuk
    I'm curious is it possible to change text properties of tick labels independently of axes properties. Do they have handles? I'd like to control their position better, alignment, color, fonts, etc. I know I can substitute them with text labels, but it has some drawbacks. Any alternative solutions? Particularly, is it possible to put xticklabels between ticks, that are irregular? plot(1:100) set(gca,'xtick',[30 45 53 70 95]) grid on I need to put xticklabels in the middle between grids.

    Read the article

  • Is shortening properties names worth it?

    - by raam86
    in how to node Blog rolling with node.js and mongoDB the author mentions it's a good idea to shorten proprieties names: ....oft-reported issue with mongoDB is the size of the data on the disk... each and every record stores all the field-names .... This means that it can often be more space-efficient to have properties such as 't', or 'b' rather than 'title' or 'body', however for fear of confusion I would avoid this unless truly required! I am aware of solutions of how to do it I am more intrested in when is it truly required?

    Read the article

  • ASP webservice serialization of properties

    - by badra
    I got a class like this which gets returned from an ASP webservice: class Data { public int A { get; set; } public int B { get; set; } public int Sum { get { return A + B; } } } When I try to consume the webservice on the client side using Silverlight I only get the properties A and B but I also need Sum. I know I can't return any logic from a webservice, so the expected behavior was it will return the the Sum as a fixed/precalculated property in the client which is what I need. Any ideas except for redesigning my class? Thanks ...

    Read the article

  • properties declared beside the constructor c++

    - by numerical25
    I am very very new to C/C++ and not sure what the method is called. But thats why I am here trying to find the answer. let me show you an example MyClass::MyClass():valueOne(1), valueTwo(2) { //code } Where valueOne and valueTwo class properties that are assigned values outside of the body, what method is this called and why is it done this way. Why not do it this way MyClass::MyClass() { valueOne = 1; valueTwo = 2 //code } if anyone can help me out that will be great. thanks

    Read the article

  • C# - Making fields/properties read only conditionally

    - by Alistair77
    I have three classes; Classes A and B both reference class C. How can I make it so members of class C can be modified when referenced from class A but not modified when referenced from class B? IE, the following should be possible; classA myClassA = new classA(); myClassA.myClassC.IssueNumber = 3; But this should not be possible; classB myClassB = new classB(); myClassB.myClassC.IssueNumber = 3; Making classB.classC read-only still allows properties of classC to be altered. I'm sure this is basic stuff but can't find a simple answer. Thanks, A

    Read the article

  • C#, get all collection properties from an object

    - by Eatdoku
    Hi, I have a class with 3 List collections like the following. I am trying to have a logic which will iterate through the object's "collection" properties and do some operation using the data stored in those collections. I am just wondering if there is an easy way of doing it using foreach. thanks public class SampleChartData { public List<Point> Series1 { get; set; } public List<Point> Series2 { get; set; } public List<Point> Series3 { get; set; } public SampleChartData() { Series1 = new List<Point>(); Series2 = new List<Point>(); Series3 = new List<Point>(); } }

    Read the article

  • Cannot call struct properties from HAML file

    - by Lander
    I have the following code in my controller: @nav_items = ActiveSupport::OrderedHash.new @nav_items[:home] = Struct::NavItem.new("Home", nil, "/", "icon-home") @nav_items[:about] = Struct::NavItem.new("About", nil, "/about", "icon-heart") @nav_items[:contact] = Struct::NavItem.new("Contact", nil, "/contact", "icon-envelope") if (current_user != nil && current_user.admin?) @nav_items[:admin_divider] = Struct::NavItem.new(nil, "divider-vertical", nil, nil) @nav_items[:admin] = Struct::NavItem.new("Admin", nil, "/admin", "") end And the following in my view: - @nav_items.each do |nav_item| %li{ :class => nav_item[:class] } %a{ :href => nav_item[:link] }= nav_item[:text] And my struct definition: Struct.new("NavItem", :text, :class, :link, :icon_class) I'm relatively new to Ruby, Rails, and HAML, but in another project using ERB rendering, code like that worked fine. I've tried referencing properties by doing something like nav_item.link as well, but that still does not work. The error I get with my current code is: Symbol as array index By using code like nav_item.link: undefined method `link' for #< Array:0x126970ff0 As this is my first time using HAML, I'm not too sure what I'm doing wrong.

    Read the article

  • Declared Properties and assigning values with self

    - by Shaun Budhram
    I understand how declared properties work - I just need a clarification on when Objective C is using the accessor method vs. when it is not. Say I have a property declared using retain: @property (nonatomic, retain) NSDate *date; ... and later... @synthesize date If I say: date = x Is that calling the accessor method? Or is it just setting the variable? self.date = x This seems to call the accessor method (I think but I'm not sure, since it seems like the retain count is increasing). Can anyone clarify this issue? I'm curious because i have some variables that seem to become invalid before I need them (and I have to specifically call retain), and I suspect this is why.

    Read the article

  • wcf net.tcp service fails to start when extra properties are set

    - by Pharabus
    i have a current project that runs fine with a self hosted net.tcp binding if I uses the following host.AddServiceEndpoint(typeof(IMonitorService), new NetTcpBinding() {PortSharingEnabled = false }, ""); host.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexTcpBinding(), "mex"); however if I ammend to the below it fails to run with the message that there is already an endpoint on the port, can anyone explain why adding the extra properties causes it to fail? host.AddServiceEndpoint(typeof(IMonitorService), new NetTcpBinding() {PortSharingEnabled = false,ListenBacklog=1000,ReceiveTimeout=new TimeSpan(0,3,0) }, ""); host.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexTcpBinding(), "mex"); Edit: testing confirms that the ReceiveTimeout property works Ok, as soon as I add the MaxConnections or ListenBacklog the service fails start Edit 2: this link seems to imply i ned portsharing is i want to modify these properies, not sure I am understanding it.

    Read the article

  • anonymous type and multiple properties

    - by ognjenb
    I have this error: An anonymous type cannot have multiple properties with the same name. Whether this can be resolved with alias ie, whether an alias exists in LINQ var device_query = from d in DevicesEntities.device join dt in DevicesEntities.devicetype on d.DeviceTypeId equals dt.Id join l in DevicesEntities.location on d.Id equals l.DeviceId join loc in DevicesEntities.locationname on l.LocationNameId equals loc.Id where l.DeviceId == d.Id select new { d.Id, d.DeviceTypeId, d.SerialNumber, d.FirmwareRev, d.ProductionDate, d.ReparationDate, d.DateOfLastCalibration, d.DateOfLastCalibrationCheck, d.CalCertificateFile, d.Notes, d.TestReportFile, d.WarrantyFile, d.CertificateOfOriginFile, d.QCPermissionFile, d.Reserved, d.ReservedFor, d.Weight, d.Price, d.SoftwareVersion, dt.Name, dt.ArticleNumber, dt.Type, l.StartDate, //AS LastStartDate, l.LocationNameId, loc.Name //in this line I have problem };

    Read the article

  • Many-to-Many Relationship (with properties) in Google App Engine for Java

    - by rvandervort
    I understand from the official documentation on unowned relationships that the app must use sets of Key objects on either side of the relationship. This makes perfect sense. Coming from many years of RDBM-style programming, though, I'm pretty confused about how I can model properties of that relationship itself. For example, if I have entities Category and Entry in my many-to-many relationship and would like to persist a dateAdded property, or some other data that are only relevant when both sides of the relationship are known. I suppose it would be possible to create a third class : CategoryEntry that links the two, but this seems like a kludge. What is the proposed way to model this kind of situation ?

    Read the article

  • How to iterate over numerically named object properties

    - by Scott Schluer
    So I have a horribly designed class that I can't change that has properties like this: object.Color1 object.Color2 object.Color3 etc... How can I iterate through those with a for loop. In other words, something like this: for (int i = 0; i <= 40; i++) { string PropertyName = "Color" + i; if (object.PropertyName != "") { // do something } } Obviously this code wouldn't work but it gives you an idea of what I'm after. I have to do some processing on each property and I don't want to repeat my code 40 times. :) A loop would be perfect, I'm just not sure how to create the name of the property on the fly.

    Read the article

  • Entity Framework 5 not updating navigation properties in both entities

    - by Taylor
    I have updated a project to use the new Entity framework shipped with VS2012, however I have run into some of my code throwing exceptions. In the VS10 version of EF I was able to create or modify and Entity and use its navigation properties before calling SaveChanges() For example: A Navigation property of a client having a collection of Invoices. Client c = new Client(); Invoice I = new Invoice(); c.Invoices.Add(I); I would then be able to use Invoice.Client somewhere in my code before actually saving it without issue. Now Invoice.Client == null. Similarly in setting I.Client = C, I does not show up under C.Invoices What am I missing here or is this just simply how EF5 is?

    Read the article

  • What's the difference between Defaults and Properties when changing cmd.exe or PowerShell's settings?

    - by mmm bacon
    I want to change the font used by both cmd.exe and PowerShell. When I right click in the window border, I see both Defaults and Properties: What's the difference? One would think Defaults was for all sessions, and Properties was for the current session. However, changes to Properties are persisted even after relaunching cmd.exe. Another problem is that changing the font in either Defaults or Properties doesn't actually change the font. This is on Windows 8.

    Read the article

  • Why can't I access hw:1,0 until gstreamer-properties is run once?

    - by Shadd
    Not necessarily an Ubuntu-specific question but I wasn't sure where else to ask. I have an AverMedia DVD EZMaker 7 which plugs into USB and works well on Ubuntu 12.04. I downloaded and installed the official drivers without error. However, when I try: gst-launch alsasrc device="hw:1,0" ! alsasink device="hw:0,0" it tells me: Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstAudioSrcClock which is the normal output, however there is no audible sound. Trying the command again doesn't help. If I run gstreamer-properties and close it right away (don't need to touch any controls), THEN the gst-launch command works. If I unplug the device and plug it back in or restart the computer, I have to run gstreamer-properties again. What is gstreamer-properties doing that enables the audio?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >