Category Archives: Java

Tips & Tricks for a Successful Online Portfolio

Our friends at Toptal screen a lot of designers, so over time we have learned what goes into making a captivating and coherent portfolio. Each designer’s portfolio is like an introduction to an individual designer’s skill set and strengths and represents them to future employers, clients and other designers. It shows both past work, but also future direction. There are several things to keep in mind when building a portfolio, so here is the Toptal Guide of tips and common mistakes for portfolio design.

1. Content Comes First

The main use of the portfolio is to present your design work. Thus, the content should inform the layout and composition of the document. Consider what kind of work you have, and how it might be best presented. A UX designer may require a series of animations to describe a set of actions, whereas the visual designer may prefer spreads of full images.

The portfolio design itself is an opportunity to display your experiences and skills. However, excessive graphic flourishes shouldn’t impede the legibility of the content. Instead, consider how the backgrounds of your portfolio can augment or enhance your work. The use of similar colors as the content in the background will enhance the details of your project. Lighter content will stand out against dark backgrounds. Legibility is critical, so ensure that your portfolio can be experienced in any medium, and considers all accessibility issues such as color palettes and readability.

You should approach your portfolio in the same manner you would any project. What is the goal here? Present it in a way that makes sense to viewers who are not essentially visually savvy. Edit out projects that may be unnecessary. Your portfolio should essentially be a taster of what you can do, a preparation for the client of what to expect to see more of in the interview. The more efficiently that you can communicate who you are as a designer, the better.

2. Consider Your Target Audience

A portfolio for a client should likely be different than a portfolio shown to a blog editor, or an art director. Your professional portfolio should always cater to your target audience. Edit it accordingly. If your client needs branding, then focus on your branding work. If your client needs UX Strategy than make sure to showcase your process.

Even from client to client, or project to project your portfolio will need tweaking. If you often float between several design disciplines, as many designers do, it would be useful to curate a print designer portfolio separately from a UX or visual design portfolio.

3. Tell the Stories of Your Projects

As the design industry has evolved, so have our clients, and their appreciation for our expertise and what they hire us to do. Our process is often as interesting and important to share with them, as the final deliverables. Try to tell the story of your product backwards, from final end point through to the early stages of the design process. Share your sketches, your wireframes, your user journeys, user personas, and so on.

Showing your process allows the reader to understand how you think and work through problems. Consider this an additional opportunity to show that you have an efficient and scalable process..

4. Be Professional in Your Presentation

Attention to detail, both in textual and design content are important aspects of any visual presentation, so keep an eye on alignment, image compression, embedded fonts and other elements, as you would any project. The careful treatment of your portfolio should reflect how you will handle your client’s work.

With any presentation, your choice of typeface will impact the impression you give, so do research the meaning behind a font family, and when in doubt, ask your typography savvy friends for advice.

5. Words Are As Important As Work

Any designer should be able to discuss their projects as avidly as they can design them. Therefore your copywriting is essential. True, your work is the main draw of the portfolio – however the text, and how you write about your work can give viewers insight into your portfolio.

Not everyone who sees your work comes from a creative, or visual industry. Thus, the descriptive text that you provide for images is essential. At the earlier stages of a project, where UX is the main focus, often you will need to complement your process with clearly defined content, both visual diagrams, and textual explanation.

Text can also be important for providing the context of the project. Often much of your work is done in the background, so why not present it somehow? What was the brief, how did the project come about?

Avoid These Common Mistakes

The culture of the portfolio networks like Behance or Dribble have cultivated many bad habits and trends in portfolio design. A popular trend is the perspective view of a product on a device. However, these images often do little to effectively represent the project, and hide details and content. Clients need to see what you have worked on before, with the most logical visualisation possible. Showcasing your products in a frontal view, with an “above the fold” approach often makes more sense to the non-visual user. Usually, the best web pages and other digital content are presented with no scrolling required. Avoid sending your website portfolio as one long strip, as this is only appropriate for communicating with developers.

Ensure that you cover the bases on all portfolio formats. Today it is expected for you to have an online presence, however some clients prefer that you send a classic A4 or US letterhead sized PDF. You need to have the content ready for any type of presentation.

Try to use a consistent presentation style and content throughout the projects in your portfolio. Differentiate each project with simple solutions like different coloured backgrounds, or textures, yet within the same language.

Source: Toptal

Getting started with Java interview questions

Are you getting ready for your next career move? And Java is your preferred tool -well its worth getting through interviewers mind set and acquaint with commonly asked questions. Yeah, agree, a simple Google search will get you a “lot of stuff” -one specific can be tried here. In fact this is bit uncommon, I have not faced 50% of these in any of my interview! but then who knows, writer can turn out to be next interviewer 🙂

