Susie Qian

1

votes
3

answer
50

views

Replace each vowel in string with following vowel using switch statement

Im new to programming and learning java. I am struggling to get this switch statement to work with replacing vowels in a string and then printing the new string. I keep getting cannot find symbol with ChangeV. Also, unsure how I can iterate through my string to check for vowels and then replace each...
susie y
2

votes
4

answer
69

views

How can I replace the for loop method with while loop

I am new to programming and trying to learn java. I am trying to replace the for loop in this method with while loop. Can anyone help me how I do it as my code I have written is incorrect. This is original public static int doSomething(int [] a, int x) { for (int i = 0; i < a.length; ++i) if (a[i]
susie y
1

votes
1

answer
32

views

How to groupby one column in ndarray but then print whole rows

I've got an array that looks like: sna = [[ 5376 5562 1487764215 7] [ 5000 5101 1487764215 8] [ 3305 3510 1487764215 9] [ 3511 3642 1487764240 3] [ 9748 10320 1487764240 4] [ 9202 9747 1487...
Susie
1

votes
2

answer
224

views

Measurement for intersection of 2 irregular shaped 3d object

I am trying to implement an objective function that minimize the overlap of 2 irregular shaped 3d objects. While the most accurate measurement of the overlap is the intersection volume, it's too computationally expensive as I am dealing with complex objects with 1000+ faces and are not convex. I am...
Susie
1

votes
1

answer
1.4k

views

Building a game via a 2D array - how to change color on part of the array?

I am still a beginner in java and I am attempting to create a game. I just created a 20 x 20 board that I added to a 2D array of squares. But, I am confused on some syntax....I still have a hard time with writing proper conditionals and algorithms, especially. So, what I want to do is fill in 8X8 in...
Susie
1

votes
1

answer
4k

views

How to select a shape on a drawing panel?

I am creating a program where I can draw different shapes onto a drawing canvas. I want to add a button that, after clicked, allows me to select a shape and then drag/translate it to a different spot on the canvas. What is the basic concept behind implementing this? When I click on the shape to sele...
Susie
1

votes
1

answer
4.3k

views

Mockito ExceptionInInitializerError caused by NPE

When I run this test I get ExceptionInitializerError. I think the error lies at line I have with marked with 'Error'. May be I need to do something to take care of that statement in my test but I just can't figure out what. Any help will be much appreciated. I am using mockito to test this. I don'...
Susie
1

votes
1

answer
282

views

After publishing to server, my application requires browser restart

Whenever I make changes to my java code and PUBLISH it, It requires me to restart my web browser. If I don't restart my browser and just refresh the page, I get null pointer exception and a stacktrace is printed in the UI page. Is there something I can do, so that when I publish, I don't have to r...
Susie
1

votes
1

answer
365

views

tkinter Menu styling on Linux

On Linux I want to change the Menu background color and make the relief flat. I've figured out how to do this but when the mouse hovers over the menu, the old background color with embossed relief appear. from tkinter import * from tkinter.ttk import * root = Tk() bar = Menu(root, background='red',...
susie_socks
1

votes
1

answer
841

views

map does not expand to full size on load when using jquery mobile

I have a Leaflet map on a page that uses jQuery mobile. I experience a similar problem if I swap in a Google Map instead of Leaflet, so I don't believe this to be specific to Leaflet but rather to jQuery mobile. The problem is that when it first loads, the background imagery of the map does not exp...
susie derkins
1

votes
1

answer
578

views

Why does “Can not locate Debconf / Log.pm in @INC” issue? I just modified /usr/bin/perl into the perl that I installed

The system is Ubuntu. There is a perl in /usr/bin/, and is version is 5.18.2. In this state, I tried to install many software by 'sudo apt-get install **' and it was OK. But a few days before, I installed a new perl in an other directory(/share/Software/perl-5.26.0/bin/perl). And I remove the origi...
Susie
1

votes
2

answer
57

views

dojo how to query node that has been removed from DOM

From my testing, it appears that dojo's query() function only selects from among elements that are part of a page's DOM. For example, suppose I have a node named rootNode that has some number of descendents with the class someClass. This code: var nodeList = query('.someclass', rootNode); will retu...
susie derkins
1

votes
1

answer
1.1k

views

Create record causes org.hibernate.MappingException: Unknown entity

I am trying to create a record in a table but it gives me the following exception. org.hibernate.MappingException: Unknown entity: com.Person My get(Person person) method works fine and returns the result. DAO class: public void create(Person person){ Session session = HibernateUtil.getSession();...
Susie
1

votes
1

answer
32

views

Use the same value in the test and in the method to be tested

Method to be tested: public boolean isValidStudent(String fName, String lName){ Student student = new Student(fName, lName);//-----------this creates problem return (studentDao.get(student).isEmpty())?false : true; } The below test fails because the method stub always returns an empty list,...
Susie
1

votes
2

answer
994

views

Reset spring url. URL gets appended after submitting form twice

..... When I initially submit this form the url is 'loclhost:8080/SpringSchool/register/student.htm' If the submit fails and I submt it again, the new url gets appended and becomes: 'loclhost:8080/SpringSchool/register/register/student.htm' As a result I get 404 error. How can I reset the url so...
Susie
1

votes
1

answer
167

views

How to use GMMs returned by opencv grabcut to calculate possibilities of a pixel belonging to foreground or background

I have been scratching my head try to understand how to use the GMM model returned by the opencv grabcut function(python API), the GMM models returned are 2* 64 elements tuple which I assume contains both the mean and variance information but I don't know how to apply it to a pixel that contains 3 c...
Susie
1

votes
1

answer
732

views

XML to Pandas Dataframe conversion

XML File : Python code : import xml.etree.cElementTree as et tree = et.parse(xml_data) root = tree.getroot() for child in root: record = child.attrib.values() all_records.append(record) pd1 = pd.DataFrame(all_records,columns=subchild.attrib.keys()) I have unstructed XML file. Hit element can have ra...
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.5k

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
25.1k

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

View additional