Saturday, May 9, 2015

Non Technical Interview Tips

After writing my previous topics that covers only technical parts of interviews, I received questions to cover the non technical skills needed for interviews. So I decided to talk only about this in a separate topic.

Rejection Reason Example

The reason was that I'm not good in communicating my ideas, and didn't prepare for the interview environment which was a bit messy.


I think the following points are really important to care about when you have an interview, feel free to send me other tips to include.

Interview Environment
  • Make sure that you set the best appointment for the interview which you are free and can sit in a quite place concentrating a solving very hard problems.
  • If you are not sure that the internet speed will be stable for a Skype interview, ask them to call you on your phone.
  •  Make a small test for your microphone, sound, internet, ...
Listen

One of the important skill interviewers assess is that you listen to questions, understand them, and not approaching solutions before making sure that you understand the problem and corner cases.

Hints

If you can't find a solution or struggled in one, you can ask them for hints.

Answers

Try to give short answers, and avoid speaking too much.

Internet Connection

I prefer DSL than Wireless and 3G. Its more stable. 

English

Try to speak slowly because they don't expect that you are super fluent in English. 

Assumptions

If you have assumptions write them on the shared document, so that they feel you know what you are doing.
Feedback

Never ever ask for feedback within the interview. 

HR vs Technical

Ask technical questions to tech people, and other questions like Salary, Vacations, Benefits, ... to HR.

Say No

If they asked you about something you don't know, feel free to say I don't know about this topic or technology. It would be ideal if you know something close to it and try to talk about instead.

Example

Do you know framework X? 

No. But I know framework Y which does the same task, and I think the concept is the same, So you can ask me about the concept or I may answer according to my experience to Y.

Feel free to comment and share the topic :).

Friday, May 8, 2015

Interview Experience

In this post I will talk about how to search, prepare, and pass a tough technical interview.

Searching for Jobs

I used to search for jobs but actually recruiters now are smart enough to find you if you have a good profile that could attract them calling you.

First make a good profile on Linkedin, and Xing. Put everything there and give small description about everything. In order to get noticed make sure that you include keywords that people use to search for candidates, and don't forget to update your current location and contact information regularly. Linkedin has a good job search that you can use to filter jobs that match your skills and needs e.g., Jobs by location.

Finally when a recruiter asks for your CV or contact, don't just reply with messages like "Hey please find the attached CV as you requested", prepare a template message like the following one:

Hello,
I'm a Software Engineer with solid algorithms, problem solving, and data structures skills. I have excellent experience in back-end development and you can check my skills and all the details about me in my CV and the following links and profiles.


- My blog contains lots of technical content (e.g., Algorithms, Problem solved by me, Administration, Java technology, Linux/Minix kernel topics, and some open source projects done by me) here is the link for it. Link

- My Github profile which contains all the projects done by me and projects I managed to contribute in. Link
- Topcoder profile: This website makes regular algorithms contests between the most professional engineers around the world and my progress in it is excellent. Link
- LinkedIn profile which contains general and detailed information about my experience both work experience and open source experience and it also contains most of the technologies I use and have knowledge about them. Link
- My SourceForge Page which contains binary packages of my projects for developers/students to download them and use them freely.

Preparation Time

Now you should put a plan for your preparation. I used to have the following plan to prepare for interviews:
  • Check Glassdoor for sample previous interviews of this company or a company with the same business.
  • Record all questions in one file with small categorization.
  • Spend only 1 day in this task and try to collect as much questions as you can.
  • Solve or review my solution at leetcode.
  • Checking my How to prepare for an interview series.
  • Studying problems in Cracking coding interview book.
  • Studying Hacking google interview handouts.
  • Solving 2 or 3 design questions.
  • Refresh my knowledge about Caching, Hashing, Distributed Systems, Parallel Computing, Computer Architecture, Unit Testing, Software Control Managers,...etc
  • Asking one of my friends to interview me.
Interview Process

Usually you will do a series of phone interviews 2 or 3, and you will be asked 2 or 3 coding questions that you can pass easily if you are well prepared. They may also ask you to write test cases for your solution and you have to cover all the cases.

For Testing:

Use the following strategy: As an example consider that he asks you to print an array of numbers:
  • Best cases test: {1, 2, 3}, {-1, -2, -3}, {1000000, 28, 27}
  • Load test {A very large array}, {INT_MAX, INT_MIN}
  • Random test {-1, 2, 77, 10082, 87273, 928, -91837, 28737}
  • Corner cases test {}, NULL, {1}, {-1}, {0}, {0, 1, -1}, {1, 2}
May be they need more than that and for such cases you can ask them for hint :) .. Its OK to ask for hints by the way ;)

At the end of the interview he may ask you some tricky questions, or open ended questions .. So be prepared.

Onsite Interview

