lookup

XSLT 2.0 External lookup using key() and document()

Hi, I'm pulling what's left of my hair out trying to get a simple external lookup working using Saxon 9.1.0.7. I have a simple source file dummy.xml: <something> <monkey> <genrecode>AAA</genrecode> </monkey> <monkey> <genrecode>BBB</genrecode> </monkey> <monkey> <genrecode>ZZZ</genrecode> </monkey> ...

tracking if a result has already been computed using hash table

My application would perform a large number of matrix operations (e.g., add/ multiply) on dense matrices. I would like to cache unique results in order to avoid duplicate computations. Dense matrix: typdef struct denseMatrix{ int m; int n; double **d; // actual matrix multiplyTable **entry; // key & result } dns; Table...

Algorithm to look up the date range based on event date

I'm writing a PHP function that would use a table of sorts to look up which DB shard the application should go to, based on the datestamp I have. The shard configuration is something like this (pseudo-code): the first column is the date of the event I'm looking for and the 2nd is the shard the event resides in. pre-2008 -> shard1 2008-...

How do you add a lookup field to a dataset?

I've got a dataset that I need a lookup field for. Problem is, this dataset's structure is defined by the result of a query. I can't add the field as a TFieldDef before setting .Active = true; because it gets overwritten, and I can't add it after running the query because you can't alter the structure of an open dataset. There has to ...

Lookup field in Edit in Datasheet mode in sharepoint doesn't work

I've added a lookup field to a document library, and it is possible to choose values as expected in "Edit properties" for a single document. However, when in Edit in Datasheet mode all of the dropdowns for the lookup field are EMPTY!!!! Is this just the way it is, or have I done something wrong? Has anyone managed to get lookup fields t...

Many to many lookups in Django

This is probably insultingly simple and worthy of a Nelson Muntz laugh, but I'm having a real braindead moment tryng to make many to many connections across various model relationships. I have the following models (simplified for your enjoyment!): class Document(models.Model): title = models.CharField(max_length=200) author = m...

RoR Lookup example

Hello. I have a very simple problem but cannot find a nice solution. I have a lookup code in ruby (for example, Students that live in a State): # State lookup (id, name) class State < ActiveRecord::Base has_many :students end # Class that belogs to a state class Student< ActiveRecord::Base belongs_to :state end and in the vie...

Confusing function lookup with templates in C++

Starting with the following (using gcc version 4.0.1): namespace name { template <typename T> void foo(const T& t) { bar(t); } template <typename T> void bar(const T& t) { baz(t); } void baz(int) { std::cout << "baz(int)\n"; } } If I add (in the global namespace) struct test {}; void bar(co...

Convert list of objects to a list of integers and a lookup table

To illustrate what I mean by this, here is an example messages = [ ('Ricky', 'Steve', 'SMS'), ('Steve', 'Karl', 'SMS'), ('Karl', 'Nora', 'Email') ] I want to convert this list and a definition of groups to a list of integers and a lookup dictionary so that each element in the group gets a unique id. That id should map t...

What is the point of Lookup<TKey, TElement> ?

The MSDN explains Lookup like this: A Lookup<TKey, TElement> resembles a Dictionary<TKey, TValue>. The difference is that a Dictionary<TKey, TValue> maps keys to single values, whereas a Lookup<TKey, TElement> maps keys to collections of values. I don't find that explanation particularly helpful. What is Lookup used for? ...

match and copy

Hi I am having some difficulty creating a macro - i need a macro whereby when the user input a dept code, the macro will take the number, go to first worksheet, read column B until it match the dept code, then copy all the appropriate rows for the dept code. I then need this to loop until the last worksheet. The workbook has about 9 work...

Where can i find the: 1) cache hits and 2) cache lookup stats in SQL Server

First of, the question is not: how to see SQL Server cache hit rate! For that one i already know of a view that contains that precises statistic. My question is in fact: where are the raw statistics from where the hit ratio is calculated? Sql server, in msdn pages, states that the cache hit ratio is the total cache hits divided by the ...

Does anyone know of a webservice for looking up definitions of words that would be able to return results in JSON?

I found http://words.bighugelabs.com/api.php but nothing like this for definitions/dictionary. Ideally I'd grab a dictionary file and build my own API for this, but this is for a demo and we need something short-term that can be called from within a javascript function. ...

Volume DNS Lookup API Provider which finds all domains for a given IP Address

We're currently looking for a reliable Reverse DNS lookup service (Input IP Address -> output domain name) which is accessible by API. Volumes are not not huge but we need a reliable service. Anybody know any providers? experience with them? NB: I need reverse lookup - i.e. I have the IP address, I want to domain name. ...

LINQ Convert Dictionary to Lookup

I have a variable of type Dictionary<MyType, List<MyOtherType>> I want to convert it to a Lookup<MyType, MyOtehrType>. I wanted to use Lambda functions to first, flatten the dictionary and then convert this to Lookup using the ToLookup(). I got stuck with the dictionary. I thought about using SelectMany but can't get it working. Anyon...

Lookup table where most sequential values point to the same object?

Suppose I have a range of keys, say 0 -> 1000 Say 0 - > 99 map to one object 100 -> 251 map to another etc. etc. What is a good way to map a key to an object without having to have an array of 1000 size and a bunch of if (x >= 0 && x <= 99) business? I mean without any logic i.e. a stairstep table ...

F# equivalent of toLookup

Given this: [ ("A","A122"); ("A","A123"); ("B","B122"); ("B","B123"); ("C","C122"); ] Is there a standard function to get this? [ ("A",["A122";"A123"]); ("B",["B122";"B123"]); ("C",["C122"]) ] I thought of Seq.distinctBy, List.partition, Set, Map, but none of them seem to be what I'm looking for. Th...

Script for the USPS

Hello, I am trying to write a script that does a zip code look up at the USPS. URL="http://zip4.usps.com/zip4/citytown_zip.jsp". The data gets submitted by POST is: zip5=YOURZIPCODE&submit.x=3&submit.y=22&submit=Find+ZIP+Code The part I am having a hard time finding is how these numbers get generated: submit.x=3 submit.y=22 The above...

Data lookup method for small data set with Java?

We have to lookup some data based on three input data fields. The lookup has to be fast. There are only about 20 possible lookup combinations. We've implemented this using a static HashMap instance where we create a key by concatinating the three data fields. Is there a better way to do this or is this the way to go? Code is below. ...

What algorithms do DNS servers use for faster lookups?

DNS servers have to be fast in order to avoid latency. What algorithms do DNS Servers use to reduce latency? Are they any caching mechanisms that could be effectively used to improve speed? ...