Properties file with a list as the value for an individual key

Try writing the properties as a comma separated list, then split the value after the properties file is loaded. For example a=one,two,three b=nine,ten,fourteen You can also use org.apache.commons.configuration and change the value delimiter using the AbstractConfiguration.setListDelimiter(char) method if you’re using comma in your values.

Access iOS dictionary programmatically

There is an API for bringing up the built-in dictionary UI (not the original question but raised in some of the responses), including checking for whether a given word is defined: if ([UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:@”word”]) { UIReferenceLibraryViewController* ref = [[UIReferenceLibraryViewController alloc] initWithTerm:@”word”]; [currentViewController presentViewController:ref animated:YES completion:nil]; }

How to iterate an ArrayList inside a HashMap using JSTL?

You can use JSTL <c:forEach> tag to iterate over arrays, collections and maps. In case of arrays and collections, every iteration the var will give you just the currently iterated item right away. <%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> <c:forEach items=”${collectionOrArray}” var=”item”> Item = ${item}<br> </c:forEach> In case of maps, every iteration the var will give … Read more

Is there an easy way to convert object properties to a dictionary

Assuming that data is some object and that you want to put its public properties into a Dictionary then you could try: Original – here for historical reasons (2012): Dictionary<string, string> FD = (from x in data.GetType().GetProperties() select x) .ToDictionary (x => x.Name, x => (x.GetGetMethod().Invoke (data, null) == null ? “” : x.GetGetMethod().Invoke (data, … Read more

delete all keys except one in dictionary

Why don’t you just create a new one? lang = {‘en’: lang[‘en’]} Edit: Benchmark between mine and jimifiki’s solution: $ python -m timeit “lang = {‘ar’:’arabic’, ‘ur’:’urdu’,’en’:’english’}; en_value = lang[‘en’]; lang.clear(); lang[‘en’] = en_value” 1000000 loops, best of 3: 0.369 usec per loop $ python -m timeit “lang = {‘ar’:’arabic’, ‘ur’:’urdu’,’en’:’english’}; lang = {‘en’: lang[‘en’]}” … Read more

Why use dict.keys?

On Python 3, use dct.keys() to get a dictionary view object, which lets you do set operations on just the keys: >>> for sharedkey in dct1.keys() & dct2.keys(): # intersection of two dictionaries … print(dct1[sharedkey], dct2[sharedkey]) In Python 2.7, you’d use dct.viewkeys() for that. In Python 2, dct.keys() returns a list, a copy of the … Read more

LINQ select in C# dictionary

If you are searching by the fieldname1 value, try this: var r = exitDictionary .Select(i => i.Value).Cast<Dictionary<string, object>>() .Where(d => d.ContainsKey(“fieldname1”)) .Select(d => d[“fieldname1”]).Cast<List<Dictionary<string, string>>>() .SelectMany(d1 => d1 .Where(d => d.ContainsKey(“valueTitle”)) .Select(d => d[“valueTitle”]) .Where(v => v != null)).ToList(); If you are looking by the type of the value in the subDictionary (Dictionary<string, object> explicitly), … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)