w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Selecting nested navigation properties will generate the same SQL statement when selecting separate navigation properties
In a nutshell yes, it has to otherwise there is no way for you to traverse to that navigation property EG, the only way to access AccountDefinition.SDOrganization.AaaPostalAddresses is if SDOrganization is not null. Having said that my personal preference is to make this intermediate inclusion explicit by listing it anyway. While this has no functional benefit its a reminder that this property will also be returned

Categories : Asp Net Mvc

MSBuild: how to use the nested properties like in Ant
Here are some of the "tricks". Save the below xml into a file called "MSBuild_Conditionals.xml" <?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="AllTargetsWrapper"> <!-- --> <PropertyGroup> <MyFavoriteFoodComplement Condition="'$(FavoriteFood)'=='PeanutButter'">Jelly</MyFavoriteFoodComplement> <MyFavoriteFoodComplement Condition="'$(FavoriteFood)'=='Steak'">Potatoes</MyFavoriteFoodComplement> <!-- Check to see if a match was given (by seeing if the variable value is an empty string), if no match (aka, an empty string), do a default --> <MyFavoriteFoodComplement Condition="'$(MyFavoriteFoodComplement)'==''">Cookie

Categories : Ant

How to build nested properties from key strings
Try the following: function objectBuild(object, keys, value) { for (var i = 0; i < keys.length-1; i++) { if (!object.hasOwnProperty(keys[i])) object[keys[i]] = {}; object = object[keys[i]]; } object[keys[keys.length-1]] = value; } Example usage (see it in action): var object = {}; objectBuild(object, ["foo", "moreFoo"], "bar"); objectBuild(object, ["foo", "ultraFoo"], "bigBar"); // object --> {foo: {moreFoo: "bar", ultraFoo: "bigBar}}

Categories : Javascript

