w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Conditional overwrite of style property
Your style definition, as written should probably not even compile because you are using an attribute on a property element (the TextBox.Style tag). Update your code so that the inner style definition has the 'BasedOn' attribute like so: <TextBox.Style> <Style TargetType="TextBox" BasedOn="{DynamicResource SelectableTextStyle}"> <Style.Triggers> .... And everything will be gravy.

Categories : Wpf

How specify two css classes: from property and conditional class
Use the class binding <div data-bind="class: myClass" > View model : var vm = { myClass : ko.observableArray(), }; vm.myClass.push('class1'); vm.myClass.push('class2'); You can also use the class binding with a computed. But if you don't want to use it, you can do that : <div data-bind="attr: { 'class' :( Color() + (SomeBooleanProperty() ? ' my-class' :'')) }">

Categories : CSS

Conditional to the caption property of a popupmenu item
thats becouse if you show message the caption you will see instead of 'Ativar' the '&Ativar' string, so both of your tests fail, well you could add the '&' to your tests but i strongly suggest you use other property like tag instead, or the checked property depending on what ur doing

Categories : Delphi

Ant conditional property expansion not working as expected
As mentioned here: http://ant.apache.org/manual/properties.html As of Ant 1.8.0, you may instead use property expansion; a value of true (or on or yes) will enable the item, while false (or off or no) will disable it. Other values are still assumed to be property names and so the item is enabled only if the named property is defined. This is some really subtle information here. So what's going on in your code is ${docbase.dir} is expanded to "/tmp/docbase". That's not true/on/yes/false/off/no so Ant then looks for a property named "/tmp/docbase". It can't find it, so it runs the unless. Here's an example that I hope will clarify things. This will run only the if target: <project name="MyProject" default="context" basedir="."> <target name="context"> &

Categories : Java

Conditional formatting a GridControl cell based on a value of a property in the viewmodel
I believe you can use approach described in the How to: Conditionally Apply Styles example. Related help article: Styles and Templates Overview

Categories : C#

Why won't CloudFormation execute my command?
Your commands block should be nested inside the config block, at the moment it is at the same level in the hierarchy. "AWS::CloudFormation::Init" : { "config" : { "files" : { "c:\Packages\WebDeploy_amd64_en-US.msi" : { "source" : "http://download.microsoft.com/download/1/B/3/1B3F8377-CFE1-4B40-8402-AE1FC6A0A8C3/WebDeploy_amd64_en-US.msi" } }, "commands" : { "1-installwebdeploy" : { "command" : "msiexec.exe /i c:\Packages\WebDeploy_amd64_en-US.msi ADDLOCAL=ALL /qn /norestart" } } }, }

Categories : Amazon

Why won't my CloudFormation script download a file?
Jonathon, I tried your template and the file downloaded successfully for me. You can check the cfn logs on the instance. They are in c:cfnlog. My cfn-init.log shows: 2013-07-19 21:30:18,269 [DEBUG] Parent directory c: est does not exist, creating 2013-07-19 21:30:18,269 [DEBUG] Writing content to c: estgoogle-logo.png 2013-07-19 21:30:18,269 [DEBUG] Retrieving contents from http://www.google.com/images/srpr/logo4w.png 2013-07-19 21:30:18,316 [DEBUG] No mode specified for c: estgoogle-logo.png 2013-07-19 21:30:18,316 [WARNING] Unsupported OS for setting owner/group: nt And my cfn-wire.log shows: 2013-07-19 21:30:18,269 [DEBUG] Request: GET http://www.google.com/images/srpr/logo4w.png [headers: {'Accept-Encoding': 'identity, deflate, compress, gzip', 'Accept': '*/*', 'User-Agent': 'pyth

Categories : Amazon

AWS - Automatic deployment (.NET) to CloudFormation stack
cloud-init is used with windows too. See the documentation for bootstrapping Windows stacks.

Categories : Amazon

Is it possible to create a SNS subscription with CloudFormation without creating a topic?
As you already discovered, AWS CloudFormation doesn't provide the expected AWS::SNS::Subscription resource (yet) and I'm not aware of this being possible by any other means, unfortunately - guess the rationale is that both are either managed within a template or externally, but your use case is sound and I can see no fundamental reason why this shouldn't be available (maybe they'll add it at some point, AWS is usually expanding their APIs over time to address such inconsistencies/missings).