In the onsite interview you will have around 5 or 6 technical interviews that will cover all aspects of skills that you may or may not have. Example:
  • 3 Coding Interviews.
  • 1 Architecture and Design Interview.
  • 1 Interview with the Engineering Manager or Hiring Manager.
You should:
  • Be patient and listen to the full question.
  • Ask questions, usually they give you partial information to check what you will do!
  • Start demonstrating how would you approach this problem
  • When he asks you to code, start coding
  • Code carefully on the board, and try write clean code
  • When you finish coding, explain it briefly
  • He will ask you to analyse it, try to be smart and give him a proof for your analysis :).
Offer Time
  • Congratulations ;) you made it!
  • Reserve a Visa appointment
  • Read the contract carefully, and discuss it with the recruiter
  • Ask for relocation package
  • Negotiate your salary
  • Accept the offer
  • Prepare your papers
  • Good bye, don't come back :)
I hope you liked the post, please leave a comment and share it.

Wednesday, March 4, 2015

Project Lombok

Lombok  is a plugin that Java developers can use to save time and effort writing repeated code like one we see in data classes. I will describe it with examples and will include a link to video and the project site to download and try.

Consider the following data class Student which has some attributes and access to it Getters/Setters.


Too much code for a data class :-S

Look at Lombok and what it can do :-P


You can also control if you want only getters or setters using the @Getter and @Setter annotation before each attribute.


Now the code looks more pretty and readable as a data class. It has lots of other useful annotations that will save you lots of repeated code.

For example you can look at the @Cleanup annotation and what it does.

References:



Monday, December 1, 2014

FireMeUp Java Job Scheduler - Open Source

In one of the projects at my current employer me and my team were asked to use a Java Job Scheduling library to schedule some jobs doing some business at dynamically configured time. 

We decided to use Quartz as we were using Spring which provides a full integration to Quartz, and I was fascinated with the design and implementation of it.

I thought that I can start a new open source project that implements a Java Job Scheduler for learning purposes with some modifications/simplifications to the current design of Quartz library.

FireMeUp Scheduler is a simple Java scheduler that can be integrated within your application in a very simple way. The library is so simple and can be used in Small and Medium scale projects, and it provides the following functionality.

  •  Jobs that run every interval of time.
  • Jobs that run every day, week, biweekly, monthly, bimonthly, and yearly in a specific time of the day. (e.g., Every day at 12:00 AM).
  • Having more that a scheduler in your application.
  • Enable/Disable scheduler freely throughout your application life time.
  • Configuring more than one trigger and associating them to schedulers.
  • Triggers can be configured in more than one way either a simple trigger that is scheduled to be triggered every interval of time, and crontab trigger that is triggered either daily, weekly, biweekly, monthly, bimonthly, or yearly at specific time HH/MM/SS.
  • Implementing your jobs and associating them to triggers, more than one job to each trigger.
  • Register/Unregister triggers to schedulers.
  • Register/Unregister jobs to triggers.
  • Job can't overlap itself if its in a running state.
  • You can implement your own trigger by extending the AbstractTrigger that contains most of the business.
Future Functions

Here are some ideas I need to add to the current project, and anyone who needs to start his own open source life can start implementing them and be part of the project.
  • Adding state recovery functionality for the configured Schedulers, Triggers, Jobs, I think we can use in-memory (not recovered) and database (recovered) models.
  •  Threading management functionality, manage the number of concurrent running threads.
  •  Configuration management functionality, configuring the application programmatically and using a properties file.
  • Providing a crontab expression parser functionality.
  • Documentation of the whole project.
  • More complex examples and test cases.
Project Links

Wednesday, April 9, 2014

Maximum Triangle Area

Problem MaxTriangle SRM 449 Div-1 250 pts problem.

Here is the problem description:

A triangle with positive area has been positioned on the plane in such a way that all of its vertices are located at integer coordinates. The lengths of two sides of this triangle are equal to sqrt(A) and sqrt(B), where sqrt(X) denotes the squared root of X. Return the maximum area this triangle can have. If there is no such triangle, return -1 instead.

Solution to this problem:

We can use vectors to solve such kinds of problems, the input is the squared of magnitude of two vectors, so we need to get all vectors that can give a magnitude value equals to sqrt(A) and sqrt(B).

Given that magnitude of a two dimensional vector(x, y) can be computed using the following equation:

Magnitude = sqrt(x*x+y*y)

So we need to iterate all valid x and y that can evaluates to this x*x+y*y=c, where c equals the squared magnitude passed.

The following method takes a squared magnitude as a parameter and returns the list of vectors:


Note: For each valid x and y, the following are also valid as per the above equation (x, y), (-x, y), (x, -y), (-x, -y).

Now we can iterate for all pairs of vectors of both squared magnitudes A and B, to get the maximum area of a triangle. To compute the area of a triangle between two two dimensional vectors is done using cross product.

