I have the following database schema :
Two tables, books and tags, with n-m relationship.
Books - Tags
We can have for example the book 1, with tags {A,B,C}, and book 2, with tags {A}.
I would like to select the books according to a list of tags.
For example : selected tags list : {A,B}
- book 1
My idea was to use the MINUS SQL function, to subtract book tags list to the selected tags list, and return the book if the list was empty. Unfortunately, this SQL function is not supported by HQL.
Any idea about that ?
hi guys,
i wonder how i can query if a ul has a first-child li with a certain classname?
like…
<ul>
<li>list element 1</li>
<li>list element 2</li>
</ul>
<ul>
<li class="whatever">list element 1</li>
<li>list element 2</li>
</ul>
i want to query if ul has a child with classname whatever - do something!
is that even possible?
thank you
I've got the following C# code segment that takes a list, finds objects that are ready to update, then shoves them into a temp list, deletes from the main list, and then goes on its merry way. My issue is that the foreach block, which cycles through my main list, won't exit.
TempLog.Clear(); //Ensure TempLog is empty
foreach (CLogger ready in PlayerLog)
{
if (ready.UpdateReady == true) // Record is ready to be updated in database
{
TempLog.Add(ready); // Add record to templog
PlayerLog.Remove(ready); // Remove from playerlog
}
}
<---- Never reaches this point
if (TempLog.Count > 0) // Just check that templog isn't empty
{
new Thread(Update).Start(); // Run update code
}
I've put heaps of debugging in, and I can watch PlayerLog start at 1, TempLog at 0, then it enters the foreach loop, picks up that the record UpdateReady flag is on, TempLog goes to 1, PlayerLog goes to 0, then it just stops.. No errors, just stops..
Thanks for the help :)
I have a RPC service with the following method:
public List<Serializable> myMethod(TransactionCall call) {...}
But I get a warning when this method is analyzed, and then the rpc call fails
Analyzing 'my.project.package.myService' for serializable types
Analyzing methods:
public abstract java.util.List<java.io.Serializable> myMethod(my.project.package.TransactionCall call)
Return type: java.util.List<java.io.Serializable>
[...]
java.io.Serializable
Verifying instantiability
(!) Checking all subtypes of Object wich qualify for serialization
It seems I can't use Serializable for my List... I could use my own interface instead (something like AsyncDataInterface, wich implements the Serializable interface) but the fact is that my method will return a list custom objects AND basic objects (such as Strings, int....).
So my questions are:
Is it a standart behaviour? (I can't figure out why I can't use this interface in that case)
Does anyone have a workaround for that kind of situation?
I need to create a new mailing list in Exchange 2010 which would consist of about 50 external email addresses. I have the list of (external) email addresses in plain text format.
I have previously solved this task by manually creating an external contact for each email address and then adding those external contacts to a distribution group.
What would be the most efficient way to solve this task with Exchange 2010?
Does EMS help here?
I'm developing a OpenGL based simulation in C++. I'm optmizing my code now and i see throughout the code the frequently use of std:list and std:vector. What is the more performatic: to continue using C++ stl data structs or a pointer based linked list? The main operation that involve std::list and std::vector is open a iterator and loop through all items in the data structs and apply some processing
Using Maven 2, is there a way I can list out the jar dependencies as just the file names?
mvn dependency:build-classpath
can list the jar files, but that will include the full path to their location in my local repository. What I need is essentially just a list of the file names (or the file names that the copy-dependencies goal copied).
So the list I need would be something like
activation-1.1.jar,antlr-2.7.6.jar,aopalliance-1.0.jar etc...
ideally as a maven property, but I guess, a file such as build-classpath can generate will do.
What I am trying to achieve is writing a Bundle-ClassPath to an otherwise manually maintained MANIFEST.MF file for a OSGi bundle. (You shouldn't need to understand this bit to answer the question.)
To clarify: The question is not about how to write manifest headers into the MANIFEST.MF file in a jar (that is easily googleble). I am asking about how to get the data I want to write, namely the list shown above.
How to get a list of all the subfolders with a specific name
e.g. all the folders which their name contains 'NAME'
I know:
find . | grep *NAME*
but this won't give me a unique list (if the folder has subfolders it gets listed multiple times)
Team,
I would like to know how to display a List View or SPinner using key and value pairs in Android platform. For example take Contacts Contact has id, First Name, LastName, i would like to display First Name and Last Name in the list view or in the spinner,
id1, lastname1, firstname1
id2, lastname2, firstname2
id3, lastname3, firstname3
Once the user selected any value in the List view or spin list, I need to get the key value from the List view or spinner.
How to do it?
Any help or examples is greatly appreciated.
Thanks,
Ramesh
I have a list containing a tuples and long integers the list looks like this:
table = [(1L,), (1L,), (1L,), (2L,), (2L,), (2L,), (3L,), (3L,)]
How do i convert the table to look like a formal list?
so the output would be:
table = ['1','1','1','2','2','2','3','3']
For information purposes the data was obtained from a mysql database.
I have a requirement to filter a list of Clients based on if they haven't had any jobs booked in the last x months. In my code I have two lists, one is my Clients and the other is a filtered List of Jobs between today and x months ago and the idea is to filter Clients based on their id not appearing in the jobs list. I tried the following:
filteredClients.Where(n => jobsToSearch.Count(j => j.Client == n.ClientID) == 0).ToList();
But I seem to get ALL clients regardless. I can easily do a foreach but this severly slows down the process. How can I filter the client list based on the job list effectively?
I have a C# List, that is filled from a database.. So far its only 1400 records, but I expect it to grow a LOT.. Routinely I do a check for new data on the entire list.. What I'm trying to figure out is this, is it faster to simply clear the List and reload all the data from the table, or would checking each record be faster..
Intuition tells me that the dump and load method would be faster, but I thought I should check first...
Guys, I'm struggling. I have query against my db that returns a single column of data and I need to set it as List. Here is what I am working with and I am getting an error about converting void to string.
public static void GetImportedFileList()
{
using (SQLiteConnection connect = new SQLiteConnection(@"Data Source=C:\Documents and Settings\js91162\Desktop\CMMData.db3"))
{
connect.Open();
using (SQLiteCommand fmd = connect.CreateCommand())
{
SQLiteCommand sqlComm = new SQLiteCommand(@"SELECT DISTINCT FileName FROM Import");
SQLiteDataReader r = sqlComm.ExecuteReader();
while (r.Read())
{
string FileNames = (string)r["FileName"];
List<string> ImportedFiles = new List<string>();
}
connect.Close();
}
}
}
THEN LATER IN THE APPLICATION
List<string> ImportedFiles = GetImportedFileList() // Method that gets the list of files from the db
foreach (string file in files.Where(fl => !ImportedFiles.Contains(fl)))
I have a list of tasks. A task is defined by a name, a due date and a duration.
My TaskManager class handles a std::list<Task> sorted by due date. It has to provide a way to get the tasks due for a specific date.
How would you implement that ?
I think a good way (from API point of view) would be to provide a std::list<Task>::iterator pair. So I would have a TaskManager::begin(date) method. Do you think this method should get the iterator by iterating from the start of the list until it finds the first task due on that date, or by getting it from a std::map<date, std::list<Task>::iterator> (but then we have to keep it up-to-date when adding or removing tasks) ?
And then, how could I implement the TaskManager::end(date) method ?
I'm writing a function that takes a list and returns a list of permutations of the argument.
I know how to do it by using a function that removes an element and then recursively use that function to generate all permutations. I now have a problem where I want to use the following function:
(define (insert-everywhere item lst)
(define (helper item L1 L2)
(if (null? L2) (cons (append L1 (cons item '())) '())
(cons (append L1 (cons item L2))
(helper item (append L1 (cons (car L2) '())) (cdr L2)))))
(helper item '() lst))
This function will insert the item into every possible location of the list, like the following:
(insert-everywhere 1 '(a b))
will get:
'((1 a b) (a 1 b) (a b 1))
How would I use this function to get all permutations of a list?
I now have:
(define (permutations lst)
(if (null? lst)
'()
(insert-helper (car lst) (permutations (cdr lst)))))
(define (insert-helper item lst)
(cond ((null? lst) '())
(else (append (insert-everywhere item (car lst))
(insert-helper item (cdr lst))))))
but doing (permutations '(1 2 3)) just returns the empty list '().
I'm trying to teach myself C by coding up a linked list. I'm new to pointers and memory management and I'm getting a bit confused. I have this code:
/* Remove a node from the list and rejiggle the pointers */
void rm_node(struct node **listP, int index) {
struct node *prev;
struct node *n = *listP;
if (index == 0) {
*listP = *listP->next;
free(n);
return;
}
for (index; index > 0; index--) {
n = n->next;
if (index == 2) {
prev = n;
}
}
prev->next = n->next;
free(n);
}
to remove an element from the list. If I want to remove the first node, I still need some way of referring to the list, which is why the listP arg is a double pointer, so it can point to the first element of the list and allow me to free the node that used to be the head. However, when I try to dereference listP to access the pointer to the next node, the compiler tells me error: request for member ‘next’ in something not a structure or union
. What am I doing wrong here? I think I might be hopelessly mixed up..?
I have a laptop I use for home and work. I like to keep them separate as best I can, and it's not very endearing to my clients to sit down in a meeting with them, crack open my start menu, and have WoW at the top of the list. Is there a way to "ban" a program from this list so that--no matter how much I use it--it will never pop in there again?
I want to sort a list List<Blabla> donnees by a criterion on one of its field. My problem is that compareTo is already overriden for this Class. So I've got something like :
Blabla {
public int compareTo(Object other) {
...
}
public int compareTo(Blabla other) {
...
}
}
In a business layer class I call :
Business {
method (){
Collections.sort(List<Blabla > donnees);
}
}
But this call N°1 compareTo method with object parameter. How could I sort my list with the N°2 method?
Hi all,
I want to delete all records in a mysql db except the record id's I have in a list. The length of that list can vary and could easily contain 2000+ id's, ...
Currently I convert my list to a string so it fits in something like this:
cursor.execute("""delete from table where id not in (%s)""",(list))
Which doesn't feel right and I have no idea how long list is allowed to be, ....
What's the most efficient way of doing this from python?
Altering the structure of table with an extra field to mark/unmark records for deletion would be great but not an option.
Having a dedicated table storing the id's would indeed be helpful then this can just be done through a sql query... but I would really like to avoid these options if possible.
Thanks,
I created a document by word 2010 in which I inserted captions for pictures and cross reffernec. I saved the document in my computer and emailed it to a colleague. When she opened the document in her computer, the caption list ( numbers which were cross referenced to pictures ) was not avaiable and she was not able to add refference to a picture or change an existing cross refference. It seems that caption list is only avaiable in the computer which the document is created.
VB 2008 .NET 3.5
I have a custom "Shipment" object that contains a list of "ShippingRate" objects. This list of "ShippingRates" is accessible through a property "Shipment.PossibleShippingRates." That property simply returns a copy of the list of "ShippingRate" for that particular Shipment.
My UI layer receives a list of "Shipment" objects from the BLL. This list is databound to a datagridview, and shows details relevant to the Shipment such as Shipping Address, etc.
I want to bind the "Shipment.PossibleShippingRates" property to a combobox, such that when the user changes the grid row, the combobox reflects the "PossibleShippingRates" for that "Shipment."
In addition, I need a way to store the "ShippingRate" they selected from the combobox for later use.
I have tried a few ideas, but none of them work properly. Any ideas on how to do this?
I want to define a function replicate to replicate a list of numbers by its value using only list comprehension, for example:
replicate [5,1,3,2,8,1,2]
output: [5,5,5,5,5,1,3,3,3,2,2,8,8,8,8,8,8,8,8,1,2,2]
I know this would be easy to use the 'replicate' built in function but only list comprehension is allow, how can I do this?
THANKS!
#include <list>
using std::list;
int main()
{
list <int> n;
n.push_back(1);
n.push_back(2);
n.push_back(3);
list <int>::iterator iter = n.begin();
std::advance(iter, n.size() - 1); //iter is set to last element
}
is there any other way to have an iter to the last element in list?
I have a method as follows. It returns a list of MyTypes which appear to be ordered by myType.Id ascending by default.
public List<MyType> GetMyTypes(List<int> ids)
{
return (from myType in db.MyTypes
where ids.Contains(myType.Id)
select new MyType
{
MyValue = myType.MyValue
}).ToList();
}
So if ids contains
302
300
301
the List returned contains items in ascending order.
What do I need to do to return List<MyType> in the order of ids?
Thanks
edit: I've tried orderby ids.IndexOf(myType.Id) but it throws the exception Method 'Int32 IndexOf(Int32)' has no supported translation to SQL.