Categories : Amazon

Installing Windows applications/extensions with Amazon CloudFormation
For your example of WebDeploy, you could add this: "C:\Webdeploy\WebDeploy_amd64_en-US.msi" : { "source" : "http://download.microsoft.com/download/1/B/3/1B3F8377-CFE1-4B40-8402-AE1FC6A0A8C3/WebDeploy_amd64_en-US.msi" } as a element of this section of the template "WindowsServer": { "Type" : "AWS::EC2::Instance", "Metadata" : { "AWS::CloudFormation::Init" : { "config" : { "files" : { You could then add this command: "1-installwebdeploy" : { "command" : "msiexec.exe /i C:\Webdeploy\WebDeploy_amd64_en-US.msi ADDLOCAL=ALL /qn /norestart" } to the list of commands.

Categories : Amazon

Generating subnet CIDR blocks programmatically in CloudFormation templates (or adding integers together)
My solution for these kinds of issues was to use a legitimate programming language to compile a template into a CloudFormation JSON document. I used PHP 5.4, Twig and Symfony Console, but YMMV. Essentially, you do the math ahead of time in the programming language, then use that data as you write-out your JSON document.

Categories : Amazon

Conditional updating of matrix elements based on conditional statement
for is not your friend in R, here's a solution using apply and conditional indexing ## create some toy data matrix( ncol=5, nrow = 100, c( runif(300), sample(c('A','G','C','T','a','c','g','t'), replace=T, 200))) -> data flip_allele_freqs <- function(x) { ## function will return 1-x on any x that looks like a number less than 1 n = as.numeric(x) if ( is.na(n) ) { ## cant convert to numeric, must be str return(x) } if (n < 1) { return( 1 - n ) } else { return x } } ## apply the flip alleles function to the rows where the two last columns are equal ##fold the new data back into the old matrix data[toupper(data[,5]) == toupper(data[,4]),] <- apply(data[toupper(data[,5]) == toupper(data[,4]),], c(1,2), flip_allele_freqs)

Categories : R

Is it possible to make conditional includes and conditional function calls?
You can have 2 activities (for a single activity extending 2 different classes) and can launch the activities conditionally. if (MODE == MODE.ANDROID) startActivity(A) else startActivity(B) But your launcher activity has to be one, that cannot be designed in this way. I was wondering why are you trying to do this ??

Categories : Java

Can conditional and combinatorial conditional relationships be designed in Neo4j?
This question really seems oriented toward your app domain logic, not about Neo4j itself. With Neo4j, it's entirely possible to dynamically add/remove nodes, add/remove relationships, etc. For function 1, you'd just need to add or remove the relationship between E1 and S1/S2 (via your app logic; there's no automatic conditional-relationship mechanism to rely upon). And for function 2, again you'd add or remove a relationship between E1/E2 and S1-S5 (or just leave E1 & E2 without any relationship). You'll be able to do any of the query+add or query+remove via Cypher (latest documentation is here).

Categories : Neo4j

Advantages of conditional-preprocessor over conditional statements
Conditional compilation means ifdef-ed out code is never actually in the final linked application. Just using language conditionals means both branches are in the final code making it bigger and potentially harder to test etc. Use #ifdef etc when you know at compile time what is required. Language conditionals are used when you don't know what you need until runtime.

Categories : C++

Will Python skip over reading an 'else' conditional if the 'if' conditional was already run?
You cannot use a conditional after else, only after elif. elif is only checked if the preceding if or elif conditionals did not match. Demo: >>> foo = 'bar' >>> if foo == 'bar': ... print 'foo-ed the bar' ... foo = 'baz' ... elif foo == 'baz': ... print 'uhoh, bazzed the foo' ... foo-ed the bar Even though foo was set to baz in the first block, the elif condition did not match. Quoting from the if statement documentation: It selects exactly one of the suites by evaluating the expressions one by one until one is found to be true [...]; then that suite is executed (and no other part of the if statement is executed or evaluated). If all expressions are false, the suite of the else clause, if present, is executed. Emphasis mine. In fact, this extends

Categories : Python

how to construct a string of physical subnet ids to create db subnet group on the fly in a cloudformation script?
I run into the same issue, after working with AWS support I understood that List of String does not mean what we initially thought. Also, if you want to place the DB inside a VPC you must not use AWS::RDS::DBSecurityGroup objects. Here is a full sample, it took me a while to get it working: "dbSubnetGroup" : { "Type" : "AWS::RDS::DBSubnetGroup", "Properties" : { "DBSubnetGroupDescription" : "Availability Zones for RDS DB", "SubnetIds" : [ { "Ref" : "subnetPrivate1" }, { "Ref" : "subnetPrivate2" } ] } }, "dbInstance" : { "Type" : "AWS::RDS::DBInstance", "Properties" : { "DBInstanceIdentifier" : { "Fn::Join" : [ "", [ { "Ref" : "AWS::St

Categories : Amazon

If my dependency property is a class how do I get property changed to activate on a class property change?
Each one of the properties of User must also notify on change. E.g.: public class User { string _Name; public string Name { get { return _Name; } set { _Name = value; PropertyChanged("Name"); } ... } }

Categories : C#

PropertyValuesHolder: Couldn't find setter/getter for property with value type float
Same problem here. Solved that way: final ObjectAnimator animScrollToBottom = ObjectAnimator.ofInt(AnimatorProxy.wrap(scrollView), "scrollY", fromPositionInt, toPositionInt).setDuration(500); or with float values: final ObjectAnimator animScrollToBottom = ObjectAnimator.ofFloat(scrollView, "y", fromPositionInt,toPositionInt).setDuration(500);

Categories : Android

Struts2 - Setting a property from a static list String property using OGNL not working
You cannot nest tags like that. And to reference inner class you need to use $ sign. <s:hidden name="username_type" value="%{@com.packagename.models.UsernameModel$UsernameTypes@ALIAS}" /> IMO it is better to use that kind of static variables directly in class rather than send them from JSP.

Categories : Java

How to determine which property to set or method to call after Enum.TryParse(PropertyName, out Property)
Put this into your class: public object this[string propertyName] { get { Type myType = typeof(UserConfiguration); PropertyInfo myPropInfo = myType.GetProperty(propertyName); return myPropInfo.GetValue(this, null); } set { Type myType = typeof(UserConfiguration); PropertyInfo myPropInfo = myType.GetProperty(propertyName); myPropInfo.SetValue(this, value, null); } } Then you can get/set properties within the class using myClassInstance[property] = myValue;

Categories : C#

CSS Fixed Property Relative to Parent/Window based on Left Property
You should use left: 1px instead of left:0. In CSS if you want to set any property to 0, then you need not to provide unit(px, em etc) but if you want to set it to any non-zero value(1 here), you have to mention a valid unit. updated Jsfiddle link .menuFloat{ z-index: 9999; position: fixed; left: 1px; top: 0; width: 100%;}

Categories : Jquery

c# property setter body without declaring a class-level property variable
You need to set a field variable and store the value there, if you're going to use custom getter and setter. With the code you have right now you will be running into a stack overflow exception. When you assign something to mongoFormId, you'll execute the line this.MongoFormId = value;. This is an assignment to mongoFormId, resulting in executing the line this.MongoFormId = value;, and so on. It won't ever stop. The correct way is a field: private string _mongoFormId; public string mongoFormId { get { return this._mongoFormId; } set { this._mongoFormId = value; revalidateTransformation(); } }

Categories : C#

Same property in two different tabs (divs). Property is null when tab 2 is posted to action method
It sounds like you have both FirstName input fields inside the same form. Something like: <form> <div id="tab1"> @Html.EditorFor(m => m.FirstName) </div> <div id="tab2"> @Html.EditorFor(m => m.FirstName) </div> </form> When you post this, the form is submitted as: FirstName=valueFromField01&FirstName=valueFromField02 From the behavior you are describing, it seems that once the model binder sets the FirstName field in your MyViewModel, it ignores the second one (but I'm not really sure about that). Solutions: Rather than have a form with different tabs inside of it, have a form inside each tab. This will ensure you only have one FirstName inside a form. Update the model so that you get both fields. You would need to

Categories : Asp Net Mvc

How to access a javascript object's property, when it has a dynamic number as property title?
There is example, how you can access to properties of your object with loop: http://jsfiddle.net/Y7mHB/ var names = { 15: '15', 117: '117' }; for(var key in names) { alert(key + ' ' + names[key]); }

Categories : Javascript

XamlParseException Failed to assign to property. Binding not working with attached property
This is a pretty common mistake. The problem is, binding targets cannot be CLR properties in XAML. It's just the rules. A binding source can be a CLR property, just fine. The targets simply must be dependency properties. We all get the error! :) I describe the whole thing here: http://blogs.msdn.com/b/jerrynixon/archive/2013/07/02/walkthrough-two-way-binding-inside-a-xaml-user-control.aspx Best of luck.

Categories : Xaml

Spring MVC/Hibernate - NullValueInNestedPathException, Invalid property, value of nested property is null?
I found out what was wrong: It seems that I set the default value of the column for the new property to null! I hope that others that are getting this same error try this solution out. -__-! Thanks to drurenia taking some interest! :D

Categories : Hibernate

Auto property synthesis will not synthesize property declared in a protocol even though its implemented
Use @dynamic navigationController; This tells the compiler that the property implementation is 'somewhere else' and that it should trust that the requirement will be fulfilled at runtime. In practice, that means its in the superclass. If you try to implement it yourself you'll end up with duplicate storage (so things probably won't work how you expect) or recursion.

Categories : Objective C

Kendo Grid Edit InLine model.Field(o => o.Property).Editable() depending on other Property
It sounds like you decided to go a different direction. You might consider using a template for that column that either disables the field or writes it as a label based on the IsFile. Otherwise, I think you're stuck with your current workaround since editability is set on the datasource and not at a row level. One other consideration though - you might be able to use a shared editor template to write out the label instead of an Editor...

Categories : Asp Net Mvc

Setting property of class type with TypeConverter from Property Panel produces expanded XAML, not string
You almost there and needs only two minor adjustments on Complex class to make it work as you expect: 1) Remove default public constructor: public Complex() { } // <- delete this line 2) Add magical DesignerSerializationVisibility attribute to Real and Imaginary properties (or in general - to all properties with public setter): [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public double Real { get { return m_real; } set { m_real = value; } } [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public double Imaginary { get { return m_imag; } set { m_imag = value; } } Hope this helps.

Categories : Wpf

Excel Vba error: Definitions of property procedures for the same property are inconsistent
Try this: Private pSkipTrade As Boolean Public Property Let SkipTrade(lSkipTrade As Boolean) pSkipTrade = lSkipTrade End Property Property Get SkipTrade() As Boolean SkipTrade = pSkipTrade End Property Somewhere else in your code you are using another variable (e.g., value) to set this property. If this variable is not of Type Boolean (e.g., a Long, Double, or Decimal), then you can do something like: Sub Test() Dim MyObject As Object Dim Value As Double '## or, whatever '# CREATE THE CLASS OBJECT Set MyObject = New cMyObject '## Modify to be your correct Type Value = Application.InputBox("Enter any number") '# ASSIGN THE PROPERTY VALUE BASED ON A LOCAL VARIABLE/LOGIC ' use boolean logic to test whether "value = 0" ' a non-zero value will return "True" MyObj

Categories : Excel

Bind an control property to a property of a Class of the Window ViewModel
You have implemented INotifyPropertyChanged on your ViewModel but you never call it when Property is changed try: public class ViewModel : INotifyPropertyChanged { private foo _property; public foo Property { get{ return _property; } set{ _property = value; OnPropertyChanged(); } } .................

Categories : C#

Giving data to a class property according to another classes property which I get from the database
Get member payments: public List<Payment> GetMemberPaymnets(int memberId) { List<Payment> Payments = new List<Payment>(); string SELECT = "SELECT ID,AMOUNT,STARTDAY,ENDDAY FROM Payments WHERE Id = @Id order by endday desc"; using (sqlConnection = new SqlConnection(sqlConnectionString_WORK)) { sqlConnection.Open(); using (SqlCommand sqlCommand = new SqlCommand(SELECT, sqlConnection)) { sqlCommand.Parameters.Add("@Id", SqlDbType.Int).Value = entity.Id; var sqlReader = sqlCommand.ExecuteReader(); while (sqlReader.Read()) { var payment = new Payment { Id = Convert.ToI

Categories : C#

WPF binding update notification for nested property when parent property changes
I'm not an WPF expert, but I think it's because you've chosen the wrong path. <TextBlock Text="{Binding Path=MyCarProperty, Value=Manufacturer}" /> update: <TextBlock Text="{Binding Source=MyCarProperty, Path=Manufacturer}" />

Categories : C#

How to map a "map" property in case when keys are another collection property members using annotations?
If you have a join table between Company and Category, with an additional column to give the ServiceType, then you can achieve this with @ElementCollection annotation. Check out this blog post or search the web for more examples. Basically, you can use @OneToMany or @ManyToMany on the categories collection, then @ElementCollection on the map, something like the following. @ElementCollection // company_id is the column that connects the company table to the join table @CollectionTable(name = "company_category_servicetypes", joinColumns = @JoinColumn(name = "company_id", insertable=true, updatable=true)) // service_type is the "extra" information you want on the relation, basically the value in the map @Column(name = "service_type", insertable=true, updatable=true) // category_id is the o

Categories : Java

PrimeFaces, sort p:column based on a property of a property
In the end it was a silly mistake on my part: the sort field (in my case "region.description") is passed unchanged as a string to the LazyDataModel, so it is my duty to handle it appropriately in the code by adding an alias. So the code above should become something like public List<Province> findLazyProvince(int startingAt, int maxPerPage, String sortField, SortOrder sortOrder, Map<String, String> filters) { Criteria crit = buildCriteria(filters); if (sortField != null && sortField.equals("region.description")) { crit.createAlias("region", "region"); } if (sortField != null && !sortField.isEmpty()) { if (sortOrder.equals(SortOrder.ASCENDING)) { crit = crit.addOrder(Order.asc(sortField)); } else {

Categories : Hibernate

MySQL: ORDER BY which uses own property or property of newest associated object
SELECT * FROM rating r LEFT JOIN (SELECT m.store_id, m.created_timestamp, m.status FROM messages m JOIN (SELECT store_id, MAX(created_timestamp) maxtime FROM messages GROUP BY store_id) mmax ON m.store_id = mmax.store_id AND m.created_timestamp = mmax.maxtime) m ON m.store_id = r.store_id ORDER BY m.status DESC, m.created_timestamp DESC

Categories : Mysql

Get attributes assigned to property of a Type using an instance of that property
You are OH so close... just get the property from the class (using reflection) and then use GetCustomAttributes(...) from the PropertyInfo. To get all of the attributes applied to the property, use: MyClass obj = new MyClass(); var attList = obj.GetType() .GetProperty("MyProperty") .GetCustomAttributes(true); or if you want just a specific attribute type:' MyClass obj = new MyClass(); var attList = obj.GetType() .GetProperty("MyProperty") .GetCustomAttributes(typeof(MyCustomAttribute), true); Note that there's no such thing as an attribute that is applied to an instance of a class - the attributes are always on the class itself. So trying to get a custom attribute for an instance will be fruitless.

Categories : C#

Is it mandatorty to keep the connection-alive property when we use chunked property?
In short, no. In the absence of a Connection header for messages adhering to HTTP/1.1 the default is a persistent Keep-Alive connection. If a connection header is present both parties should act accordingly given that header's value. As stated by RFC 2616 Section 8.1.2: A significant difference between HTTP/1.1 and earlier versions of HTTP is that persistent connections are the default behavior of any HTTP connection. That is, unless otherwise indicated, the client SHOULD assume that the server will maintain a persistent connection, even after error responses from the server. Of course, this doesn't prevent you from explicitly setting a Connection: close header if you wish to close the connection once the transfer completes.

Categories : Http

Hydrate property via joining another List on unique Id
This piece of code should match your needs: public class Equipment { public int ProcessId { get; set; } public string Name { get; set; } } public class WorkflowItem { public Equipment { get; set; } public void LoadEquipmentFrom(IEnumerable<Equipment> cache){ var equipment = cache.FirstOrDefault(e => e.ProcessId == Equipment.ProcessId); if(equipment != null) Equipment.Name = equipment.Name; } } You could also assign the instance from cache to the existing one, it wouldn't matter since both must have the same Identifier Equipment = equipment;. That would be easier if you have more properties to set. To optimize further use an IDictionary<int, Equipment> instead of that IEnumerable<Equipment>, because you'll be reading

Categories : C#



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