Search Results

Search found 12126 results on 486 pages for 'property hiding'.

Page 51/486 | < Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >

  • PHP and Classes: access to parent's public property within the parent class

    - by takpar
    Hi, here is what my code looks like i have two forms: class Form_1 extends Form_Abstract { public $iId = 1; } class Form_2 extends Form_1 { public $iId = 2; } i expect the code behave like this: $oForm = new Form_2; echo $oForm->getId(); // it returns '2' echo $oForm->getParentId(); // i expect it returns '1' here is my Form_Abstract class: class Form_Abstract { public $iId = 0; public function getId() { return $this->iId; } /** this method will be called from a child instance */ public function getParentId() { return parent::$iId; } } but it throws a Fatal Error: Fatal error: Cannot access parent:: when current class scope has no parent please help me with the method getParentId()

    Read the article

  • xCode "Property access results unused - getters should not be used for side effects"

    - by David DelMonte
    Hi all, I'm getting this warning when I'm calling a local routine. My code is this: -(void)nextLetter { // NSLog(@"%s", __FUNCTION__); currentLetter ++; if(currentLetter > (letters.count - 1)) { currentLetter = 0; } self.fetchLetter; } I'm getting the warning on the self.fetchLetter statement. That routine looks like this: - (void)fetchLetter { // NSLog(@"%s", __FUNCTION__); NSString *wantedLetter = [[letters objectAtIndex: currentLetter] objectForKey: @"langLetter"]; NSString *wantedUpperCase = [[letters objectAtIndex: currentLetter] objectForKey: @"upperCase"]; ..... } I prefer to fix warning messages, is there a better way to write this? Thanks!

    Read the article

  • populating object collection property with Linq

    - by Benjamin Ortuzar
    I have an XML structure that has many doc nodes, and each node may have zero or more extract paragraphs (paras). <doc> <docitem>3</docitem> <docid>129826</docid> <doctitle>sample title</doctitle> <docdatetime>2009-07-03T16:59:00</docdatetime> <collectdatetime>2009-07-03T16:59:23</collectdatetime> <summary> <summarytext>sample summary</summarytext> </summary> <paras> <paraitemcount>2</paraitemcount> <para> <paraitem>1</paraitem> <paratext>sample text 1</paratext> </para> <para> <paraitem>2</paraitem> <paratext>sample text 2</paratext> </para> </paras> </doc> <doc> ... </doc> I also has some Linq code to populate some Document objects: List<Document> documentsList = (from doc in xmlDocument.Descendants("doc") select new Document { DocId = doc.Element("docid").Value, DocTitle = doc.Element("doctitle").Value, DocDateTime = DateTime.Parse(doc.Element("docdate").Value), DocSummary = doc.Element("summary").Value, DocParas = "" ///missing code to populate List<string> } ).ToList<Document>(); Is it possible add all the paras nodes into the Document.DocParas List<string> using Linq and Xpath, or should I do this task in a different way? Note: I'm using .NET C# 3.5

    Read the article

  • Dependency Property on ValueConverter

    - by spoon16
    I'm trying to initialize a converter in the Resources section of my UserControl with a reference to one of the objects in my control. When I try to run the application I get an XAML parse exception. XAML: <UserControl.Resources> <converter:PointConverter x:Key="pointConverter" Map="{Binding ElementName=ThingMap}" /> </UserControl.Resources> <Grid> <m:Map x:Name="ThingMap" /> </Grid> Point Converter Class: public class PointConverter : DependencyObject, IValueConverter { public Microsoft.Maps.MapControl.Map Map { get { return (Microsoft.Maps.MapControl.Map)GetValue(MapProperty); } set { SetValue(MapProperty, value); } } // Using a DependencyProperty as the backing store for Map. This enables animation, styling, binding, etc... public static readonly DependencyProperty MapProperty = DependencyProperty.Register("Map", typeof(Microsoft.Maps.MapControl.Map), typeof(PointConverter), null); public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string param = (string)parameter; Microsoft.Maps.MapControl.Location location = value as Microsoft.Maps.MapControl.Location; if (location != null) { Point point = Map.LocationToViewportPoint(location); if (string.Compare(param.ToUpper(), "X") == 0) return point.X; else if (string.Compare(param.ToUpper(), "Y") == 0) return point.Y; return point; } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } }

    Read the article

  • Using RichTextBox SelectionTabs property in winforms

    - by Bala R
    In a winforms application, I'm using a RichTextBox and I'm trying to reduce the output from a '\t' to 4 spaces from whatever the default is. I have this in the form's OnLoad _richTextBox.Text = "1\t2\t3\t4\t5"; _richTextBox.SelectAll(); _richTextBox.SelectionTabs = new int[] {100,200,300,400 }; I have a breakpoint before and after this snippet. The SelectionTabs is set to {int[0]} (empty int array) before and after the assignment. Can anyone tell me why my assignment is not going through?

    Read the article

  • JSF Spring Bean set property

    - by Sebastian
    Hi, i have a JSF web application. I use Beans as Spring Beans (not JSF managed beans). Now i have an URL to application www.xxx.com?parameter=2 I would like to set this parameter into bean on the page load. I now how to do this with spring web flow but with JSF Navigation i cant do this. What do you think about using JSTL c:set... or jsp:setProperty...? Thanks for your help. Kind regards Sebastian

    Read the article

  • Change table row display property

    - by Idsa
    I have an html page with a table that contains a hidden row: <table> <tr id="hiddenTr" style="display:none"> </tr> </table> I need to make it visible at client side using jquery. I tried this $('#hiddenTr').show(); and this $('#hiddenTr').css('display', 'table-row'); Both implementations don't work for me. Furthemore the second one is not crossbrowser.

    Read the article

  • Object Reference is required for non static field, method, or property

    - by JB
    using System; using System.IO; using System.Data; using System.Text; using System.Drawing; using System.Data.OleDb; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Drawing.Printing; using System.Collections.Generic; namespace Eagle_Eye_Class_Finder { public class GetSchedule { public GetSchedule() { IDnumber[] IDnumbers = new IDnumber[3]; IDnumbers[0] = new IDnumber() { Name = "Joshua Banks", ID = "900456317", year = "Senior", class1 = "TEET 4090", class2 = "TEET 3020", class3 = "TEET 3090", class4 = "TEET 4290" }; IDnumbers[1] = new IDnumber() { Name = "Sean Ward", ID = "900456318", year = "Junior", class1 = "ENGNR 4090", class2 = "ENGNR 3020", class3 = "ENGNR 3090", class4 = "ENGNR 4290" }; IDnumbers[2] = new IDnumber() { Name = "Terrell Johnson", ID = "900456319", year = "Sophomore", class1 = "BUS 4090", class2 = "BUS 3020", class3 = "BUS 3090", class4 = "BUS 4290" }; } public class IDnumber { public string Name { get; set; } public string ID { get; set; } public string year { get; set; } public string class1 { get; set; } public string class2 { get; set; } public string class3 { get; set; } public string class4 { get; set; } public static void ProcessNumber(IDnumber myNum) { StringBuilder myData = new StringBuilder(); myData.AppendLine(IDnumber.Name); myData.AppendLine(": "); myData.AppendLine(IDnumber.ID); myData.AppendLine(IDnumber.year); myData.AppendLine(IDnumber.class1); myData.AppendLine(IDnumber.class2); myData.AppendLine(IDnumber.class3); myData.AppendLine(IDnumber.class4); MessageBox.Show(myData); } public string GetDataFromNumber(string ID) { foreach (IDnumber idCandidateMatch in IDnumbers) { if (IDCandidateMatch.ID == ID) { StringBuilder myData = new StringBuilder(); myData.AppendLine(IDnumber.Name); myData.AppendLine(": "); myData.AppendLine(IDnumber.ID); myData.AppendLine(IDnumber.year); myData.AppendLine(IDnumber.class1); myData.AppendLine(IDnumber.class2); myData.AppendLine(IDnumber.class3); myData.AppendLine(IDnumber.class4); return myData; } } return ""; } } } }using System; using System.IO; using System.Data; using System.Text; using System.Drawing; using System.Data.OleDb; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Drawing.Printing; using System.Collections.Generic; namespace Eagle_Eye_Class_Finder { public class GetSchedule { public GetSchedule() { IDnumber[] IDnumbers = new IDnumber[3]; IDnumbers[0] = new IDnumber() { Name = "Joshua Banks", ID = "900456317", year = "Senior", class1 = "TEET 4090", class2 = "TEET 3020", class3 = "TEET 3090", class4 = "TEET 4290" }; IDnumbers[1] = new IDnumber() { Name = "Sean Ward", ID = "900456318", year = "Junior", class1 = "ENGNR 4090", class2 = "ENGNR 3020", class3 = "ENGNR 3090", class4 = "ENGNR 4290" }; IDnumbers[2] = new IDnumber() { Name = "Terrell Johnson", ID = "900456319", year = "Sophomore", class1 = "BUS 4090", class2 = "BUS 3020", class3 = "BUS 3090", class4 = "BUS 4290" }; } public class IDnumber { public string Name { get; set; } public string ID { get; set; } public string year { get; set; } public string class1 { get; set; } public string class2 { get; set; } public string class3 { get; set; } public string class4 { get; set; } public static void ProcessNumber(IDnumber myNum) { StringBuilder myData = new StringBuilder(); myData.AppendLine(IDnumber.Name); myData.AppendLine(": "); myData.AppendLine(IDnumber.ID); myData.AppendLine(IDnumber.year); myData.AppendLine(IDnumber.class1);// i get it for all of these myData.AppendLine(IDnumber.class2); myData.AppendLine(IDnumber.class3); myData.AppendLine(IDnumber.class4); MessageBox.Show(myData); } public string GetDataFromNumber(string ID) { foreach (IDnumber idCandidateMatch in IDnumbers) { if (IDCandidateMatch.ID == ID) { StringBuilder myData = new StringBuilder(); myData.AppendLine(IDnumber.Name); myData.AppendLine(": "); myData.AppendLine(IDnumber.ID); myData.AppendLine(IDnumber.year); myData.AppendLine(IDnumber.class1); myData.AppendLine(IDnumber.class2); myData.AppendLine(IDnumber.class3); myData.AppendLine(IDnumber.class4); return myData; } } return ""; } } } }

    Read the article

  • Created nested model setting a property on nested model before save

    - by CWitty
    I have two models a Company and a User the Company has_many :users and the User belongs_to :company. I have a form such as: <%= form_for @company, data: {toggle: :validator}, novalidate: "novalidate", html: {role: :form} do |f| %> company fields Then in there I have <%= f.fields_for :users, @company.users.build do |user_form| %> A bunch of user fields It posts the data with the nested attributes of users_attributes: {"0" => {name: "Chad"}} But it doesn't create the user only the company object. Company Model class Company < ActiveRecord::Base has_many :users, dependent: :destroy has_many :contacts, dependent: :destroy accepts_nested_attributes_for :users accepts_nested_attributes_for :contacts attr_accessor :card_token, :users_attributes before_create :create_company_customer_token before_create :create_admin_user before_destroy :set_deleted_flag validates_presence_of :name, :phone_number private def create_admin_user self.users.first.admin = true end def set_deleted_flag self.deleted = true save users.each do |u| u.destroy end false end def create_company_customer_token begin customer = Stripe::Customer.create(description: "Company: #{self.name}", card: self.card_token, plan: self.plan) self.stripe_customer_id = customer['id'] rescue Stripe::StripeError => e self.errors.add(:stripe_customer_id, "Looks like we are having an issue at the moment, please try again shortly") @logger ||= Rails.logger @logger.error(e) end end end User Model class User < ActiveRecord::Base include Clearance::User has_many :messages belongs_to :company before_destroy :set_deleted_flag after_create :send_welcome_email validates_presence_of :first_name, :last_name validates_uniqueness_of :email, scope: :company_id, conditions: -> { where.not(deleted: true) } def name "#{first_name} #{last_name}" end private def set_deleted_flag self.deleted = true save end def send_welcome_email UserMailer.welcome_email(self).deliver end end

    Read the article

  • adding to json property that may or may not exist yet

    - by mmcgrail
    let say i want to do this var dasboard = {}; $('.check').click(function(){ $(this).toggleClass("active").siblings().slideToggle('slow', function() { dashboard['pages']['pagename'][$(this).closest('li').attr("id")]['show'] = $(this).is(":hidden") ? 'collapsed' : 'expanded'; }); } i get an error saying 'dashboard.pages is undefined' is there away to dynamically add 'pages' and the children that follow without having to do the work of checking to see if it is defined first then if its not doing dashboard['pages'] = {}; because sometimes they may already exist and I don't want to have to inspect the tree first i just want to build the branches as needed

    Read the article

  • Exclude property files from resources

    - by c0mrade
    How to exclude files from src/main/resources, for ex : I have a folder named "map" in there, which I wanna keep and I want to delete everything from war(or not to package it inside at firstplace). Or alternative but same result, exclude all *.resources files from src/main/resources and put in war everything else? Thank you

    Read the article

  • Difference between Property and Method

    - by Asim Sajjad
    Which one is better to use when it come to return value for example public int EmployeeAge { get{return intEmployeeAge}; } And public int EmployeeAge() { return intEmployeeAge; } Which one is better and why? And what is best programming practice to use when we have secnario like above ?

    Read the article

  • Implementation of a general-purpose object structure (property bag)

    - by Thomas Wanner
    We need to implement some general-purpose object structure, much like an object in dynamic languages, that would give us a possibility of creating the whole object graph on-the-fly. This class has to be serializable and somehow user friendly. So far we have made some experiments with class derived from Dictionary<string, object> using the dot notation path to store properties and collections in the object tree. We have also find an article that implements something similar, but it doesn't seem to fit completely into our picture either. Do you know about some good implementations / libraries that deal with a similar problem or do you have any (non-trivial) ideas that could help us with our own implementation ? Also, I probably have to say that we are using .NET 3.5, so we can't take advantage of the new features in .NET 4.0 like dynamic type etc. (as far as I know it's also not possible to use any subset of it in .NET 3.5 solution).

    Read the article

  • ModelMetadata: ShowForEdit property not appearing to work.

    - by Dan
    Iv wrote an MetaDataProvider like the one below and am using it in conjunction with Editor templates. The DisplayName is working correctly, but for some reason the ShowForEdit value it not having any effect. Any ideas? public class MyModelMetadataProvider : DataAnnotationsModelMetadataProvider { protected override ModelMetadata CreateMetadata(IEnumerable<Attribute> attributes, Type containerType, Func<object> modelAccessor, Type modelType, string propertyName) { var metadata = base.CreateMetadata(attributes, containerType, modelAccessor, modelType, propertyName); I metadata.DisplayName = "test"; metadata.ShowForEdit = false; metadata.ShowForDisplay = false; metadata.HideSurroundingHtml = true; return metadata; } }

    Read the article

  • Datacontracts property getter running twice

    - by user321426
    I have a set of data contracts that act as wrappers to base classes that we wish to expose. A quick example is: [DataMember] public List<decimal> Points { get { return sourceObject.ListPoints(); } private set{} } We have some other properties that we have to massage the data first (we are converting object graphs and need to guard against circular references). The issue that we are seeing is that this getter will fire twice, once within the service operation, then again during serialization. This is causing two problems: We manually add to collections, since this is running twice the collections are filled with dupes. If an exception is thrown during the second run, it happens outside of the try/catch in the operation, and does not throw a fault. The service throws a cryptic timeout message, and the only way to see the error is via WCF trace logs.

    Read the article

  • Sort ArrayList of custom Objects by property

    - by Samuel
    Hello World!! :D I had a question which is pretty easy if you know the answer I guess. I read about sorting ArrayLists using a Comparator but somehow in all of the examples people used compareTo which according to some research is a method working on Strings... I wanted to sort an ArrayList of custom objects by one of their properties: a Date object (getStartDay()). Normally I compare them by item1.getStartDate().before(item2.getStartDate()) so I was wondering whether I could write something like: public class customComparator { public boolean compare(Object object1, Object object2) { return object1.getStartDate().before(object2.getStartDate()); } } public class randomName { ... Collections.sort(Database.arrayList, new customComparator); ... } I just started with Java so please forgive my ignorance :) Thanks in advance!! -Samuel

    Read the article

  • SHAREPOINT: Custom Field type property storage defined for custom field

    - by Eric Rockenbach
    ok here is a great question. I have a set of generic custom fields that are highly configurable from an end user perspective and the configuration is getting overbearing as there are nearly 100 plus items each custom field allows you to perform in the areas of Server/Client Validation, Server/Client Events/Actions, Server/Client Bindings parent/child, display properties for form/control, etc, etc. Right now I'm storing most of these values as "Text" in my field xml for my propertyschema. I'm very familiar with the multi column value, but this is not a complex custom type in sense it's an array. I also considered creating serilzable objects and stuffing them into the text field and then pulling out and de-serilizing them when editing through the field editor or acting on the rules through the custom spfield. So I'm trying to take the following for example <PropertySchema> <Fields> <Field Name="EntityColumnName" Hidden="TRUE" DisplayName="EntityColumnName" MaxLength="500" DisplaySize="200" Type="Text"> <default></default> </Field> <Field Name="EntityColumnParentPK" Hidden="TRUE" DisplayName="EntityColumnParentPK" MaxLength="500" DisplaySize="200" Type="Text"> <default></default> </Field> <Field Name="EntityColumnValueName" Hidden="TRUE" DisplayName="EntityColumnValueName" MaxLength="500" DisplaySize="200" Type="Text"> <default></default> </Field> <Field Name="EntityListName" Hidden="TRUE" DisplayName="EntityListName" MaxLength="500" DisplaySize="200" Type="Text"> <default></default> </Field> <Field Name="EntitySiteUrl" Hidden="TRUE" DisplayName="EntitySiteUrl" MaxLength="500" DisplaySize="200" Type="Text"> <default></default> </Field> </Fields> <PropertySchema> And turn it into this... <PropertySchema> <Fields> <Field Name="ServerValidationRules" Hidden="TRUE" DisplayName="ServerValidationRules" Type="ServerValidationRulesType"> <default></default> </Field> </Fields> <PropertySchema> Ideas?????

    Read the article

  • Silverlight MediaElement Position Property Weirdness

    - by BarrettJ
    I have a MediaElement that is reporting its position incorrectly and weirdly, but consistently. It seems like when it gets to the last second of the audio (and it's always the last second, regardless if the sound is two seconds or 10), it doesn't update it's position until it finishes. Example output: Playback Progress: 0/3.99 - 0 Playback Progress: 0.01/3.99 - 0 Playback Progress: 0.03/3.99 - 0 Playback Progress: 0.06/3.99 - 1 Playback Progress: 0.07/3.99 - 1 Playback Progress: 0.08/3.99 - 2 Playback Progress: 0.11/3.99 - 2 Playback Progress: 0.14/3.99 - 3 Playback Progress: 0.19/3.99 - 4 Playback Progress: 0.23/3.99 - 5 Playback Progress: 0.25/3.99 - 6 Playback Progress: 0.28/3.99 - 7 Playback Progress: 0.3/3.99 - 7 Playback [SNIP] Playback Progress: 2.8/3.99 - 70 Playback Progress: 2.83/3.99 - 70 Playback Progress: 2.88/3.99 - 72 Playback Progress: 2.9/3.99 - 72 Playback Progress: 2.91/3.99 - 72 Playback Progress: 2.92/3.99 - 73 Playback Progress: 2.99/3.99 - 74 Playback Progress: 3/3.99 - 75 Playback Progress: 3/3.99 - 75 Playback Progress: 3/3.99 - 75 Playback Progress: 3/3.99 - 75 Playback Progress: 3/3.99 - 75 Playback Progress: 3/3.99 - 75 Playback Progress: 3/3.99 - 75 Playback Progress: 3/3.99 - 75 Playback Progress: 3/3.99 - 75 Playback Progress: 3.99/3.99 - 100 That is the result of: WriteLine("Playback Progress: " + Position + "/" + LengthInSeconds + " - " + (int)((Position / LengthInSeconds) * 100)); public double Position { get { return my_media_element != null ? my_media_element.Position.TotalSeconds : 0; } } public double LengthInSeconds { get { return my_media_element != null ? my_media_element.NaturalDuration.TimeSpan.TotalSeconds : 0; } } Anyone have any ideas why this is occurring?

    Read the article

  • How to serialize a protected property in wcf

    - by Denis Rosca
    Hello everyone, I have to classes (Person and Address) that i need to send via wcf, the classes look like this: public class PersoanaFizica :IExtensibleDataObject { [DataMember] private Guid _id; [DataMember(Name = "Id")] protected virtual Guid Id { get { return _id; } set { _id = value; } } private ExtensionDataObject _extensionData; public virtual ExtensionDataObject ExtensionData { get { return _extensionData; } set { _extensionData = value; } } private string _firstName; [Searchable(PropertyName="FirstName")] [DataMember] public virtual string FirstName { get { return this._firstName; } set { this._firstName = value; } } private string _lastName; [Searchable(PropertyName="LastName")] [DataMember] public virtual string LastName { get { return this._lastName; } set { this. _lastName = value; } } private Address _address; [Searchable(PropertyName="Address")] [DataMember] public virtual Address Address { get { return this._address; } set { this._address = value; } } } public class Address : IExtensibleDataObject { [DataMember] private Guid _id; [DataMember] public virtual Guid Id { get { return _id; } set { _id = value; } } private ExtensionDataObject _extensionData; public virtual ExtensionDataObject ExtensionData { get { return _extensionData; } set { _extensionData = value; } } private string _country; [Searchable(PropertyName="Country")] [DataMember] public virtual string Country { get { return this._country; } set { this._country = value; } } // and some other properties related to the address } The problem is that when i try to send them via wcf, the client recieves the Id properties set to 00000-0000-00000-00000 or smth like this. Any idea why this is happening? And how to serialize the proper values? Thanks,Denis.

    Read the article

  • How to serialize a protected property in wcf

    - by Denis Rosca
    Hello, i need some help with wcf serializing. I have two classes Person and Address. The Address class looks like this: public class Adresa : IExtensibleDataObject { private Guid _id; [DataMember] protected virtual Guid Id { get { return _id; } set { _id = value; } } private ExtensionDataObject _extensionData; [DataMember] public virtual ExtensionDataObject ExtensionData { get { return _extensionData; } set { _extensionData = value; } } private string _street; [DataMember] public virtual string Street { get { return this._cUTAM; } set { this._cUTAM = value; } } private string _number; [DataMember] public virtual string Number { get { return this._number; } set { this._number = value; } } private string _postalCode; [DataMember] public virtual string PostalCode { get { return this._postalCode; } set { this._postalCode = value; } } // and some other stuff related to the address } The Person class looks like this: public class PersoanaFizica :IExtensibleDataObject { private Guid _id; [DataMember] protected virtual Guid Id { get { return _id; } set { _id = value; } } private ExtensionDataObject _extensionData; [DataMember] public virtual ExtensionDataObject ExtensionData { get { return _extensionData; } set { _extensionData = value; } } private string _firstName; [DataMember] public virtual string FirstName { get { return this._firstName; } set { this._firstName = value; } } private string _lastName; [DataMember] public virtual string LastName { get { return this._lastName; } set { this._lastName = value; } } } The problem is that when the wcf client the data the Id properties are set to a bunch of zeros ( something like 000000-0000-000000-0000000). Any ideas on why this is happening? Thanks, Denis.

    Read the article

  • Some question of object property name in Actionscript3.

    - by unsouled
    A.as package { public class A { public static var someObject:Object = { (B.SOME_CONST): { value: 10 } }; } } B.as package { public class B { public static const SOME_CONST:String = "someStringConst"; } } And this is test code. var obj:Object = A.someObject; trace(obj.hasOwnProperty(B.SOME_CONST)); trace(obj.hasOwnProperty("someStringConst")); trace(obj.hasOwnProperty("SOME_CONST")); I expected that result will be true, true, false but real result is false, false, true. Why?

    Read the article

< Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >