attributes

Get href,src,width,height of image using jQuery

Hello, I want to get the href, src, width, height of all images on a page. The jQuery code is $('img:regex(data:extension, jpg)').each(function() { var imgsrc = $(this).attr('href'); //$(this).attr('width') =0; var newImg = new Image(); newImg.src = imgsrc; var width = newImg.width; //wid...

How does Castle.ActiveRecord override virtual properties?

In active record to write a model you write: [ActiveRecord("TableName")] public class Model { [Property("SomeField")] public virtual string SomeField { get; set; }; [Property("SomeLazyField"), Lazy= true] public virtual string SomeLazyField { get; set; }; } If the field is lazy it must fetch it on the first access, so ...

Default value for attribute constructor?

I'm getting this error, An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type When I try to write something like this [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public class UrlAttribute : Attribute { public UrlAttribute(string p...

hpricot add attribute to a HTML tag?

Can someone please explain how to add a custom attribute to an HTML tag using Ruby with Hpricot gem? I have a tag that looks like this: <div class="test" id="tag1" style=""> and I want to add a custom integer attribute called 'Readable=0' so it looks like this: <div class="test" id="tag1" style="" readable=0> Is this possible? ...

In XSL, how do I select a value, based on multiple attributes?

This has got to be a very basic question, but I'm really struggling with a solution. From the following XML, I'm trying to extract the first instance only, when I have a match on the tag="099" and the code="a" attributes in a marc:datafield node, and a marc:subfield node, respectively <?xml version="1.0" encoding="UTF-8" ?> <marc:colle...

JBoss Monitoring with Cacti

Hi all! If there is anyone out there who has experience with monitoring JBoss with Cacti, I need help! I used this template posted on the Cacti forums. It has 3 template graphs, and 2 of those graphs are working really well. For some reason though, the third graph (Transaction Manager) isn't working. I'm get 0's for all the values. I...

Overriding inheritance on intrinsic attributes in C#

After wrestling with a bunch of uncaught exceptions when trying to serialize my classes and subclasses, I've finally understood what my problem had been: [Serializable] isn't inherited by subclasses when applied to a base class. I'm still really fuzzy about C# Attributes in general, but I do understand that when creating a custom Attribu...

Is it possible to make Python functions behave like instances?

I understand that functions can have attributes. So I can do the following: def myfunc(): myfunc.attribute += 1 print(myfunc.attribute) myfunc.attribute = 1 Is it possible by any means to make such a function behave as if it were an instance? For example, I'd like to be able to do something like this: x = clever_wrapper(myfu...

Accessing controller method from ResultExecutingContext in ASP.NET MVC site

I'm writing an attribute where I want to access a method on the class that the controller that has the attribute on one of its actions derives from. That's quite a mouthful, so let me explain: My controller derives from a class that has a method with the following signature: protected bool IsSearchEngine() (the base class itself derive...

Using SOAP to generate XML attributes in PHP

I need to generate the following XML with SOAP: <MetaDataConstraint class="topics"> <Value>FRX</Value> </MetaDataConstraint> I am not sure how to generate the attributes. Based on: http://stackoverflow.com/questions/2045850/using-soap-to-generate-xml-attributes-in-php, I tried to do the following, but unfortunatelly it does not ...

DropdownList: SelectIndex = 0 based upon a user clearing a text box/the text changing. Javascript.

Hello all. I have a scenario whereby I have a textbox with an autocomplete extender attached and two drop down lists; this enables a user to search for product info. Ideally I'd like to create something that effectivley, 'resets' the drop downs so that when a user clicks on the textbox (maybe I'll do it 'onenter'/'ondelete' if there is...

xml schema attribute ref

Hellow, i have this xml schema <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns="http://hidden/abc" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://hidden/abc" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.8"> <xs:element name="inv_constraint"> <xs:complexTy...

Simplexml xpath to attribute value and and child node values in one query

example XML: <users> <user id="fakeuserid"> <password>fakeuserpassword</password> <username>fakeusername</username> </user> <user id="anotherfakeuserid"> <password>anotherfakeuserpassword</password> <username>anotherfakeusername</username> </user> </users> I would like to be able to access the id attrib...

XPath Perl get attribute value

I'm trying to get XPath to return an attribute value yet first search for the tag's contents, i.e. if I have <select name="xxx"> <option=bla>123</option> <option=blubb>456</option> </select> I want to say, "search for the option tag containing 456 within a certain select tag with name "xxx". I do this: my $xp = XML::XPathEngine-...

"Filtering" a collection before starting a Linq query on it

I´m working on some validation code and having some issues with my Linq code. What I have is a class that validates on a particular attribute (ValidationAttribute). That all works fine, ie the validation works with a class that has some properties decorated with that attribute (or subclasses of it). What I now want to accomplish is to ...

Why does the value attribute of a button have specified = false in IE?

I have been looking for an elegant solution to converting a submit button to a button. In Internet Explorer you cannot simply change the type of an input. I couldn't change the attribute on a clone of the object either, so I thought I would manually duplicate it by creating a new object and then iterate through the attributes of the subm...

How to retrive the name of the attribute dynamically without specifying the name of the attribute ?

I am developing asp.net mobile application. I am using LINQ to XML to query XML file. I am using the following query to retrieve the name & value of the query dynamically as follows var TotalManifolds = from MF in FieldRoot.Element("FIELD-DEFINITION").Element("MANIFOLDS").Elements("MANIFOLD") join SLT in FieldRoot.E...

How to write a single LINQ to XML query to iterate through all the child elements & all the attributes of the child elements ?

I am developing asp.net mobile application. I am using XML as a database. I am querying on the XML to access the required elements & attributes by using LINQ to XML in .net. I have the follwing part in my XML file. <VALVES> <VALVE NAME="PWV"> <DISPLAY-NAME> Production Master Valve </DISPLAY-NAME> <COMMANDS...

Overriding AuthorizeCore in custom Authorize attribute results in "no suitable method found to override" error

I'm trying to build custom AuthorizeAttribute, so in my Core project (a class library) I have this code: using System; using System.Web; using System.Web.Mvc; using IVC.Core.Web; using System.Linq; namespace IVC.Core.Attributes { public class TimeShareAuthorizeAttribute : AuthorizeAttribute { protected override bool Aut...

Is there a shorthand for Form.BeginInvoke?

Quite often in my GUI code, I write something like this: private void SecondTimer_Elapsed(object sender, ElapsedEventArgs e) { if (progressBar1.InvokeRequired) { progressBar1.BeginInvoke(new ElapsedEventHandler(SecondTimer_Elapsed), new[] {sender, e}); return; } //Code goes here } Of course, this is necessary i...