Remote debugging eclipse with tomcat

Its extremely basic -but I always miss a step or so and end up searching on google. So I though I will just Jot it down -more so for me!

  • In bin/catalina.bat add following

    set JPDA_OPTS=-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
  • For starting tomcat, do not use startup.bat instead navigate to bin folder from command prompt and use following command to start tomcat
    “catalina.bat jpda start”
  • If tomcat starts listening successfully -it should print a message as

    “Listening for transport dt_socket at address: 8000”
  • Next In eclipse,

    1. select the project and click on debug->debug configurations Under “Remote Java application” -create a new configuration, and then enter

      Host -> localhost

      Port -> 8000 (same as given in address for JPDA_OPTS)
    2. All set ..eclipse should be able to connect to tomcat and debug points should be enabled in webapp

Why web sockets fail on http while succeed over https

I was in a mess and this is the blog which gave me clue out of it.
I had created two simple examples of websocket implementation using yet to realease spring 4 support for websockets.
I tested it from home and all well and good (no issues).
Next day I tried to demo it in my team –and the HTTP version failed, but to surprise the HTTPS was still good and saved my day!
I realized that I have not done my homework properly –rather impressed by simplicity of spring, have rushed in implementation. While searching for the issue I stumbled on the above article –it turns out that “Automatic Proxy” at office network was culprit. Here is the story

  1. We have “automatic proxy ” at work place –meaning no explicit IP or script in proxy tab in browser setting, once on network, transparent proxies are used.
  2. For HTTP :: Since browser was not aware of any explicit proxy, it addressed the Web socket server and while passing through the transparent proxy, required headers were removed. Websocket is an http upgrade (communicated via certain header, above article have all the details) -since headers were removed, the end server could not make sense of it and treated as simple HTTP
  3. For HTTPS :: Again browser was not aware of proxy, but since data was encrypted –proxy did not tampered the header and request went through to the actual server -since headers were still there all went good and fine!
  4. Spring web socket client (Sockjs) was smart enough to switch to WSS when I used HTTPS –which I did not realize at first shot. Lesson learned -test stuff behind proxy, firewalls even if it is an internal demo 🙂

In actual scenario –in any of corporate deployment, it’s going to be a HTTPS, so seems that web socket have a very good story there!

Spring data -yet another abstraction -quickly getting started

We started with JDBC, then ORM which abstracted the underlying relation DB. Then came JPA -which abstracted the underlying ORM. Now Spring Data

But the kind of versatility we see today in data storage -relational, distributed, nosql and others, to me Spring Data seems to server the purpose.

It abstracts the CRUD for “different” type of data as relational, nosql and just by coding to appropriate interface CRUD operations can be achieved. For getting started use this link for configuring the entity manage, transaction manager -basically the setup stuff.

Write a DaoInterface -here the magic goes, the extended interface decides type of data , relational, nosql etc.

