Mike Petrov

+ Follow
since Oct 10, 2011
Mike likes ...
Chrome Java Windows
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 Mike Petrov

Thank you, Paul, for being there during the learning process
2 years ago
Three years ago I've passed OCAJP 7 (1Z0-803) with 95% (story). At the time I was still in university and the certification helped me in getting my first job.

Of course, I had a dream of passing stage two (1Z0-804). Unfortunately I got caught up in graduating from the university, starting my career and stuff. Long story short, I've never found time to do that. Moreover, the task seemed insurmountable to me since since the amount of needed knowledge material is considerably higher for OCP. This year I thought that OCP might be a nice goal to complete till the end of 2016. A couple of months ago I've moved to a different country and started brushing up my skills for a new job. A large amount of preparation was done with K&B 6 for SCJP. That's when I thought of giving a try to OCP. I passed through K&B 7 including basic chapters and giving attention to the new ones. I decided to try one Enthuware test. If the score was to be bad, I'd drop this endeavour till some time later. Otherwise, I'd try and make a crazy sprint for a couple of weeks to pass the exam (unfortunately, currently I'm not in the position to spend months on preparation).

To my surprise, the first score was 80% and I decided to get the ball rolling. Overall results were 80-86-83-86-89-80-74-85-NA (didn't have time to take the last one). That is an average of 83%. The drop in the last results is due to incredibly pressing learning schedule and my physical limitations. Whereas with OCAJP I took 3 days on average to go through one mock test, this time it was strictly one day for each test, no exceptions. During my last tests I started to feel a great deal of fatigue and decided it was time to stop with whatever I've got.

Simply put, I'd be more than satisfied with a result of more than 80%. This week I've got 86% with approx. 40 minutes of time left. That is more than enough taking into account my learning schedule, time pressure and stress.

1. The exam did not surprise me and contents were pretty much expected.
2. I've encountered a couple of questions on regex replacing capabilities. I explicitly remember K&B 7 saying that those will not be tested so I didn't even spend my time learning the method signatures.
3. Learn constructor parameters for I/O classes. E.g., which Reader can be constructed with File and which with String. That was my struggle sometimes.

I think I'll be aiming at 1Z0-810 now but that will be after I get initial things done in my next job.

Good luck to everyone! You're more capable than you might think.
2 years ago
The following suggestions cover exclusively the JDBC chapter.
Most serious ones that affect supposed language behavior are colored in blue.
I encourage someone to check my conclusions for possible mistakes as it would be a source of knowledge for me too.

Where: p. 849 (table column name) and p. 872 (code snippet on top)
Should be:
NOTE: p. 872 has already been added to errata wiki with suggestion to change "UnitPrice" to "Price" in SQL query. My suggestion is the contrary:
1) revert that record in wiki
2) change rs.getFloat("Price"); to rs.getFloat("UnitPrice"); on p. 872
3) change "Read the data in the column "Price" to "Read the data in the column UnitPrice" on p. 872
4) change "Price is the third column" to "UnitPrice is the third column" on p. 872
5) change "and Price is in position 3" to "and UnitPrice is in position 3" on p. 872
6) change column name to "UnitPrice" on p. 849
The reason is that code snippets in this chapter use the data model introduced on p. 847 extensively. After passing through the chapter, I've noted that "UnitPrice" is seen far more often than "Price". Thus moving to "UnitPrice" would involve less effort.
All of the following examples feature "UnitPrice":
  • UML diagram on p. 847
  • SQL Update on top of p. 865
  • section "getFloat" on p. 873
  • SQL Update on p. 889
  • SQL Select on p. 890
  • sections "updateRow()" and "cancelRowUpdates()" on p. 891
  • list of columns on the bottom of p. 898
  • code snippet on the bottom of p. 908
  • SQL Select on p. 909

  • Where: p. 874, "getTimestamp" (4th paragraph from the top), third line
    What: "where ffffffffff"
    Should be: there are 10 f's but should be 9 since there are 9 digits in the maximum number of nanoseconds. Previously declared form "yyyy-mm-dd hh:mm:ss.fffffffff" is correct.

    Where: p. 876, 2nd paragraph, first line
    What: "ResultSetMetaData class"
    Should be: ResultSetMetaData is an interface, not a class.

    Where: p. 876, last paragraph, sentence beginning on third line
    What: "Also, note that each column must be set to a value before the row is inserted in the database or a SQLException will be thrown"
    Should be: Only NOT NULL columns should be set to a value. No one requires you to set columns that allow for null values.

    Where: p. 876, code snippet, fourth line
    What: rs.next();
    Should be: this statement should be deleted as it's not necessary to read the RS metadata.

    Where: p. 892, last paragraph
    What: "...if you deleted row 1, the cursor is still positioned at row 1. However, if the deleted row was the last row, then the cursor is positioned after the last row".
    Should be: It seems that things work vice-versa. Check code snippets below.

    Before delete, row #1
    After delete, row #0
    Cursor is before the first row
    org.postgresql.util.PSQLException: ResultSet not positioned properly, perhaps you need to call next.

    Before delete, row #3
    After delete, row #2

    Where: p. 895, code snippet on top, next to last line
    What: "rsinsertRow();"
    Should be: "rs.insertRow();"

    Where: p. 896, code snippet, line "rs.moveToInsertRow();"
    What: "Move the special insert row"
    Should be: "Move to the special insert row"

    Where: p. 917, last paragraph
    What: "...and inserting a row has no effect on the current RowSet data"
    Should be: my research shows that inserting a row to RowSet causes it to appear in subsequent reads. Look at the code snippet below.

    should not be visible
    Chapter 15: JDBC, page 856
    Paragraph starting with "First,"
    Next to last line

    Replace "jdbc.sql.Driver" with "java.sql.Driver"
    yes, the map will return null as a result of put() but that doesn't mean that the value for the key would be set to null.
    Considering the class provided, how can the map possibly have null values if the map is private and public setter method takes primitive int?

    UPD. Sorry. The talk was about getBalance(), not setBalance(). Found my own mistake. Disregard the message.
    This is a question in-between Hibernate and Collections API. Sorry for posting it in a wrong section if the topic tends to be more Collection-specific.

    The situation is this. Let's say we have a User entity that should own a Collection of Orders so that we could easily provide user with all his orders stored in DB if necessary. Under the hood it's Orders and Users tables with Orders having a key to a particular User in each row.
    1. What Collection interface should we choose for our code and mapping purposes? Obviously there can be no duplicate orders so should it be a Set? Or a List since we will encounter some sorting purposes (see next question)?
    2. Let's say we show our user's orders in a table somewhere in our View (servlet, JSP, whatever). We should provide the opportunity to sort the table using different columns (date / total sum / etc). How do we implement this? Should we read our Collection once from DB and then sort it in code based on View's needs? Then should we use a sorted Set (TreeSet) or a List maintaining order (ArrayList)? Do we make each new sorting using a new Comparator? I think we definitely shouldn't read it from the DB again using Hibernate's Order since we create an unnecessary select.

    The question may sound stupid but it's a matter of practical experience I don't have for now. Thank you in advance.

    The next step

    D'oh! I'm yet to finish this particular step ;)

    One of the things I wanted to achieve was to use industry-popular set of technologies. Maybe the whole project structure would be awfully realised but I really want to scale a real-world set of technologies to my university project. This is my contribution to the aspect of job security. What about frameworks, in my area they mostly want to see Spring and/or Struts in your CV.
    5 years ago
    I've stumbled over the Model-View relationship in MVC. There's a small diagram in HFSJ that shows Controller between Model and View with V and M not knowing anything about each other. That's how I wanted to design my app. But it turned out that it's more an MVA (M-V-Adapter) pattern than the MVC since View doesn't talk to Model. Is that right? I don't want to ask a vague question but I don't really get what are the advantages of mixing M and V allowing them to talk to each other if this could be done using intermediate controller.
    5 years ago
    Hello Ulf!

    First let me apologize for not giving an immediate reply: i've been on a foreign trip.

    Your answer has definitely cleared a certain amount of vagueness! I'll stick to my initial plan of learning Servlets and JSP. I'll leave specialized frameworks for later since they should be chosen for the particular project.

    I'll post more questions as I advance with my project. And again -- thank you for your answer.
    5 years ago
    Hello everyone.

    First let me apologize if the topic doesn't belong to this section.
    I'm a student and I've got to make a university project. Generally speaking, what I want is a web app that would allow to deal with some data in a database with standard CRUD-like operations and provide a childish API to make this data available from some other clients. Essentially, nothing special, but not for me. I decided to make it Java EE-based since I've been learning Java for some time. Sure I know you should first take an overview of all the technologies to choose the most suitable one, but I'm obviously not in the position to show my expertise (or lack of it, which is definitely more plausible). The problem is I'm a little bit overwhelmed with a set of technologies constituting Java EE and related ones and I guess I may not need to study the whole thing now. So the main task is to finish my project and the secondary one is to gain skills needed to work as a Java EE developer with a help of this project.

    I decided to utilize some sort of MVC pattern with my project. As far as I understand I need servlets as Controllers, some plain Java classes as Model (business logic). Maybe I should use Hibernate to get some experience with this framework. And I'm a little bit stuck about the View. JSP/JSF/Template Engines? Does GWT belong to this layer? As a possible hint for this part I would like to use Google Maps API in the web page to superimpose my data on the map.

    I clearly don't want to be a typical student type asking someone to do all the work. I'm accustomed to self-education. I need a direction and a helping hand. I'd appreciate any advice. Thank you in advance.
    5 years ago
    From my experience, Enthuware tests are harder than real-life OCAJP and that makes sense. But don't get into the trap of thinking "why learn more?". You never know what you'll get on the exam. Even EW authors have said that some test-takers had questions on topics not even mentioned in exam objectives.
    CertView home page states:

    We are currently working through some issues related to our new electronic Certificate (eCertificate) solution on CertView. Until we are live with the new solution, all Candidates who are certified on or after 01 September, 2013 will automatically receive a physical printed Certificate sent to their address on record in their Pearson VUE profile. Certificate shipments are sent via standard mail. Please wait 8 weeks from your date of Certification for receipt of your Certificate in the mail. We will update this message when our eCertificate is live. You will be able to download a copy of your certificate from your CertView account at that time. Thank you for your patience with this new CertView feature.

    Looks like, yes.
    5 years ago
    Fernando Almeida
    I don't know what kind of advice to give. The only thing that comes to mind is make sure you know the topic on String comparing using both == and equals(), String Pool and all these things. I had lots of questions on this topic. But I think you already know that ;) Anyway, wish you luck!

    Mohammad Ali Asgar
    Being such an attentive person will definitely give you an advantage on any exam ;) Of course, you're right. I took the first EW exam twice because I decided to start from scratch. And that's why I wouldn't take into account my first exam score because I remembered at least several questions if not more. That's why IMO my real result for the first time should be lower than 80% if not below the passing score.

    I don't know what exactly has influenced me but yes, Gupta's book was really useful although not sufficient. Of course, I've used online resources but mostly in connection with book and EW exams. That is, if I felt that I haven't grasped the concept I used short googling to find a Stack Overflow page or a Ranch forum topic. I wanted to eliminate all possible doubts and try not to fall in minutiae. I've also written short sample programs to test certain aspects, every possible input or cause all possible errors. For example, try all the combinations of comparing primitive numbers and wrappers using both == and equals.

    Steven Squeers
    No, I haven't used them. As far as I know, Sierra/Bates is even significantly overlapping the OCA. You need only certain chapters for OCA + Java 7-specific things. I think I'll use this book for my OCP preparation because it's highly praised. Plus 7-specific objectives of course.
    5 years ago
    I've paid on 9th September and it was $150.

    And I thought that it actually was $150 for the last couple of months.
    I decided to share my story here. Got 95% today and after all these days finally feel myself satisfied.

    I won't give the exact preparation time here. My everyday routine load was quite high and unstable so the numbers won't say anything. Let's say I started with Finegan / Liguori guide and passed the in-book test. The first Enthuware test disappointed me a lot: I got somewhere between 60-70%. That was clearly not the result I was hoping for even taking into consideration the fact that Enthuware tests are harder than actual exam. So I got a little upset, my routine seized me and I left the preparation. When I've sorted out my business I decided to start over (perfectionists' stuff, you know). But then I decided to read Mala Gupta's book after Finegan / Liguori. I also passed Gupta's in-book test.

    Speaking about books.
    Finegan / Liguori itself is definitely NOT enough. IMO the book is good to give you a general overview of the exam material but no more. The book itself is filled with typos and leaves lots of tricky cases aside.
    Mala Gupta's book is much better but not an ideal too. It gives LOTS of those small tricky cases you need to know to feel yourself invincible. The problem is I that I got a feeling that well-known general concepts were explained in a strange way. I can't speak for sure since it wasn't yesterday that I started to learn programming so I wasn't able to perceive these concepts as entirely new ones.

    Then I've passed six Enthuware exams. Getting 500 serious questions for $10 makes it not just a great but an awesome deal. You won't regret any single dollar spent on it.
    There's just one problem with these questions that is also the biggest advantage: you feel yourself worthless. They'll question you on every single corner case you didn't even know exist. My system was the following. I took the exam and then reviewed every single question. There are great explanations for every question. I strongly advise you to read explanations even to the ones you've answered correctly. You can encounter the situation when the reason for the answer being right won't be the one you think of.
    My results were: 86-90-82-86-86-84. Almost every exam was passed in an uncomfortable setting but that's not to justify me. For example, number five was taken on a van's rear seat driving between towns in a terrible road jumping up to the ceiling with my laptop.

    My worse-scored topics were Exceptions and Working with Inheritance. I was always worried to make a mistake in loops but almost every time went fine.
    I was also writing out all the tricky rules. I've learned the operator precedence table and tried to memorize String, StringBuilder and ArrayList's methods and constructors.
    For example, excerpt from my notes:
    "Switch must have a body, even if it's empty.
    String's replace() returns the same String object if there is no change.
    All compound assignment operators internally do an explicit cast.
    java.lang.Number is not final.
    With inheritance, the instance variables bind at compile time and the methods bind at runtime."

    I decided I was ready and then made an appointment. I think that collateral moments are important so that you wouldn't be distracted. Plan your time so that you wouldn't feel like going to the restroom, hungry or thirsty. Also reserve 15-20 mins if this is your first exam -- they need to take your photo and signature. You'd better ask about paper or erasable board beforehand -- it will substantially help you, especially in loop and lots-of-variables kind of questions although I was prepared not to have any writing tools at all. The testing environment is similar to Enthuware's. You'll get your result by email in 30 minutes.

    Good luck! Hope this helps.
    5 years ago