Chris Barrett

+ Follow
since Dec 05, 2013
Chris likes ...
Eclipse IDE Firefox Browser
Merit badge: grant badges
For More
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 Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chris Barrett

I don’t believe the first screenshot is MVC. That looks more like MVP (Model View Presenter). In MVP, the Presenter is both Active View and Controller (while the V in MVP is an interface View).

MVP is a derivative of MVC used in .NET apps. I’ve had to use it in C# with Window Form apps, but never seen it used in Java. At least in my experience, MVP can lead to code duplication as each Windows Form is siloed from other Windows Forms.
Can anyone shed light on why you would want to return an immutable list (or map, or set)?

Just spent the afternoon working on a legacy system that had some sweet logic like:

Which, years later, was used like:

And everything worked until BarImpl's constructor got passed an null. Of course, there were a bunch more layers between the constructor call and the attempt to add to the immutable List.

As I contemplate replacing a bunch of emptyList() with ArrayList<>() so that no one can accidentally add to an immutable List I'm left to wonder when does it make sense to create an immutable List and how would you stop future users of your class from making the same mistake as above?

6 years ago
Hi Dana,

As the exception name would indicate, NoSuchElementException, usually means that the element wasn't present on the page when Selenium attempted to find it.
(Link here to the  org.openqa.selenium.NoSuchElementException API as the link above will go to  java.util.NoSuchElementException ).