public interface TestDao extends CrudRepository<TestData , Integer> {

And then for CRUD operations use this Interface :

public class TestService{
    TestDao testDao;
 	public boolean saveTestData(TestData testData){
                return true;
    	return false;
	@Table (name="testtable")
	public class TestData {
	    private Long id;
	    public Long getId() {
	        return id;
	    public void setId(Long id) { = id;

I found it simple, yet flexible and power full considering the fact that although projects start with SQL, but down the line NOSQL is definitely on their road map -this abstraction will ensure least throwaway code!

Is amazon micro instance of any worth?

I was attracted by per hour pricing of Amazon cloud hosting – to see how things work out, I decided to give it a try.

The Good Part
The entry level is “micro instance” -free of cost for 750 hrs a month. I quickly calculated 24×30=720 -hmm and it works. It says, it good for small traffic -perfect! I just had couple of visitors per HOUR! Nothing can be lesser than that 😉

Background of my APP -its a enterprise app, CPU intensive and high on DB queries. Wanted to demo a couple of clients so was just looking around for some cheap option and I stumbled upon “Free” option.

And The Bad Part
My excitement did not last longer -I noticed a behavior that for a couple of ‘seconds’ things would work as fast as its locally deployed but just a couple of minutes of continuous usage -and thing would come to grinding halt:(

I would have smelled fishy on my side if I could produce this behavior locally, but I have been running this app in LAB environment for a couple of days without any issue.

I spend couple of hours searching for the root cause and I stumble upon this -Thanks god, it saved me a hell lot of effort! Visit this blog and it’s nicely described how “stealed CPU” is the culprit!

So is micro instance any worth ? Only if you want to get a first hand feel of deployments in the cloud and a pat that “hooo -my app is running in ‘cloud’ “, nothing more nothing less!

For starter and less traffic -use their small instance which as on today comes at .080$ in singapore zone. As explained in the blog-at least it will provide consistent behavior.

Never put static files in WEB-INF folder and never be over confident about ur analysis ;)

It could be weird but when you code in hurry to get over ASAP, it invites even more delay and trouble -I spend almost 2 hrs trying to access static files placed in a folder inside WEB-INF folder, forgetting that it will never be accessible from a browser because that’s why there exist a WEB-INF folder -to restrict public access!

So my intent was good – I had a JSP which has embedded SWF file. Everything was in root foler parellal to WEB-INF. Then I though lets restrict access to SWF using direct URL (SWF have some login code as well) – So I created a folder view “inside” WEB-INF and moved all my files there. hmm..

  1. After execution of business logic, I forwarded the request to JSP .
  2. JSP was rendered but SWF was not loaded.
  3. I tried redirect by putting the folders outside WEB-INF (For redirect it has to be out side WEB-INF!) and it worked!!!
  4. Oh my –I concluded, it’s issue with the forward, completely ignoring the fact that it’s about static file location
  5. After 2-3 hrs, yeah, 2-3 hrs, I used Firebug -I do not know why I did not used at the beginning, may be I was trying to be over smart and highly confident about my analysis of the cause!
  6. Firebug reveled that all files need to be at a place accessible by browser -which is outside WEB-INF

More than any technical learning – do not be overconfident about your analysis 😉

Looking up spring beans defined in java configuration classes

Recently I got rid of XML files in Spring app used for configuration by using annotated classes. A basic issue -how to “lookup” these instance if required, took me some time. The good old way with XML

AbstractApplicationContext ctx = new ClassPathXmlApplicationContext("/META-INF/application-context-root.xml");

It’s still simple, use a different class with configuration class as argument

ApplicationContext context = new AnnotationConfigApplicationContext(RootConfig.class);
sessionManager = (SessionManager) context.getBean("sessionManager");

MySql connections autodrop after a certain hours

MySql is configured to drop any connection which has been Idle for more than 8 hours. What is the implication of this? After you return to your deployed app after a gap of 8 hours (If default SQL parameters have not been changed), you will be greeted with an exception.

How to solve this issue?

  1. Increase the wait_time parameter -Not a good Idea, it might unnecessarily hold on to the resources and not might be a sure shot way. Apart from that, being dependent on an “external” configuration for failover is not a very good idea -what if the server itself crashes, what if this configuration is missed in one of the instnaces, and many such issues will pop up against this approach.
  2. Use the parameter autoReconnect=true with JDBC URL -My SQl itself does not recommend this, have a look at link and people have reported that this does not work as well, refer link.
  3. Custom handling -have your code identify that connection has been lost and then recover it and try to reconnect, but then it would be a lot of fail over mechanism in code.
  4. The best way I found was to configure pooling mechanism as c3p0. See this post how to configure c3p0 in JPA for hibernate, it’s simple, easy and reliable.

So how do you test that issue is solved?

  1. Change wait_timeout in MySql to just 2 minutes, this is how it can be done from MySql workbench admin console mysql_timeout
  2. Keep value of idleTestPeriod less than wait_timeout -A quick recap what idleTestPeriod signifies
  3. idleTestPeriod:  default value=0; If this is a number greater than 0, c3p0 will test all idle, pooled but unchecked-out connections, every this number of seconds
  4. Login after wait_timeout has passed -it should not throw a exception

Solving classloading issue while adding pooling support using c3p0 in JPA with hibernate underneath

I added c3p0 for pooling in JPA, but encountered an exception

Unable to load class [org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider]

My configuration looked like

<property name="hibernate.connection.provider_class"
          value="org.hibernate.connection.C3P0ConnectionProvider" />
<property name="hibernate.c3p0.max_size" value="10" />
<property name="hibernate.c3p0.min_size" value="0" />
<property name="hibernate.c3p0.acquire_increment" value="5" />
<property name="hibernate.c3p0.idle_test_period" value="60" />
<property name="hibernate.c3p0.max_statements" value="0" />
<property name="hibernate.c3p0.timeout" value="100" />	    

Details about these properties and other defined at link

Looking at log trace it’s not difficult to figure out that jar is not correct, so first change, upgrade to latest c3p0 artifact.





After changing this, it worked but printed an Warning

WARN - HHH000208: org.hibernate.connection.C3P0ConnectionProvider has been deprecated in favor of org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider; that provider will be used instead.

This indicates that provider_class should be changed to remove the depricated class, so it should be

<property name="hibernate.connection.provider_class"
          value="org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider" />

This cleanly integrated the c3p0 implementation.