Menu
  • HOME
  • TAGS

Attr value is declared in two different libraries

android,design,attributes,styles

The easiest fix for this is to just rename the attribute in one of the libraries. To do that you have to: Download the source code of one of the libraries and add it to your project. Now you have to rename the attribute in the source code you just...

What is the % CSS Color Attribute supposed to mean?

css,attributes

This almost certainly refers to the alpha channel, or opacity of the color. This would be a float between zero and one. background-color: rgba(173, 0, 91, 0.75); Demo: .element { width: 100px; height: 100px; background-color: rgba(173, 0, 91, 0.75); } <div class="element"></div> PMS is a color standard for prints, created...

What's the difference between the square bracket and dot notations in Python?

python,object,collections,attributes,member

The dot operator is used for accessing attributes of any object. For example, a complex number >>> c = 3+4j has (among others) the two attributes real and imag: >>> c.real 3.0 >>> c.imag 4.0 As well as those, it has a method, conjugate(), which is also an attribute: >>>...

Java attributes

java,object,attributes

Objects are instances of classes, so think in terms of classes, attributes and operations. Classes map directly to the UML class. Attributes are fields or properties of the class. Operations are logic exposed as methods. Do not include getters and setters here - they're essentially a work-around for the lack...

Form Tag Helpers Cannot Process '-' in Rails 4

ruby-on-rails,validation,attributes,form-helpers,parsley

There are 2 ways to write data tags in Rails (or other tags with -): data: {parsley: 'something'} # -> data-parsley="something" or 'data-parsley' => 'something' # -> data-parsley="something" Also, there is a strange, but useful behavior: inside data braces, you can use _ and it will renders as -, for...

Get textColor attr from what was defined in xml

android,xml,attributes,textview

You can try this: final String androidNamespace = "http://schemas.android.com/apk/res/android"; String textColor = attrs.getAttributeValue(androidNamespace, "textColor"); ...

options[options.length] not working

javascript,jquery,html,attributes

options is not an attribute, it is an property to try var options = $('#response_').prop('options'); var options = $('#response_')[0].options; //or But instead you can use jQuery to create the option like $('<option />',{text: response_title, value: r, selected: true}).appendTo('#response_'); ...

Cannot get attribute from PropertyInfo c#

c#,asp.net,asp.net-mvc,reflection,attributes

No, it is not an inheritance problem. You need to change this: FieldAttribute sfi =(FieldAttribute)propInfo.PropertyType .GetCustomAttribute(typeof(FieldAttribute)); to this: var sfi = propInfo.GetCustomAttribute(typeof(FieldIDAttribute)) as FieldIDAttribute; This is because PropertyType returns the type of the property, i.e. string in your case. And the type string does not have your custom attribute. Also...

How to access the property of an object that was created dynamically using __getattr__

python,python-2.7,attributes

You are never returning the created attribute: def __getattr__(self, attr): self.__dict__[attr] = globals()[str.capitalize(attr)]("a", "b") return self.__dict__[attr] You do set the attribute in self.__dict__, so the next attempt to access it finds the attribute and never calls __getattr__ again. I'm not sure why you are using str.capitalize() as an unobund method...

Python AttributeError: I don't know why this is not working [closed]

python,tkinter,attributes,syntax-error,trackback

Spelling? Try subMenu.add_separator().

Python attribute button error

python,button,tkinter,attributes

Under your "#button2" comment;3 lines below, you used self.button.configure() However there is no variable called "button". I think you meant to say: self.button2.configure() ...

Hide attribute of an element from DOM

javascript,attributes,hidden

You can't hide DOM-attributes, but as I see you are using jQuery, you could try data. E.g. $('#hello_div').data('my_attr', 'attr_value'); and later retrieve: var v = $('#hello_div').data('my_attr'); ...

Magento Ignore Child Attributes in Layered Navigation

magento,attributes,layered

From magento's point of view you have 3 products (following exapmle) air condenser(1), coil(2), bundle of 1 and 2(3). If you only want the bundled products info to appear then in 'manage products' select the air condenser or coil. Once in the 'edit product' form find the field for 'visibility'...

set super product attributes 'Attribute Name' to 'use default '

