hashtable

Understanding pushing to a hash and ||=[] construct. (generated in boilerplate.t)

元气小坏坏 提交于 2019-12-08 19:36:29
问题 I'm re-acquainting myself with Perl, and have just used module-starter to initialise a new project. I'm now trying to understand the generated code. All is fine apart from the follow line indicated : sub not_in_file_ok { my ($filename, %regex) = @_; open( my $fh, '<', $filename ) or die "couldn't open $filename for reading: $!"; my %violated; while (my $line = <$fh>) { while (my ($desc, $regex) = each %regex) { if ($line =~ $regex) { ##I'm having problems here push @{$violated{$desc}||=[]}, $

Java Hashtable .containsKey(String key) is returning true even when the strings and hashcodes are different… How?

↘锁芯ラ 提交于 2019-12-08 14:05:37
I'm currently having some issues with my Hashtable in java, where FEightPuzzle is a class which I've created. Inside my class I have a String which is storing the key for each instance. Now during my program when I check inside the Hashtable for duplicate instances I sometimes "find" some when really the found ones are different. Take for example when I call bol.containsKey(current.key) where bol is a HT and current is an FEightPuzzle. When this is true I check the values of the keys and they are current.key = "8 14 11 0 6 12 13 1 10 4 5 9 15 2 3 7" bol.get(current.key).key = "12 8 4 0 13 9 5

Converting Hashtable in Powershell

强颜欢笑 提交于 2019-12-08 12:18:42
问题 I need some help outputting a a hash table to the body of an email message. $computer = "adwte998" $err = "This is the error" $td = Get-Date $table = @{ Workstation = $computer Error = $err Time = $td } send-mailmessage -to "email@email.com" -from "Automated Reboot<no-reply@email.com>" -subject "E-Mail HashTable Test" -body ($table | Out-String) -smtpserver smtpserver.email.com The Message body looks like it should if i just returned the $table I would ideally like to convert the table to a

C# application how could i implement dictionary or hashtable for this?

試著忘記壹切 提交于 2019-12-08 10:40:24
问题 This is my problem, i want to write a basic console application where i enter a date as input, if that date hasnt been entered the application then allow a time to enter a note, i.e for 07/08/2013 for time 5:00 - 7:00 pm enter text blah blah then application will keep looping, if i enter the same date, i shouldnt be able to enter the same times as above, but i should be able to enter 7:00 to 8 for example. i was thinking of using dictionary : Dictionary<string, Booking> BookingDict = new

Compare similar values from hashtable with loop in Powershell

不打扰是莪最后的温柔 提交于 2019-12-08 09:14:37
问题 I have 2 hash tables : [hashtable]$Localisation = @{ "Macdo" = "OU=France,OU=Paris"; "BurgerKing" = "OU=USA,OU=LA"; "Quick" = "OU=Japan,OU=Tokyo"; } [hashtable]$Profil = @{ "Big Mac" = "Macdo"; "Whooper" = "BurgerKing"; "Burger" = "Quick, BurgerKing, Macdo"; "Fries" = "BurgerKing, Macdo"; "Coke" = "Quick, Macdo"; "HappyMeal" = "Macdo"; } I need to get this kind of result: "Big Mac" = "OU=France,OU=Paris" "Whooper" = "OU=USA,OU=LA"; "Burger" = "OU=Japan,OU=Tokyo, OU=USA,OU=LA, OU=France,OU

How does the MAD (Multiply, Add, Divide) Hashing function work?

丶灬走出姿态 提交于 2019-12-08 08:10:09
问题 I have been assigned as a university project the task to create data structures (such as minheap, hashtable etc.) from scratch. However the Hashtable or more specifically the Hash maps - functions have given me quite some trouble. I have come across the MAD (Multiply, Add, Divide) function which basically is: h(x) = [(a*x + b) % p] % N, where a,b : random integers, p : large prime number and N : number of elements in hashtable. My question is how (and why) exactly does this function

Java Hashtable .containsKey(String key) is returning true even when the strings and hashcodes are different… How?

和自甴很熟 提交于 2019-12-08 06:58:46
问题 I'm currently having some issues with my Hashtable in java, where FEightPuzzle is a class which I've created. Inside my class I have a String which is storing the key for each instance. Now during my program when I check inside the Hashtable for duplicate instances I sometimes "find" some when really the found ones are different. Take for example when I call bol.containsKey(current.key) where bol is a HT and current is an FEightPuzzle. When this is true I check the values of the keys and they

how to get the keys of a xmlHashTable ? (libxml2)

泪湿孤枕 提交于 2019-12-08 04:43:02
问题 I am using the library libxml2 to parse an XML document. And then I saw xmlHashTable in this library. Is it possible to get all the keys of a xmlHashTable ? I want to store all the keys in an array. The XML document is: <?xml version="1.0" encoding="UTF-8"?> <?type-proto key="MIPRegistrationRequest" value="mip" ?> <?avp-proto key="Example-AVP" value="data" ?> <!DOCTYPE dictionary SYSTEM "dictionary.dtd" [ <!-- Any files added here need to be added to Makefile.am and packaging/nsis/wireshark

C++ hash table w/o using STL

时光毁灭记忆、已成空白 提交于 2019-12-08 03:18:37
问题 I need to create a hash table that has a key as a string, and value as an int. I cannot use STL containers on my target. Is there a suitable hash table class for this purpose? 回答1: Here's a quick a dirty C hash I just wrote. Compiles, but untested locally. Still, the idea is there for you to run with it as needed. The performance of this is completely dependant upon the keyToHash function. My version will not be high performance, but again demonstrates how to do it. static const int

Frequently Used metadata Hashmap

穿精又带淫゛_ 提交于 2019-12-08 03:04:25
问题 Are there any implementations of a static size hashtable that limits the entries to either the most recently or most frequently used metadata? I would prefer not to keep track of this information myself. I know most caching components keep track of this, but I would rather not introduce quite a lot of new dependencies. 回答1: You can build an LRU cache using the standard JDK library using LinkedHashMap: public class MyLRUCache<K, V> extends LinkedHashMap<K, V> { private final int maxEntries;