Wednesday 18 November 2015

Create random numbers in java

Creating Random numbers in java can be generated in java using Random class.

Implementation is as below, which will create random integers starting from 0(inclusive) to 90(exclusive)

Random generator = new Random();
        ArrayList<Integer> numbers = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            numbers.add(generator.nextInt(90) );
        }


Example to create numbers within range (like between 15 and 105)

Random generator = new Random();
        ArrayList<Integer> numbers = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            numbers.add(generator.nextInt(90)+15 );
        }

Monday 7 September 2015

ERROR: The provided repository type was not detected in the current directory.

When creating diff using 'rbt post' for review board with perforce client, reported issue occurs as below. This can be solved by verifying the client root in p4client and the path from where the rbt post command issued must be the same.
 


C:\Users\demouser>rbt post -d --repository-type perforce

>>> RBTools 0.7.4

>>> Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]

>>> Running on Windows-7-6.-SP1

>>> Home = C:\Users\demouser\AppData\Roaming

>>> Current directory = C:\Users\demouser

>>> Checking for a Perforce repository...

>>> Running: p4 info

ERROR: The provided repository type was not detected in the current directory.


 C:\Users\demouser>


Client root in p4 client should be the same as current directory

Saturday 11 July 2015

object doesn't support this property or method attachevent





  • When I try to launch the Internet Explorer 11 via Selenium RC server, faced with the below pop.
  • After surfing found attachEvent is a deprecated function used in older versions of Internet Explorer and modern browsers use addEventListener instead.
  • So if you are using earlier version of Selenium server try using the latest selenium standalone server. Which will solve the reported pop up issue.



couldn't open app window; is the pop-up blocker enabled

When I try to launch the Internet Explorer 11 via Selenium RC server, faced with the below pop.

After marking the pop up blocking to be turned off and disabling the “Enable protected mode settings” under security tab, the reported issues got resolved. Please find the helpful screen shots.