magento,attributes

It seems like what you're trying to do is remove an attribute value for certain products at a certain store scope (in which case it will fall back to 'use default' mode and acquire the next attribute value available , whether that be defined at the website level or global...

Creating an Attribute class that allows adjusting a base value?

python,python-3.x,get,attributes,set

Below are four approaches that might meet your needs. Descriptors Descriptors allow you to provide direct attribute access while hiding the underlying implementation. class AttributeDescriptor(object): def __init__(self): self.initialized = False self.base = 0 self.adjustments = [] def compute(self): return self.base + sum(self.adjustments) def __set__(self, inst, value): if not self.initialized: self.base...

How to mark function argument as output

c++,c,gcc,attributes,out

"Is it possible to do something similar in C/C++?" Not really. Standard c++ or c doesn't support such thing like a output only parameter. In c++ you can use a reference parameter to get in/out semantics: void func(int& i) { // ^ i = 44; } For c you...

Java Atribute In Class and Subclass

java,class,attributes,subclass

If you want to use new MappaFermi(), you have to define a no-argument constructor. This is the default constructor, and any class that has no other constructor will implicitly have a no-arg constructor. But as soon as you define a constructor with arguments, like Mappa(Name mappaName), the no-arg default constructor...

jQuery select when attribute NAME starting with? [duplicate]

javascript,jquery,html,asp.net-mvc,attributes

Using this answer, You can just iterate through the attributes, and remove them according to the name... Your javascript should be something like $("input").each(function() { var theElem=this; $.each(this.attributes,function() { if(this.specified) { if(this.name.indexOf("data-val-range")>-1) { console.log("removing ",this.name); $(theElem).removeAttr(this.name); } } }) }); Here is a jsfiddle https://jsfiddle.net/dkusds1s/...

why does empty attribute break script?

javascript,jquery,attributes,title,uncaught-typeerror

Yes, you'll want to make it conditional depending on whether you got a match from any given test. For instance, to make it work with when: if (when) $(this).attr("data-when", when[1]); ...which won't add the data-attr at all if there wasn't a match, or $(this).attr("data-when", when ? when[1] : ""); ....which...

Python Passing a Function to an Object

python,oop,object,attributes

In python, functions are objects too and can be passed around. There is a small error in your code and an easy way to simplify this. The first problem is that you were calling the function foo while passing it in to your Button class. This will pass the result...

How large of a String should generally be stored in one core data entity attribute?

ios,core-data,attributes,entity

Whether to use one attribute or multiple attributes depends only on whether the data is logically a single value or multiple values. That is, it depends entirely on the structure of the data, not its size. However, for excessively large values, it often makes more sense to save the data...

CSS :not() with [attribute*=value] selector not works properly

css,html5,css3,attributes,css-selectors

The reason is because you do have a li that is not .menu-class-2: <ul class="nav-menu" id="menu-main-navigation"> <li class="menu-class"> <a href="#12">Nav 1</a> <ul class="sub-menu"> <li class="menu-class-3"> <!-- THIS ONE HERE --> <a href="#12">Nav 2</a> <ul class="sub-menu"> <li class="menu-class-2"><a href="#2">Anchor, it should be lowercase</a></li> </ul> </li> </ul> </li> </ul> Since your css...

How to add an extra metdata to a field of an object?

c#,attributes,metadata

Sure, you can use Attributes just like you wrote in the last block of your code. For that, you need to declare the following classes: [AttributeUsage(AttributeTargets.Field)] public class Input:Attribute { } [AttributeUsage(AttributeTargets.Field)] public class Output:Attribute { } Then, you can retrieve the attribute(s) of the field using reflection: var isInput...

Compare Variable with Model Attributes

c#,regex,attributes

Use Regex.IsMatch method: Email newUser = new Email(); Regex regex = new Regex("^[a-zA-Z0-9_\\+-]+(\\.[a-zA-Z0-9_\\+-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z]{2,4}$"); foreach (string email in user.Emails) { if (regex.IsMatch(email) ) { newUser.Address = email; } } Edit If you want to avoid duplication of regex pattern and also validate other attributes, you may use this method to perform...

Should I use the same VBO for passing different vertex attributes? Or should I use 2?

c++,opengl,attributes,shared,vbo

The top example won't work as the second glBufferData call will overwrite all of the buffer space in the second one. To properly do that, you have to use the stride and pointer arguments properly, so that the data is interleaved. It's easier (and cleaner imo) to just have multiple...

Error when appending a node of XmlNodeType::Attribute to an XmlNode

xml,dom,attributes,appendchild,xmlnode

This is because, by definition, attributes are not children of other nodes, so you cannot pass them to AppendChild. There is a special place for them: xmlNode->Attributes->SetNamedItem(nodAttribute); ...

Should I use a single object or individual values as attributes in an Angular directive?

javascript,html,angularjs,angularjs-directive,attributes

This is a mostly matter of preference. Since you can achieve the eventual outcome with both routes. I personally prefer to see individual attributes as suggested in your first example for the sake of working with verbose, expressive elements. Just by looking at <my-directive my-width="300" my-height....> in your first example,...

XSL for transformation of text node

xml,xslt,attributes,element,transformation

Get rid of formatting-only text nodes: <xsl:strip-space elements="*"/> Create <sometext> elements from text-only nodes. <xsl:template match="object/text()"> <sometext><xsl:value-of select="normalize-space(.)"/></sometext> </xsl:template> UPDATE General solution for any element: <xsl:template match="*[*|@*]/text()"> <sometext><xsl:value-of select="normalize-space(.)"/></sometext> </xsl:template> ...

Leverage MultipleApiVersions in Swagger with attribute versioning

attributes,asp.net-web-api2,swagger,swagger-ui,swashbuckle