Initializing nested object properties
Without requiring changes to your Employee class, you could use object initializers: var myEmployee = new Employee { Name = "Jhon", Insurance = new Insurance { PolicyId = 123, PolicyName = "Life Time" } }; Alternatively, and maybe preferably, you can have the Employee class create a new instance of Insurance either in its constructor (as in the other answers), or one other option would be to do it in the Insurance property getter itself, so it's instantiated only if you use it. Here's an example of the latter: class Employee { private Insurance insurance; public Insurance Insurance { get { if (insurance == null) { insurance = new Insurance(); } return insurance

Categories : C#

Can python objects have nested properties?
The traceback is because your property doesn't have a return statement, hence it returns NoneType, which obviously can't have attributes of its own. Your property would probably need to return an instance of a different class, that has its own prop attribute. Something like this: class a(): def __init__(self): self.b = b() @property def prop(self): print("hello from object.prop") return self.b class b(): @property def prop(self): print("Hello from object.prop.prop") x = a() print x.prop.prop >> hello from object.prop >> Hello from object.prop.prop >> None

Categories : Python

AngularJS binding to nested model properties
I'm not quite sure if your trying to get a list property from the model or if you're trying to create a Dynamic Set Model? As for the list property that isn't very difficult just append an array to the model or even append some object with a list property. Multiple Models Or are you looking to use multiple 'models'? function MyCtrl($scope, $filter) { $scope.Model = { SubModel : { // Submodel stuff }, FooModel : { // Submodel stuff } } } EDIT: I completely missed the point of the question my first try. The question really wanted to render different content based on a property's type (if that's not what you wanted I apologize) Plunker Example HTML <div ng-app ng-controller="MyCtrl"> <div ng-i

Categories : Javascript

ModelMetadata.FromStringExpression doesn't work on nested properties
You have to create a new custom HtmlHelper class that uses a new Model or new ViewData, so : public static class CustomHtmlHelperExtensions { public static HtmlHelper CustomHtmlHelper(this HtmlHelper helper, Object model) { ViewDataDictionary customViewData = new ViewDataDictionary(helper.ViewData) { Model = model }; ViewDataContainer customViewDataContainer = new ViewDataContainer(customViewData); ViewContext customViewContext = new ViewContext(helper.ViewContext.Controller.ControllerContext, helper.ViewContext.View, customViewData, helper.ViewContext.TempData, helper.ViewContext.Writer); return new HtmlHelper(customViewContext, customViewDataContainer, helper.RouteCollection); } private class ViewDataContainer : IViewDataCo

Categories : Asp Net Mvc

Dynamic linq order by on nested property with null properties
static void Main(string[] args) { var data = new List<MyType>() { new MyType() { SomeProperty = new Inner() { NestedProperty = "2" }}, new MyType() { SomeProperty = new Inner() { NestedProperty = "1" }}, new MyType() { SomeProperty = new Inner() { NestedProperty = "3" }}, new MyType(), }.AsQueryable(); var sorted = data.OrderBy(x => GetPropertyValue(x, "SomeProperty.NestedProperty")); foreach (var myType in sorted) { try { Console.WriteLine(myType.SomeProperty.NestedProperty); } catch (Exception e) { Console.WriteLine("Null"); } } } public static object GetPropertyValue(object obj, string propertyName) { try { foreach (var prop in propertyName.Spl

Categories : C#

How should i create datacontract for a List of class which contain nested list of classes as properties
What you have in your example is fine and will automatically serialize correctly. I recommend attributing your classes with [DataContract] and your properties with [DataMember] for explicitness.

Categories : Wcf

Will calling a nested Navigation Property retrieve all the parent navigation properties?
You can see what query is executed in the SQL Server Profiler (if using SQL Server), or you can have a look at some Entity Framework Tracing Provider. http://code.msdn.microsoft.com/EFProviderWrappers-c0b88f32 This will give you lots of information and understanding...

Categories : Entity Framework

Struts 1.1 nested and in combination
Use <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> and the code will look like <c:choose> <c:when test="${element.method1 == true}"> <c:choose> <c:when test="${element.method2 == true}"> <span style="color:green;"><c:out value="${element.prop1}/></span> </c:when> <c:otherwise> <span style="color:red;"><c:out value="${element.prop1}/></span> </c:otherwise> </c:choose> </c:when> <c:otherwise> <span style="color:black;"><c:out value="${element.prop1}/></span> </c:otherwise> </c:choose>

Categories : Java

How to change the existing custom properties/properties in .pptx files using Apache POI
You'll want to take a look at the JavaDocs for XSLFSlideShow. From there, you'll see it has a method getProperties(). That returns a POIXMLProperties object, which lets you get at the three different kinds of properties that an OOXML file (such as .pptx) has - core, extended and custom. Next, you'll need to work out what kind of properties the ones you want to change are. Assuming you wanted to change the title (a core property), you'd do something like: OPCPackage pkg = OPCPackage.open("input.pptx"); XSLFSlideShow slideshow = new XSLFSlideShow(pkg); POIXMLProperties props = slideshow.getProperties(); CoreProperties cp = props.getCoreProperties(); cp.setTitle("I changed the title!"); FileOutputStream out = new FileOutputStream("output.pptx"); slideshow.write(out); out.close(); pkg.clos

Categories : Java

Load all Appointment Properties, including extended properties, in Exchange 2010
No, it is not possible. You can use predefined property sets like: PropertySet.FirstClassProperties to get the known set of properties. Getting extended properties this way is not supported at all. You have to specify explicitly which extended properties you want to access. For example: ItemView view = new ItemView(10); ExtendedPropertyDefinition extendedPropertyDefinition = new ExtendedPropertyDefinition("Expiration Date", MapiPropertyType.String); view.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.Subject,extendedPropertyDefinition);

Categories : Api

How to load properties from config.properties in multithreaded environment in JAVA
For me this would be simply enough public class DirecoryWatcher{ private static String FOLDER; public static synchronized getFolder(){ if(FOLDER == null){ // FOLDER = your loading code } return FOLDER; } } Make sure to assign the value you read from the file to your static field, so you make sure you read it only once. Also, synchronized methods is a good practice for accessing resources, it's not completely mandatory for this case, since you're only reading the file. You can also make this approach extensible to read any property given as argument. I hardcoded FOLDER for the sake of clarity. public class DirectoryWatcher{ private static Map<String,String> properties = new HashMap<String,String>(); public static syn

Categories : Java

How to do arithmetic in Spring properties, with values from a properties file?
If you're using Spring 3.0 or later, you can use the property inside the SpEL expression like this: <property name="validationQueryTimeout" value="#{${jdbc.timeout}/1000}" />

Categories : Java

Convert Entity Framework Properties to Dependency Properties
Firstly. Really bad idea to do this, not because it is hard, but due to that you need to inherit DependencyObject. DependencyObject is an STA Threaded class. You won't be able to use a worker thread to instantiate your objects, which means you can't use a worker thread to use Entity Framework. Now, I suggest you use the MVVM pattern with WPF. You should have a View bind to a ViewModel, which then binds to your Entity Framework POCO objects. You can try IValidateObject for you validation MVC4 - Custom validation via IValidateObject Validate method not working I personally however prefer the FluentValidation library.

Categories : Wpf

Ant Build: Not finding local.properties or build_web_extras.properties
UPDATE 1) Initially at the beginning of the build output that you posted there was Unknown argument: -build. I suppose that changing the build target name fixed it. Otherwise you need to state clearly which commands you're running and in which context. 2) The build seems to depend on the environment and the local.properties file is missing. You can either make sure it's there or ensure that you're pointing at the right location. This could also be related to some properties not being imported properly, but only you would know that for sure.. What happens when you rename the -build target to just build? See the concept of hidden/private targets: http://ant.1045680.n5.nabble.com/private-targets-td1350568.html http://www.jrenard.info/blog/creating-private-targets-with-ant.html http://

Categories : Apache

How to bind a shape's properties to a business model's properties
Create an ObservableCollection of Section type objects in your ViewModel. ObservableCollection<Section> _col; public ObservableCollection<Section> Sections { get { return _col; } set { _col = value; OnPropertyChanged("Sections"); } } and Bind it in your XAML as following <ItemsControl Name="itemsControl" ItemsSource="{Binding Path=Sections}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas Background="White" Width="500" Height="500" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <Rectangle Fill="Red" Width="{Binding Width}" Height="{Binding Height}" /> </DataTemplate> </ItemsControl.ItemTem

Categories : C#

Restrict access of the main obj to the properties of its properties in Javascript
I'm still not very sure what you are asking, but this is what i came up with. I made two JS classes to demonstrate what you are saying. function Owner(name) { this.Name = name; this.ChangeName = function (newName) { this.Name = newName; return this; }; } function Car(make, model, owner) { this.Make = make; this.Model = model; this.Owner = owner; this.UpdateMake = function (newMake) { this.Make = newMake; return this; }; this.UpdateModel = function (newModel) { this.Model = newModel; return this; }; this.UpdateOwner = function (newOwner) { this.Owner = newOwner; return this; }; } Here's the fiddle: http://jsfiddle.net/whytheday/zz45L/18/ Car would not have access to Ow

Categories : Javascript

Javascript Object and Properties: Adding & Accessing Properties
You're missing a comma after your dev1 object: var device = { dev1 : { "version" : "1.0", "name" : "AIR" }, dev2 : { "version" : "1.0", "name" : "BEE" } } For your question about adding keys, you would want to use dot-notation when possible, and array-notation for variable key names: var newKey = "health"; device.dev1[newKey] = newValue;

Categories : Javascript

Can I put comments in between or after multiline properties in a Java Properties file?
Unfortunately its not possible as Java properties file can have only single line # comments. However you might be aware that you can also define property in xml format and XML syntax will let you enter multi-line comments. If you decide to give XML a chance then you will need to call Properties#loadFromXML(InputStream) to load your XML property file.

Categories : Java

Fatal error: Cannot redeclare class Properties ....Properties.php
You might be including Properties.php in your other php files more than once. First make sure that you're not declaring class Properties twice in Properties.php. Then, you need to check all of your includes. I strongly recommend you to check error stack using xdebug or anything. Then you can find out what is this error coming from. You should use include_once whenever you want to include properties.php. (Because it contains a class, and a class cannot be redeclared)

Categories : PHP

How to mutualize appenders properties in log4j.properties file?
Try to implement your custom default Appender and then use it instead RollingFileAppender log4j.logger.FOO=DEBUG, fileFOO log4j.appender.fileFOO=me.project.MyRollingFileAppender log4j.appender.fileFOO.File=/some/path/file-FOO.log public class MyRollingFileAppender extends RollingFileAppender { public MyRollingFileAppender() { super(); init(); } public MyRollingFileAppender(Layout layout, String filename) throws IOException { super(layout, filename); init(); } public MyRollingFileAppender(Layout layout, String filename, boolean append) throws IOException { super(layout, filename, append); init(); } private void init() { this.setMaxFileSize("5MB"); this.setMaxBackupIndex(20); this.setLayout( new PatternLayout("%d %-5p ~ %m%n"))

Categories : Java

Possible to add custom properties on a $resource factory and propagate changes to those properties?
It's not angular way. If you want create service - create service, angular have instruments for this, you can read info here about this. Factories should't have logic. So create in your service methods login, logout etc, and with help of $http send request to your server.

Categories : Angularjs

how can I recognize object properties vs datatype properties?
On Object and Datatype Properties In Protégé there are are different tabs for creating Object Properties and Datatype Properties. If a property should relate individuals to individuals, then it needs to be an object property, and if it relates individuals to literals, then it needs to be a datatype property. If you have a property hasEdition whose domain is Book, then the question becomes what the range should be. If you expect triples like: Book72 hasEdition "1"^^xsd:int Book16 hasEdition "3"^^xsd:int where the value are literals, then hasEdition should be a datatype property. If, on the other hand, you have a class Edition with some particular individuals, e.g., Edition a owl:Class . first a Edition . second a Edition . third a Edition . … so that you can have Book72 h

Categories : Misc

Java Properties - Global and local properties
The java properties object is a Hashtable. If you read the properties for your main configuration file and then read a second properties file into the same object it will override the existing properties if they exist in both places, or add new ones if they don't already exist. Properties that are only found in the original file will remain as well.

Categories : Java

JQuery selector for finding a nested span within a nested class is not working
I don't see any problem with your code at the moment, let's reformat it a bit: var tabs = $('.collapse').not('.in'); console.log("tabs.length: " + tabs.length); tabs.each(function () { var $this = $(this), thisErrors = $this.find('.field-validation-error'), thisId = '#' + $this.attr('id'); console.log("current tab ID: " + thisId); console.log("number of errors: " + thisErrors.length); if (thisErrors.length) { $(thisId).collapse('show'); } }); Or working fiddle: http://jsfiddle.net/Rq8y7/ Does it work now? And what's the debug message in console after you run above code?

Categories : Jquery

How can I bind data from nested List<> objects to nested ListView controls?
You can bind the datasource of your inner list view to a property of the items bound to your outer listview. However, to do that the inner listview as to be in the itemtemplate of the outer listview. See the code below and note the DataSource='<%# Eval("Labels_color") %>' attribute for the inner list view. <asp:ListView ID="ListView_Orp_Results" runat="server" ItemPlaceholderID="itemPlaceholder"> <LayoutTemplate> <div id="outer_result_container"> <div id="itemPlaceholder" /> </div> </LayoutTemplate> <ItemTemplate> <div id="result_photo">...</div> <div id="result_category">...</div> <div id="result_detector">...</div> <div id="inner_result_container" runat="server"

Categories : Asp Net

Parsing a flattly-written nested text template into a usable nested data structure for N levels
Replaces each ">" with a tab. Output is pretty much exactly as your brute force output. (file.txt is your template file as above) test = open("file.txt", "r") for line in test: print line.replace(">", " ") #print line

Categories : Python

nested json with jQuery: create List of nested item
Your problem is that institut is an array containing a single object, so you can reference that single object using institut[0]. This will work: $.each(data.fakultaeten, function (key, value) { var mother = "<li id='first'>" + value.name + "<ul>"; $.each(value.institut[0], function (key1, value1) { alert(key1); }); }); Here is a working example

Categories : Jquery

MySQL - Reference main query in nested select (need to be nested)
This cannot work. SELECT clause is always evaluated at the end of the execution chain, @teamg_id variable will always be 0 in the nested subquery. Try this query, it is not tested (I can't see your data, playing whith sample data always helps), but probably it gives desired results. I commented out some parts and add one join condition. /* SET @teamg_id := 0; */ SELECT /* @teamg_id := player.team_id, */ player.team_id AS player_team, event.local_team_id AS local_team, event.visitor_team_id AS visitor_team, action.unique_id AS action_id, action.player_id AS player_id, player.name AS player_name, playerindex.rank AS player_pos, playerindex.ses_var_nest AS ses_var_nest FROM er_players player

Categories : Mysql

Avoiding nested each loops when handling nested JSON data
JSON is "just" javascript object literals. You can skip the jQuery call, and just reference the objects and arrays directly after you parse it. obj.custom_sql_rule[0].something_else[0]; of course, your JSON is a bit oddly-formed. If at all possible, don't arbitrarily mix objects {} and arrays [] . Use the latter when you have lists of identical objects or primitive data, and the former when you have named properties. And once you have a valid javascript object, you can just iterate through its properties. for(var sqlProp in jsonObj) { if(jsonObj[sqlProp].error) { errorsContainer.append("<div>" + jsonObj[sqlProp].error + "</div>"); } }

Categories : Javascript

How to insert nested lists (or nested block elements) into RichTextBlock?
Ok Ill start with silverlight. There was a TreeView Control in silverlight that would have exactly solved your problem. Link to tree view example But since we already know that winRt is a subset of API's these controls have been removed for metro app. More over microsofts design policy regarding the Type Of scenario you are mentioning has changed to : Semantic Zoom For Metro Apps So i advise if your app requirement is like that Either go with the richtextbox or use Grids with Rows and columns Which ever suits your coding best. One more way is to use third party library for tree structure . Syncfusion tree control Syncfusion has a tree control you can try out in the Demo. Even there are more third party tool but none are free not even he above one. Please Let me know if any more co

Categories : HTML

How Can I Convert Nested YAML to nested Arrays and OpenStructs in Ruby
There is the solution (https://github.com/jsuchal/hashugar) i often use. opts = Hashugar.new({:a => 1, 'b' => {:c => 2, :d => [3, 4, {:e => 5}]}}) But you also need to do: opts.b.d.last.e I do not understand how do you want to name array's getters. As Arup Rakshit sayed: give us yaml example and expected output or behavior.

Categories : Ruby

Set SuiteClassess from Properties file and indtentify properties file in command line
I havent used JUnit so cannot give the code for SuiteClasses. About passing the properties file name from command line - you can pass that to the main() method and add logic in SelectedProperties to read the properties file and split the comma separated values for "test" property. And then pass that as an array to the SuiteClasses. I actually implemented similar idea using TestNG. But instead of passing the classes from properties file, i do it from excel sheet. The sheet has class names and execution flag columns. Based on the execution flags, the TestNG xml is created dynamically and executed.

Categories : Java

Idiomatic Emberjs for nested routes but non-nested templates
You could define the parent template to just display the outlet and have an index route which will get displayed inside that. Then for the nested resource you can do the same thing. <script type="text/x-handlebars" data-template-name="user"> {{outlet}} </script> <script type="text/x-handlebars" data-template-name="user/index"> <h2>user/index</h2> </script> <script type="text/x-handlebars" data-template-name="posts"> {{outlet}} </script> <script type="text/x-handlebars" data-template-name="posts/index"> <h2>posts/index</h2> </script> That way it won't be a master/detail. The router would be: App.Router.map(function() { this.resource('user', function() { this.resource('posts', function() { }); });

Categories : Ember Js

nested attributes, passing current_user.id to nested model
'current_user' is a devise helper method. it can be accessed in controllers n views directly. if i m not wrong, only the new answer should have the current_user.id Old answers should not be updated. u can do this as f.fields_for :answers, @question.answers.build do |a| a.hidden_field :user_id, :value => current_user.id a.submit

Categories : Ruby On Rails

how to remove nested entry in a nested map using dot notation
You could write your own method to do this, although you'd be likely to have to resort to a fair amount of casting. You'd probably just split on dots, then keep calling get (and remembering the result for the next step) until you got to the last part, at which point you'd call remove instead... remembering to check for a null return from get at every step. I don't know of anything built into a third party library to do this - which isn't to say it's nowhere, of course.

Categories : Java

PHP - Find nested array1 in nested array2
If I understand correctly what you are trying to achieve, you could do it like this (see comments in code): /* Process one needle (look into haystack and modify it accordingly) */ function processNeedle(&$haystack, $needle) { $needleKeys = array_keys($needle); $needleValues = array_values($needle); $needleLen = count($needle); $haystackLen = count($haystack); /* Find indexes where a match begins */ $matches = array(); for ($i = 0; $i < ($haystackLen - $needleLen + 1); $i++) { $match = true; for ($j = 0; $j < $needleLen; $j++) { if ($haystack[$i + $j]["v1"] != $needleKeys[$j]) { $match = false; break; } } if ($match) { $matches[] = $i;

Categories : PHP

Nested ajax with nested rendered attribute in JSF
It is most likely what your ManagedBean is not in ViewScoped or SessionScoped. When you post back to the bean, you are loosing rendered states. I suggest to change for the ViewScoped one. Not related : You should remove the action attribute from the h:form since JSF override it.

Categories : JSF



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.