Two common reasons:
  • It's a totally valid error. Someone changed the page and either deleted the element or accidentally changed the id. If that was the case, you would want to know.  
  • Selenium tried processing the page before the page was fully loaded.

  • In your case, since the test sometimes pass, I would think it's the second reason.

    Are you using a WebDriverWait statement to make sure the element has loaded before Selenium attempts to access?

    While you could use that to reference the specific id in question, a better approach is to put at the very bottom of the page (usually through a shared footer or something just before the </body>) a placeholder id for WebDriverWait to hook into:
    <div id="wait_holder"></div>

    7 years ago
    Hi Maribeth,

    Welcome to the Ranch!

    Which version of Java have you installed, and did you install the JRE (Java Runtime Environment), or the JDK (Java Development Kit)?

    The JRE only includes the software needed to execute (run) Java applications. To compile Java source code into a runnable program using javac, you need to have the Java Development Kit (JDK) installed. Just Google "jdk java 8" and you'll find the link right away.
    7 years ago
    I would start by double checking the two references match. The validatorId value should match the value of the @FacesValidator annotation that registers the validator.

    Take a close look at the code you posted, and you'll note that one is employeeTitleValidater and the other is employeeTitleValidate

    Oh, and I would recommend you use the fully qualified name in order to eliminate any chance of ambiguity.
    7 years ago
    Hi Michael,

    Welcome to the Ranch!

    The tutorial you are following may indeed have been written using a different version of Java, but that generally wouldn't matter. Usually with tutorials, it would only be an issue if you were using a version of Java older than the version the tutorial was written. And even then, unless this is a very old tutorial, most tutorials written in Java 5, 6, or 7 should work fine against Java 8.

    Have you defined a main method using the signature exactly as provided in the error message?

    The main method provides an execution entry point for your program. Without one, or if there are any mistakes in the signature ( such as writing the method name as 'man' instead of 'main', or writing the parameter type as a String instead of a String[] ), the Java runtime won't understand where to begin. So, I would start your debugging process.

    Unless this is a JavaFX application. Then the process would be different as the error message indicated.
    7 years ago

    Jack Goodman wrote:I can't find normal free online courses about HTML/css. Can you recommend something please?

    Coursera offers many free university level courses - including HTML & CSS, such as:
    If you prefer setting your own pace, Code Academy offers free introduction courses:
    7 years ago
    Hi Jack,

    Welcome to the Ranch! I did something similar as you - I had a career in finance, but I loved technology, and just recently completed that transition to a software engineer with a major firm. I also worked part-time as a web developer while putting myself through night school to learn the skills.

    In my experience, it is incredibly difficult to make money as an freelance web-developer. The barrier to entry is super low (a cheap computer, some understanding of HTML, CSS and WordPress). In addition to what Jeanne said, as a web developer with limited experience, you will also learn "exciting" terms like scope creep when dealing with clients. Scope creep killed my profitability all the time - I found myself agreeing to a "simple" build that I guessed (having had no experience) would take 10 or 15 hours for $500. I would also rush to build before having really locked the client down to a design (imagine building a house and then having the client say, "Yeah, that's not what I was thinking it would look like..."). Builds would often run 30 hours or more in length. And since I knew nothing about contracts, and didn't want to upset the client, etc... my hourly income was well below that of McDonald's. And the income is very intermittent.

    What eventually worked for me was I started spending a lot of time on WordPress free support forums posting helpful solutions. That gave me a "portfolio" of solutions that highlighted my professionalism and ability to articulate with different types of users. I used that "portfolio" to approach some of the professional WordPress theme developers (you can find many WordPress commercial market sites if you search Google) to see if I could help in their support forums. These are generally private forums that the developers' paying clients use for support posting. Often developers are obligated under marketplace rules to provide support, but many freelance developers don't really want to do it. They were happy to "unload" the support under their watchful eye. I started doing that a few hours a day, which gave me a predictable income stream. As I got to know the theme developers, I was able to learn more and more, plus they became references when I finished school.

    Not sure if that approach will work for you, but might be worth trying. Good luck!
    7 years ago

    chenchih lee wrote:Do anyone have any idea what should i changed in order to let all browser can used.
    I don't really know how to used jquery.

    Sorry, but what you need to change is the technology being used. You need to choose a technology that is supported by default by all browsers. That is not ActiveX. That is JQuery/JavaScript.

    Maybe you wonder why non-IE browsers don't support ActiveX?

    Firefox does not support ActiveX technology for multiple reasons.
  • ActiveX is only available on Windows operating systems, and as a result webpages that require it will not work on Linux or Mac.
  • ActiveX integration with the Windows operating system has made it a target for malicious software.

  • That's direct from Mozilla, makers of Firefox:

    Paul Clapham wrote:I'd be interested to see how that works, because if you pick any integer, there are zillions of different Strings which have that integer as their hashcode.

    Because I was curious, too. I did some Googling. On the surface:
    The switch statement compares the String object in its expression with the expressions associated with each case label as if it were using the String.equals method; consequently, the comparison of String objects in switch statements is case sensitive. The Java compiler generates generally more efficient bytecode from switch statements that use String objects than from chained if-then-else statements.
    For reference:

    At the nuts & bolts (JVM) level:
    The general approach used is to translate a single string switch statement into a series of two chained switch statements: the first a synthesized statement switching on the argument string's hash value and computing a string's position in the list of original case labels, if any, followed by a second switch on the computed integer value.  The second switch has the same code structure as the original string switch statement except that the string case labels are replaced with positional integer constants starting at 0. The first switch statement can be thought of as an inlined map from strings to their position in the case label list.  An alternate implementation would use an actual Map for this purpose, as done for enum switches. ... The generated code assumes that the hashing algorithm of String is the same in the compilation environment as in the environment the code will run in.  The string hashing algorithm in the SE JDK has been unchanged since at least JDK 1.2.  Since the algorithm has been specified since that release as well, it is very unlikely to be changed in the future.  Different hashing algorithms, such as the length of the strings or a perfect hashing algorithm over the particular set of case labels, could potentially be used instead of String.hashCode.
    For reference:
    7 years ago
    It's legit. It's not SPAM.

    Eric Ligman, Microsoft Director of Sales Excellence, hosts an annual free eBook give away on his blog.
    Topics include: Windows 10, Office 365, Office 2016, Power BI, Azure, Windows 8.1, Office 2013, SharePoint 2016, SharePoint 2013, Dynamics CRM, PowerShell, Exchange Server, System Center, Cloud, SQL Server.
    7 years ago
    Hi Shakku,

    Welcome to the Ranch!

    I have not tried compiling your program, but I'm curious to know about this part:

    Why is that part needed?  It seems to be overly complex and the lack of {} makes following the blocks difficult.
    7 years ago
    Hi Ronald,

    Welcome to the Ranch!

    Java DB is included in the JDK from Java 6 onwards. It's an embedded database, meaning if you compile your program for distribution to a user, the database will be included. It works great for small, standalone type apps. PostgreSQL or MySQL are not required to use Java DB. PostgreSQL or MySQL would require more complex configuration setups, so if your goal is to learn Java not databases, I would stick with Java DB for the time being. Once you are comfortable with how Java works with databases, then look at learning to configure a PostgreSQL or MySQL database for connection to Java.

    I wouldn't say Java DB is another name for Apache Derby, though, technically. The Java DB product includes Derby without any modification whatsoever to the underlying source code, but I believe Oracle has added wrapper code to help simplify the configuration with Java. From a usability perspective, Java DB and Derby have the same functionality and therefore the Java DB documentation often refers to the core functionality as Derby.

    fred rosenberger wrote:The point is, PMG was responsible for us doing something together, using our GPS to find stuff.

    A friend of mine spent three hours on Sunday with her son wandering their community looking for Pokemon. Her son asked strangers for help, made eye contact, learned to use the map, and talked animatedly with his mom about Pokemons. Her son is 7. He is autistic. Any game that can do that is great.
    7 years ago