.EnableSwagger(c => c.MultipleApiVersions( (apiDesc, version) => { var path = apiDesc.RelativePath.Split('/'); var pathVersion = path[1]; return CultureInfo.InvariantCulture.CompareInfo.IndexOf(pathVersion, version, CompareOptions.IgnoreCase) >= 0; }, vc => { vc.Version("v2", "Swashbuckle Dummy API V2"); //add this line when v2 is released // ReSharper disable once ConvertToLambdaExpression vc.Version("v1", "Swashbuckle Dummy API V2"); } )) ...

How to fetch attribute value of parent node from child nodelist.(XPath)

xml,xpath,xml-parsing,attributes,parent-node

Ahh,i found this. int separatorDistanceFromRight = Integer.parseInt(separatorNodeList.item(i).getParentNode().getAttributes().getNamedItem("r").getNodeValue()); ...

Changing an attribute of a variable selector in Jquery?

javascript,jquery,variables,attributes,selector

Do this: tabChosen = "#" + tabChosen; //puts into '#id' format

Python - How to pull an attribute out of list of custom objects and convert it to a float?

python,lambda,floating-point,attributes

You just need to create the original team entries with float contents: newTeam = team(row["Tm"],float(row["Y/C"]),float(row["AY/A"])) If instead you want to pursue the lambda approach you can use: sortedTeams = sorted(league, key = lambda team: float(attrgetter("passOffYc")(team))) This could similarly be used in your function score function. What you were missing is...

FadeOut element

jquery,attributes,fadeout

You can use filter to filtering the elements having title not as "head" $(document).ready(function () { $('div') .filter(function () { return $(this).attr('title') != 'head'; }) .fadeOut(100); }); Demo: https://jsfiddle.net/tusharj/uuvks2ga/...

Render outcome of “action” attribute?

jsf,attributes,action,renderer

As always, BalusC was right. There is no generated Javascript. But there was another thing i forgot about. One needs to add the following code: button.queueEvent(new ActionEvent(button)); in the decode method of the according component renderer, where "button" is the UIComponent parameter of the "decode" method. Thanks a lot BalusC...

Dynamic annotation/attribute values

c#,validation,annotations,attributes

All true. You can not. Despite you wrote you can not use enums, this actually can serve a solution: Pass enum parameter to your attribute and use this parameter in the attribute constructor's logic/algorithm to implement your extended logic. Note: This is exactly opposite of some DPs so we safely...

How can I get childnode's attribute from xml in java dom4j?

java,xml,attributes,dom4j,child-nodes

Quick and dirty: public static void main(String[] args) throws Exception { Document doc = new SAXReader().read(new File("D:/bb.xml")); Element root = doc.getRootElement(); Iterator bbbIt = root.elementIterator(); while (bbbIt.hasNext()) { Element bbb = ((Element) bbbIt.next()); System.out.println("name:" + bbb.attributeValue("name")); Iterator cccIt = bbb.elementIterator(); while (cccIt.hasNext()) { System.out.println("b:" + ((Element) cccIt.next()).attributeValue("B")); } } }...

Length of elements using jQuery is 0

jquery,list,attributes

Your call at the end is searching the DOM, but you've never added those elements to the DOM. If you added them, they'd show up on the search: var item = []; var innerValue = "value"; var innerKey = "key"; item.push('<li title ="head"' + 'id="' + innerValue + '">' +...

Assigning graph attributes using a function in R

r,attributes,igraph

Two things: Your function is not returning a value. You aren't reassigning the variable when you call the function. Try: toy.graph <- graph.formula(121-221,121-345,121-587,345-587,221-587, 490, 587) deco <- function(x){ V(x)$color <- "red" return(x) } toy.graph <- deco(toy.graph) plot(toy.graph) If you want to avoid reassigning variables and having your function return a...

How to filter out nodes from an XML using PERL script

xml,perl,filter,attributes,libxml2

I use XML::LibXML as my XML parser. use XML::LibXML qw( ); die "usage\n" if @ARGV != 2; my ($type, $qfn) = @ARGV; my $doc = XML::LibXML->new->parse_file($qfn); for my $node ($doc->findnodes('//message') { my $type_addr = $node->getAttribute('type'); next if !$type_addr || $type_addr ne $type; $node->parentNode->removeChild($node); } $doc->toFile($qfn); ...

How to properly escape quotes inside form INPUT attribute assignments?

attributes,cgi,quoting

Use HTML entities. " == &quot; and so on. so... <INPUT TYPE="TEXT" SIZE=64 MAXLENGTH=64 NAME="name" VALUE="a &quot;Quoted&quot; thing with backslash thusly: &#92;"> ...does the trick....

Xaml: < and > in Attributs like: Text=“<- vor”

xaml,attributes,unicode-escapes

There are 4 special characters in XAML: < > & " In order to use any one of these characters in a string literal (such as a TextBlock), use the W3C Xaml standard. For example <TextBlock Text="&lt;&lt;"/> will produce a TextBlock that displays "<<" in the text field. https://msdn.microsoft.com/en-us/library/aa970677%28v=vs.110%29.aspx...

XML transformation: Creating node in output xml from node attribute of input xml using xslt

xml,xslt,attributes,transform

Using below xslt can be used to achieve the above requirement. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" /> <xsl:template match="/viewentries"> <xsl:for-each select="viewentry"> <xsl:element name="ROW"> <xsl:for-each select="entrydata"> <!-- &lt;<xsl:value-of select="@name" />&gt; --> <xsl:variable name="assignedTo" select="'AssignedTo'"/> <xsl:variable...

Setting the attribute of an object to be and attribute of another object

ruby-on-rails,ruby,attributes

Consider using associations http://guides.rubyonrails.org/association_basics.html Using them you can easily define relations between models using helpers like Product belongs_to :user User has_many :products ...

Creating a status attribute for a model

ruby-on-rails,ruby,activerecord,model,attributes

Rails 4 has an built in enum macro. It uses a single integer column and maps to a list of keys. class Order enum status: [:ordered, :shipped, :delivered] end The maps the statuses as so: { ordered: 0, shipped: 1, delivered: 2} It also creates scopes and "interrogation methods". order.shipped?...

jQuery link elements by attribute

jquery,attributes

You can use hover: Changes in HTML: <div id="message_3" class="tester">HAHAHAHAHAHAHA</div> ^^^^^^^^^ <div id="message_4" class="tester">Another HAHAHAHAHAHAHA</div> ^^^^^^^^^ Javascript: $('.bx').hover(function () { $(this).css("background-color", "blue"); $('#message_' + $(this).attr('id')).show(); }, function () { $(this).css("background-color", "white"); $('.tester').css("display", "none"); }); Demo: https://jsfiddle.net/tusharj/pkb3q6kq/21/ Id must be unique on the page You don't need to bind event to...

PHP - get value of an XML attribute

php,xml,attributes

<?php $xmlDoc=new DOMDocument(); $xmlDoc->load('source.xml'); $properties = $xmlDoc->getElementsByTagName('property'); $first_property = $properties->item(0); echo "$first_property->tagName\n"; $first_property_children = $first_property->childNodes; echo $first_property_children->length; /* for ($j=4;$j<($cd->length);$j++) { echo ("<div>" . $c->item($j)->attributes()->description . "</div>"); echo ("<div>" . $c->item($j)->childNodes["description"] . "</div>");...

Read-only attributes via properties versus via documentation

python,properties,attributes,private,readonly

First note that there's almost no technical way to prevent someone to access your object's implementation and modify it if he really wants to. Now wrt/ your question / example: using an implementation attribute (_x) and readonly property makes the intent quite clear if your list is really supposed to...

I need help displaying an Xml file with php in table form

php,xml,table,attributes

OK - try this one then.. $xml = simplexml_load_file($file); echo '<table>'; foreach($xml->level_1->level_2 as $item){ $level3 = $item->level_3_1->attributes(); echo '<tr>'; foreach($level3 as $name => $value){ echo "<th>$name</th>"; echo "<td>$value</td>"; } echo '</tr>'; } echo '</table>'; ...

Microstrategy documents - matching differen attributes with the same value

attributes,document,matching,value,microstrategy

You can't... or you can try to add the attribute year in the report with year-of-observation and put a filter year = year-of-observation, at this point many things can happen: If the two attributes have no relationship, the lookup table for year will be added to your report query in...

DDD: Can an entity have attributes of primitive data types?

object,attributes,entity,domain-driven-design,value

While it is common attitude to compose an entity of another entities or value objects, it is not necessary. Please remember that you should think about an abstraction. Primitive types are ok when there is no business logic involved in using them. For example: public class User { private UserId...

Listing Product Attributes in Alphabetical Order (Woocommerce)

php,wordpress,attributes,woocommerce,product

Merging the two examples in the Codex, and assuming your attribute is called "artist" then you'd get a list of terms like so: $terms = get_terms( 'pa_artist' ); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ echo '<ul>'; foreach ( $terms as $term ) { echo...

Why do I always get the error “list” object has no attribute 'tranpose'?

python,matrix,attributes

Last line of matrixmult() is returning a list. It should return a Matrix object: return Matrix(self.n_rows, other.n_cols, res) Also in the transpose method, you should have: return Matrix(self.n_cols, self.n_rows, ma_transpose) ...

Seeking example of how to tell Autofac which service to inject by name

c#,attributes,autofac,inject

Documentation says : Named services are simply keyed services that use a string as a key Named and Keyed Services It means that you can use the WithKey attribute with a string parameter to do what you want : public CoupDo( [WithKey("FLAG6")]ItemUserFlagCtrl Flag6Ctlr, [WithKey("FLAG5")]ItemUserFlagCtrl Flag5Ctlr) { ... } WithKeyAttribute is...

Is it bad to have an empty attribute class?

c#,reflection,attributes

No. Attributes are frequently used just as flags. Take the pervasive: [Serializable] If you reflect into its source code, it's basically blank inside (it just has some constructors), but it's one of the most used attributes in .NET. The same thing goes for attributes like [XmlIgnore]....

Python class attributes and their initialization

python,class,attributes

q=1 inside the class is a class attribute, associated with the class as a whole and not any particular instance of the class. It is most clearly accessed using the class itself: MyClass1.q. A instance attribute is assigned directly to an instance of a class, usually in __init__ by assigning...

Accessing a custom attribute from within an instanced object

c#,attributes

Attributes aren't used that way. Attributes are stored in the class object that contains the attribute, not the member object/field that is declared within the class. Since you want this to be unique per member, it feels more like this should be member data with MyField, something passed in by...

Working with HTML output tag to view scalable image and assign src

javascript,html,css,attributes

So If you really want to use css properties in this case you have to inject them inline using style attribute var span = document.createElement('span'); span.innerHTML = ['<img height="35" width="75" class="thumb" src="', e.target.result, 'style="max-height:25px; max-width:25px;"', // You can manipulate that dynamically using '" title="', escape(theFile.name), '"/>'].join(''); document.getElementById('list').insertBefore(span, null); }; Check...

Data attributes with css selectors [duplicate]

css,data,attributes

you have to add this attribute to the div then hide it: [data-id="b5c3cde7-8aa1"] { display:none; } <div data-id="b5c3cde7-8aa1">hide me</div> ...

return RSS attribute values via BeautifulSoup

python,attributes,rss,beautifulsoup

Telling BeautifulSoup to use the lxml parser seems to keep self closing tags. Try using: soup = BeautifulSoup(handler, 'lxml') ...

how to select all elements with matching attribute of this in jQuery?

javascript,jquery,html,attributes,this

You can use .filter() to get the result. $(document).on('click','.foo', function() { var dataIndex = $(this).data('index'); $('.container div').filter(function(){ return $(this).data('index') === dataIndex }).addClass('bah'); }); Or using attribute based selector. $(document).on('click','.foo', function() { var dataIndex = $(this).data('index'); $('.container div[data-index="'+dataIndex+'"]').addClass('bah'); }); ...

get Id of input field using JavaScript

javascript,attributes

You can simply get it using .id attribute like this: this.id; Or you can also use .getAttribute() method: this.getAttribute('id') So your example should be, like thsi: function load_getUserListByGroupID(element) { alert(element.id); } <a href="#" class="SearchUser_Icon Hyperlink_Text" onclick="load_getUserListByGroupID(this)" id="2">aa</a> ...

Delete attribute from class instance python

python,class,oop,attributes

other_attribute and my_attribute are not an attributes on the instance. They are attributes on the class. You'd have to delete attributes from there, or provide an instance attribute with the same name (and a different value) to mask the class attribute. Deleting the attributes from the class means that they'll...

How to change an attribute of a javascript prototype object

javascript,object,attributes,prototype

You're missing a lot of information from your post that makes it difficult to debug. From my understanding the problem is that: You want your jQuery object's value property to be stored in an array that you wrapped in an object. You want to store this property with the setData...

Difference between ContentPropertyAttribute and ContentProperty [duplicate]

c#,wpf,attributes

You can omit the word "Attribute" when writing attributes over something. The actual class is called ContentPropertyAttribute. Both of your lines do exactly the same and use the exact same attribute class.

Python list of objects, get all 'orientations' of attributes

python,list,object,attributes,swap

Preparation: class Rectangle: def __init__(self, height, width): self.height = height self.width = width def flipped(self): return Rectangle(self.width, self.height) def __repr__(self): return 'Rectangle({}, {})'.format(self.height, self.width) rectangles = [Rectangle(1, 10), Rectangle(2, 20), Rectangle(3, 30)] Solution: from itertools import product for orientation in product(*zip(rectangles, map(Rectangle.flipped, rectangles))): print(orientation) Output: (Rectangle(1, 10), Rectangle(2, 20), Rectangle(3,...

Yii, changing original posted attributes

php,yii,attributes

Just simply do a $model->name=strtoupper($model->name); Refer here...

Reflection doesn't recognize that class is inherited C#

c#,inheritance,reflection,attributes

Just change this line: foreach (var a in Attribute.GetCustomAttributes(typeof(cl1))) to foreach (var a in Attribute.GetCustomAttributes(this.GetType()))...

Visual Studio: replace default doubleclick-event

c#,winforms,visual-studio,events,attributes

if you just add DefaultEvent attribute to your control class with another event name, it should work fine (rebuild projects before check after adding attribute) [DefaultEvent("KeyPress")] public class NumericControl : System.Windows.Forms.NumericUpDown ...

Using reflection to get attribute names in struct returns value__

c#,reflection,struct,attributes

you should use :var t = typeof(ItemTypes).GetFields().Where(k => k.IsLiteral == true);

No such column for attribute in a join table

ruby-on-rails,activerecord,attributes,associations,jointable

The error is caused by a faulty foreign_key option in TaskVolunteer. belongs_to :volunteer, class_name: "User", foreign_key: :volunteer_id foreign_key here refers to the column on the users table not on tasks_volunteers. You can just remove the foreign key option. class TaskVolunteer < ActiveRecord::Base # task_id, volunteer_id, selected (boolean) belongs_to :task belongs_to...

Save attributes to values

jquery,table,checkbox,attributes

The following code will get you started: $(function() { $("input[type=checkbox]").on("change",function(){ getPropChecked = $(this).prop("checked"); if(getPropChecked) { getId = $(this).prop("id"); getValue = $(this).attr("value"); getDataPrice = $(this).attr("data-price"); alert("getId: " + getId + " getValue: " + getValue + " getDataPrice:" + getDataPrice); } }) }) Please refer to this stack overflow post...

Can I restrict a custom attribute to void methods only?

c#,attributes,custom-attributes,postsharp

Turns out in my particular case there was a solution since I was using PostSharp. My custom attribute inherits from PostSharp.Aspects.MethodInterceptionAspect (which inherits from Attribute) which has an overridable CompileTimeValidate(MethodBase method) method. This allows to emit compiler errors during build time: public override bool CompileTimeValidate(MethodBase method) { Debug.Assert(method is MethodInfo);...

XSLT sort by attribute and attribute value (with exclude)

sorting,xslt,attributes,xslt-1.0,alphabetical

I am not entirely sure if this meets your requirements, but you could explicitly select the ones you want to come first in a separate xsl:apply-templates, then select the others with a sort on their type attribute <xsl:apply-templates select="orderEntry[@type='specific' or @type='other']" /> <xsl:apply-templates select="orderEntry[@type!='specific' and @type!='other']"> <xsl:sort select="@type" order="descending" />...

How to move an attribute and its value from one element to another

xml,xslt,attributes,xslt-1.0

You need to think of this as two separate changes, rather than a single "move" 1) Remove the Weight attribute for the Order element. Or rather, do not copy the Weight attribute to the output <xsl:template match="@Weight" /> 2) Add a Weight attribute to the Item element when copying it...

Retrieving Entities from Core Data: Printing properties gives me incomplete/unwanted results?

objective-c,core-data,printing,attributes

Assuming your CXStellarObject object is a custom subclass of NSManagedObject, you need to override the description method for that object and write it to return formatted info about your managed object. Something like this: -(NSString *) description; { NSMutableString *result = [[NSMutableString alloc] init]; [result appendFormat: @" descriptor = %@\n",...

how to access xml tag by attribute of the parent

php,html,xml,xpath,attributes

You can just select the node where its attribute is using = thru xpath also: [@number='$numberSelected'] So just query it and continue on getting the results if it did yielded. Use foreach if you're expecting more: $result = $dom->xpath("//pizza[@number='$numberSelected']"); if(!empty($result)) { $pizza = $result[0]; echo $pizza->title; // and others }...

Python: Appending elements to list of a class

python,list,class,attributes

You may want to use a subclass here: class Someclass1(Someclass): field = Someclass.field + [XShortField("Field"+str(option), 0x2000] s_class = Someclass if option == 0: #nothing is added pass elif option == 1: #one element is added s_class = Someclass1 elif option == 2: #two elements are added [...] #and so on...

Declaring a local variable within class scope with same name as a class attribute

c++,class,variables,attributes,local

The local variable will shadow the member one (it has the more narrow scope). If you just write Data = 4; you will assign to the local variable Data. You can still access the member variable with this->Data = 4; This works basically just as { int data = 4;...

Is it possible to get an HTML attribute to CSS?

html,css,attributes

It can be done with Javascript Suppose, you have an <img> like <img id="my_img" src="my_img_src"/> Then, you can get the src of the <img> as follows var myimgsrc = document.getElementById("my_img").src; Now, the variable myimgsrc holds the src of your <img>. Again using Javascript you can use the variable to set...

How to get all the src and href attributes of a web site

javascript,image,website,attributes,src

Using plain JS you can do: The string that we give querySelectorAll is just a normal CSS selector. var srcNodeList = document.querySelectorAll('[src],[href]'); for (var i = 0; i < srcNodeList.length; ++i) { var item = srcNodeList[i]; if(item.getAttribute('src') !== null){ alert(item.getAttribute('src')); } if(item.getAttribute('href') !== null){ alert(item.getAttribute('href')); } } Here's the fiddle:...

Custom Vertex Attributes GLSL

c++,opengl,attributes,vertex

Binding your bone weights and indices is no different of a process than binding your position data. Assuming the data is generated properly in your buffers, you use glBindAttribLocation to bind the attribute index in your vertex stream to your shader variable, and glVertexAttribPointer to define your vertex array (and...

Extract attributes of an string

java,string,attributes,extract

Assuming that order of elements is fixed you could write solution using regex like this one String s = "type=INFO, languageCode=EN-GB, url=http://www.stackoverflow.com, ref=1, info=Text, that may contain all kind of chars., deactivated=false"; String regex = //type, info and deactivated are always present "type=(?<type>.*?)" + "(?:, languageCode=(?<languageCode>.*?))?"//optional group + "(?:, url=(?<url>.*?))?"//optional...

Validation doesn't fire (System.ComponentModel.DataAnnotations)

c#,validation,attributes,system.componentmodel

Use another overload: var isValid = Validator.TryValidateObject(pTemp, context, results, true); From MSDN: public static bool TryValidateObject( Object instance, ValidationContext validationContext, ICollection<ValidationResult> validationResults, bool validateAllProperties ) validateAllProperties Type: System.Boolean true to validate all properties; if false, only required attributes are validated.. Since bool is equal to false by default you have...

What happens if Vertex Attributes not match Vertex Shader Input

opengl,attributes,glsl,vertex-shader,pixel-shader

There are two scenarios: If the attribute array is enabled (i.e. glEnableVertexAttribArray() was called for the attribute), but you didn't make a glVertexAttribPointer() call that specifies the data to be in a valid VBO, bad things can happen. I believe it can be implementation dependent what exactly the outcome is....

AttributeError: 'NoneType' object has no atribute 'insert'

python,attributes

That's because you initialize self.heap with None: class PriorityQueue(object): def __init__(self): self.heap = None You probably should initialize with Heap(): class PriorityQueue(object): def __init__(self): self.heap = Heap() Your code has also other issues: You should call self.heap.insert with only one parameter (you're calling with two): def enqueue(self, item, priority): '''Post:...

Using value of propertie in his own custom attribute

c#,.net,properties,attributes

Attributes are just metadata, not code. So change it to something like: [Printable(FormatStyle = FormatStyles.XY)] public int MyProperty{ get; set; } Then the printer code can check for a FormatStyle parameter to the attribute and apply the requested format to the property. ...

check all jquery not working for dynamically populated checkbox

jquery,checkbox,attributes

use prop() for setting checked and unchecked $('[name=selectall]').change(function() { $('.icheckbox').prop('checked', this.checked); }); NOTE: there is no selectall class in your html prop demo attr domo working only once...

Ruby Update Attribute with Sum of Database Attributes

ruby-on-rails,ruby,database,attributes,sum

It would be better to make before_update, that would take care of updating your value in DB, whenever you change tips_value or profile_value, and from anywhere. In your Affinity model add before_update :sync_value_amount private def sync_value_amount self.value = self.tips_value + self.profile_value end ...

Set value of specific property by custom attribute

c#,properties,configuration,attributes

You could keep the simplicity of your config file and get rid of the nested loops by loading the values into a dictionary and then passing that into your ConfigFile class. public static void ReadConfigFile() { var configLines = File.ReadAllLines("configfile.cfg"); var testList = configLines.Select(line => line.Split('=')) .Select(splitString => new Tuple<string,...

XLS Copy Child Element to Parent Attribute

xslt,attributes,parent-child,xls,elements

The problem with your approach is that when you do: <xsl:apply-templates select="@*|node()"/> you also copy the original @name attribute, overwriting the new @name attribute you have just now created. Try instead: <xsl:template match="game"> <game> <xsl:copy-of select="@*"/> <xsl:attribute name="name"> <xsl:value-of select="description"/> </xsl:attribute> <xsl:apply-templates select="node()"/> </game> </xsl:template> or, if you know all...