Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Dave Nice

+ Follow
since Jan 06, 2013
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dave Nice

R. Jain wrote:Can you clarify the rule a bit clearly in a statement? On what basis is poor and not honoured with title case?

this is not important. I just need to know how
6 years ago
Hi there,

I need to turn some strings from:
'1 The High Street'

if string is
I want to achieve
'The Dog and Duck'
...whereby the 'and' is NOT converted to title case

My code as follows:

String propertyPageTitle = "1-the-high-street";
propertyPageTitle = propertyPageTitle.replace("-", " ");
propertyPageTitle = WordUtils.capitalizeFully(propertyPageTitle);

prints: '1 The High Street'

How could I handle the second scenario so it does not convert 'and' to titlecase?
6 years ago

thank you - I posted in haste and evidently made some mistakes.

I did indeed link to Random class and not DataFactory, which is here:

I think my problem is that I'm primarily a selenium user, who is using Java to empower my use of selenium. So this may not be the best place for questions.

However, my question remains as to how best to generate random names from a large pool, without having to store these names in an array within the class. I want to abstract the data away from the code to simplify things.

The second example I gave works fine, I'm just struggling to find an answer to how I can read names from a .csv or .xls instead of holding them in the array itself. If I want, say, 1000 names to choose from, this is not practical in the current method.
6 years ago
Forgive the beginner question.

I'm trying to use the DataFactory class to pull in a list of names, as I need to populate my app in development with randomized test data for testing.


So, I can get a random name like so:-

But - it always prints 'Lindsey'. I need a way of completely randomizing but I can't see the class has a method to let me do this? I can use the randomize method but this takes an int argument which will always bring back the same index value (same name).

I wonder if I am over complicating this. I can use a simple String array of names, but I don't want, like 10,000 names in my array and I want a good way of generating good, randomized data. Perhaps a .csv file of names could be read in? Here is a second method I wrote but I don't have the skills to know how to read the array values from my large .csv file:

Any help much appreciated.

6 years ago

Jaikiran Pai wrote:See if this helps then

Is this any different from running using command line?

The difference depends on what triggers the application and that decides where the memory configurations need to be done.

OK thanks. Maybe I will try running direct from command line instead but I will try the link you mention too.

Jaikiran Pai wrote:How do you run that application from IntelliJ?

I use the r/h panel to run the maven goals so, 'Site', 'Clean', 'Deploy' etc...
Is this any different from running using command line?
I'm running IntelliJ 12.1.2 with Maven and am trying to use the Parameterized.class from Junit 4.11 to read in a .csv file containing 500 records and perform tests on each parameter (parameter is simply a relative url onto which I append a base url). I am getting a java.lang.OutOfMemoryError: Java heap space error.

I believe I have already increased the memory size in Info.plist and also Maven runner to max sizes but still no joy. Can anyone post the recommended / optimal solution for IntelliJ 12? Please note I am a beginner, so I don't know if what I am trying is already going to ask too much of resources.

I am having some trouble getting the Maven Postman plugin to mail my surefire test report. I'm a beginner so there is likely an obvious mistake here. I will post my POM file below in case it shows any obvious cause. I have tried running clean, site, deploy and, although the report is generated, it does not get mailed. I'm not clear which maven goal I should be running to get the report generated. Any help much appreciated.

6 years ago
Ok, sorry for the delayed reply. I moved to another machine to try and resolve the issue. I am now working on a Windows 8 machine. I have installed Maven to here:

C:\Program Files\Apache Software Foundation\apache-maven-3.0.4

I have the following variables now set in Windows:

M2_HOME=C:\C:\Program Files\Apache Software Foundation\apache-maven-3.0.4;
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_11


The Path is showing as broken after I add %M2_HOME%\bin but it seems fine with %JAVA_HOME%\bin but I've no idea why.

These are the variables that are given in Maven installation homepage.

I still get a negative when doing a 'mvn -version' in command prompt.

Any further advice much appreciated.

7 years ago
Hello Jeanne,

Thanks for your reply. I'm a little confused all round (easily done). I know that, to get Maven working I need to put the following variable entry in System Variables:

M2_HOME=C:\Program Files\Apache Software Foundation\apache-maven-3.0.4

I also need this variable in Path:


I cannot see the variable in the Path, but when I try and add it, it tells me it already exists. Now, in REE, my Path is red which tells me it is broken (was broken even before the Maven installation).

Path=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\

So, I don't know if the fact it is broken is causing the fail in the Maven installation, or if I am doing something wrong with the installation and, of course, I need to fix the Path!
7 years ago

I'm trying to install Maven and to make the process easier, have installed Rapid Environment Editor. I cannot get the installation to work but I think REE has helped me discover the reason - the 'Path' System Variable is in red and showing as broken. I have no idea what it should be and am loathe to tinker in case I make major screw ups to the system. Can anyone help with this??

The full Path is as follows:

Path=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\

I am running Win 7 on an 8GB machine.

7 years ago