Interview Question and Answer: Elevator Algorithm

Dev Patterns


One of the interview questions asked is “Elevator Algorithm”. As you think this problem seems easy, but you might not be easily think of the algorithm in a fast manner. I have written a simple version of it and I think this would be enough for an interview.

ElevatorCabin Class

This class is the core class that nearly all of the logic runs, so it will be enough for you to view this thorough.

ElevatorEngine Class

This class is the engine that will simulate the work of an elevator using the thread mechanism.

ElevatorEngineDriver Class

The driver classs to test the algorithm.

View original post

Why we need web server in front of application server

Bit and Bytes

This topic is the question raised in me when I asked to configure apache web server in front of my tomcat server. I know tomcat itself acts as a web server. Then why we need a separate web server?. This question made me to find the answer and post it here.

Why web server

When we go for an enterprise application, the first question will be what does the web server and application server. Why don’t you receive requests to your app server directly instead of passing it through web server?. Why can’t you install external load balancers to app server and make your application works without web server? When tomcat itself acts as a web server, why do we go with web servers like apache?.

Here we see the need of web servers in detail. When someone is specialist in some job, then we can let that job to…

View original post 1,661 more words

Exporting a CLOB


I’m in the final phase of a clear down process to remove data that is no longer legally required from a production database. Unfortunately for me this involves writing the data directly to disc in csv format for reference later, not my preferred option for this piece of work but it pays the bills – so who am I to complain? Anyway the process has been relatively painless up to now – I’m hitting tables with clobs and large ones at that – ranging from 10,000 characters up to just over a 1,000,000 in length. How the devil do I write these to a CSV?

From the start of this piece of work the best method appeared to be to export the data in a format file that would make it easy to use as reference via an external table due to a potential requirement to have to audit from…

View original post 1,331 more words

Maven Best Practices

Don't Make the Same Mistake Twice


Love or hate it… he will stay for a moment.
So let’s apply the best practices to our poms and maven builds.

Make the build reproducible
  - Always specify a version for Maven2 plugins
  - Minimize number of SNASPHOT dependencies
  - Use dependency management section
  - Beware of relocation in maven repo
  - After a dependency modification, double check the produced artifacts
Use and abuse of modules
  - more “technical/layered”
  - more business oriented
Make the build maintainable
  - Prefer default directory layout
  - Avoid duplication by moving common tags to parent pom
  - Always specify a version of dependencies in a parent pom
  - Use Properties Liberally
  - Minimize the number of Profiles
Make the build portable
  - Don’t commit eclipse and maven artifacts
  - Don't modify pom/artifactsin your "enterprise" repository

Make the build reproducible

Always specify a version for Maven2 plugins

Wrong way

Correct way

<plugin> <groupid>org.apache.maven.plugins</groupid>…

View original post 783 more words

Creating our own hashmap in java

coding algorithms

This is an attempt to come up with my own hashmap in java. It serves all basic needs of original java.util.HashMap with O(1) complexity in read operations.

To look into the internals of java.util.HashMap itself, see here

Output is ‘SMTS1’ which says when key is duplicated, it is getting replaced.

To cross verify the concept like collisions we need to choose the user defined key instead of ‘String’, I hope one can take it further from here on 🙂

View original post

Why “Agile” and especially Scrum are terrible

Michael O. Church

Follow-up post: here

It’s probably not a secret that I dislike the “Agile” fad that has infested programming. One of the worst varieties of it, Scrum, is a nightmare that I’ve seen actually kill companies. By “kill” I don’t mean “the culture wasn’t as good afterward”; I mean a drop in the stock’s value of more than 85 percent. This shit is toxic and it needs to die yesterday. For those unfamiliar, let’s first define our terms. Then I’ll get into why this stuff is terrible and often detrimental to actual agility. Then I’ll discuss a single, temporary use case under which “Agile” development actually is a good idea, and from there explain why it is so harmful as a permanent arrangement.

So what is Agile?

The “Agile” fad grew up in web consulting, where it had a certain amount of value: when dealing with finicky clients who don’t…

View original post 3,303 more words

Don’t waste your time in crappy startup jobs.

Five Posts to Write Right Now

The Daily Post

Nothing to write? Here are five types of posts you can publish right now, no matter your interests or writing style.

1. Your reply to . . .

I keep my eye out for multiple perspectives on a single topic and takes (and takedowns) of widely circulated articles. Consider educator Diane Ravitch’s recent reply to Alexander Nazaryan of Newsweek on comedian Louis C.K. and Common Core standards, which summarizes the article and issue-at-hand before diving into her own discussion points.

Don’t want to address your response to a specific person? Reply to an entity or publication, as Caitlin Constantine at Fit and Feminist did in her post to Self magazine, “Lay off the women in running tutus.” Whether directed to a particular person or an organization, these types of commentaries can be timely reads on trending topics.

2. A timely or thematic list.

Posts written as lists don’t have to be vacuous…

View original post 408 more words

Hello world!

Welcome to After you read this, you should delete and write your own post, with a new title above. Or hit Add New on the left (of the admin dashboard) to start a fresh post.

Here are some suggestions for your first post.

  1. You can find new ideas for what to blog about by reading the Daily Post.
  2. Add PressThis to your browser. It creates a new blog post for you about any interesting  page you read on the web.
  3. Make some changes to this page, and then hit preview on the right. You can alway preview any post or edit you before you share it to the world.