Search Results

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

Page 16/486 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • @property setter for BOOL.

    - by George
    Hi, I'm having problems setting a BOOL using @property and @synthesize. I'm using @property BOOL isPaused; And I can get it by using [myObject isPaused]; but I cannot manage to set it. I'd like to use [myObject setPaused: NO];. I also tried @property (setter=setPaused) BOOL isPaused; but if I'm not mistaking, then I need to write that setter myself.

    Read the article

  • Get property name from class

    - by Polaris
    I need property name in my app and I use next code to get it string PropertyName =SomeClass.GetType().GetProperty("Category").Name; But I think that is bad idea. Because I use web service classes and I dont know when property names can be changed. This code give me exception only in runtime. But if I write something like this SomeClassInstance.Property.GetProperyName i get exception in moment of compilation and repair this problem. Is it possible to get property name dynamically?

    Read the article

  • Why does every thread in my application use a different hibernate session?

    - by Ittai
    Hi, I have a web-application which uses hibernate and for some reason every thread (httprequest or other threads related to queueing) uses a different session. I've implemented a HibernateSessionFactory class which looks like this: public class HibernateSessionFactory { private static final ThreadLocal<Session> threadLocal = new ThreadLocal<Session>(); private static Configuration configuration = new AnnotationConfiguration(); private static org.hibernate.SessionFactory sessionFactory; static { try { configuration.configure(configFile); sessionFactory = configuration.buildSessionFactory(); } catch (Exception e) {} } private HibernateSessionFactory() {} public static Session getSession() throws HibernateException { Session session = (Session) threadLocal.get(); if (session == null || !session.isOpen()) { if (sessionFactory == null) { rebuildSessionFactory();//This method basically does what the static init block does } session = (sessionFactory != null) ? sessionFactory.openSession(): null; threadLocal.set(session); } return session; } //More non relevant methods here. Now from my testing it seems that the threadLocal member is indeed initialized only once when the class is first loaded by the JVM but for some reason when different threads access the getSession() method they use different sessions. When a thread first accesses this class (Session) threadLocal.get(); will return null but as expected all other access requests will yeild the same session. I'm not sure how this can be happening as the threadLocal variable is final and the method threadLocal.set(session) is only used in the above context (which I'm 99.9% sure has to yeild a non null session as I would have encountered a NullPointerException at a different part of my app). I'm not sure this is relevant but these are the main parts of my hibernate.cfg.xml file: <hibernate-configuration> <session-factory> <property name="connection.url">someURL</property> <property name="connection.driver_class"> com.microsoft.sqlserver.jdbc.SQLServerDriver</property> <property name="dialect">org.hibernate.dialect.SQLServerDialect</property> <property name="hibernate.connection.isolation">1</property> <property name="hibernate.connection.username">User</property> <property name="hibernate.connection.password">Password</property> <property name="hibernate.connection.pool_size">10</property> <property name="show_sql">false</property> <property name="current_session_context_class">thread</property> <property name="hibernate.hbm2ddl.auto">update</property> <property name="hibernate.cache.use_second_level_cache">false</property> <property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <!-- Mapping files --> I'd appreciate any help granted and of course if anyone has any questions I'd be happy to clarify. Ittai

    Read the article

  • C# "Rename" Property in Derived Class

    - by Eric
    When you read this you'll be awfully tempted to give advice like "this is a bad idea for the following reason..." Bear with me. I know there are other ways to approach this. This question should be considered trivia. Lets say you have a class "Transaction" that has properties common to all transactions such as Invoice, Purchase Order, and Sales Receipt. Let's take the simple example of Transaction "Amount", which is the most important monetary amount for a given transaction. public class Transaction { public double Amount { get; set; } public TxnTypeEnum TransactionType { get; set; } } This Amount may have a more specific name in a derived type... at least in the real world. For example, the following values are all actually the same thing: Transaction - Amount Invoice - Subtotal PurchaseOrder - Total Sales Receipt - Amount So now I want a derived class "Invoice" that has a Subtotal rather than the generically-named Amount. Ideally both of the following would be true: In an instance of Transaction, the Amount property would be visible. In an instance of Invoice, the Amount property would be hidden, but the Subtotal property would refer to it internally. Invoice looks like this: public class Invoice : Transaction { new private double? Amount { get { return base.Amount; } set { base.Amount = value; } } // This property should hide the generic property "Amount" on Transaction public double? SubTotal { get { return Amount; } set { Amount = value; } } public double RemainingBalance { get; set; } } But of course Transaction.Amount is still visible on any instance of Invoice. Thanks for taking a look!

    Read the article

  • Extend an entity to create a computed observable that requires a navigation property

    - by Julianyus
    I'm trying to extend an entity to create a computed observable that requires a navigation property: app.domain.indicador = function () { this.ValorMetaActual = ko.computed({ read: function () { console.log(this.ValoresMeta); //navigation property: undefined return 0; }, deferEvaluation: true }, this); }; The problem is that when the observable is created, the navigation property does not yet exist. What could I do to fix this?

    Read the article

  • Indirect property notification

    - by Carlo
    Hello, this question might look a little trivial, but it might not be. I'm just wondering which of the following two cases is better for indirect property notification, or perhaps there is an even better way. The scenario: I have two properties, the first one is an object called HoldingObject, the second one is a boolean called IsHoldingObject, which is false if HoldingObject == null, otherwise it's true. I'm just wondering what is the best notification mechanism for IsHoldingObject: Case (A) - Notify IsHoldingObject changed from the HoldingObject proeperty: public class NotifyingClass1 : INotifyPropertyChanged { private object _holdingObject; public object HoldingObject { get { return _holdingObject; } set { if (_holdingObject != value) { _holdingObject = value; NotifyPropertyChanged("HoldingObject"); // Notify from the property that is being checked NotifyPropertyChanged("IsHoldingObject"); } } } public bool IsHoldingObject { get { return this.HoldingObject == null; } } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged(string propertyName) { if (this.PropertyChanged != null) this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } #endregion } Case (B) - Notify IsHoldingObject changed from the IsHoldingObject directly, by setting it to false or true from HoldingObject property: public class NotifyingClass2 : INotifyPropertyChanged { private object _holdingObject; public object HoldingObject { get { return _holdingObject; } set { if (_holdingObject != value) { _holdingObject = value; NotifyPropertyChanged("HoldingObject"); // 1) Set the property here this.IsHoldingObject = _holdingObject != null; } } } private bool _isHoldingObject; public bool IsHoldingObject { get { return _isHoldingObject; } set { if (_isHoldingObject != value) { _isHoldingObject = value; // 2) Notify directly from the property NotifyPropertyChanged("IsHoldingObject"); } } } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged(string propertyName) { if (this.PropertyChanged != null) this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } #endregion } I personally lean to the first one because it requires less code, but I'm not sure how recommendable it is to do that. Let me know if there is another (better) way. Thanks!

    Read the article

  • Help with AJAX, Using PHP and hiding elements.

    - by ryan
    Hey, This is my first time with AJAX, so I'm a bit confused and need your help. I have four div id's and want to toggle hide/show between them based on result from database. Sounds simple, eh! But it is hard to implement for me. HELP!. This is my code - <div id="1">HEya</div> <div id="2">What's up?</div> <input type="submit" id='approve' name="action" value="Approve" onclick="a()" class="approve" /> <input type="submit" id='reject' value="Reject" name="action" onclick="r()" class="reject"/> <script language="javascript" type="text/javascript"> //if cookie exists, at the beginning the form should be hidden if (<?php $responseanswer['response']=='approve'; ?> ){ document.getElementById('1').style.display = 'none'; document.getElementById('2').style.display = 'inline'; } //if user clicks reject, hide one element dislay another else if (<?php $responseanswer['response']=='reject'; ?>){ //if cookie exists document.getElementById('2').style.display = 'none'; document.getElementById('1').style.display = 'block'; } else { function a() { var a = document.getElementById('2'); document.getElementById('1').style.display= 'block'; } //on reject creating a new cookie function r() { var a = document.getElementById('reject'); document.getElementById('1').style.display = 'none'; document.getElementById('2').style.display= 'block'; } } </script> Eveything is fine, but the div is not hiding.

    Read the article

  • Tag property null when data binding

    - by rotary_engine
    Can anyone see what is wrong with this? The Tag property is returning null however the Binding for Id property is definately returning an int value. <ListBox ItemsSource="{Binding ElementName=myDomainDataSource, Path=Data}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Path=Id, Mode=OneWay}" /> <HyperlinkButton Content="Edit" Tag="{Binding ElementName=Id, Mode=OneWay}" Click="Edit_Click" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> and then... private void Edit_Click(object sender, RoutedEventArgs e) { ContentControl c = sender as ContentControl; // exception - c.Tag is null int id = (int)c.Tag; } The Id property is showing a value on the UI, but doesn't seem to be getting stored in the buttons Tag property.

    Read the article

  • initializing a readonly property. Object c

    - by tak
    i was trying to create a property which is readonly. i wanted to initialize with a value from the class creating an instance of this class.e.g @property (readonly) NSString *firstName; And wanted to initialize it like -(id)initWithName:(NSString *)n{ self.firstName = n; } Once i do this, this compiler shows an error that the readonly property cannot be assigned. So how can i do this?

    Read the article

  • Question regrarding declaring a property

    - by Simon
    Hi. We declare properties using the @property keyword and synthesize it in the implementation file. My question is, What if I declare a property using the @property keyword and also declare a variable in the interface block with the same name? For example, consider the following code, Interface: @interface myClass : NSObject { NSString *myClass_name; // LINE 1 } @property(nonatomic, retain) NSString *myClass_name; // LINE 2 @end Implementation: @implementation myClass @synthesize myClass_name @end Declaring myClass_name in LINE 1 will make any problem? Like any reference problem or any unnecessary memory consumption problem?

    Read the article

  • Calling an object method from an object property definition

    - by Ian
    I am trying to call an object method from an object (the same object) property definition to no avail. var objectName = { method : function() { return "boop"; }, property : this.method() }; In this example I want to assign the return value of objectName.method ("boop") to objectName.property. I have tried objectName.method(), method(), window.objectName.method(), along with the bracket notation variants of all those as well, ex. this["method"], with no luck.

    Read the article

  • Setting custom property in msi file

    - by krk
    How to set custom property in a msi file on the fly? I do not want to pass the custom property using msiexec. I want to save the value of the property in the msi file itself based on user log in. Thanks in advance.

    Read the article

  • Possible Conflict with Class name & Property Name?

    - by coffeeaddict
    If you have a namespace that contains a property in ClassA and a class that has the name of that Property somewhere else in your project and both are in the same namespace this won't cause conflicts will it? So lets say I have a class named Car namespace Dealer { class Vehicle { // the main class that defines vehicle, so this is Dealer.Vehicle (Vehicle.cs) } } and a property over in some other class namespace Dealer { class Dealer { public Vehicle Vehicle { get { return _vehicle; } } } } so for the second it is really this for the property public Dealer.Vehicle Vehicle { get { return _car; } } so now you have Dealer.Vehicle and Dealer.Dealer.Vehicle. Wondering of that would cause a conflict ever. If both those classes are in the same namespace and

    Read the article

  • @property, ok in this situation?

    - by fuzzygoat
    I am still finding my feet with objective-c and was wondering if its acceptable to use @property on the two objects below. #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface MapViewController : UIViewController <MKMapViewDelegate, CLLocationManagerDelegate> { CLLocationManager *locationManager; IBOutlet MKMapView *googleMapView; } @property(nonatomic, retain) CLLocationManager *locationManager; @property(nonatomic, retain) MKMapView *googleMapView; @end One of my reasons for using them is so that I can use the setters in my viewDidUnload, I seem to be using @property a lot and was just wondering if the use in this situation is acceptable? -(void)viewDidUnload { [self setLocationManager:nil]; [self setGoogleMapView:nil]; [super viewDidUnload]; } much appreciated Gary

    Read the article

  • Binding lineargradientbrush color with property

    - by user1629894
    I have a problem with color in gradientstop. I want binding offset color with my property that return color (System.Windows.Media), but not working and return defalt color Transparent. If binding same property with Foreground Label is working. This style is in ResourceDictionary. <Style TargetType="{x:Type TabControl}"> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush StartPoint="0 0" EndPoint="0 1"> <LinearGradientBrush.GradientStops> <GradientStop Offset="0.1" Color="Black" /> <GradientStop Offset="1" Color="{Binding Path=MyColor}" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Setter.Value> </Setter> </Style> and it's working: <Style TargetType="{x:Type Label}"> <Setter Property="Foreground" Value="{Binding Path=MyColor, Converter={StaticResource ColorToBrush}}" /> </Style> my property is: public Color MyColor { set { myColor = value; NotifyPropertyChanged("MyColor"); } get { return myColor; } } Thank you everybody for answers

    Read the article

  • Reflection: different ways to retrieve property value

    - by jules
    I'm retrieving an IEnumerable list of properties via following code: BindingFlags bindingFlag = BindingFlags.Instance | BindingFlags.Public; var dataProperties = typeof(myParentObject).GetProperties(bindingFlag); Then I'm iterating through the list and retrieving the value for each property. I've come across two different approaches to doing this, and just wondered what the difference is between them: 1) object propertyValue = property.GetGetMethod().Invoke(myObject, null); 2) object propertValue = property.GetValue(myObject, null)

    Read the article

  • Web Parts custom property not showing up

    - by Morri
    I'm trying to create a custom property for my web part, but can't get it to show up in Sharepoint. Here's my current code : [Serializable] [XmlRoot(Namespace = "MyWebPart")] [DefaultProperty("Text")] public class MyWebPart : WebPart { ... [Category("My Web Parts Properties")] [DefaultValue(defaultPropertyValue)] [WebPartStorage(Storage.Shared)] [FriendlyNameAttribute("Property name")] [Description("Longer desc for my property")] [Browsable(true)] [XmlElement(ElementName = "SomeProperty")] public string SomeProperty { get { return someProperty; } set { someProperty = value; } } Is there something else required to get custom properties working?

    Read the article

  • How to extract object reference from property access lamda

    - by Jim C
    Here's a follow-up question to http://stackoverflow.com/questions/2820660/get-name-of-property-as-a-string. Given a method Foo (error checking omitted for brevity): // Example usage: Foo(() => SomeClass.SomeProperty) // Example usage: Foo(() => someObject.SomeProperty) void Foo(Expression<Func<T>> propertyLambda) { var me = propertyLambda.Body as MemberExpression; var pi = me.Member as PropertyInfo; bool propertyIsStatic = pi.GetGetMethod().IsStatic; object owner = propertyIsStatic ? me.Member.DeclaringType : ???; ... // Execute property access object value = pi.GetValue(owner, null); } I've got the static property case working but don't know how to get a reference to someObject in the instance property case. Thanks in advance.

    Read the article

  • Entity Framework does not map 2 columns from a SqlQuery calling a stored procedure

    - by user1783530
    I'm using Code First and am trying to call a stored procedure and have it map to one of my classes. I created a stored procedure, BOMComponentChild, that returns details of a Component with information of its hierarchy in PartsPath and MyPath. I have a class for the output of this stored procedure. I'm having an issue where everything except the two columns, PartsPath and MyPath, are being mapped correctly with these two properties ending up as Nothing. I searched around and from my understanding the mapping bypasses any Entity Framework name mapping and uses column name to property name. The names are the same and I'm not sure why it is only these two columns. The last part of the stored procedure is: SELECT t.ParentID ,t.ComponentID ,c.PartNumber ,t.PartsPath ,t.MyPath ,t.Layer ,c.[Description] ,loc.LocationID ,loc.LocationName ,CASE WHEN sup.SupplierID IS NULL THEN 1 ELSE sup.SupplierID END AS SupplierID ,CASE WHEN sup.SupplierName IS NULL THEN 'Scinomix' ELSE sup.SupplierName END AS SupplierName ,c.Active ,c.QA ,c.IsAssembly ,c.IsPurchasable ,c.IsMachined ,t.QtyRequired ,t.TotalQty FROM BuildProducts t INNER JOIN [dbo].[BOMComponent] c ON c.ComponentID = t.ComponentID LEFT JOIN [dbo].[BOMSupplier] bsup ON bsup.ComponentID = t.ComponentID AND bsup.IsDefault = 1 LEFT JOIN [dbo].[LookupSupplier] sup ON sup.SupplierID = bsup.SupplierID LEFT JOIN [dbo].[LookupLocation] loc ON loc.LocationID = c.LocationID WHERE (@IsAssembly IS NULL OR IsAssembly = @IsAssembly) ORDER BY t.MyPath and the class it maps to is: Public Class BOMComponentChild Public Property ParentID As Nullable(Of Integer) Public Property ComponentID As Integer Public Property PartNumber As String Public Property MyPath As String Public Property PartsPath As String Public Property Layer As Integer Public Property Description As String Public Property LocationID As Integer Public Property LocationName As String Public Property SupplierID As Integer Public Property SupplierName As String Public Property Active As Boolean Public Property QA As Boolean Public Property IsAssembly As Boolean Public Property IsPurchasable As Boolean Public Property IsMachined As Boolean Public Property QtyRequired As Integer Public Property TotalQty As Integer Public Property Children As IDictionary(Of String, BOMComponentChild) = New Dictionary(Of String, BOMComponentChild) End Class I am trying to call it like this: Me.Database.SqlQuery(Of BOMComponentChild)("EXEC [BOMComponentChild] @ComponentID, @PathPrefix, @IsAssembly", params).ToList() When I run the stored procedure in management studio, the columns are correct and not null. I just can't figure out why these won't map as they are the important information in the stored procedure. The types for PartsPath and MyPath are varchar(50).

    Read the article

  • Int property in class definition

    - by Daniel I-S
    I have the following class structure for custom UITableViewCells: NumericEntryCell - Contains method for controlling max value that can be entered into a textbox. SliderCell - inherits from NEC and contains methods for handling slider-control of textbox value TextOnlyCell - just contains a textbox CellA - inherits from SliderCell and has a max value of 28 CellB - inherits from TextOnlyCell and has a max value of 150. I want NumericEntryCell to contain a definition for a property that contains the maxValue. I want to be able to set a value for this in the initialize method of a child class (CellA or CellB). Currently I have an int maxValue declared in the interface of NEC. I declare a property for this with @property int maxValue and @synthesize it within the .m file. However, attempting to modify this property's value from CellA or CellB's initialize method has no effect - when I hit a breakpoint in the NEC method that uses this value, its value is always zero. How can I get this to work?

    Read the article

  • How do I use SPMemember.ID property to get User or Group

    - by Jason
    I have to write a utility to enumerate and manage the owners of groups within a SharePoint site. I know I can use the Groups property of the SPWeb object to retrieve a collection of groups. And I know I can use the Owner property of the group to get back the owner. My problem is that I do not know what to do next. The SPGroup.Owner property returns a SPMember object. The member object has one property called ID that returns the unique ID (an integer) of the member. What I cannot seem to find information on is how to use that integer value to determine if the member is a User or a Group and how to get back additional details (say the name). Any ideas? Thanks.

    Read the article

  • How to make an private property?

    - by mystify
    I tried to make a private property in my *.m file: @interface MyClass (Private) @property (nonatomic, retain) NSMutableArray *stuff; @end @implementation MyClass @synthesize stuff; // not ok Compiler claims that there's no stuff property declared. But there's a stuff. Just in an anonymous category. Let me guess: Impossible. Other solutions?

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >