Feeds:
Posts
Comments

Garbage Collection

When we create any object using new keyword, some amount of memory will be allocated. Once we done with that object, it should be removed from the memory. Java implements automatic memory management also known as Garbage collection. It will automatically recycle the dynamically allocated memory. Garbage collector will recycle the memory.

Garbage collection was first invented by John McCarthy in 1958 as part of the implementation of Lisp..

Garbage collection organizes objects into generations (Young, Tenured and Perm).. Continue Reading »

SCEA Part -1

I would like to thank this Forum for the precious information I got from it as well as to Mikalai Zaikin as well as to Java Ranchers..

I would like to share my experience and materials which I have used for SCEA preparation..Firstly, I am having 2 yr 10 months experience. Those who are having exp less than 4 yrs ,I would suggest them to finish these certifications (SCWCD, SCBCD & SCDJWS for J2EE 5) , though it’s not mandatory, but it helps you to gain more knowledge. If you are 5 + exp, then its easy to clear this exam..Exam contains only scenario based questions and we need to select an appropriate answer. It’s quite difficult for me, to choose those answers :’( . Don’t go for most powerful and new ones instead read the question carefully and address the requirements. For example, sometime two-tier architecture will be better than 3-tier, DAO over JPA, RMI over web services (it depends on our requirements )..
Continue Reading »

Preparation tips & links: (for 1st round interview) –Basic stuffsss …. More to add on… All d best!!!

*) Basic flow architecture of java – Read abt JVM, why we need JRE, Where we will be using JIT, CLASSLOADER workflow..

*) We should be good in core java concepts.. I would prefer to read Kathy serria (SCJP book).. Its not mandatory to take this SCJP exam, but its better to read this book atleast once and be familiar with all the topic.. Concentrate more on Threads,Generics & Collections (especially HashMap implementation).. I would urge you to code as much as possible.. Understand HashCode concept, implement a simple HashMap (what will happen if collision occurs in HashMap) , LoadFactor, rehash ,running time complexity(O(1)) .. Please check the source code of HashMap.java

*) Annotation – how to create a simple annotation (@Retention(RetentionPolicy.RUNTIME)) Continue Reading »

I would like to share my interview exp with a Startup product company.. I have answered all the questions ,expect only one question.. Cleared the first round… I need to give demo on Spring,struts,hibernate by sharing my desktop..

I love this project, its about cloud computing and mainly virtualization as well as its going to be competitor to big companies.. Continue Reading »

This below program helps to crawl a web page,especially if we are behind the firewall..

Proxy.py

import urllib2
#Browser proxy setting
proxy_info = {
‘user’ : ‘vignesh_v’,
‘pass’ : ‘passwd’,
‘host’ : “10.16.65.13″,
‘port’ : 80
}

# build a new opener that uses a proxy requiring authorization
proxy_support = urllib2.ProxyHandler({“http” : \
http://%(user)s:%(pass)s@%(host)s:%(port)d” % proxy_info})
opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)
# Install the opener
urllib2.install_opener(opener)
#Open the url
f = urllib2.urlopen(‘http://www.python.org/’)
print f.headers
print f.read()

Web.py ..

Python has inbulit sqlite3 db..This below program will create a table in sqlite3 and insert a record and will retrieve the data.We use Web.py module to display the data in a html file.Web.py module has inbuilt server which will deploy this html..

Please install this webpy module

Note: User have to align the below code..

SmsAppMain.py

#imports the web.py module
import web
#Import inbulit sqlite db
import sqlite3

#Creating the connection
global connection
connection = sqlite3.connect(‘smsapp.db’)
#Load the cursor
global cursor
cursor = connection.cursor()

def createUser():
#Create the usertbl
cursor.execute(”’create table usertbl(username text,passwd text)”’)
print ‘Created Usertbl’
# Insert a row of data
cursor.execute(“””insert into usertbl values (‘viggi’,’test’)”””)
# Save the changes
connection.commit()

def retrieveUser(name):
import sqlite3 as db
db = web.database(dbn=”sqlite”,db=”smsapp.db”)
#Get a reference to the connection object via the cursor
connection = db._db_cursor().connection
cursor.execute(‘select * from usertbl’)
for element in cursor:
strUser = element
return strUser

#look for templates in your templates directory
render = web.template.render(‘templates/’)

#Regex that matches a URL,like /,/help
urls = (“/.*”, “SmsAppMain”)

#Class with GET function
class SmsAppMain:
def GET(self):
name = ‘Viggi’
#createUser()
strUser = retrieveUser(name)
#index is the name of the template
return render.index(str(strUser))

if __name__ == “__main__”:
#Create an application with the URLs
#looking up the classes in the global namespace
app = web.application(urls, globals())
app.run()

index.htm:

$def with (name)
$if name:
hello to $name.
$else:
Hello, dumb

Create the templates folder and copy this index.htm…
cmd : python SmsAppMain.py

Open a browser and hit this url http://localhost:8080/index.htm


References :

http://webpy.org/skeleton/0.3

http://docs.python.org/library/sqlite3.html

Dijkstra’s algorithm

Dijkstra’s algorithm used to solve shortest path problem.. Its used in routing…

For given source vertex(node) in the graph ,the alg will find the shortest path between the vertex and with every other vertex.

Ex: Finding shortest route between one city and all other cities..
Continue Reading »

Follow

Get every new post delivered to your Inbox.