Search Results

Search found 361 results on 15 pages for 'dictionaries'.

Page 6/15 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Associative array challenges, or examples?

    - by Aerovistae
    I understand well when and how to use an associative array, but I'm trying to teach a friend to program and I'm having some trouble with this particular concept. I need a good set of problems whose solutions are best implemented through the use of maps/hashes/associative arrays/dictionaries. I googled all over and couldn't find any. I was hoping someone might know of some, or perhaps get a community wiki sort of answer. That way I can say, here's our problem, and here's how we could effectively solve it through the use of an associative array... It's one of those cases where when I'm programming and I run into a situation that calls for a dictionary, I recognize it, but I can't seem to make up any such situations to use for a demonstration.

    Read the article

  • CAM XML Editor version 2.2.1 now available.

    - by drrwebber
    CAM Editor v2.2.1 release is now available. Lots of nice enhancements, CAMV performance boost and important bug fixes for DoD, NIEM and LEXS schema. Download is available from the CAM XML Editor Resource Site. The CAM editor is the leading open source XML Editor/Validation/Schema designer for rapidly building and deploying complete XML information exchanges. Provides a visual WYSIWYG structure with rule entry wizards and drag and drop dictionary components. Will import, analyze and refactor existing XML Schema. Oracle is a proud sponsor of the project and its use on the NIEM.gov initiative.Creates XSD schema + JAXB bindings, Mindmap or UML models (XMI), XML test suite examples, HTML documentation + spreadsheets (NIEM IEPDs). XSD schema export in default, flatten, NIEM, and OASIS modes. Generates canonical component dictionaries from schema sets, ERwin models, or spreadsheets.

    Read the article

  • How to make the switch to C++11?

    - by Overv
    I've been programming in C++ for a while now, but mostly thinks centered around the low-level features of C++. By that I mean mostly working with pointers and raw arrays. I think this behavior is known as using C++ as C with classes despite me only having tried C recently for the first time. I was pleasantly surprised how languages like C# and Java hide these details away in convenient standard library classes like Dictionaries and Lists. I'm aware that the C++ standard library has many convenience containers like vectors, maps and strings as well and C++11 only adds to this by having std:: array and ranged loops. How do I best learn to make use of these modern language features and which are suitable for which moments? Is it correct that software engineering in C++ nowadays I'd mostly free of manual memory management? Lastly, which compiler should I use to make the most of the new standard? Visual Studio has excellent debugging tools, but even VS2012 seems to have terrible C++11 support.

    Read the article

  • Does anyone have a specific example of using the Flyweight Pattern?

    - by Jeremy E
    I have been studying design patterns and came accross the fly weight pattern. I have been trying to see opportunities to use the pattern in my applications but I am having trouble seeing how to use it. Also, what are some signs that a fly weight pattern is being used when I read other peoples code? According to the definition it says: Use sharing to support large numbers of fine-grained objects efficiently. If I read it right Dictionaries and Hashtables could be instances of fly weights is this correct? Thanks in advance.

    Read the article

  • MVC2 Strong typing breaking changes...

    - by BitFiddler
    I had the code working for: http://stackoverflow.com/questions/1930229/post-idictionary-back-to-mvc-model I recently migrated to MVC2 and now all my collections/dictionaries are coming back null. I can't seem to find any information about what has changed in the new release to cause this. Anyone know of something that might help?

    Read the article

  • How Do I code this in python with simplejson

    - by Spikie
    how do i code a python program that return a json element that look like this {1:{'name':foo,'age':xl} 2:{'name':vee,'age':xx} .... } What i meant is that i want return nested dictionaries What i hoped to accomplish is something like this var foo = 1.name # to the the value of name in the clientside I hope all this made sense .English is my second language thanks in advance

    Read the article

  • Python Copy Through Assignment?

    - by Marcus Whybrow
    I would expect that the following code would just initialise the dict_a, dict_b and dict_c dictionaries. But it seams to have a copt through effect: dict_a = dict_b = dict_c = {} dict_c['hello'] = 'goodbye' print dict_a print dict_b print dict_c As you can see the result is as follows: {'hello': 'goodbye'} {'hello': 'goodbye'} {'hello': 'goodbye'} Why does that program give the previous result, When I would expect it to return: {} {} {'hello': 'goodbye'}

    Read the article

  • Immutable Dictionary overhead?

    - by Roger Alsing
    When using immutable dictionaries in F# , how much overhead is there when adding / removing entries? Will it treat entire buckets as immutable and clone those and only recreate the bucket whos item has changed? Even if that is the case, it seems like there is alot of copying that needs to be done in order to create the new dictionary(?)

    Read the article

  • dynamically set the control template

    - by Saboor
    hi, i am using dictionaries in WPF. i have two bitmap image in it with name something like image1 and image2 now in forms, i like to set them to single image control depending on condition, some times image1 and sometimes image2. so how i set the source dynamically, in dictonary i have UriSource="/wpf1;component/images/infobarGreen.png" / UriSource="/wpf1;component/images/infobarRed.png" /

    Read the article

  • Sort a python dict

    - by ensnare
    I have a list of dictionaries: [{'title':'New York Times', 'title_url':'New_York_Times','id':4}, {'title':'USA Today','title_url':'USA_Today','id':6}, {'title':'Apple News','title_url':'Apple_News','id':2}] I'd like to sort it by the title, so elements with A go before Z: [{'title':'Apple News','title_url':'Apple_News','id':2}, {'title':'New York Times', 'title_url':'New_York_Times','id':4}, {'title':'USA Today','title_url':'USA_Today','id':6}] What's the best way to do this? Also, is there a way to ensure the order of each dictionary key stays constant, e.g., always title, title_url, then id? Thank you.

    Read the article

  • Chart for deciphering terms in different programming languages

    - by Nathan Adams
    This has been bugging me every since I started to use Python - in PHP you have this ability to use a string as a key in an array. PHP calls these associative arrays. Python calls these dictionaries. Does anyone know of a premade chart that will let me see what the different terminology is in different languages. For example: PHP             | Python Assosicative array | Dictionary

    Read the article

  • Using NSPredicate to segment table by dates in iPhone

    - by pabloruiz55
    I have an array of dictionaries with several jobs. I want to have a table display these jobs sorted by month - year. How could i divide that array so i end up having for example: section: july 2009 and the amount of rows for each job in that date. section: august 2009 and the amount of rows for each job in that date. and so on. Thanks

    Read the article

  • Infinite loop when adding a row to a list in a class in python3

    - by Margaret
    I have a script which contains two classes. (I'm obviously deleting a lot of stuff that I don't believe is relevant to the error I'm dealing with.) The eventual task is to create a decision tree, as I mentioned in this question. Unfortunately, I'm getting an infinite loop, and I'm having difficulty identifying why. I've identified the line of code that's going haywire, but I would have thought the iterator and the list I'm adding to would be different objects. Is there some side effect of list's .append functionality that I'm not aware of? Or am I making some other blindingly obvious mistake? class Dataset: individuals = [] #Becomes a list of dictionaries, in which each dictionary is a row from the CSV with the headers as keys def field_set(self): #Returns a list of the fields in individuals[] that can be used to split the data (i.e. have more than one value amongst the individuals def classified(self, predicted_value): #Returns True if all the individuals have the same value for predicted_value def fields_exhausted(self, predicted_value): #Returns True if all the individuals are identical except for predicted_value def lowest_entropy_value(self, predicted_value): #Returns the field that will reduce <a href="http://en.wikipedia.org/wiki/Entropy_%28information_theory%29">entropy</a> the most def __init__(self, individuals=[]): and class Node: ds = Dataset() #The data that is associated with this Node links = [] #List of Nodes, the offspring Nodes of this node level = 0 #Tree depth of this Node split_value = '' #Field used to split out this Node from the parent node node_value = '' #Value used to split out this Node from the parent Node def split_dataset(self, split_value): fields = [] #List of options for split_value amongst the individuals datasets = {} #Dictionary of Datasets, each one with a value from fields[] as its key for field in self.ds.field_set()[split_value]: #Populates the keys of fields[] fields.append(field) datasets[field] = Dataset() for i in self.ds.individuals: #Adds individuals to the datasets.dataset that matches their result for split_value datasets[i[split_value]].individuals.append(i) #<---Causes an infinite loop on the second hit for field in fields: #Creates subnodes from each of the datasets.Dataset options self.add_subnode(datasets[field],split_value,field) def add_subnode(self, dataset, split_value='', node_value=''): def __init__(self, level, dataset=Dataset()): My initialisation code is currently: if __name__ == '__main__': filename = (sys.argv[1]) #Takes in a CSV file predicted_value = "# class" #Identifies the field from the CSV file that should be predicted base_dataset = parse_csv(filename) #Turns the CSV file into a list of lists parsed_dataset = individual_list(base_dataset) #Turns the list of lists into a list of dictionaries root = Node(0, Dataset(parsed_dataset)) #Creates a root node, passing it the full dataset root.split_dataset(root.ds.lowest_entropy_value(predicted_value)) #Performs the first split, creating multiple subnodes n = root.links[0] n.split_dataset(n.ds.lowest_entropy_value(predicted_value)) #Attempts to split the first subnode.

    Read the article

  • List of drugs for sample data

    - by Skoder
    Where can I find a list of common medical drugs? Researching and typing 150+ drug names would be quite inefficient. In general, are there any sites which have a list of items for developers to use in applications? For example, you can download dictionaries in specific formats (e.g. XML) for use in word games.

    Read the article

  • Why is a .net generic dictionary so big

    - by thefroatgt
    I am serializing a generic dictionary in VB.net and I am very surprised that it is about 1.3kb with a single item. Am I doing something wrong, or is there something else I should be doing? I have a large number of dictionaries and it is killing me to send them all across the wire. The code I use for serialization is Dim dictionary As New Dictionary(Of Integer, Integer) Dim stream As New MemoryStream Dim bformatter As New BinaryFormatter() dictionary.Add(1, 1) bformatter.Serialize(stream, dictionary) Dim len As Long = stream.Length

    Read the article

  • Sort a list of dicts by dict values

    - by ensnare
    I have a list of dictionaries: [{'title':'New York Times', 'title_url':'New_York_Times','id':4}, {'title':'USA Today','title_url':'USA_Today','id':6}, {'title':'Apple News','title_url':'Apple_News','id':2}] I'd like to sort it by the title, so elements with A go before Z: [{'title':'Apple News','title_url':'Apple_News','id':2}, {'title':'New York Times', 'title_url':'New_York_Times','id':4}, {'title':'USA Today','title_url':'USA_Today','id':6}] What's the best way to do this? Also, is there a way to ensure the order of each dictionary key stays constant, e.g., always title, title_url, then id? Thank you.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >