Search Results

Search found 11996 results on 480 pages for 'dependency properties'.

Page 20/480 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • Declarative Data Load for Object Properties & .NET UI Controls

    This article details a new practice to prepare the .NET Business Objects using the data retrieved from the Database and binding them to .NET UI Controls dynamically using Reflection through centralized mapping between a typess Properties Vs Data-Columns Vs UI-Controls....Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Copying Properties between 2 Different Types&hellip;

    - by Shawn Cicoria
    I’m not sure where I had seen some of this base code, but this comes up time & time again on projects. Here’s a little method that copies all the R/W properties (public) between 2 distinct class definitions: It’s called as follows: private static void Test1() { MyClass obj1 = new MyClass() { Prop1 = "one", Prop2 = "two", Prop3 = 100 }; MyOtherClass obj2 = null; obj2 = CopyClass(obj1); Console.WriteLine(obj1); Console.WriteLine(obj2); } namespace Space1 { public class MyClass { public string Prop1 { get; set; } public string Prop2 { get; set; } public int Prop3 { get; set; } public override string ToString() { var rv = string.Format("MyClass: {0} Prop2: {1} Prop3 {2}", Prop1, Prop2, Prop3); return rv; } } } namespace Space2 { public class MyOtherClass { public string Prop1 { get; set; } public string Prop2 { get; set; } public int Prop3 { get; set; } public override string ToString() { var rv = string.Format("MyOtherClass: {0} Prop2: {1} Prop3 {2}", Prop1, Prop2, Prop3); return rv; } } Source of the method: /// /// Provides a Copy of Public fields between 2 distinct classes /// /// Source class name /// Target class name /// Instance of type Source /// An instance of type Target copying all public properties matching name from the Source. public static T CopyClass(S source) where T : new() { T target = default(T); BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; if (source == null) { return (T)target; } if (target == null) target = new T(); PropertyInfo[] objProperties = target.GetType().GetProperties(flags); foreach (PropertyInfo pi in objProperties) { string name = pi.Name; PropertyInfo sourceProp = source.GetType().GetProperty(name, flags); if (sourceProp == null) { throw new ApplicationException(string.Format("CopyClass - object type {0} & {1} mismatch in property:{2}", source.GetType(), target.GetType(), name)); } if (pi.CanWrite && sourceProp.CanRead) { object sourceValue = sourceProp.GetValue(source, null); pi.SetValue(target, sourceValue, null); } else { throw new ApplicationException(string.Format("CopyClass - can't read/write a property object types {0} & {1} property:{2}", source.GetType(), target.GetType(), name)); } } return target; }

    Read the article

  • Dependency Properties Made Easy

    ok so I found that for some reason I thought I did a post on this before and I couldn't find it. So I thought I would make a new post as simple as possible. Here is a simple dp:public readonly DependencyProperty ResistanceProperty = DependencyProperty.Register("Resistance", typeof(double), typeof(AnimatingPanelBase), null);public double Resistance{get{return (double)GetValue(ResistanceProperty);}set{SetValue(ResistanceProperty, value);}}Nice and simple right? why bother you ask, well the biggest...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • How do I iterate over the properties of an anonymous object in C#?

    - by Tomas Lycken
    I want to take an anonymous object as argument to a method, and then iterate over its properties to add each property/value to a a dynamic ExpandoObject. So what I need is to go from new { Prop1 = "first value", Prop2 = SomeObjectInstance, Prop3 = 1234 } to knowing names and values of each property, and being able to add them to the ExpandoObject. How do I accomplish this? Side note: This will be done in many of my unit tests (I'm using it to refactor away a lot of junk in the setup), so performance is to some extent relevant. I don't know enough about reflection to say for sure, but from what I've understood it's pretty performance heavy, so if it's possible I'd rather avoid it... Follow-up question: As I said, I'm taking this anonymous object as an argument to a method. What datatype should I use in the method's signature? Will all properties be available if I use object?

    Read the article

  • How to retrieve .properties?

    - by user1014523
    Im developing desktop java application using maven. I got a *.properties file that I need to retrive during execution (src/resources/application.properties). The only thing comes to my mind is to use: private Properties applicationProperties; applicationProperties.load(new BufferedInputStream(new FileInputStream("src/resources/application.properties"))); This would work if I run my application directly from IDE. I want to to keep outpout hierarchy clear, so I set maven to copy resources folder dircetly to target folder (which is a basedir for the output application). This way application.properties file won't load (since I have target/resources/application.properties but not target/src/resources/application.properties). What is the best way to manage resources so they work both when I debug from IDE and run builded jar file directly?

    Read the article

  • Why do C# automatic properties not support default values like VB 2010?

    - by Rob van Groenewoud
    Looking at the new VB 2010 features, I stumbled upon support for Auto-Implemented Properties. Since I'm working with C#, this seemed quite familiar, but I noticed that VB did add a feature I would love to have in C#: setting a arbitrary default value for the auto-implemented property: I really like the clean usage of auto-properties in C#. This would save us the effort of introducing a backing field and hooking it up to the property everytime we simply need a default value, thereby cluttering up the code unnecessarily. I was wondering why this wasn't introduced in C# as well? What could be the rationale for not doing this? Is a syntax discussion going on, or are there technical limitations to implementing this?

    Read the article

  • Pass Variable to Java Method from an Ant Target

    - by user200317
    At the moment I have a .properties file to store settings related to the framework. Example: default.auth.url=http://someserver-at008:8080/ default.screenshots=false default.dumpHTML=false And I have written a class to extract those values and here is the method of that class. public static String getResourceAsStream(String defaultProp) { String defaultPropValue = null; //String keys = null; try { InputStream inputStream = SeleniumDefaultProperties.class.getClassLoader().getResourceAsStream(PROP_FILE); Properties properties = new Properties(); //load the input stream using properties. properties.load(inputStream); defaultPropValue = properties.getProperty(defaultProp); }catch (IOException e) { log.error("Something wrong with .properties file, check the location.", e); } return defaultPropValue; } Throughout the application I use method like follows to just exact property needed, public String getBrowserDefaultCommand() { String bcmd = SeleniumDefaultProperties.getResourceAsStream("default.browser.command"); if(bcmd.equals("")) handleMissingConfigProperties(SeleniumDefaultProperties.getResourceAsStream("default.browser.command")); return bcmd; } But I have not decided do a change to this and use ant and pass a parameter instead of using it from .properties file. I was wondering how could I pass a value to a Java Method using ANT. Non of these classes have Main methods and will not have any main. Due to this I was unable to use it as a java system properties. Thanks in advance.

    Read the article

  • Dependency issue installing PostGIS on CentOs 6.3

    - by Nyxynyx
    I am new to linux and is trying to install PostGIS2 after successfully installing PostgreSQL 9.1. The machine is running CentOS 6.3 and has cPanel installed. Problem: When I tried installing PostGIS using yum: yum install postgis2_91 postgis2_91-utils, I get the dependency error below. How should I solve this dependency problem and install PostGIS? Thank you so much! --> Finished Dependency Resolution Error: Package: postgis2_91-utils-2.0.1-1.rhel6.i686 (pgdg91) Requires: perl-DBD-Pg Error: Package: gdal-1.7.2-1.el6.i686 (pgdg91) Requires: libdapserver.so.7 Error: Package: gdal-1.7.2-1.el6.i686 (pgdg91) Requires: libdap.so.11 Error: Package: gdal-1.7.2-1.el6.i686 (pgdg91) Requires: libgeotiff.so.1.2 Error: Package: gdal-1.7.2-1.el6.i686 (pgdg91) Requires: libnetcdf.so.6 Error: Package: gdal-1.7.2-1.el6.i686 (pgdg91) Requires: libdapclient.so.3 Error: Package: gdal-1.7.2-1.el6.i686 (pgdg91) Requires: libhdf5.so.6 Error: Package: gdal-1.7.2-1.el6.i686 (pgdg91) Requires: librx.so.0 Error: Package: gdal-1.7.2-1.el6.i686 (pgdg91) Requires: libogdi.so.3 Error: Package: gdal-1.7.2-1.el6.i686 (pgdg91) Requires: libcfitsio.so.0 You could try using --skip-broken to work around the problem ** Found 6 pre-existing rpmdb problem(s), 'yum check' output follows: bandmin-1.6.1-5.noarch has missing requires of perl(bandmin.conf) bandmin-1.6.1-5.noarch has missing requires of perl(bmversion.pl) bandmin-1.6.1-5.noarch has missing requires of perl(services.conf) exim-4.77-1.i386 has missing requires of perl(SafeFile) frontpage-2002-SR1.2.i386 has missing requires of libexpat.so.0 sendmail-cf-8.14.4-8.el6.noarch has missing requires of sendmail = ('0', '8.14.4', '8.el6') Update An error still remains: Error: Package: postgis2_91-utils-2.0.1-1.rhel6.i686 (pgdg91) Requires: perl-DBD-Pg You could try using --skip-broken to work around the problem ** Found 6 pre-existing rpmdb problem(s), 'yum check' output follows: bandmin-1.6.1-5.noarch has missing requires of perl(bandmin.conf) bandmin-1.6.1-5.noarch has missing requires of perl(bmversion.pl) bandmin-1.6.1-5.noarch has missing requires of perl(services.conf) exim-4.77-1.i386 has missing requires of perl(SafeFile) frontpage-2002-SR1.2.i386 has missing requires of libexpat.so.0 sendmail-cf-8.14.4-8.el6.noarch has missing requires of sendmail = ('0', '8.14.4', '8.el6')

    Read the article

  • Handling null values and missing object properties in Silverlight 4

    - by PeterTweed
    Before Silverlight 4 to bind a data object to the UI and display a message associated with either a null value or if the binding path was wrong, you would need to write a Converter.  In Silverlight 4 we find the addition of the markup extensions TargetNullValue and FallbackValue that allows us to display a value when a null value is found in the bound to property and display a value when the property being bound to is not found. This post will show you how to use both markup extensions. Steps: 1. Create a new Silverlight 4 application 2. In the body of the MainPage.xaml.cs file replace the MainPage class with the following code:     public partial class MainPage : UserControl     {         public MainPage()         {             InitializeComponent();             this.Loaded += new RoutedEventHandler(MainPage_Loaded);         }           void MainPage_Loaded(object sender, RoutedEventArgs e)         {             person p = new person() { NameValue = "Peter Tweed" };             this.DataContext = p;         }     }       public class person     {         public string NameValue { get; set; }         public string TitleValue { get; set; }     } This code defines a class called person with two properties.  A new instance of the class is created, only defining the value for one of the properties and bound to the DataContext of the page. 3.  In the MainPage.xaml file copy the following XAML into the LayoutRoot grid:         <Grid.RowDefinitions>             <RowDefinition Height="60*" />             <RowDefinition Height="28*" />             <RowDefinition Height="28*" />             <RowDefinition Height="30*" />             <RowDefinition Height="154*" />         </Grid.RowDefinitions>         <Grid.ColumnDefinitions>             <ColumnDefinition Width="86*" />             <ColumnDefinition Width="314*" />         </Grid.ColumnDefinitions>         <TextBlock Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="32,0,0,0" Name="textBlock1" Text="Name Value:" VerticalAlignment="Top" />         <TextBlock Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="32,0,0,0" Name="textBlock2" Text="Title Value:" VerticalAlignment="Top" />         <TextBlock Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="32,0,0,0" Name="textBlock3" Text="Non Existant Value:" VerticalAlignment="Top" />         <TextBlock Grid.Column="1" Grid.Row="1" Height="23" HorizontalAlignment="Left" Name="textBlock4" Text="{Binding NameValue, TargetNullValue='No Name!!!!!!!'}" VerticalAlignment="Top" Margin="6,0,0,0" />         <TextBlock Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Name="textBlock5" Text="{Binding TitleValue, TargetNullValue='No Title!!!!!!!'}" VerticalAlignment="Top" Margin="6,0,0,0" />         <TextBlock Grid.Column="1" Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="6,0,0,0" Name="textBlock6" Text="{Binding AgeValue, FallbackValue='No such property!'}" VerticalAlignment="Top" />    This XAML defines three textblocks – two of which use the TargetNull and one that uses the FallbackValue markup extensions.  4. Run the application and see the person name displayed as defined for the person object, the expected string displayed for the TargetNullValue when no value exists for the boudn property and the expected string displayed for the FallbackValue when the property bound to is not found on the bound object. It's that easy!

    Read the article

  • Eclipse: Cannot install CDT because of a conflicting dependency

    - by MarkZar
    my eclipse has been configured for Java and pydev, now i want to configure C/C++ development tools with Eclipse. i dont want to download the whole Eclipse IDE for C/C++ Developers, for it is not convenient. so i decided to install CDT in my Eclipse. Help == Install New Software, then input http://download.eclipse.org/tools/cdt/releases/indigo, waited for a while, and chose the following CDT Main Features, CDT Optional Features, and Next, then an error occurred. Cannot complete the install because of a conflicting dependency. Software being installed: C/C++ DSF GDB Debugger Integration 4.0.0.201106081058 (org.eclipse.cdt.gnu.dsf.feature.group 4.0.0.201106081058) Software being installed: C/C++ Development Tools SDK 8.0.2.201202111925 (org.eclipse.cdt.sdk.feature.group 8.0.2.201202111925) Only one of the following can be installed at once: GDB DSF Debugger Integration Core 4.0.0.201106081058 (org.eclipse.cdt.dsf.gdb 4.0.0.201106081058) GDB DSF Debugger Integration Core 4.0.2.201202111925 (org.eclipse.cdt.dsf.gdb 4.0.2.201202111925) GDB DSF Debugger Integration Core 4.0.1.201109151620 (org.eclipse.cdt.dsf.gdb 4.0.1.201109151620) Cannot satisfy dependency: From: C/C++ Development Tools 8.0.2.201202111925 (org.eclipse.cdt.feature.group 8.0.2.201202111925) To: org.eclipse.cdt.gnu.dsf.feature.group [4.0.1.201202111925] Cannot satisfy dependency: From: C/C++ DSF GDB Debugger Integration 4.0.0.201106081058 (org.eclipse.cdt.gnu.dsf.feature.group 4.0.0.201106081058) To: org.eclipse.cdt.dsf.gdb [4.0.0.201106081058] Cannot satisfy dependency: From: C/C++ DSF GDB Debugger Integration 4.0.1.201202111925 (org.eclipse.cdt.gnu.dsf.feature.group 4.0.1.201202111925) To: org.eclipse.cdt.dsf.gdb [4.0.2.201202111925] Cannot satisfy dependency: From: C/C++ Development Tools SDK 8.0.2.201202111925 (org.eclipse.cdt.sdk.feature.group 8.0.2.201202111925) To: org.eclipse.cdt.feature.group [8.0.2.201202111925] i have googled for a lot of time, but still cannot find a valid solution. can anyone give a hand to me? thanks a lot!

    Read the article

  • What are the CS fundamentals behind package/dependency management?

    - by Frep D-Oronge
    Often I hear about situations where companies are developing extensable in house software (the dreaded enterprise 'framework') which is supposed to support multiple 'plugins' from diffirent teams. Usually this ends up being a half baked solution that does not really work due to compatibility prolems between addins, or between addins and the framework itself. Usually this means QA have to 'rubber stamp' a global set of versions accross all plugins, or more usually plugins are released and stuff breaks in nasty ways. This problem has been solved before however, for example the package management systems like apt for debian linux. I suspect that the reason it works is that it is built from the start on a known 'Computer Science-y' concept. My question is what is it?

    Read the article

  • When should I use Dependency Injection and when utility methods?

    - by Roman
    I have a Java EE project with Spring IoC container. I've just found in Utils class static method sendMail(long list of params). I don't know why but I feel that it would look better if we had separate class (Spring bean with singleton scope) which will be responsible for sending email. But I can't find any arguments which can prove my position. So, are there any pros (or cons) in using DI in this (rather general) situation?

    Read the article

  • AccessControlException: access denied - caller function failed to load properties file

    - by Michael Mao
    Hi all: I am having a jar archive environment which is gonna call my class in a folder like this: java -jar "emarket.jar" ../tournament 100 My compiled class is deployed into the ../tournament folder, this command runs well. After I changed my code to load a properties file, it gets the following exception message: Exception in thread "main" java.security.AccessControlException: access denied (java.io.FilePermission agent.properties read) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkRead(Unknown Source) at java.io.FileInputStream.<init>(Unknown Source) at java.io.FileInputStream.<init>(Unknown Source) at Agent10479475.getPropertiesFromConfigFile(Agent10479475.java:110) at Agent10479475.<init>(Agent10479475.java:100) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at emarket.client.EmarketSandbox.instantiateClientObjects(EmarketSandbox.java:92) at emarket.client.EmarketSandbox.<init>(EmarketSandbox.java:27) at emarket.client.EmarketSandbox.main(EmarketSandbox.java:166) I am wondering why this security checking will fail. I issue the getPropertitiesFromConfigFile() function inside my class's default constructor, like this: public class Agent10479475 extends AbstractClientAgent { //default constructor public Agent10479475() { //set all properties to their default values in constructor FT_THRESHOLD = 400; FT_THRESHOLD_MARGIN = 50; printOut("Now loading properties from a config file...", ""); getPropertiesFromConfigFile(); printOut("Finished loading",""); } private void getPropertiesFromConfigFile() { Properties props = new Properties(); try { props.load(new FileInputStream("agent.properties")); FT_THRESHOLD = Long.parseLong(props.getProperty("FT_THRESHOLD")); FT_THRESHOLD_MARGIN = Long.parseLong(props.getProperty("FT_THRESHOLD_MARGIN ")); } catch(java.io.FileNotFoundException fnfex) { printOut("CANNOT FIND PROPERTIES FILE :", fnfex); } catch(java.io.IOException ioex) { printOut("IOEXCEPTION OCCURED :", ioex); } } } My class is loading its own .properties file under the same folder. why would the Java environment complains about such a denial of access? Must I config the emarket.client.EmarketSandbox class, which is not written by me and stored inside the emarket.jar, to access my agent.properties file? Any hints or suggestions is much appreciated. Many thanks in advance.

    Read the article

  • Dependency Injection with @Inject in Weld (JSR-299 RI). How is the corresponding @Produces found?

    - by Thorbjørn Ravn Andersen
    I have played with the JSR-299 Reference Implementation "Weld" with the purpose of using it in a stand-alone application, and I have had a look at the documentation, and marveled at the magic. My question is how the producer of a given object to be @Inject'ed is found? Either the java compiler produces hints for annotations which is easily found by the classloader, or the complete classpath must be traversed loading all classes to see what they do which sounds highly inefficient to me, or it is a completely different approach. What is the trick?

    Read the article

  • Maven test dependency in multi module project

    - by user209947
    I use maven to build a multi module project. My module 2 depends on Module 1 src at compile scope and module 1 tests in test scope. Module 2 - <dependency> <groupId>blah</groupId> <artifactId>MODULE1</artifactId> <version>blah</version> <classifier>tests</classifier> <scope>test</scope> </dependency> This works fine. Say my module 3 depends on Module1 src and tests at compile time. Module 3 - <dependency> <groupId>blah</groupId> <artifactId>MODULE1</artifactId> <version>blah</version> <classifier>tests</classifier> <scope>complie</scope> </dependency> When I run mvn clean install, my build runs till module 3, fails at module 3 as it couldnt resolve the module 1 test dependency. Then I do a mvn install on module 3 alone, go back and run mvn install on my parent pom to make it build. How can i fix this?

    Read the article

  • Can I assign a maven dependency to a specific repo?

    - by mds
    So I have several large projects that use up to 8 different external repos, all specified in settings.xml rather than in poms. A lot of our internal dependencies are snapshots, so this obviously causes a lot of checking for updates across several external repos, when they are all in our internal repo. So my question is, is there a way to setup a profile/filter or anything similar where I can ensure that an update will only be checked for in a specific repo(s)? This is all in the spirit of better/quicker builds. Thanks!

    Read the article

  • WPF - How do I use the UserControl with a dependency property and view model?

    - by user320849
    Hello, My goal is to have a user select a year and a month. Translate the selection into a date and have the user control send the date back to my view model. That part works for me....However, I cannot get the ViewModel's initial date to set those drop downs. public static readonly DependencyProperty Date = DependencyProperty.Register("ReturnDate", typeof(DateTime), typeof(DatePicker), new FrameworkPropertyMetadata{BindsTwoWayByDefault = true,}); public DateTime ReturnDate { get { return Convert.ToDateTime(GetValue(Date)); } set { SetDropDowns(value); SetValue(Date, value); } } The SetDropDowns(value) just sets the selected items on the combo boxes, however, the program never makes it to that method. On the view I am using: <cc1:DatePicker ReturnDate="{Binding Path=StartDate, Mode=TwoWay}" IsStart="True" /> If this has been answered, then my bad. I looked around and didn't see anything that worked for me. Thus, when the program loads how do I get the value from the view model to a method in order to set the combo boxes? Thanks, -Scott

    Read the article

  • Maven - add dependency on artifact source

    - by Jacob Hansson
    I have two maven modules, one that ends up as a jar, and one war that depends on that jar. I want the jar module to package it's source code together with the compiled classes in the jar, so that the second module is able to access it. I have tried using the maven-source-plugin, but I am confused as to how to add a dependency on the output of that. It seems that the dependency by default goes to the compiled jar, and not the source-code jar (ending with "-source.jar") that maven-source-plugin creates. How do I add the "-source.jar" as a dependency, while still preserving the dependency on the compiled sources?

    Read the article

  • Maven. What to do with "homeless" jars?

    - by Jake
    I have some proprietary.jar that I need to include in my project, but I don't wish to install it to the local repository. What I did initially was to put the jar into version control in my project's lib/ folder, and then specify the Maven dependency as: <!-- LOCAL DEPENDENCY --> <dependency> <groupId>topsecret</groupId> <artifactId>proprietary</artifactId> <version>0.0.1</version> <scope>system</scope> <systemPath>${basedir}/lib/java/proprietary.jar</systemPath> </dependency> However, this becomes a big problem when my project becomes someone else's dependency. Maven will not be able to validate this POM because the path is not absolute. What is the best way to overcome this problem?

    Read the article

  • Is it possible to use Dependency Injection/IoC on an ASP.NET MVC FilterAttribute ?

    - by Pure.Krome
    Hi folks, I've got a simple custom FilterAttribute which I use decorate various ActionMethods. eg. [AcceptVerbs(HttpVerbs.Get)] [MyCustomFilter] public ActionResult Bar(...) { ... } Now, I wish to add some logging to this CustomFilter Action .. so being a good boy, I'm using DI/IoC ... and as such wish to use this pattern for my custom FilterAttribute. So if i have the following... ILoggingService and wish to add this my custom FilterAttribute .. i'm not sure how. Like, it's easy for me to do the following... public class MyCustomFilterAttribute : FilterAttribute { public MyCustomFilterAttribute(ILoggingService loggingService) { ... } } But the compiler errors saying the attribute which decorates my ActionMethod (listed above...) requires 1 arg .. so i'm just not sure what to do :(

    Read the article

  • Java/Eclipse Dependency mapping / graphing tool - Where is a JAR being used in my project?

    - by gav
    Hi All, I have a JAR on the build path of a medium sized Java application and I would like to know where it's used. At the most basic level if someone could tell me how to 'Find References' for a Jar that would be great. Whilst I'm looking at dependencies it would be great to find a tool that would map all of my package / external library usages and graph them. I used to have a free plug-in for eclipse that did just that but I haven't been able to rediscover it. Thanks, Gav

    Read the article

  • php sort properties of object

    - by lannoo
    I want to sort the properties of an object so I can loop through them in a defined order. for example: I have an object 'book' with the following properties: 'id', 'title', 'author', 'date'. Now i want to loop through these properties like this: foreach($book as $prop=>$val) //do something now the order of the loop has to be 'title', then 'author', 'date' and 'id' How would one do this? (I can't change the order of the properties in the class of the object because there arent any properties defined there, I get the object from the database with 'MyActiveRecord')

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >