Search Results

Search found 10804 results on 433 pages for 'attribute keys'.

Page 119/433 | < Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >

  • Links sometimes not working in WebView

    - by littleFluffyKitty
    On occasion links in the WebView will not respond. The highlight press color will appear around them but nothing happens. I am also using WebViewClient's shouldOverrideUrlLoading and that function is not called when this happens. Edit: I have narrowed this issue down to the following circumstances: The webpage is the first page a WebView opens. The webpage uses meta name="viewport" attribute in the html head The WebView is using WebView.getSettings().setUseWideViewPort(true); Android 2.1 (Doesn't appear to happen in later versions, didn't test earlier) If a webpage meeting those above is opened no links will work. If another similar page is loaded, those links will not work either. It is not until you load a page without meta name="viewport" that links start to work. After a page without that meta attribute is opened and then you load a page with the meta viewport attribute, the links start working.

    Read the article

  • Finding the attributes on the properties of an instance of a class

    - by Dan
    Given an instance of a class I want to set properties on attributes at runtime. So I tried this, but as far as I can tell this finds the attributes on the class not the instance, so any changes I make to the attribute properties have no effect. var properties = myObject.GetType().GetProperties(); foreach (object prop in properties) { var attribute =prop.GetCustomAttributes(typeof(MyAttribute), true)[0]; //attribute.MyProp do some stuff } If I try using type descriptor like below, there is no way of getting to the attributes on the properties. var myObject= (MyClass) object; PropertyDescriptorCollection props = TypeDescriptor.GetProperties(myObject); //There is no props[0].GetCustomAttributes(

    Read the article

  • Tell me how to use ActiveRecord#afeter_add

    - by Small Wolf
    Hey,Guys! Now I hava a problem,how can I make the callback#after_add receive a reference to the join model in a has_many :through association? my code like this: class Emergency has_many :departments, :through => :eme_references, :source => :email, :after_add => Proc.new { |eme_reference| eme_reference.eme_flag = 1} end the attribute eme_flag is the model EmeReference's attribute! but in the block ,i get the eme_reference.class is Emergency. I want to set the attribute eme_flag of the model EmeReference. That is my question! cheers!

    Read the article

  • Custom business object comparer

    - by gruber
    Hello, I need to implement mechanism that compares two business objects and return the list of differences (past value, new value, isDifferenceBetter). Because not all fields of class has to be compared and one fields need to be compared with different function then the other (sometimes < is better sometimes is better ... ) I figured out that I need to implelemnt custom attribute and give it to each field that has to be compared in this object. This attribute must have: - name - delegate or sth to point to the function which would be applied for comparision (dont know how to do it so far) So could anyone suggest me if its a good idea? Maybe any other ideas. Using attributes I would be able to use refflection to iterate through each field with attribute and invoke needed delegate. thanks for help bye

    Read the article

  • Serial numbers generation without user data

    - by Sphynx
    This is a followup to this question. The accepted answer is generally sufficient, but requires user to supply personal information (e.g. name) for generating the key. I'm wondering if it's possible to generate different keys based on a common seed, in a way that program would be able to validate if those keys belong to particular product, but without making this process obvious to the end user. I mean it could be a hash of product ID plus some random sequence of characters, but that would allow user to guess potential new keys. There should be some sort of algorithm difficult to guess.

    Read the article

  • Reflection: How to get the underlying type of a by-ref type

    - by Qwertie
    I was surprised to learn that "ref" and "out" parameters are not marked by a special attribute, despite the existence of ParameterInfo.IsOut, ParameterInfo.IsIn (both of which are always false as far as I can see), ParameterAttributes.In and ParameterAttributes.Out. Instead, "ref" parameters are actually represented by a special kind of "Type" object and "out" parameters are just ref parameters with an additional attribute (what kind of attribute I don't yet know). Anyway, to make a by-ref argument you call Type.MakeByRefType(), but my question is, if you already have a by-ref type, how do you get back to the original Type? Hint: it's not UnderlyingSystemType: Type t = typeof(int); Console.WriteLine(t.MakeByRefType().UnderlyingSystemType==t); // FALSE

    Read the article

  • Combining RequiresSTA and Timeout attributes on a test fails

    - by Peter Lillevold
    I have a test that opens and closes a WPF Window and thus requires the STA threading apartment. To safeguard the test against the window staying open (and thus hang the test indefinitely) I wanted to use the Timeout attribute. The problem is that applying the Timeout attribute causes the test to fail on timeout regardless of whether the test works or not. Without the attribute everything works fine. My theory is that Timeout causes the test to be executed on a new thread that does not inherit the STA apartment. Is there another way to have both STA and the timeout safeguard in NUnit? My test looks something like this: [Test, RequiresSTA, Timeout(300)] public void Construct() { var window = new WindowView(); window.Loaded += (sender, args) => window.Close(); var app = new Application(); app.Run(window); try { // ...run system under test } finally { app.Shutdown(); } }

    Read the article

  • How to get attributes values separately for each container present on the webpage in jquery ?

    - by Rachel
    This question is in continuation to How to get attributes of container in jquer, I have different containers on my webpage and all of them have <div id = "some values"> now how can I get attributes values separately for each component ? Is there any way I can know which attribute id belong to which container div ? Currently I am using : var id = $( '.promotion' ).attr( 'id' ); But if I have multiple promotional components on page and all have same div attribute as id than how can I relate that this particular attribute id belonged to this specific container ? Update: I am having a function which is called for each container present on the page and so if I am using above mentioned code than will it not always return me the first match for id in the div and would never go to other divs and so I will always get same value for id which is for the first container ? If so than what is the work around for this ? Hope this question is clear.

    Read the article

  • using sudo with mercurial and ssh authentication

    - by Shawn
    How do i run ssh-add key sudo hg clone [email protected]/etc/etc but use my ssh keys and not the superusers. Hey everyone, when i use sudo with for example, sudo hg clone [email protected]/etc/etc after i have added a key to my user account it doesnt work. I remember this is because the sudo is ran as the superuser but that user cannot have keys added to it. I remember setting some directive (im using debian) that allowed me to run that command as sudo, but still have my ssh keys taken from my normal user account but i didnt make a note of it at the time. Thanks.

    Read the article

  • Webhook data for Orders Paid

    - by David Lazar
    A client recently requested some fancy processing based off of the Gateway attribute registered with a Paid order. When I receive, validate and inspect the JSON of the order, I am logging the gateway attribute and finding it is nil at times. When I check the order using the API after the Webhook, the gateway attribute is present and matches the one rendered in the Shop admin. Is there an explanation for why the gateway can at times be nil? This prevents me from taking care of the client's requested processing.

    Read the article

  • Python: confused with classes, attributes and methods in OOP

    - by user1586038
    A. Am learning Python OOP now and confused with somethings in the code below. Question: 1. def init(self, radius=1): What does the argument/attribute "radius = 1" mean exactly? Why isn't it just called "radius"? The method area() has no argument/attribute "radius". Where does it get its "radius" from in the code? How does it know that the radius is 5? """ class Circle: pi = 3.141592 def __init__(self, radius=1): self.radius = radius def area(self): return self.radius * self.radius * Circle.pi def setRadius(self, radius): self.radius = radius def getRadius(self): return self.radius c = Circle() c.setRadius(5) """ B. Question: In the code below, why is the attribute/argument "name" missing in the brackets? Why was is not written like this: def init(self, name) and def getName(self, name)? """ class Methods: def init(self): self.name = 'Methods' def getName(self): return self.name """

    Read the article

  • AppFabric serialization problem.

    - by jandark
    I am trying cache a class instance with AppFabric but it return class instance with empty members. The reason is DataContract Attribute. My class is marked with [Serializable] and [DataContract(Name = "TestClass", Namespace = "CustomNameSpace.TestClass")] attributes. Problem solving if I mark all properties with DataMember or remove DataContract attribute. But I do not want to remove DataContract attributte because of other serialization needs (such as json or something else) Or I do not want to add DataMember attribute to other classes. (a lot of) Do you have any idea to solve that problem ? Thanks.

    Read the article

  • List filtering: list comprehension vs. lambda + filter

    - by Agos
    I happened to find myself having a basic filtering need: I have a list and I have to filter it by an attribute of the items. My code looked like this: list = [i for i in list if i.attribute == value] But then i thought, wouldn't it be better to write it like this? filter(lambda x: x.attribute == value, list) It's more readable, and if needed for performance the lambda could be taken out to gain something. Question is: are there any caveats in using the second way? Any performance difference? Am I missing the Pythonic Way™ entirely and should do it in yet another way (such as using itemgetter instead of the lambda)? Thanks in advance

    Read the article

  • How to use this piece of code in a function

    - by oliverbj
    I have this jQuery code: var vis = (function(){ var stateKey, eventKey, keys = { hidden: "visibilitychange", webkitHidden: "webkitvisibilitychange", mozHidden: "mozvisibilitychange", msHidden: "msvisibilitychange" }; for (stateKey in keys) { if (stateKey in document) { eventKey = keys[stateKey]; break; } } return function(c) { if (c) document.addEventListener(eventKey, c); return !document[stateKey]; } })(); vis(function(){ document.title = vis() ? 'Visible' : 'Not visible'; }); What it does now is to change the document title of the page. If the page is not visible, it will be changed to that and vise verca. My question is, how can I use this function like this: if page is visible{ //do something } if page is not visible{ //do something else }

    Read the article

  • Neo4j+Gremlin : Trouble with T.gte and floating point node attributes

    - by letronje
    For a type of nodes in my graph, attribute values for an attribute(named 'some_count') is either missing or an integer or a float. I'm trying to write gremlin to filter these nodes based on minimum value for this attribute. I first verified that the values are indeed present by firing the following gremlin g.v(XXX)._().in('category').hasNot('some_count', T.eq, null).back(1).some_count Next, I tried filtering by exact value and that works and show me the matching nodes or gives an empty array if there is no match g.v(XXX)._().in('category').hasNot('some_count', T.eq, null).back(1).has('some_count', T.eq, 120000.0d) But the following query that uses the 'greater than or equal to' comparator doesn't work. g.v(XXX)._().in('category').hasNot('some_count', T.eq, null).back(1).has('some_count', T.gte, 1.0d) this returns nil (I'm querying via ruby/rails using Neo4j AR Adapter ) Instead of returning an empty array for no match, it returns a nil, which tells me something could be wrong with the query itself. I'm running neo4j community server 1.8. Is there a way I can ask Neo4j to log errors/queries, to see what could be going wrong ?

    Read the article

  • Taking 2 attributes from XElement to create a dictionary LINQ

    - by AndyC
    I'm trying to take one attribute to use as the key, and another to use as the value. If I use (xDoc is an XDocument object in the example): Dictionary<string, XElement> test = xDoc.Descendants() .Where<XElement>(t => t.Name == "someelement") .ToDictionary<XElement, string>(t => t.Attribute("myattr").Value.ToString()); I get a dictionary with the myattr value as key (which is what I want) but the entire XElement object as the value. What I want to do, is to select a second attribute to set as the value property on each dictionary item, but can't seem to figure that out. Is it possible to do all of this in 1 Linq statement? Curiousity has caught me! Cheers!

    Read the article

  • How do you get the ID of a control in ASP.NET

    - by James
    I am attempting to loop through an array of numbers, match them to the checkbox they they are associated with, and checkmark that box. My checkbox is set up like: <input type="checkbox" runat="server" id="someID" name="somename" value="1234" /> My code when the page loads currently looks like: foreach (string interest in interests_Var){ foreach (var c in Page.Controls) { } } interests_Var is my array containing different numbers. We'll assume one of them is 1234. While looping through the page controls, I want to compare the value of the control to my number. If it equals my number, I want to then apply the attribute checked="checked". I'm assuming I have to find the ID of the control I am using, then use that ID to add a new attribute. Or is there a way I can add the attribute using the c variable? I'm not dead set on this setup, so if you know a better way, I'm all ears. Thanks for any help and suggestions.

    Read the article

  • Is this the best way to get the size of a Paper via CUPS?

    - by Lawrence Johnston
    I've got a CUPS job control file. I need to get the actual dimensions of the print that was made. This is the way I've figure out to do it: Get the paper name using the media attribute. (e.g. Letter) Get the printer uri from the printer-uri attribute. (e.g. ipp://localhost/printers/MyPrinter) Get the printer name by passing the printer uri to the IPP_GET_PRINTER_ATTRIBUTES operation and getting the printer-name attribute. (e.g. MyPrinter) Get the path to the PPD passing the printer name to the the cupsGetPPD method. Open the PPD passing the path to the PPD to the ppdOpenFile method. Get the paper size by passing the PPD and paper name to the ppdPageSize method. This will work, but it seems a bit roundabout. Is there a more efficient way of getting what I need?

    Read the article

  • My choice of fieldname for CakePHP's form helper is not working properly, why?

    - by grokker
    Hi, I'm creating an AJAX form. The problem is when I'm trying to create a input form with formhelper, my input's name attribute is not correctly renedered in the view. Here's my code: $form->input('MainAttribute.'.$i.'.SubAttribute.'.$j.'.score', array('label' => '', 'options' => $scores)); I created it that way because I want SubAttribute to be inside MainAttribute. When I inspect the HTML, the name attribute of the form is cutted of like: name="data[SuperMainAttribute]" How can I specify the name attribute to the one that I'm planning on doing? (e.g. data[MainAttribute][0][SubAttribute][0][score])

    Read the article

  • Perl array and hash manipulation using map

    - by somebody
    I have the following test code use Data::Dumper; my $hash = { foo => 'bar', os => 'linux' }; my @keys = qw (foo os); my $extra = 'test'; my @final_array = (map {$hash->{$_}} @keys,$extra); print Dumper \@final_array; The output is $VAR1 = [ 'bar', 'linux', undef ]; Shouldn't the elements be "bar, linux, test"? Why is the last element undefined and how do I insert an element into @final_array? I know I can use the push function but is there a way to insert it on the same line as using the map command? Basically the manipulated array is meant to be used in an SQL command in the actual script and I want to avoid using extra variables before that and instead do something like: $sql->execute(map {$hash->{$_}} @keys,$extra);

    Read the article

  • How to find hidden properties/methods in Javascript objects?

    - by ramanujan
    I would like to automatically determine all of the properties (including the hidden ones) in a given Javascript object, via a generalization of this function: function keys(obj) { var ll = []; for(var pp in obj) { ll.push(pp); } return ll; } This works for user defined objects but fails for many builtins: repl> keys({"a":10,"b":2}); // ["a","b"] repl> keys(Math) // returns nothing! Basically, I'd like to write equivalents of Python's dir() and help(), which are really useful in exploring new objects. My understanding is that only the builtin objects have hidden properties (user code evidently can't set the "enumerable" property till HTML5), so one possibility is to simply hardcode the properties of Math, String, etc. into a dir() equivalent (using the lists such as those here). But is there a better way?

    Read the article

  • C# 3.5 Merge 2 lists of 2 different types

    - by Ehsan
    I have 2 generic Lists List<type1> L1 , List<type2> L2 in C# 3.5 Problem: type1 has an attribute called "key1" and type2 has an attribute called "key2" How to merge L1 and L2 on key1 = key2. Both lists are unsorted but I'm welcome to any ideas on how to sort the lists based on the attribute. I'd like to be able to merge the two lists on a key. I know it's not a dictionary and it would've been nice if it was but there is a very specific reason why they are lists which I will not get in to because that is irrelevant.

    Read the article

  • XSLT ... I can'f find a (working) find minimum value in XML and set variable

    - by Bob
    I've search for hours and not found an example that allows for the very first position to be the lowest. I'm getting 'False' instead of the value returned .... EDIT: Oddly enough if I run a 2nd instance as MAX_Landed with ascending it returns a value just fine. If I switch the order in the XSLT the first instance will return 'False' and the 2nd will work. Hope I'm making sense ..... Example XML which I can't get formatted to show correctly and in a hurry so you get the gist I hope: <?xml version="1.0"?> <GetLowestOfferListingsForASINResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01"> <GetLowestOfferListingsForASINResult ASIN="0470067802" status="Success"> <AllOfferListingsConsidered>false</AllOfferListingsConsidered> <Product xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01" xmlns:ns2="http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd"> <LowestOfferListings> <LowestOfferListing> <Qualifiers> <ItemCondition>Used</ItemCondition> <ItemSubcondition>Good</ItemSubcondition> </Qualifiers> <Price> <LandedPrice> <Amount>15.71</Amount> </LandedPrice> </Price> </LowestOfferListing> <LowestOfferListing> <Qualifiers> <ItemCondition>Used</ItemCondition> <ItemSubcondition>Good</ItemSubcondition> </Qualifiers> <Price> <LandedPrice> <Amount>16.71</Amount> </LandedPrice> </Price> </LowestOfferListing> <LowestOfferListing> <Qualifiers> <ItemCondition>Used</ItemCondition> <ItemSubcondition>Good</ItemSubcondition> </Qualifiers> <Price> <LandedPrice> <Amount>18.71</Amount> </LandedPrice> </Price> </LowestOfferListing> </LowestOfferListings> </Product> </GetLowestOfferListingsForASINResult> </GetLowestOfferListingsForASINResponse> Example XSLT : <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:amz="http://mws.amazonservices.com/schema/Products/2011-10-01" exclude-result-prefixes="amz"> <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/> <xsl:template match="/"> <xsl:variable name="MIN_Landed"> <xsl:for-each select="//Amount"> <xsl:sort data-type="number" order="ascending"/> <xsl:if test="position()=1"><xsl:value-of select="."/></xsl:if> </xsl:for-each> </xsl:variable> <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"> <ERRORCODE>0</ERRORCODE> <PRODUCT BUILD="" NAME="" VERSION=""/> <DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="" RECORDS="1" TIMEFORMAT="h:mm:ss a"/> <METADATA> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="DATA" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Min_Landed" TYPE="TEXT"/> </METADATA> <RESULTSET> <xsl:attribute name="FOUND">1</xsl:attribute> <xsl:for-each select="amz:GetLowestOfferListingsForASINResponse/amz:GetLowestOfferListingsForASINResult/amz:Product/amz:LowestOfferListings/amz:LowestOfferListing"> <ROW> <xsl:attribute name="MODID">0</xsl:attribute> <xsl:attribute name="RECORDID">1</xsl:attribute> <COL> <DATA> <xsl:value-of select="amz:Qualifiers/amz:ItemCondition"/> </DATA> </COL> <COL> <DATA> <xsl:value-of select="$MIN_Landed"/> </DATA> </COL> </ROW> </xsl:for-each> </RESULTSET> </FMPXMLRESULT> </xsl:template> </xsl:stylesheet> HELP PLEASE! I really didn't want to post so much Amazon code but here it is stripped down to a bare bones response

    Read the article

  • How to reverse a dictionary that it has repeated values (python)

    - by Galois
    Hi guys! So, I have a dictionary with almost 100,000 (key, values) pairs and the majority of the keys map to the same values. For example imagine something like that: dict = {'a': 1, 'c': 2, 'b': 1, 'e': 2, 'd': 3, 'h': 1, 'j': 3} What I want to do, is to reverse the dictionary so that each value in dict is going to be a key at the reverse_dict and is going to map to a list of all the dict.keys that used to map to that value at the dict. So based on the example above I would get: reversed_dict = {1: ['a', 'b', 'h'], 2:['e', 'c'] , 3:['d', 'j']} I came up with a solution that is very expensive and I would really want to hear any ideas more efficient than mine. my expensive solution: reversed_dict = {} for value in dict.values(): reversed_dict[value] = [] for key in dict.keys(): if dict[key] == value: if key not in reversed_dict[value]: reversed_dict[value].append(key) Output >> reversed_dict = {1: ['a', 'b', 'h'], 2: ['c', 'e'], 3: ['d', 'j']} I would really appreciate to hear any ideas better and more efficient than than mine. Thanks!

    Read the article

  • Filtering SQLAlchemy query on attribute_mapped_collection field of relationship

    - by bsa
    I have two classes, Tag and Hardware, defined with a simple parent-child relationship (see the full definition at the end). Now I want to filter a query on Tag using the version field in Hardware through an attribute_mapped_collection, eg: def get_tags(order_code=None, hardware_filters=None): session = Session() query = session.query(Tag) if order_code: query = query.filter(Tag.order_code == order_code) if hardware_filters: for k, v in hardware_filters.iteritems(): query = query.filter(getattr(Tag.hardware, k).version == v) return query.all() But I get: AttributeError: Neither 'InstrumentedAttribute' object nor 'Comparator' object associated with Tag.hardware has an attribute 'baseband The same thing happens if I strip it back by hard-coding the attribute, eg: query.filter(Tag.hardware.baseband.version == v) I can do it this way: query = query.filter(Tag.hardware.any(artefact=k, version=v)) But why can't I filter directly through the attribute? Class definitions class Tag(Base): __tablename__ = 'tag' tag_id = Column(Integer, primary_key=True) order_code = Column(String, nullable=False) version = Column(String, nullable=False) status = Column(String, nullable=False) comments = Column(String) hardware = relationship( "Hardware", backref="tag", collection_class=attribute_mapped_collection('artefact'), ) __table_args__ = ( UniqueConstraint('order_code', 'version'), ) class Hardware(Base): __tablename__ = 'hardware' hardware_id = Column(Integer, primary_key=True) tag_id = Column(String, ForeignKey('tag.tag_id')) product_id = Column(String, nullable=True) artefact = Column(String, nullable=False) version = Column(String, nullable=False)

    Read the article

< Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >