homework

SQL Query with computed column

help me please with a query. Assume that we have a table with columns: Transaction StartTime EndTime Now, I need a query with computed column of (value = EndTime-Startime). Actually I need to group Users(Transaction has a FK for Users) and sort them by average time spent for transaction. ...

Assembly Language Question: Counting upper case and lower case letter from a string

Write an Assembly Language program named “count letters” that counts the occurrences of all small and capital letters in given below string and then prints the result in the format (Caps, count:: Small, count). String is “bcAdBDeCEad” and it should print this result (Caps, 5:: Small, 6). The program should take address of the source stri...

C++ Set Erase Entry Question

Hi. I encountered a problem here. I'm using C++ multiset. This is the test file. Score: 3-1 Ben Steven Score: 1-0 Ben Score: 0-0 Score: 1-1 Cole Score: 1-2 Ben I'm using while loop and ifstream (fin1) to read in from the test file above. multiset<string, less<string> > myset; while(!fin1.eof()) { fin1 >> scoreName; if(scoreName...

binary tree number of nodes with a given level

i need to write a program that counts the number of nodes from a certain level given in binary tree i mean < numberofnodes(int level){} > i tried writing it without any success because i don't how to get to a certain level then go to count number of nodes ...

C++ Vector of pointers

For my latest CS homework, I am required to create a class called Movie which holds title, director, year, rating, actors etc. Then, I am required to read a file which contains a list of this info and store it in a vector of pointers to Movies. I am not sure what the last line means. Does it mean, I read the file, create multiple Movi...

Deferring signal handling in Linux

I'm trying to figure out how to block a signal in Linux kernel 2.4 (user space) from invoking its handler, but keep it available to be handled later, preferably as soon as I re activate the handling of said signal. The function sigprocmask seem to come up in all my search results, but I can't find a good, clear description that explain...

Using sigprocmask to implement locks

I'm implementing user threads in Linux kernel 2.4, and I'm using ualarm to invoke context switches between the threads. We have a requirement that our thread library's functions should be uninterruptable by the context switching mechanism for threads, so I looked into blocking signals and learned that using sigprocmask is the standard ...

Recursive QuickSort suffering a StackOverflowException -- Need fresh eyes

I am working on a Recursive QuickSort method implementation in a GenericList Class. I will have a second method that accepts a compareDelegate to compare different types, but for development purposes I'm sorting a GenericList<int> I am recieving stackoverflow areas in different places depending on the list size. I've been staring at a...

Constructors for C++ objects

I have class Person as following : class Person { char* name; int age; }; Now I need to add two contructors. One taking no arguments, that inserts field values to dynamically allocated resources. Second taking (char*, int) arguments initialized by initialization list. Last part is to define a destructor showing information ...

Constructors taking references in C++

I'm trying to create constructor taking reference to an object. After creating object using reference I need to prints field values of both objects. Then I must delete first object, and once again show values of fields of both objects. My class Person looks like this : class Person { char* name; int age; public: Person()...

about cosine similarity

hi i m finding cosine similarity between documents ..i did like dis D1=(8,0,0,1) where 8,0,0,1 are the tf-idf scores of the terms t1, t2, t3 , t4 D2=(7,0,0,1) cos(theta) = (56 + 0 + 0 + 1) / sqrt(64 + 49) sqrt(1 +1 ) which comes out to be cos(theta)= 5 now what do i evaluate from this value...i dont get it wat does cos(theta)=5 s...

extra storage merge sort

I need make a merge sort using an additional array. Here is my code: public class extra_storage{ public static void main(String[]args) { int x[]=new int[]{12,9,4,99,120,1,3,10}; int a[]=new int[x.length]; mergesort(x,0,x.length-1,a); for (int i=0;i<x.length;i++){ System.out.println(x[...

Catching the return of main function before it deallocates resources

I'm trying to implement user threads in Linux kernel 2.4, and I ran into something problematic and unexpected. Background: a thread basically executes a single function and dies, except that when I call thread_create for the first time it must turn main() into a thread as well (by default it is not a thread until the first call, which ...

A question on vectors, pointers and iterators

Guys, I have a midterm examination tomorrow, and I was looking over the sample paper, and I'm not sure about this question. Any help would be appreciated. Let v be a vector<Thingie*>, so that each element v[i] contains a pointer to a Thingie. If p is a vector<Thingie*>::iterator, answer the following questions: what type is p? what ty...

How can I log into gmail in a script/program using HTTPS?

My teacher has given me as an assignment to log into gmail and then send one e-mail or read the list of unread e-mails, but I can't use IMAP/POP3/SMTP or anything that isn't HTTP or HTTPS. I've tried looking for libraries in Ruby/Java to do it but nothing really worked for me. I tried looking at the gmail source code page but I couldn't...

Inverting image using the Python Image Library module

Good day chaps. I'm interested in learning how to invert (make a negative of) an image using the python image libary module. I cannot however, use the ImageOps function 'invert.' I need another solution, using the RGB values. I've searched and tried to no avail. Thanks for any help :) ...

Implementing union of Set using basic java array

Note: This is an assignment. Hi, Continuing with my Set implementation using Java basic array, I'm now struggling with the 3 to last function namely the union. import java.io.*; class Set { private int numberOfElements = 0; private String[] setElements = new String[5]; private int maxNumberOfElements = 5; ...

Binary Tree operator overloading and recursion

I was wondering how to overload the == operator for a binary tree to compare if two trees have identical data at same nodes. So far this is what I have: bool TreeType::operator==(const TreeType //two null trees are equal else if((root != NULL) //one tree is null the other is not } //TREETYPE DECLARATIONS struct TreeNode; enum ...

successor of int32 in C#

what is an immediate inheritor of int32 in C#? int or int16 ...

Creating a for loop in R

For this project you are required to use an R script to simulate the effectiveness of the t-test. A for loop will be used to carry out the following 2000 times: Would the loop look something like this i <- 1 for (i <= 2001) { x <-rf(5,df1=5,df2=10) b <- df2 p.value <-t.test(x,mu=(b/(b-2))$p.value i <- i+1 } ...