arundhaj

all that is technology

Spring Hibernate - Create table if not exists

 

We have to configure hibernate, if we require the application to create the table when it doesn't already exists. Else, we would end up with the below mentioned exception.

ERROR: ERROR: relation "mytable" does not exist
  Position: 13
org.hibernate.exception.SQLGrammarException: could not execute statement
    at org.hibernate.exception …

Starting CDH quickstart VM in Windows

 

While trying Cloudera CDH quickstart VM in my Windows 7 machine, I was facing issues to start it with VMware player.

I was getting the following error message.

The import failed because D:\VirtualMachines\cloudera-quickstart-vm-4.3.0-vmware\cloudera-quickstart-vm-4.3.0-vmware.ovf did not pass OVF specification conformance …

Getting Started with ZeroMQ in Python

 

A simple getting started sample for ZeroMQ in Python. We will implement a Echo Server and Echo Client.

echo_server.py

import zmq

context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://127.0.0.1:5000")

while True:
    msg = socket.recv()
    print "Got", msg
    socket.send(msg)

echo_client …

Converting repeating decimals into fractions

 

I came across an interesting maths tip, which I couldn't resist sharing.

Turning a fraction to a decimal is a childs' play, with a simple division. The trick is on restoring the fraction back from the decimal that has a repeating numbers.

Let us take a decimal "0.4545454545..."

Pick …

Better not to ask feedback

 

Better not to ask feedback, if you don't respect it.

It is the feedback which managers' ask the team. Feedback about work, people, environment and organization. Getting feedback from people generally motivates, as it makes people feel better that they are being heard.

Though it is mandatory for the …

Using mail during django development

 

While developing a module that requires to send emails, using actual email servers would be an overhead. They might introduce network latency, possible spam filtering etc. All end up retarding productivity.

We have smtpd.DebuggingServer that could be used as a local email server. All emails that are sent to …

QuerySyntaxException: Foo is not mapped

 

While writing query using hibernate, I always tend to query based on table name and end up getting QuerySyntaxException

org.hibernate.hql.internal.ast.QuerySyntaxException: foo is not mapped [from foo]
    at org.hibernate.hql.internal.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180)
    at org.hibernate.hql.internal.ast.tree …