Susie

0

votes
0

answer
4

views

Loop strmatch, then dataset intersection, then extract data subset by observation

Step 1: Find intersection between two datasets. I would like to find the intersection between biglist and matchlist. use matchlist, clear //matchlist contains unique observations that I need levelsof countryname, local(country1) use biglist, clear //big list has a lot of duplicates and things I don'...
Susie
1

votes
2

answer
13.3k

views

WrongTypeOfReturnValue exception thrown when unit testing using mockito

My Test List myList; @Test public void testIsValidPerson() { myList = new ArrayList(); myList.add(new Person("Tom")); when(personDao.get(person)).thenReturn(myList); when((personDao.get(person)).isEmpty()).thenReturn(false);//------Exception thrown boolean result = service.isValid("Tom"); assertFa...
Susie
1

votes
1

answer
485

views

EL is not interpreted and appears plain vanilla in generated HTML output [duplicate]

This question already has an answer here: EL expressions not evaluated in JSP 2 answers I am using Struts1 and JSP. I can access the form property using the tag but I can't do it with the JSTL. Why not? My form is a DynaActionForm. This statement works: This does not work, displays ${myForm.map.o...
Susie
6

votes
1

answer
8k

views

curl not passing phpsessid

Try as I might, I am unable to get curl to pass the PHPSESSID cookie. I have a similar setup to what several others have described, but I haven't been able to get any of the proposed solutions working. I have a page that sends a get request to pageA.php. pageA.php needs some information from pageB...
susie derkins
2

votes
2

answer
70

views

How to make a image look more uniform without losing fine details

I have a reconstructed object with accumulated effects of lighting as shown below, which looks quite dirty: I want to make the body of the object to have a more uniform color (cleaner) while keeping the fine details of letters, patterns, etc. What I am current doing is to fit the image in HSV space...
Susie
1

votes
3

answer
24.3k

views

MailConnectException while sending mail using java mail api

Trying to send an email using java mail api. And I keep getting MailConnectException. I have tried multiple ways to solve it without success. Exception is thrown by this statement transport.connect("smtp.gmail.com", "[email protected]", "myPassword"); Can anyone tell me what I'm doing wrong? publi...
Susie
5

votes
5

answer
1.9k

views

Appropriate method encapsulation for unit testing

My class contains 14 private methods and 1 public method. The public method calls all the private method directly or indirectly via other private methods. The public method also has a call to a DAO that queries the database. I wrote a unit test for the class. Since you can't write unit test for p...
Susie
6

votes
1

answer
2.1k

views

php undefined index notice not raised when indexing null variable

I'm curious to know if the following behaviour in PHP is intended or not. And, if it is intended, it is considered acceptable to initialize an array from a null variable by creating an index into it (as is done in the first code snippet)? error_reporting(E_ALL); $arr = null; echo ($arr["blah"]===nu...
susie derkins
1

votes
1

answer
2.5k

views

CSS styles and Jquery do not get applied to jsp:include file [closed]

I am using eclipse and Tomcat 7. I have an index.jsp page. In the index.jsp file, I include login.jsp file using jsp:include tag. when I first run the application, the page gets rendered as expected. But when I click on the link in the page that points back to the same index.jsp page, the renderin...
Susie
1

votes
3

answer
448

views

Sort a list of objects

Is there such a method as follows I can use, so that I can pass any list of any objects and it will return a sorted list in the order I want? public List sort(List listToBeSorted, String order, String property){ } class Person{ private String name; private Date dob; private int age; } So if I cal...
Susie
3

votes
1

answer
1.6k

views

Can you mock a non static method that calls a static method using Mockito?

I understand you can't mock static methods using mockito. But the method I am trying to mock is not static but it has a call to static methods in it. So can I mock this method? I get exception when I run the test. Is the call to the static method the reason for this exception? The Class to be test...
Susie
4

votes
5

answer
9.8k

views

Change background color using jQuery

I am trying to change the background color with jQuery. What am I doing wrong? I know this can be done with CSS a lot easier but I am trying to do it with jQuery. Link to jsfiddle. I am trying to change the background of "Hi" to yellow. window.onload=function(){ $('.myClass td').css({'background...
Susie
2

votes
1

answer
698

views

php chmod returns true for success but doesn't actually change permissions

Perhaps I am not understanding how php's chmod() function should work, but I am experiencing it returning TRUE (indicating success) yet not actually modifying the permissions. I am working with a file that has been uploaded to my web server's tmp directory. $fn = $value["tmp_name"]; $fps = fileperms...
susie derkins
2

votes
1

answer
2.2k

views

Select alphabetic only strings of three characters length

I have a field in my table that is a varchar and contains alphabetic, numeric, and mixed alphanumeric values. I would like to select only the values from that field which are 3 characters in length and alphabetic only. I am using oracle. Sample Data: AAA BBB 12345 CCC25 DDDDD The select statement...
Susie
4

votes
4

answer
3.2k

views

Hibernate criteria returns empty list but data exists. Using annotation

I can't figure out why this query isn't giving me any result. I know the data exists in the table. The list variable "results" is empty when the query is executed. Am I implementing the composite key correctly? I even tried using the @EmbeddedId to get this done but the returned list was still emp...
Susie
2

votes
1

answer
2.1k

views

How to set empty string as password for MYSQL database in properties file.

My question is how do I set empty string as password for mysql database in properties file? The password for MySql database is an empty string. I tried leaving the right hand side empty like this jdbc.password= in my application.properties file but I get the following exception: org.hibernate.exce...
Susie
2

votes
2

answer
3.6k

views

Batch processing fails in Oracle. Find out which statement in the batch is causing it

I am extracting data from excel sheet and inserting them into my oracle table. The database is setup in a way that when executing a batch statement, if any insert statement in the batch fails, all the other statements in the batch are not executed. So my problem is how can I find out which row of da...
Susie
2

votes
3

answer
10.3k

views

Keep the radio button selected after refreshing the page or submitting the request

I understand this question may sound very basic but I have been trying to solve it this whole morning and I still haven't been able to do it. I will really appreciate any help. I have two radio buttons in my jsp page. When either one is selected, it calls a javascript function. What evetually happen...
Susie
2

votes
3

answer
88

views

Project Euler's Fibonacci - Why does this answer work?

The following solution is still not quite fitting in my head. Why is it f1 = f2 and f2 = add in the while loop? n = 4000000 f1 = 1 f2 = 1 add = 0 result = 0 while add < n: f1 = f2 f2 = add add = (f1 + f2) if add % 2 == 0: result = result + add print (result) I've been tackling some of th...
Susie
4

votes
4

answer
5.7k

views

Differentiate between two submit buttons in a form using javascript

How can I find out which submit button was clicked in javascript? function submitForm(){ //if find open popup //else if add continue in the same window } WHAT I HAVE TRIED: I tried to do it with onclick instead as follows but when the "Find" button is clicked it opens a popup window and submits the...
Susie
5

votes
2

answer
7k

views

Close log files

This project has been handed down to me, so I do not know much about it. There is a method where log (java.util.logging.Logger) is used and it creates two log files: First file: fileName.log Second file: fileName.log.lck In Linux when I do lsof, I see these two files as open. How do I close these tw...
Susie
2

votes
3

answer
1.5k

views

Rest JAX-RS exception, MessageBodyWriter not found

I am using Jersey 2.13 I get MessageBoddyWriter not found exception when I try to access a resource via a url in a browser. Exception: MessageBodyWriter not found for media type=application/json, type=class java.util.ArrayList, genericType=java.util.List. I have another method that produces "APPLIC...
Susie
3

votes
5

answer
19.6k

views

how to update a column for all rows in a table with different values for each row in a table of 100 records

my table contains 100 records and i need to update a column with new values(diff value for each record) for each of the 100 records .How can i do this. the column to update the values is not primary key.
susie
3

votes
0

answer
133

views

Number of ways to go through a partially ordered set

This is built upon a previous question Solve a simple packing combination with dependencies, although there is no need to check out that question to understand this one. This question asks about the fastest ways to count the number of linear extensions of a partially ordered set. Such an partially o...
Susie
7

votes
3

answer
4.8k

views

No output in console

This sounds like a trivial question but I googled about it and found nothing that helped me. Nothing gets printed in my console. It was working just fine yesterday. I haven't made any changes to my RAD. Even the system.out statements do not get printed in the console. I debugged to make sure it hit...
Susie
1

votes
9

answer
34.6k

views

Printing out 2d array elements in java

I'm trying to print out elements in a 2d array, but can't seem to format it. Anytime I try to format it I get an error String [][] plants = new String[2][2]; plants[0][0] = "Rose"; plants[0][1] = "Red"; plants[1][0] = "Snowdrop"; plants[1][1] = "White"; //String plant; //String color; for (int i = 0...
Rolo Susie
3

votes
3

answer
1.7k

views

Create dictionary with multiple values per key

How can I create a dictionary with multiple values per key from 2 lists? For example, I have: >>> list1 = ['fruit', 'fruit', 'vegetable'] >>> list2 = ['apple', 'banana', 'carrot'] And, I want something to the effect of: >>> dictionary = {'fruit': ['apple', 'banana'], 'vegetable': ['carrot']} I have...
Susie
3

votes
3

answer
3.5k

views

ajax very slow in IE 8 but very fast in firefox and chrome

There are a lot of similar posts but nothing quite fit my need. So I am forced create a post. List of names are displayed on a jsp page. When you hover over a name, I do an ajax call to display the details for that name in a tooltip popup. The users will be using IE8. It takes approximately about...
Susie
40

votes
1

answer
65.2k

views

How can I add a space in between two buttons in a boxLayout?

I have four buttons in a BoxLayout group. This is just a sample of two because it's all repeated code. I want to create a slight space between each button so they don't run into each other. I have tried practically every method in the .add(Box.Create....) and nothing worked. enter.add(Box.createVer...
Susie
2

votes
1

answer
62

views

Stripping WhiteSpace & Comments using python file executable from Command Line

Trying to write a program that takes in, from the command line, my executable file + an optional argument called 'no-comments' and the file. So if someone writes in command line: stripWhiteSpace.py file.rtf Then it will strip all the whitespace EXCEPT new lines. If someone writes in command line: st...
Susie
7

votes
3

answer
130

views

Solve a simple packing combination with dependencies

This is not a homework question, but something that came up from a project I am working on. The picture above is a packing configuration of a set of boxes, where A,B,C,D is on the first layer and E,F,G on the second layer. The question is that if the boxes are given in a random order, what is the pr...
Susie
1

votes
2

answer
43

views

Error in eval(expr, envir, enclos) : object 'variable' not found- ggplot2

I need help to make the ggplot2 plot for my data. This is my script in R. > library(reshape2) > library(ggplot2) mdat = read.csv(file = "~/Desktop/final_data/low_group.csv", header = TRUE, sep="\t") > head(mdat) day..variable..value 1 Day 0, Actinobacteria,0.187 2 Day 3, Actinobacteria,0.117 3 Day...
Susie
2

votes
2

answer
404

views

How can you access an array or a list saved in request scope using javascript?

In my servlet: String[] array = {"apple", "ball", "cat"}; req.setAttribute("myArray", array); In javascript: var x = '${myArray}'; alert(x.length); //prints 28 alert('${myArray[0]}'); //prints apple alert(x) //prints [Ljava.lang.String;@267c3c78 How can I get...
Susie
3

votes
2

answer
2.1k

views

Tooltip popup with dynamic information

What I am trying to do is when you hover over a name, show a tooltip popup with details of that name. I did the following but for some reason, it doesn't seem to work. No tooltip shows up. When you hover over a name it calls a function and does an AJAX request and we get back details as string. I h...
Susie
2

votes
2

answer
850

views

Access an array returned from an oracle procedure

My oracle procedure returns an array of string and I call the procedure from my java method. When I execute the query I get the following exception. java.sql.SQLException: ORA-03115: unsupported network datatype or representation Note: I have used OracleTypes.ARRAY here but I also tried using Type...
Susie
4

votes
2

answer
1.7k

views

Exclusive OR (XOR) in EL

Is there a way to do an exclusive or in EL? I have two variables. I want to check if only one of them is empty at a time. I understand I can do this manually by doing the following but I wanted to know if there is an EL keyword for it?
Susie
3

votes
1

answer
879

views

Cairo with tkinter?

Is it possible to draw on a Cairo Surface and then display that as a tkinter.PhotoImage? Could somebody provide an example or at least a description of how one would do this?
susie_socks
63

votes
10

answer
141.2k

views

Create a List of primitive int?

Is there a way to create a list of primitive int or any primitives in java like following? List myList = new ArrayList(); It seems I can do List myList = new ArrayList(); and add "int" into this list. But then this would mean I can add anything into this list. Is my only option, creating an array...
Susie
4

votes
1

answer
581

views

Getting the maximum in each rolling window of a 2D numpy array

I have a 2D numpy array and I want to get the maximum value contained in each 2d rolling window that starts from left to right, top to bottom, rolling one row or column each time. The most naive method would be iterating through all rolling windows and get the maximum of all values enclosed in this...
Susie
7

votes
1

answer
1.9k

views

Reassigning variables in python [duplicate]

This question already has an answer here: Why can a function modify some arguments as perceived by the caller, but not others? 10 answers I have the following code and variables, and I want to find what the variables a, a1, a2, b, b1, and b2 refer to after the code has been executed. def do_somethi...
Susie

View additional