See the following video but this is for three dimensional vectors.

Cross product of two dimension vectors (x1, y1) and (x2, y2) = x1*y2-x2*y1

Read this.

Here is my code for this problem.


Monday, February 24, 2014

Sample ADF CRUD web application

In this post i will show you how to use ADF to create a simple CRUD application in just few minutes.

To know more about ADF "Application development framework" please go to this link.

1. Create an ADF web application.


2. Set application name "Sample Crud" and click finish.


3. Choose "Connect to a Database" and press "Create a Database Connection".


4. Put connection details, and connect to the Oracle Sample HR database, and make sure to test the connection.

Note: Make sure that the hr user is not locked, and if its locked you may need to unlock it.


5. Mark the "Connect to a database" step as Done.


6. Expand the "Build Business Services" step and click "Go to Substeps".


7. Expand "Create Entity Objects and Associations", Press "Create Entity Objects and Associations".



8. Choose the model project.


9. Choose the database connection created in step 3.


10. Press the Query button, and move the Jobs table to the right column.


11. For the updatable views, chose JobsView and move it to the right column, then press finish.


12. Mark the "Build Business Services" step as Done.


13. Open the "adf-config" unbounded task flow.


14. From the "Component Palette" panel drag the view icon to the task flow.


15. Rename it to "jobsView" and double click on it, and then click Ok.


16. Drag a button from "Component Palette" panel into the page, and rename it from the property panel.



17. Do the same for the Edit, Delete, View buttons.



18. From the "Data Control" panel, drag the JobsView1 into the page, and insert it as a read only table.


19. Choose "Single Row" for selection, and click Ok.


20. Back to the "adf-config" unbounded task flow, and drag a new view for the job form.


21. Double click the new page, and drag the JobsView1 into it from the "Data Control" panel as a form.



22. Check the "Include submit button" checkbox, and click Ok.



23. Back to the "adf-config" unbounded task flow, and drag a new view for the job details.


24. Double click the new view, and add the JobsView1 into it as a read only form, and click Ok.


25. Back to the "adf-config" unbounded task flow, In the "Data Control" panel, expand the JobsView1 -> Operations and drag the "CreateInsert" operation into the task flow.



26. Do the same for "Delete" operation.

27. From "Data Control" -> Operations, drag "Commit" and "Rollback" operations into the task flow page.


28. From the "Component Palette" panel click the "Control Flow Case" icon and drag from "jobsView" page to the "viewJobDetails" page, and name it "view".


29. Do the following to complete navigation flow for our business case:

A. "create" flow from "jobsView" to "createInsert" operation.
B. "edit" flow from "jobsView" to "jobForm" page.
C. "delete" flow from "jobsView" to "delete" operation.
D. "CreateInsert" flow from "CreateInsert" operation to "jobForm" page.
E. "Delete" flow from "Delete" operation to "Commit" operation.
F. "save" flow from "jobForm" page to "Commit" operation.
G. "cancel" flow from "jobForm" page to "Rollback" operation.
H. "Commit" flow from "Commit" operation to "jobsView" page.
I. "Rollback" flow from "Rollback" operation to "jobsView" page.
J. "back" flow from "viewJobDetails" page to "jobsView" page.


30. Go to the "jobsView" page, and double click it, and from the property panel, change the action for each button to be as follow:

A. "View" button action = "view"
B. "Create" button action = "create"
C. "Delete" button action = "delete"
D. "Edit" button action = "edit"


31. In the "jobForm" page, add a new button and name it cancel, and the action = cancel, imediate=true.


32. In the "viewJobDetails" page add a new button and name it back, and the action = back.


33. Right click the adf-config unbounded task flow and click run, if prompted to choose the run configuration choose "jobsView" page to be the start page.

34. Screen shots for the application:



Done.

Configuring logging for ADF application

In this post i will show you how to configure ADF logger that logs your messages/errors to a specific log file.  Here are the steps needed to do the configuration.

1. In JDeveloper right click IntegratedWeblogicServer instance, and choose Configure Oracle Diagnostic logging for "IntegratedWeblogicServer".



2. Choose the root logger, and in structure window expand log_handlers, copy log_handler named "old-handler".

3. Paste the copied log_handler and name it XX-custom-handler, from property window change .



4. Choose the path property and change its default value.



5. In the overview tab of logging.xml file, click the add symbol to add a persistent logger. In the logger name select the class file or package for which you want to use this logger. example : xx.oracle.app select a level based on the severity you need.
 




6. Expand the Root logger and choose the newly created logger, and in the handler declarations window press the add icon, and choose the custom handler.



7. Now select your project in the application window, and double click it to change the run configuration java options -> Choose the default run configuration -> Edit -> Java options and add the following option "-Djbo.debugoutput=adflogger".







8. Now you can use the ADFLogger util to create a logger instance that logs to you log file.


Done.