homework

How can I match a tab to the end of the line with a Perl regex?

I have a file with the below contents: After learning everything you've learned so far, you may think you've bingo: got a pretty good foundation in programming Perl, since you'd already be a good way through most of the concepts many other languages entail. endbingo: But if you put down this book today and did nothing else bingo: ...

why jspService() cannot be overridden?

Why the jspService() method cannot be overridden, where as jspInit() and jspDestroy() can be overridden? ...

How to share a linked list between two processes?

I have two processes and i want to share a linked list between them. One of the processes is just going to read the list while other process is going to modify the list ( add/delete entries). Can you tell me how to achieve it? Let me add more details to it the language is C and the platform is Linux. It seems that shared memory is o...

Searching an array list for most common String

Hi, I was wondering how I could search an ArrayList of Strings to find the most commonly occurring 'destination' in an 'Itinerary' object I've created (which contains a list of different destinations.) So far I have: public static String commonName(ArrayList<Itinerary> itinerary){ int count = 0; int total = 0; ArrayList<...

Can the same servlet perform input validation from an html form it displayed?

Is it possible to have the same servlet perform validation? It seems that one might have to utilize some sort of recursion here, but when I type in something in the e-mail box and click submit the e-mail parameter is still blank. After I click submit, the URL changes to: http://localhost/servlet/EmailServlet?Email=test The page shows E...

zig zag scan algorithm

I need a pseudocode or real code on how to do a zig zag scanning on a 2-d array using the following pattern: I have tried to use google to find this, but can't find any answers... This pattern is usually used for image decoding ...

Problem with Delegates in C#, forms and multiple solutions

EDIT: this is a winform application, sorry for the inconvenience Disclaimer: this is an assignment we got in college, and I'm stuck over this particular section of code. I have 2 solutions in Visual Studio 2008, one for a Form and one for a DLL which the form can use for functionality. The idea is to send HTML mails from the client, an...

How do you print a 2D array given a data access table and a 1D array of the data?

If I have a 1 dimensional array of data such as this: 1 2 3 4 5 6 7 8 9 1 and a corresponding data access table: 0 2 5 8 How would I print the 2D diagonalized array below with the zeros? 1 2 0 0 3 4 5 0 0 6 7 8 0 0 9 1 Code would be very helpful. Thanks Here is what I tried...the if statement needs tweaking: //table[] is the acc...

How to detect a floating point number using a regular expression

What is a good regular expression for handling a floating point number (i.e. like Java's Float) The answer must match against the following targets: 1) 1. 2) .2 3) 3.14 4) 5e6 5) 5e-6 6) 5E+6 7) 7.e8 8) 9.0E-10 9) .11e12 In summary, it should ignore preceeding signs require the first character to the left of the decimal...

How to create a linked list from begining in java?

Possible Duplicate: How do I implement a Linked List in Java? hi all, I need to create linked list in java, but not from the built-in class, i want to create from the beginning. i have created a class and when i try to manually add elements, it worked, but how to implement add(element) method so i can add element to that li...

How do I create a list or set object in a class in Python?

For my project, the role of the Lecturer (defined as a class) is to offer projects to students. Project itself is also a class. I have some global dictionaries, keyed by the unique numeric id's for lecturers and projects that map to objects. Thus for the "lecturers" dictionary (currently): lecturer[id] = Lecturer(lec_name, lec_id, ma...

how to display new window in current browser window (html)?

Hi, I am trying to create an embedded <script> containing a function called "showForm()" that displays the contents of a file called "form.htm" within the main browswer window. This is what I need to do: Display the form.htm file in the browser window that was used to open the cover.htm file. (hint: use the "opener" keyword to refere...

Java package and classpath question

Can anyone please explain the answer to the following question: Given a correctly compiled class whose source code is: package com.sun.test; public class Commander { public static void main(String[] args) { } } Assume that the class file is located in /foo/com/sun/test/, the current directory is /foo/, and that the classpath c...

how to read input with multiple lines in java

Hi all, Our professor is making us do some basic programming with java, he gaves a website and everything to register and submit our questions, for today I need to do this one example I feel like I'm on the right track but I just can't figure out the rest .. here is the actualy question : **Sample Input:** 10 12 10 14 100 200 **Sample...

What kind of advantages are there to changing 'cond' to be a special form

What kind of advantages are there to changing 'cond' to be a special form instead of syntactic sugar? ...

Java EE online banking code example

Is there any open source Java EE application for online banking and processing that you guys are aware of? Say for example I want to implement the whole online banking stack, from front-end, middleware, and back-end. Has anybody open-sourced this before? ...

If I have: (apply f '(x1 x2 x3 .... xn)) and I'd like to change it to a Macro expansion

If I have: (apply f '(x1 x2 x3 .... xn)) and I'd like to change it to a Macro expansion: (f x1 x2 x3...xn), what kind of problems can occur? ...

search a collection for a specific keyword

What i want to do is search a hashset with a keyword.. I have 3 classes... main() Library Item(CD, DVD,Book classes) In library i am trying to do my search of the items in the hashsets.. In Item class is where i have the getKeywords function.. here is the Items class... import java.io.PrintStream; import java.util.Collection; im...

Floating point mantissa bias

Does anybody know how to go out solving this problem? * a = 1.0 × 2^9 * b = −1.0 × 2^9 * c = 1.0 × 2^1 Using the floating-point (the representation uses a 14-bit format, 5 bits for the exponent with a bias of 16, a normalized mantissa of 8 bits, and a single sign bit for the number), perform the following two calculations, paying clo...

find largest submatrix algorithm

I have an N*N matrix (N=2 to 10000) of numbers that may range from 0 to 1000. How can I find the largest (rectangular) submatrix that consists of the same number? Examples: or 10 9 9 9 80 5 9 9 9 10 85 86 54 45 45 15 21 5 1 0 5 6 88 11 10 The output should be the area of the submatrix, followed by 1-based coordinates ...