homework

Adding a string in front of a string for each item in a list in python

I have a list of websites in a string and I was doing a for loop to add "http" in the front if the first index is not "h" but when I return it, the list did not change. n is my list of websites h is "http" for p in n: if p[0]!="h": p= h+ p else: continue return n when i return the list, it returns my original...

Checking if two strings are permutations of each other

How to determine if two strings are permutations of each other ...

Sql commands using joins for the follwing four tables

There are four tables Employee (Employee_id,name,chief_id) Department(Department_Id,name) Emp_Dep(Employee_id,Department_Id) Emp_Sal(Employee_id,salary) Now I need to write a query which displays Employee IDs who get maximum salary in each department. ...

Using Spring and Hibernate -final year project

I’m planning to build Management Information System in Java for my final year project. I would like to use Spring and Hibernate, however I haven’t used any of these frameworks yet. Hence my question is, will I have enough time to learn it (I don’t mean to be an expert, just to be able to use them in my project) and still complete my pro...

masm assembly unresolved externals

My class is working out of the "Assembly programming for Intel computers" book (5th edition) and I'm trying to get the programs to assemble. The book comes with Irvine32.inc which is supposed to make IO and stuff easier. I have those in the same directory as the .asm file I'm trying to compile. Whenever I do ml /Fe test.exe test.asm /lin...

How do you determine the Big-O notation of a while loop?

Below is a binary search function. int search(int a[], int v, int left, int right) { while (right >= left) { int m = (left + right)/2; if (v == a[m]) return m; if (v < a[m]) right = m - 1; else left = m + 1; } return -1; } How do I determine the Big-O notation fo...

Algorithm for approximate search in sorted integer list

Hi All, Consider an array of integers (assumed to be sorted); I would like to find the array index of the integer that is closest to a given integer in the fastest possible way. And the case where there are multiple possibilities, the algorithm should identify all. Example: consider T=(3, 5, 24, 65, 67, 87, 129, 147, 166), and if the g...

output a jFrame to jpeg or bitmap

I've been working on an assignment, and have all the requirements completed. The project is to compare the differences in runtime between a linear search algorithm and a binary search. I have a graph class that puts out the results of those searches in a xy graph. The graph object is a Turtle class that extends JFrame. Is there any w...

AWK command help

How do I write an awk command that reads through the /etc/passwd file, and prints out just the names of any users who have the /bin/bash program as their default command shell? ...

using my own config file in my application

As a practice exercise at my college we have to make a simple room booking system, complete with its own config file. We're not allowed to use the one built into VB.NET (the professor wants us to adapt to not relying on things like that) so I've made my own. This is a sample: // Config file. // First column is the variable name that wil...

delete all shared memory and semaphores on linux

how can i delete all NOT USED semaphores and shared memory with a single command in ubuntu?? ...

Designing bayesian networks

I have a basic question about Bayesian networks. Let's assume we have an engine, that with 1/3 probability can stop working. I'll call this variable ENGINE. If it stops working, then your car doesn't work. If the engine is working, then your car will work 99% of the time. I'll call this one CAR. Now, if your car is old(OLD), instead of...

Java: calculating area of a triangle

import java.lang.Math; import java.awt.* public class Triangle implements Shape { java.awt.Point a; java.awt.Point b; java.awt.Point c; public Triangle(java.awt.Point a, java.awt.Point b, java.awt.Point c) { this.a = a; this.b = b; this.c = c; } public double getArea( ) { do...

Why does G++ tell me "Stack" is not declared in this scope?

I created the following two C++ files: Stack.cpp #include<iostream> using namespace std; const int MaxStack = 10000; const char EmptyFlag = '\0'; class Stack { char items[MaxStack]; int top; public: enum { FullStack = MaxStack, EmptyStack = -1 }; enum { False = 0, True = 1}; // methods void init(); void ...

Markov decision process' questions

I'm a bit confused about some points here: What does it mean to say that it will be successful 70% of the time he tries a given action? Does it mean that every time he tries to perform an action A, it will 70% of the time do that action A and the other 30% do the action that leads to the same state, or just that it is as if he always...

xpath: contains() for a group of answers

Hi, I'm trying to learn XPath, and I am having trouble with doing a nested search (using contains). Specifically, I was given the following question: There is a list of authors, and a list of books, according to the following dtd: <!ELEMENT db1 (book*, author*)> <!ELEMENT book (title)> <!ATTLIST book bid ID #REQUIRED authors ...

Newbie C++ question about functions and error checking....

Am working on a small problem and have spent quite a few hours trying to figure out what I did wrong. Using Dev++ compiler which at times has some cryptic error messages. I tried to make the Volume calculation a function and got it to work but I have 2 small nits. Will work on error checking after I resolve this. With the function ad...

How do I write a mouse down event in JavaScript?

Hi, This is very basic I'm sure to JavaScript but I am having a hard time so any help would be appreciated. I want to call a function within a for loop using the mouseDown event occurring within an object's second child node. The part italicized is my attempt to do this. The swapFE function is still a work in progress by the way. And o...

To use or not to use the State Pattern?

I'm designing a pinball game for a Uni project in which there are supposed to be 2 modes: running mode and builder mode, whereby one can design/redesign the layout of the machine. My initial thought was the State pattern - however, I'm concerned that the common interface between the states may contract them into implementing methods whi...

Use PowerShell to Compare SharePoint User Meta Data in User Profile and User Information List

Hi, I came across a request on LinkedIn for a PowerShell script that was required to: Retrieve all users from the given SharePoint site-collection For each user, the script must retrieve the properties are common between "User Profile" and "User Information List" If any of the common fields between the two are different, the user name...