Search Results

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

Page 47/433 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • How to assign optional attribute of NSManagedObject in a NSManagedObjectModel having Three NSManaged

    - by Kundan
    I am using coredata framework. In my NSManagedObjectModel i am using three entities that are Class, Student and Score where class and student have one-to-many & inverse relationship and Student and Score have also inverse but one-one relationship. Score entity has all optional attributes and having default '0' decimalVaue, which is not assigned at the time new Student is added. But later i want to assign them score individually and also to particular attribute not all of score attributes in a go. I am able to create and add Students to particular Class but dont have any idea how to call particular student and assign them score. For example I want to assign Score'attribute "dribbling" [there are many attributes like "tackling"] a decimal value to Student "David" of Class "Soccer" ,how i can do that? Thanks in advance for any suggestion.

    Read the article

  • C# cast string to enum with enum attribute

    - by rubentjeuh
    Hello, i've got the following question: I've got public enum Als { [StringValue("Beantwoord")] Beantwoord = 0, [StringValue("Niet beantwoord")] NietBeantwoord = 1, [StringValue("Geselecteerd")] Geselecteerd = 2, [StringValue("Niet geselecteerd")] NietGeselecteerd = 3, } with public class StringValueAttribute : System.Attribute { private string _value; public StringValueAttribute(string value) { _value = value; } public string Value { get { return _value; } } } And i would like to put the value from the item I selected of a combobox into a int: int i = ((int)(Als)Enum.Parse(typeof(Als), (string)cboAls.SelectedValue)); //<- WRONG Is this possible, and if so, how? (the stringvalue matches the value selected from the combobox) Thanks

    Read the article

  • [PHP] Condition for array with string as keys

    - by Kel
    My PL/SQL procedure returns a cursor. It always returns data. I fetch (oci_fetch_assoc) it and save it in an array. If results were found the keys of the array will be strings. If the cursor didn't find data, it will return value 0, thus the key of the array will be numeric. while($data = oci_fetch_assoc($cursor)){ if(!isset($data[0])){ ... } ... ... } What's the best way to check that the array is not just 0, but contains data? Thanks

    Read the article

  • Are concurrency issues possible when using the WCF Service Behavoir attribute set to ConcurrencyMode

    - by Brandon Linton
    We have a WCF service that makes a good deal of transactional NHibernate calls. Occasionally we were seeing SQL timeouts, even though the calls were updating different rows and the tables were set to row level locking. After digging into the logs, it looks like different threads were entering the same point in the code (our transaction using block), and an update was hanging on commit. It didn't make sense, though, because we believed that the following service class attribute was forcing a unique execution thread per service call: [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.PerCall)] We recently changed the concurrency mode to ConcurrencyMode.Single and haven't yet run into any issues, but the bug was very difficult to reproduce (if anyone has any thoughts on flushing a bug like that out, let me know!). Anyway, that all brings me to my question: shouldn't an InstanceContextMode of PerCall enforce thread-safety within the service, even if the ConcurrencyMode is set to multiple? How would it be possible for two calls to be serviced by the same service instance? Thanks!

    Read the article

  • Rails - building an absolute url in a model's virtual attribute without url helper

    - by Nick
    I have a model that has paperclip attachments. The model might be used in multiple rails apps I need to return a full (non-relative) url to the attachment as part of a JSON API being consumed elsewhere. I'd like to abstract the paperclip aspect and have a simple virtual attribute like this: def thumbnail_url self.photo.url(:thumb) end This however only gives me the relative path. Since it's in the model I can't use the URL helper methods, right? What would be a good approach to prepending the application root url since I don't have helper support? I would like to avoid hardcoding something or adding code to the controller method that assembles my JSON. Thank you

    Read the article

  • NHibernate and hbm2dll update attribute

    - by michael lucas
    Hi, i'm using NHibernate with Sdf database. In my hibernate.cfg.xml file i've set: <property name="hbm2ddl.auto" value="update"/> But this does not seem to work at all. "Update" attribute should make NHibernate generate missing tables and columns during application launch, but it does not happen. If i want missing tables geenrated I have to set hbm2dll.auto property to "create" which is not an option for me since it drops existing db content beforehand. I experienced the same problem with PostgreSql problem. Am I missing something?

    Read the article

  • MYSQL Inner Join two table over two keys

    - by bertsisterwanda
    I am doing a query to return all users shopping carts, stored in the sb_carts table. The product information stored in sb_carts is referenced over two keys product_sku and school_id. It needs to reference both to return a unique product with unique stock levels etc. When I execute the following query it returns one row, I am expecting 3 rows. I have tried breaking the inner join into two separate joins but this still returns only 1 result. joining only on one key has the desired result, but may be retuning the wrong product. A left join returns 3 rows but some data is missing product specific Here is a simplified example of what I am doing SELECT sb_carts.product_sku FROM sb_carts INNER JOIN sb_products ON sb_products.sku = sb_carts.product_sku AND sb_products.school_id = sb_carts.school_id WHERE sb_carts.order_id = 0 AND sb_carts.user_id = 2 GROUP BY sb_carts.cart_id

    Read the article

  • php compare array keys, not values

    - by user271619
    I am successfully using the array_key_exists(), as described by php.net Example: <?php $search_array = array('first' => 1, 'second' => 4); if (array_key_exists('first', $search_array)) { echo "The 'first' element is in the array"; } ?> But, take out the values, and it doesn't work. <?php $search_array = array('first', 'second'); if (array_key_exists('first', $search_array)) { echo "The 'first' element is in the array"; } ?> Not sure how to only compare 2 arrays by their keys only.

    Read the article

  • MS Test : How do I enforce exception message with ExpectedException attribute

    - by CRice
    I thought these two tests should behave identically, in fact I have written the test in my project using MS Test only to find out now that it does not respect the expected message in the same way that nunit does. nunit (fails): [Test, ExpectedException(typeof(System.FormatException), ExpectedMessage = "blah")] public void Validate() { int.Parse("dfd"); } ms test (passes): [TestMethod, ExpectedException(typeof(System.FormatException), "blah")] public void Validate() { int.Parse("dfd"); } No matter what message I give the ms test, it will pass. Is there any way to get the ms test to fail if the message is not right? Can I even create my own exception attribute? I would rather not have to write a try catch block for every test where this occurs.

    Read the article

  • Ignoring extra keys in a hash passed in to create

    - by denniss
    Does rails provide a way to ignore extra keys that are passed in to create. Supposed User has two attributes, first_name and last_name. When I do User.create({ :first_name => "first", :last_name => "last", :age => 10}) that line gives me an UknonwnAttributeError. Well, that makes sense, it happens cause age is not one of the attributes. But is there a way to just ignore key-value pair that is not one of the attributes for User?

    Read the article

  • Structure accessible by attribute name or index options

    - by Bruno DeGoia
    I am very new to Python, and trying to figure out how to create an object that has values that are accessible either by attribute name, or by index. For example, the way os.stat() returns a stat_result or pwd.getpwnam() returns a struct_passwd. In trying to figure it out, I've only come across C implementations of the above types. Nothing specifically in Python. What is the Python native way to create this kind of object? I apologize if this has been widely covered already. In searching for an answer, I must be missing some fundamental concept that is excluding me from finding an answer.

    Read the article

  • Get from associative array only that elements which keys are specified

    - by hsz
    Hello ! It's late and I know it is a very simple question but right now I do not have an idea and deadline is near.. I've got two arrays: $array1 = array( 'a' => 'asdasd', 'b' => 'gtrgrtg', 'c' => 'fwefwefw', 'd' => 'trhrtgr', ); $array2 = array( 'b', 'c' ); What was the name of function to get a part of assoc array by keys from the second array ? $result = array( 'b' => 'gtrgrtg', 'c' => 'fwefwefw', ); Thanks !

    Read the article

  • PHP pass associative array from one function to another wihle keeping keys intact

    - by veronica
    I have two functions and one array function A { $segments = array(); $segments['word']=$var1; $segments['word2']=$var2; $segments['word3']=$var3; return $segments; } function B { $someVar=$segments['word']; $someVar1=$segments['word']; $someVar2=$segments['word']; $vars['other_stuff']... return $vars; } but I am not passing $segments['word']...word3'] to the second function. I am passing $segments[0]; $segments[1]; etc... How can I pass the keys to second function $segments['word'] $segments['word1'] $segments['word2'] Thank you,

    Read the article

  • JQuery validation - how to set the title attribute to the error message

    - by JK
    In JQuery validation the default behavior on an error is to create a label like so: <label for="FirstName" generated="true" class="error">This field is required.</label> Is it possible to change it so that it will output this instead (with a title attribute set to the error message)? <label for="FirstName" generated="true" class="error" title="This field is required.">This field is required.</label> I've tried the highlight method, but the label has not been created yet: $("#form").validate({ highlight: function (element, errorClass) { var label = $("label[for=" + element.id + "]"); // but label doesn't exist yet so this doesnt work if (label && label.length > 0) { // label.length is always 0 label.attr('title', label.text()); } } });

    Read the article

  • custom attribute changes in .NET 4

    - by Sarah Vessels
    I recently upgraded a C# project from .NET 3.5 to .NET 4. I have a method that extracts all MSTest test methods from a given list of MethodBase instances. Its body looks like this: return null == methods || methods.Count() == 0 ? null : from method in methods let testAttribute = Attribute.GetCustomAttribute(method, typeof(TestMethodAttribute)) where null != testAttribute select method; This worked in .NET 3.5, but since upgrading my projects to .NET 4, this code always returns an empty list, even when given a list of methods containing a method that is marked with [TestMethod]. Did something change with custom attributes in .NET 4? Debugging, I found that the results of GetCustomAttributesData() on the test method gives a list of two CustomAttributeData which are described in Visual Studio 2010's 'Locals' window as: Microsoft.VisualStudio.TestTools.UnitTesting.DeploymentItemAttribute("myDLL.dll") Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute() -- this is what I'm looking for When I call GetType() on that second CustomAttributeData instance, however, I get {Name = "CustomAttributeData" FullName = "System.Reflection.CustomAttributeData"} System.Type {System.RuntimeType}. How can I get TestMethodAttribute out of the CustomAttributeData, so that I can extract test methods from a list of MethodBases?

    Read the article

  • Space bar and arrow keys on Radio buttons trigger TypeError: Error #1009

    - by Sr.Richie
    I've just discovered a bug in my app, it looks like a Flash player bug, i would like to know if anyone has found a workaround or something. I've some radio buttons groups in my app. If I press the arrow keys while holding the spacebar pressed, it ends up triggering TypeError: Error #1009: Cannot access a property or method of a null object reference. at fl.controls::LabelButton/drawIcon() at fl.controls::LabelButton/draw() at fl.controls::RadioButton/draw() at fl.core::UIComponent/callLaterDispatcher() If found this thread that describes my same situation. Do you think there's any workaround for this? Is it really a flash bug?

    Read the article

  • taking text from title attribute and adding it into a div in jquery

    - by ivordesign
    Basically i'm trying to grap the text from the title attribute in a link and show it in a paragaph in another div when a user hovers of the item, and then hide it when the user moves away. so far what i've got is (function($) { $.fn.showText = function() { $(this).hover( function() { $(this) .data('title', $(this).attr('title')) .removeAttr('title') .appendTo(".itemDecription p"); }, function() { $(this).attr('title', $("this").data('title')); } ); } })(jQuery); //call the plugin $(function(){ $('.wrapper ul li a').showText(); }); I got the code from somewhere else on stackoverflow, but i just can't seem to get it to work, and help would be much appriciated.

    Read the article

  • Optional attribute values in MappedField

    - by David Brooks
    I'm new to Scala and Lift, coming from a slightly odd background in PLT Scheme. I've done a quick search on this topic and found lots of questions but no answers. I'm probably looking in the wrong place. I've been working my way through tutorials on using Mapper to create database-backed objects, and I've hit a stumbling block: what types should be used to stored optional attribute values. For example, a simple ToDo object might comprise a title and an optional deadline (e.g. http://rememberthemilk.com). The former would be a MappedString, but the latter could not be a MappedDateTime since the type constraints on the field require, say, defaultValue to return a Date (rather than a Date or null/false/???). Is an underlying NULL handled by the MappedField subclasses? Or are there optional equivalents to things like MappedInt, MappedString, MappedDateTime that allow the value to be NULL in the database? Or am I approaching this in the wrong way?

    Read the article

  • Filtering foreign keys with AJAX in Django admin

    - by cnobile
    I have most of this figured out already. I have AJAX returning the region/state/province when a country is selected. The correct foreign key is saved to the database, however, when the record is viewed afterwards the selected state is not shown in the select nor are any states for the selected country. I understand why this is happening as, the admin view is not aware of the relation between the state and the country. So here is the question. Is there a hook in the admin view that will allow me to load the correct states for the country and set the selected attribute on the option in the select tag? Or how can I override the admin view for any forms that require the country and region/state/province set? I am using jQuery and Djando-1.1. Thanks

    Read the article

  • find xml element by attribute

    - by Moudy
    Using JQuery or Javascript how would I return 'Mary Boone' from the xml below starting out with the show 'id' attribute of '2'? I'm thinking something along the lines of - var result = xml.getElementByAttribute("2").gallery.text(); the XML: <shows> <show id="1"> <artist>Andreas Gursky</artist> <gallery>Matthew Marks</gallery> <medium>photography</medium> </show> <show id="2"> <artist>Eric Fischl</artist> <gallery>Mary Boone</gallery> <medium>painting</medium> </show> </shows>

    Read the article

  • Database design - alternatives for Entity Attribute Value (AEV)

    - by Bob
    Hi, see http://stackoverflow.com/questions/695752/product-table-many-kinds-of-product-each-product-has-many-parameters for similar topic. My question: i want to design a database, that will be used for a production facility of different types of products where each product has its own (number of) parameters. because i want the serial numbers to be in one tabel for overview purposes i have a problem with these different paraeters . One solution could be AEV, but it has its downsides, certainly because we have +- 5 products with every product +- 20.000 serial numbers (records). it looks a bit overkill to me... I just don't know how one could design a database so that you have an attribute in a mastertable that says: 'hey, you could find details of this record in THAT detail-table". 'in a way that you qould easely query the results) currenty i am using Visual Basic & Acces 2007. but i'm going to Visual Basic & MySQL. thanks for your help. Bob

    Read the article

  • Pig: Count number of keys in a map

    - by Donald Miner
    I'd like to count the number of keys in a map in Pig. I could write a UDF to do this, but I was hoping there would be an easier way. data = LOAD 'hbase://MARS1' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage( 'A:*', '-loadKey true -caching=100000') AS (id:bytearray, A_map:map[]); In the code above, I want to basically build a histogram of id and how many items in column family A that key has. In hoping, I tried c = FOREACH data GENERATE id, COUNT(A_map); but that unsurprisingly didn't work. Or, perhaps someone can suggest a better way to do this entirely. If I can't figure this out soon I'll just write a Java MapReduce job or a Pig UDF.

    Read the article

  • How to dynamically set validation messages on properties with a class validation attribute

    - by Dan
    I'm writing Validation attribute that sits on the class but inspects the properties of the class. I want it to set a validation message on each of the properties it finds to be invalid. How do I do this? This is what I have got so far: [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public class LinkedFieldValidationAttribute : ValidationAttribute { private readonly string[] _properiesToValidate; public LinkedFieldValidationAttribute(params string[] properiesToValidate) { _properiesToValidate = properiesToValidate; } public override bool IsValid(object value) { PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(value); foreach (var propertyName in _properiesToValidate) { var propertyValue = properties.Find(propertyName, false).GetValue(value); //if value is invalid add message from base } //return validity } }

    Read the article

  • Find Elements by Attribute using XDocument

    - by Ignacio
    This query seems to be valid, but I have 0 results. IEnumerable<XElement> users = (from el in XMLDoc.Elements("Users") where (string)el.Attribute("GUID") == userGUID.ToString() select el); My XML is as follows: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <Users> <User GUID="68327fe2-d6f0-403b-a7b6-51860fbf0b2f"> <Key ID="F7000012ECEAD101"> ... </Key> </User> </Users> Do you have any clues to shed some light onto this?

    Read the article

  • How to automatically email customers registration keys?

    - by Danny
    I've written a bit of software that I'd like to share with others (a Mac Dashboard widget, specifically), but I'd also like to be compensated a bit for the time I spent on it. I've devised my own simple registration key algorithm, which takes a customer's email address and creates a 12-character alphanumeric key. The software itself is finished, demo limitations, key validation & all. I just need to get the keys to customers. How do I simply alert a key generation script to automatically email a customer a key, upon notification that they paid my account? Can I use PayPal IPN & JavaScript? The simplest solution will do - this is a five dollar widget. :)

    Read the article

< Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >