Search Results

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

Page 8/486 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Why do programming languages allow shadowing/hiding of variables and functions?

    - by Simon
    Many of the most popular programming languges (such as C++, Java, Python etc.) have the concept of hiding / shadowing of variables or functions. When I've encountered hiding or shadowing they have been the cause of hard to find bugs and I've never seen a case where I found it necessary to use these features of the languages. To me it would seem better to disallow hiding and shadowing. Does anybody know of a good use of these concepts?

    Read the article

  • Will the changes of a property in a "StaticResource instance" reflected in UI ?

    - by Anish
    I have used object data provider to create instance of my view-model as below: <ObjectDataProvider x:Key="Datas" ObjectType="{x:Type ViewModel:UserControlViewModel}"> </ObjectDataProvider> <DataTemplate x:Key="SourceGrid"> <WPFToolKit:DataGrid x:Name="SourceDataGrid" ItemsSource="{Binding Source={StaticResource Datas},Path=SourceGridData}" CanUserSortColumns="True" GridLinesVisibility="None" IsSynchronizedWithCurrentItem="True" SelectionUnit="FullRow"></WPFToolKit:DataGrid> </DataTemplate> My question is... as I am using the instance - "Datas" as staticResource, will the changes to the property "SourceGridData" get reflected in UI? ItemsSource="{Binding Source={StaticResource Datas},Path=SourceGridData}" `

    Read the article

  • KindError: Property r must be an instance of SecondModel, why ?

    - by zjm1126
    class FirstModel(db.Model): p = db.StringProperty() r=db.ReferenceProperty(SecondModel) class SecondModel(db.Model): r = db.ReferenceProperty(FirstModel) class sss(webapp.RequestHandler): def get(self): a=FirstModel() a.p='sss' a.put() b=SecondModel() b.r=a b.put() a.r=b a.put() self.response.out.write(str(b.r.p)) the error is : Traceback (most recent call last): File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 511, in __call__ handler.get(*groups) File "D:\zjm_code\helloworld\a.py", line 158, in get a.r=b File "D:\Program Files\Google\google_appengine\google\appengine\ext\db\__init__.py", line 3009, in __set__ value = self.validate(value) File "D:\Program Files\Google\google_appengine\google\appengine\ext\db\__init__.py", line 3048, in validate (self.name, self.reference_class.kind())) KindError: Property r must be an instance of SecondModel thanks

    Read the article

  • Help: Instance Variables & Properties [iPhone]

    - by Devoted
    In something like this: @interface Control_FunViewController : UIViewController { UITextField *nameField; UITextField *numberField; } @property (nonatomic, retain) IBOutlet UITextField *nameField; @property (nonatomic, retain) IBOutlet UITextField *numberField; I understand that "UITextField *nameField;" is an instance variable and "@property ..." is a property. But what do these individual things do? I guess what I'm really asking is how the property is used for example in the implementation file (.m)

    Read the article

  • Silverlight with using of DependencyProperty and ControlTemplate

    - by Taras
    Hello everyone, I'm starting to study Silverlight 3 and Visual Studio 2008. I've been trying to create Windows sidebar gadget with button controls that look like circles (I have couple of "roundish" png images). The behavior, I want, is the following: when the mouse hovers over the image it gets larger a bit. When we click on it, then it goes down and up. When we leave the button's image it becomes normal sized again. Cause I'm going to have couple of such controls I decided to implement custom control: like a button but with image and no content text. My problem is that I'm not able to set my custom properties in my template and style. What am I doing wrong? My teamplate control with three additional properties: namespace SilverlightGadgetDocked { public class ActionButton : Button { /// <summary> /// Gets or sets the image source of the button. /// </summary> public String ImageSource { get { return (String)GetValue(ImageSourceProperty); } set { SetValue(ImageSourceProperty, value); } } /// <summary> /// Gets or sets the ratio that is applied to the button's size /// when the mouse control is over the control. /// </summary> public Double ActiveRatio { get { return (Double)GetValue(ActiveRatioProperty); } set { SetValue(ActiveRatioProperty, value); } } /// <summary> /// Gets or sets the offset - the amount of pixels the button /// is shifted when the the mouse control is over the control. /// </summary> public Double ActiveOffset { get { return (Double)GetValue(ActiveOffsetProperty); } set { SetValue(ActiveOffsetProperty, value); } } public static readonly DependencyProperty ImageSourceProperty = DependencyProperty.Register("ImageSource", typeof(String), typeof(ActionButton), new PropertyMetadata(String.Empty)); public static readonly DependencyProperty ActiveRatioProperty = DependencyProperty.Register("ActiveRatio", typeof(Double), typeof(ActionButton), new PropertyMetadata(1.0)); public static readonly DependencyProperty ActiveOffsetProperty = DependencyProperty.Register("ActiveOffset", typeof(Double), typeof(ActionButton), new PropertyMetadata(0)); public ActionButton() { this.DefaultStyleKey = typeof(ActionButton); } } } And XAML with styles: <UserControl x:Class="SilverlightGadgetDocked.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:SilverlightGadgetDocked="clr-namespace:SilverlightGadgetDocked" Width="130" Height="150" SizeChanged="UserControl_SizeChanged" MouseEnter="UserControl_MouseEnter" MouseLeave="UserControl_MouseLeave"> <Canvas> <Canvas.Resources> <Style x:Name="ActionButtonStyle" TargetType="SilverlightGadgetDocked:ActionButton"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="SilverlightGadgetDocked:ActionButton"> <Grid> <Image Source="{TemplateBinding ImageSource}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="DockedActionButtonStyle" TargetType="SilverlightGadgetDocked:ActionButton" BasedOn="{StaticResource ActionButtonStyle}"> <Setter Property="Canvas.ZIndex" Value="2"/> <Setter Property="Canvas.Top" Value="10"/> <Setter Property="Width" Value="30"/> <Setter Property="Height" Value="30"/> <Setter Property="ActiveRatio" Value="1.15"/> <Setter Property="ActiveOffset" Value="5"/> </Style> <Style x:Key="InfoActionButtonStyle" TargetType="SilverlightGadgetDocked:ActionButton" BasedOn="{StaticResource DockedActionButtonStyle}"> <Setter Property="ImageSource" Value="images/action_button_info.png"/> </Style> <Style x:Key="ReadActionButtonStyle" TargetType="SilverlightGadgetDocked:ActionButton" BasedOn="{StaticResource DockedActionButtonStyle}"> <Setter Property="ImageSource" Value="images/action_button_read.png"/> </Style> <Style x:Key="WriteActionButtonStyle" TargetType="SilverlightGadgetDocked:ActionButton" BasedOn="{StaticResource DockedActionButtonStyle}"> <Setter Property="ImageSource" Value="images/action_button_write.png"/> </Style> </Canvas.Resources> <StackPanel> <Image Source="images/background_docked.png" Stretch="None"/> <TextBlock Foreground="White" MaxWidth="130" HorizontalAlignment="Right" VerticalAlignment="Top" Padding="0,0,5,0" Text="Name" FontSize="13"/> </StackPanel> <SilverlightGadgetDocked:ActionButton Canvas.Left="15" Style="{StaticResource InfoActionButtonStyle}" MouseLeftButtonDown="imgActionInfo_MouseLeftButtonDown"/> <SilverlightGadgetDocked:ActionButton Canvas.Left="45" Style="{StaticResource ReadActionButtonStyle}" MouseLeftButtonDown="imgActionRead_MouseLeftButtonDown"/> <SilverlightGadgetDocked:ActionButton Canvas.Left="75" Style="{StaticResource WriteAtionButtonStyle}" MouseLeftButtonDown="imgActionWrite_MouseLeftButtonDown"/> </Canvas> </UserControl> And Visual Studio reports that "Invalid attribute value ActiveRatio for property Property" in line 27 <Setter Property="ActiveRatio" Value="1.15"/> VERY BIG THANKS!!!

    Read the article

  • FileNameColumnName property, Flat File Source Adapter : SSIS Nugget

    - by jamiet
    I saw a question on MSDN’s SSIS forum the other day that went something like this: I’m loading data into a table from a flat file but I want to be able to store the name of that file as well. Is there a way of doing that? I don’t want to come across as disrespecting those who took the time to reply but there was a few answers along the lines of “loop over the files using a For Each, store the file name in a variable yadda yadda yadda” when in fact there is a much much simpler way of accomplishing this; it just happens to be a little hidden away as I shall now explain! The Flat File Source Adapter has a property called FileNameColumnName which for some reason it isn’t exposed through the Flat File Source editor, it is however exposed via the Advanced Properties: You’ll see in the screenshot above that I have set FileNameColumnName=“Filename” (it doesn’t matter what name you use, anything except a non-zero string will work). What this will do is create a new column in our dataflow called “Filename” that contains, unsurprisingly, the name of the file from which the row was sourced. All very simple. This is particularly useful if you are extracting data from multiple files using the MultiFlatFile Connection Manager as it allows you to differentiate between data from each of the files as you can see in the following screenshot: So there you have it, the FileNameColumnName property; a little known secret of SSIS. I hope it proves to be useful to someone out there. @Jamiet Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

    Read the article

  • FileNameColumnName property, Flat File Source Adapter : SSIS Nugget

    - by jamiet
    I saw a question on MSDN’s SSIS forum the other day that went something like this: I’m loading data into a table from a flat file but I want to be able to store the name of that file as well. Is there a way of doing that? I don’t want to come across as disrespecting those who took the time to reply but there was a few answers along the lines of “loop over the files using a For Each, store the file name in a variable yadda yadda yadda” when in fact there is a much much simpler way of accomplishing this; it just happens to be a little hidden away as I shall now explain! The Flat File Source Adapter has a property called FileNameColumnName which for some reason it isn’t exposed through the Flat File Source editor, it is however exposed via the Advanced Properties: You’ll see in the screenshot above that I have set FileNameColumnName=“Filename” (it doesn’t matter what name you use, anything except a non-zero string will work). What this will do is create a new column in our dataflow called “Filename” that contains, unsurprisingly, the name of the file from which the row was sourced. All very simple. This is particularly useful if you are extracting data from multiple files using the MultiFlatFile Connection Manager as it allows you to differentiate between data from each of the files as you can see in the following screenshot: So there you have it, the FileNameColumnName property; a little known secret of SSIS. I hope it proves to be useful to someone out there. @Jamiet Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

    Read the article

  • Firefox - setting/extension to toggle between showing & hiding of all images, without reloading the page

    - by galacticninja
    I'm looking for a Firefox setting or extension that can easily toggle between showing and hiding of all images without reloading the page (similar to Opera's feature - the 'Show only cached images' feature is preferable, but optional in my case). I have found an extension that can show/hide images (Image-Show-Hide) but it needs to reload the page to show/hide the images. I prefer that the page not reload when unhiding images from a page previously set to hide all images.

    Read the article

  • Camtasia 6: Callout not hiding!!

    - by user35112
    i am creating a video in Camtasia Studio 6. I created a callout in timeline, In timeline its showing that this callout will hide after 5 seconds. When i play the movie the callout is not hiding but if i click on the timeline anywhere after the callout and play the video the callout is hidden. Whats going on???

    Read the article

  • How to retrieve the Description property from SettingsProperty?

    - by BadNinja
    For each item in my application's settings, I've added text to its Description Property which I want to retrieve at runtime. I'm sure I'm missing some basic logical nuance here, but everything I've tried has failed. Clearly, my understanding of what value needs to be passed to the Attributes property of the SettingsProperty class is wrong. I'm further confused by the fact that when I iterate through all they keys returned by SettingsProperty.Attributes.Keys, I can see "System.Configuration.SettingsDescriptionAttribute", but when I pass that string in as the key to the Attributes property, null is returned. Any insight into how to properly retrieve the value Description Property would be very much appreciated. Thanks. :) public void MyMethod() { SettingsPropertyCollection MyAppProperties = Properties.Settings.Default.Properties; IEnumerator enumerator = MyAppProperties.GetEnumerator(); // Iterate through all the keys to see what we have.... while (enumerator.MoveNext()) { SettingsProperty property = (SettingsProperty)enumerator.Current; ICollection myKeys = property.Attributes.Keys; foreach (object theKey in myKeys) System.Diagnostics.Debug.Print(theKey.ToString()); // One of the keys returned is: System.Configuration.SettingsDescriptionAttribute } enumerator.Reset(); while (enumerator.MoveNext()) { SettingsProperty property = (SettingsProperty)enumerator.Current; string propertyValue = property.DefaultValue.ToString(); // This fails: Null Reference string propertyDescription = property.Attributes["System.Configuration.SettingsDescriptionAttribute"].ToString(); // Do stuff with strings... } }

    Read the article

  • Is method hiding ever a good idea

    - by ScottS
    In C# the new keyword can be used to hide a base class method without overriding the base class method. I've never encountered a situation where hiding a method was the best choice available. Are there any situations where method hiding is the best choice?

    Read the article

  • Hiding Group Column Names

    - by Robert
    You once replied to a post about hiding list group header names. http://edinkapic.blogspot.com/2008/06/hiding-list-view-group-headers.html I do not write code or jQuery at that. But you mentioned that it would be better to write a solution in jQuery. Would you have code that would hide the group header and colon in a 2003 list (SP v.2)? Do you have any good leads? Thanks. Robert S.

    Read the article

  • How to serialize a Linq to Sql object graph without hiding the child's "Parent" member

    - by Richard B
    Without hiding the Child object's reference to the Parent object, has anyone been able to use an XmlSerializer() object to move a Linq to SQL object to an XML document, or is the only appropriate way of handling this to create a custom serialization/deserialization class to handle moving the data to/from the xml document? I don't like the idea of hiding the child object's reference to the parent object is why I'm asking. Thx.

    Read the article

  • Expando Object and dynamic property pattern

    - by Al.Net
    I have read about 'dynamic property pattern' of Martin Fowler in his site under the tag 1997 in which he used dictionary kind of stuff to achieve this pattern. And I have come across about Expando object in c# very recently. When I see its implementation, I am able to see IDictionary implemented. So Expando object uses dictionary to store dynamic properties and is it what, Martin Fowler already defined 15 years ago?

    Read the article

  • Throwing exception from a property when my object state is invalid

    - by Rumi P.
    Microsoft guidelines say: "Avoid throwing exceptions from property getters", and I normally follow that. But my application uses Linq2SQL, and there is the case where my object can be in invalid state because somebody or something wrote nonsense into the database. Consider this toy example: [Table(Name="Rectangle")] public class Rectangle { [Column(Name="ID", IsPrimaryKey = true, IsDbGenerated = true)] public int ID {get; set;} [Column(Name="firstSide")] public double firstSide {get; set;} [Column(Name="secondSide")] public double secondSide {get; set;} public double sideRatio { get { return firstSide/secondSide; } } } Here, I could write code which ensures that my application never writes a Rectangle with a zero-length side into the database. But no matter how bulletproof I make my own code, somebody could open the database with a different application and create an invalid Rectangle, especially one with a 0 for secondSide. (For this example, please forget that it is possible to design the database in a way such that writing a side length of zero into the rectangle table is impossible; my domain model is very complex and there are constraints on model state which cannot be expressed in a relational database). So, the solution I am gravitating to is to change the getter to: get { if(firstSide > 0 && secondSide > 0) return firstSide/secondSide; else throw new System.InvalidOperationException("All rectangle sides should have a positive length"); } The reasoning behind not throwing exceptions from properties is that programmers should be able to use them without having to make precautions about catching and handling them them. But in this case, I think that it is OK to continue to use this property without such precautions: if the exception is thrown because my application wrote a non-zero rectangle side into the database, then this is a serious bug. It cannot and shouldn't be handled in the application, but there should be code which prevents it. It is good that the exception is visibly thrown, because that way the bug is caught. if the exception is thrown because a different application changed the data in the database, then handling it is outside of the scope of my application. So I can't do anything about it if I catch it. Is this a good enough reasoning to get over the "avoid" part of the guideline and throw the exception? Or should I turn it into a method after all? Note that in the real code, the properties which can have an invalid state feel less like the result of a calculation, so they are "natural" properties, not methods.

    Read the article

  • escaping a dollar in the middle of an ant property

    - by jk
    I have a property whose value contains a $. I'd like to use this property as a regexp in a propertyregexp. Ant appears to resolve the property as a paramater to the propertyregexp, but then the dollar gets interpreted as a regexp symbol. Example: <property name="a" value="abc$" /> <property name="b" value="xyz" /> <path id="paths"> <pathelement location="abc$/def" /> <pathelement location="abc$/ghi" /> </path> <pathconvert property="list" refid="paths" pathsep="${line.separator}" dirsep="/" /> <propertyregex property="list" input="${list}" override="true" regexp="${a}(.*)" replace="${b}\1" /> <echo message="${list}" /> I'd like to the pair xyz/def and xyz/ghi. Is this possible? I'm using Ant 1.8.

    Read the article

  • Get the property, as a string, from an Expression<Func<TModel,TProperty>>

    - by Jaxidian
    I use some strongly-typed expressions that get serialized to allow my UI code to have strongly-typed sorting and searching expressions. These are of type Expression<Func<TModel,TProperty>> and are used as such: SortOption.Field = (p => p.FirstName);. I've gotten this working perfectly for this simple case. The code that I'm using for parsing the "FirstName" property out of there is actually reusing some existing functionality in a third-party product that we use and it works great, until we start working with deeply-nested properties(SortOption.Field = (p => p.Address.State.Abbreviation);). This code has some very different assumptions in the need to support deeply-nested properties. As for what this code does, I don't really understand it and rather than changing that code, I figured I should just write from scratch this functionality. However, I don't know of a good way to do this. I suspect we can do something better than doing a ToString() and performing string parsing. So what's a good way to do this to handle the trivial and deeply-nested cases? Requirements: Given the expression p => p.FirstName I need a string of "FirstName". Given the expression p => p.Address.State.Abbreviation I need a string of "Address.State.Abbreviation" While it's not important for an answer to my question, I suspect my serialization/deserialization code could be useful to somebody else who finds this question in the future, so it is below. Again, this code is not important to the question - I just thought it might help somebody. Note that DynamicExpression.ParseLambda comes from the Dynamic LINQ stuff and Property.PropertyToString() is what this question is about. /// <summary> /// This defines a framework to pass, across serialized tiers, sorting logic to be performed. /// </summary> /// <typeparam name="TModel">This is the object type that you are filtering.</typeparam> /// <typeparam name="TProperty">This is the property on the object that you are filtering.</typeparam> [Serializable] public class SortOption<TModel, TProperty> : ISerializable where TModel : class { /// <summary> /// Convenience constructor. /// </summary> /// <param name="property">The property to sort.</param> /// <param name="isAscending">Indicates if the sorting should be ascending or descending</param> /// <param name="priority">Indicates the sorting priority where 0 is a higher priority than 10.</param> public SortOption(Expression<Func<TModel, TProperty>> property, bool isAscending = true, int priority = 0) { Property = property; IsAscending = isAscending; Priority = priority; } /// <summary> /// Default Constructor. /// </summary> public SortOption() : this(null) { } /// <summary> /// This is the field on the object to filter. /// </summary> public Expression<Func<TModel, TProperty>> Property { get; set; } /// <summary> /// This indicates if the sorting should be ascending or descending. /// </summary> public bool IsAscending { get; set; } /// <summary> /// This indicates the sorting priority where 0 is a higher priority than 10. /// </summary> public int Priority { get; set; } #region Implementation of ISerializable /// <summary> /// This is the constructor called when deserializing a SortOption. /// </summary> protected SortOption(SerializationInfo info, StreamingContext context) { IsAscending = info.GetBoolean("IsAscending"); Priority = info.GetInt32("Priority"); // We just persisted this by the PropertyName. So let's rebuild the Lambda Expression from that. Property = DynamicExpression.ParseLambda<TModel, TProperty>(info.GetString("Property"), default(TModel), default(TProperty)); } /// <summary> /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"/> with the data needed to serialize the target object. /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> to populate with data. </param> /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"/>) for this serialization. </param> public void GetObjectData(SerializationInfo info, StreamingContext context) { // Just stick the property name in there. We'll rebuild the expression based on that on the other end. info.AddValue("Property", Property.PropertyToString()); info.AddValue("IsAscending", IsAscending); info.AddValue("Priority", Priority); } #endregion }

    Read the article

  • FACEBOOK LINTER ERROR: value for property 'og:image:url' could not be parsed as type 'url'

    - by Martin Devarda
    I've read all threads in stack overflow about this issue, but my problem persists. THE PROBLEM IS ON THIS PAGE: http://www.organirama.it/minisite-demo/001.html THE PAGE CONTAINS THIS TAGS <meta property="og:title" content="A wonderful page" /> <meta property="og:type" content="video.movie" /> <meta property="og:url" content="http://www.organirama.com/minisite-demo/001.html" /> <meta property="og:image" content="http:/www.organirama.com/minisite-demo/photos-small/001.png" /> <meta property="og:site_name" content="Organirama"/> <meta property="fb:admins" content="1468447924"/> LINTER ERROR Object at URL 'http://www.organirama.com/minisite-demo/001.html' of type 'video.movie' is invalid because the given value 'http:/www.organirama.com/minisite-demo/photos-small/001.png' for property 'og:image:url' could not be parsed as type 'url'. WHAT I DISCOVERED The problem seems somehow related to the domain. Infact, if I make og:image point to another image on another domain, everything works.

    Read the article

  • Objective-C property getter

    - by Daniel
    What is technically wrong with the following: @property(nonatomic, assign) NSUInteger timestamp; @property(nonatomic, readonly, getter = timestamp) NSUInteger startTime; @property(nonatomic, assign) NSUInteger endTime; I am sure I can find a better way to organise this, but this is what I ended up with at one point in my project and I noticed that accessing the startTime property always returned 0, even when the timestamp property was set to a correct timestamp. It seems having set the getter of startTime to an existing property (timestamp), it is not forwarding the value of timestamp when I do: event.startTime => 0 event.timestamp => 1340920893 All these are timestamps by the way. Just a reminder, I know the above should have happened in my project but I don't understand why accessing startTime doesn't forward onto timestamp property. UPDATE In my implementation I am synthesising all of these properties: @synthesize timestamp, endTime, startTime; Please check an example object to use that demonstrates this at my gist on GitHub: https://gist.github.com/3013951

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >