Question 1: As per the book I follow to learn EJB author told that every lookup creates a new stateful session bean. So, what I did is defined a method init() with @PostConstruct annotation with a sysout statement. So, that need to be executed for every Stateful bean instantiated. But the same is not happening. Consider the following cod...
Hi - as a part of a homework assignment, I'm trying to read a single char from stdin, and act according to it:
char choice;
while (1) {
printf("please enter [y]es, [n]o or [m]aybe: ");
scanf("%c", choice);
fflush(stdin);
// validate input
if (choice == 'y' || choice == 'n' || choice == 'm') {
break;
} el...
Hello - I'm trying to write a function that'll detect if a digit is found in a number:
// returns 1 if source contains num, 0 otherwise
int contains_num(source, num);
for example, contains_num(12345, 3) returns 1 and contains_num(12345, 6) returns 0.
I'm not sure how to go about solving this. Probably can't use pointers, arrays and s...
My challenge is as follow:
In competition we have "repechage" Meaning the competitors who loose his fight against the finalist have a chance to come back to get a bronze medal.
Now, how can I find the competitors that lost against the finalist if I cant enter more than 13 ifs?
=IF(N23=B8;B10;B8;IF(N23=B12;B14;IF(N23=B14;B12;IF(N23=B16...
I'm a beginner in Java and I have an assignment to build P2p File Sharing Java application.
I started by creating server and client. Client can send messages to server and server responds. I believe the next step should be inserting the Thread into the server class. I read all about it and tried it bud I just can't pull it off. I hope so...
Some examples of adding and subtracting similarly typed pointers, using numeric and character pointers please. Using C.
Thanks.
...
Hello All,
Im working on a problem that goes like this -
Implement a function that evaluates an expression consisting of
following operands : '(', ')', '+', '-', '*', '/'. Each numbers in the
expression could be large (as large as being represented by string of
1000 digits). The '/' (i.e. divide) operand returns the integer
quotient.
...
I'm trying to figure out the answer to this question with the following code, but it turns out, the value of the pointer (address of problem3 turned out to be so far away from the parameter and local variables of the function) where the hell is x = problem3; pointing to...
void problem3(int a) {
int overflowme[16];
int x = probl...
I want this code to be possible.
template<typename K, typename T, typename Comparer>
class AVLTree
{
...
void foo() {
...
int res = Comparer::compare(key1, key2);
...
}
...
};
Specifically, I want to force Comparer class to have a static int compare(K key1, K key2) function. I was thinking about using ...
Next semester we have a module in making Java applications in a team. The requirement of the module is to make a game. Over the Christmas holidays I've been doing a little practice, but I can't figure out the best way to draw graphics.
I'm using the Java Graphics2D object to paint shapes on screen, and calling repaint() 30 times a secon...
Hi all.
I've written a working tetris clone but it has a pretty messy layout. Could I please get feedback on how to restructure my classes to make my coding better. I focuses on making my code as generic as possible, trying to make it more an engine for games only using blocks.
Each block is created seperately in the game.
My game has ...
Thank you guys on this website you helped in TF/IDF. It helped me alot to make tf-idf function in java. I made tf but I have one question. As on wiki they wrote IDF can be calculated that how many documents have the term. But I am confused.
For example, Here is the string "JosAH is great. JoshAH rocks" so the TF would be 2/5 and for IDF...
cramming for a c++ exam, on string manip with some example questions (to which i dont have solutions) - below is today's handiwork. although it works fine - would be awesome if any obvious lapses / better way of doing things occur to you, just drop me a quick note, i need to learn me some C++ fast :)
thanks!
#include <iostream>
#includ...
I have:
/*
* File: NameSurferEntry.java
* --------------------------
* This class represents a single entry in the database. Each
* NameSurferEntry contains a name and a list giving the popularity
* of that name for each decade stretching back to 1900.
*/
import acm.util.*;
import java.util.*;
public class NameSurferEntry imple...
Hi,
I have an array of 16 squares and I would like to auto complete it with integers values depending of the position in the array and the vector TOP_RIGHT.
TOP_RIGHT = 3
# Build the array...
@top_right = Array.new(16, 0)
@top_right.each_index do |square|
@top_right[square] = square / TOP_RIGHT if (0...16).include?(square - TOP_RIGH...
What is the difference between Cache and Translation LookAside Buffer[TLB] ?
Thanks.
...
How can a buffer overflow effect the OSI model?
How many layers of the OSI model can be affected by an buffer overflow vulnerability.
...
Hi.So I can easily accomplish task to find largest number and then if can be divided by three, print out. But do not know how to find second largest number from users sequence.
Thanks for any hints!
public class SecondLargest {
public static void main(String[] args) {
int max = 0;
Scanner scan = new Scanner(System.i...
When I try working on unsigned integers in MIPS, the result of every operation I do remains signed (that is, the integers are all in 2's complement), even though every operation I perform is an unsigned one: addu, multu and so fourth...
When I print numbers in the range [2^31, 2^32 - 1] I get their 'overflowed' negative value as if they...
Hi everyone...
I have a project fir my "Operating Systems". I need to write 2 program with java...
1) write a program that produce Water with 2 method Oxygen and Hydrogen.
method Oxygen produce one Oxygen and method Hydrogen produce one hydrogen. when 2 Hydrogen and one Oxygen was existed H2O created. I must write this with with Semaph...