Sunday, December 20, 2015

Technical blog advise: Toptal Engineering blog

Editor of a technical blog -Toptal Engineering blog- reached me and I really love their blog. Their aim is to post technical publications like programming, software tools and tutorials. Their blog covers a variety of topics, across many programming languages and dev/design.

There is post about Java in the Toptal Engineering blog. It is Top 10 Most Common Mistakes That Java Developers Make: A Java Beginner’s Tutorial you can find it useful too. The topic says this post is for beginners but I think it is wrong. This blog post is for intermediate and advanced Java developers. Please bookmark it.

One of the Java mistakes which I usually do is forgetting to close the buffer readers. Also I never pay attention to the memory issues while writing codes in Java. However we should clear our garbage collector sometimes. The most of the developers create unneeded objects. For example, we are using different string objects rather than directly append strings. In addition to this, we all have a lot of unneeded null objects in the software. The main reason why we use unneeded objects is that we want to see the errors if there is a fail. So our first concern is handling errors, so the performance comes next. However we can do some little tricks while writing Java codes and we may gain performance too. The blog post which I mentioned is about these little tricks.

Have a nice read guys :)

Tuesday, January 6, 2015

SEO Tips

Don't spent a lot of money for Search Engine Optimization. Here are easy tips...

1. We should keep META-Description length under 160 characters. Search engines does not read after this length.

2. If text to code ratio of the main page is around %15, this is too low. We may consider removing some of the scripts if they are not in use in the main page.

3. Lets say we have 18 external links. We should keep them around 3 if we can. External links lowers reputation of the websites for search engines.

4. Having keywords is good but if the page does not have the keywords in META-Keyword tag, search engines thinks we are spamming. We should remove unused keywords from the META. Also we shouldn’t use more than 20 keywords anytime.

5. We have some broken links they are bad for SEO also. We can check them online using this tool

6. One of the important thing for SEO is back links. Right now we don’t have much back links. We need to establish high quality back links to get better SEO results. I have this tool to start back linking but we need to consider adding web site to globally recognized directories like DMOZ, Yahoo, etc. also this article is very useful on this purpose

7. Social media integration is another key point. Right now search engines don’t know our social accounts. google+ is a good starting point. We may add our website as a local business on map. This will help google to index website much faster. I think we should have twitter, linkedIn, facebook and google+ accounts to start.

8.We should check W3C validity of the Html. We can check this here

9. Add google analytics code into your website and analyze web site there to see if we have missed any other points.

10. For the site links, best practice is, if the target url is in our domain we should not use _blank. If the target url is in a different domain we should use _blank.

11. Bundling helps us to compress and minified js and css files into a single file for saving bandwidth and number of requests to load page. Inline scripts are important for SEO since search engines only reads first 100K of your web site. If we have inline scripts in the page, search engines will read these scripts instead of actual page content. We can also include having too many js or css links in the page to this problem. So bundling will help us for SEO purpose as well. Having a clean html is important as having a clean page layout. You can call it is occupational habit but I like to check html source of company web sites that I like to work with. Some of them are very clean and organized. They even hides messages in html like “Thank you for checking our source codes. We tried to keep everything clean and neat. Hope you enjoy!” In Wordpress there is a plugin called Js & Css Optimizer. You can combine and minify suitable css and js files using that plugin.

12. Create a sitemap.xml and submit it to Google with Google Web Master Tools. There is this site to generate sitemaps if we need to I used this all the time and had good results.

13. Robots.txt is so important for search engines. If you are using Wordpress, here is the best robots.txt file:


User-agent: *
# disallow all files in these directories
Disallow: /cgi-bin/
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/
Disallow: /archives/
Disallow: /*?*
Disallow: *?replytocom
Disallow: /wp-*
Disallow: /author
Disallow: /comments/feed/
User-agent: Mediapartners-Google*
Allow: /

User-agent: Googlebot-Image
Allow: /wp-content/uploads/

User-agent: Adsbot-Google
Allow: /

User-agent: Googlebot-Mobile
Allow: /

14. Before uploading a new image:

* Rename it with keywords. E.g: crm-salesforce-secure-ImageName.jpg

* Check it's size. Better less than 100 KB.

15. When adding a new image into a page:

* Please add "Alt" attribute to all images. It should be meaningful. You can copy&paste the image name for image "Alt" attribute. "Alt" attribute is important for search engines.

* You can add "Link Title", it should be meaningful too. But that is not as important as "Alt" attribute.

* You can add link to the images. The image link will be the same as image URL. (This enables Google will index our images and they will be searchable on Google Image Search). Link target can be "_blank" which means image is going to be opened in a new browser tab. If we use a lightbox plugin, we don't add target attiribute.

16. When adding a URL:

* If the url is not in our host, you can give it like "Open link in a new window tab". (This can be done using target="_blank" attribute in html) In this way, our website will not closed, so user can return our website easily with browser tab.

* Links should be meaningful. "visit this" is not proper, but "visit crm".

17. Writing a Text:

* Please use bold for key words. For example "crm" and "Salesforce" should be bold. Emphasized words are indexed in Google as a keyword.

* Please use meaningful titles.

* Use keywords in the first paragraph (especially in first sentence) and last paragraph. Use keywords like crm, secure, salesforce etc.

18. SEO Analysis & Reports

Keyword Density (
Code To Text Ratio (
Link Analyze (

Keyword Position Checker (
Back Link Checker (
Page Rank Checker (

Seval / January 2014 / Ankara Turkey 

Wednesday, October 22, 2014

National Cyber Security Awareness Month (NCSAM)

I have good news for you. I've got an email from SingleHop company. In this email, they indicated that October is National Cyber Security Awareness Month (NCSAM). So I decided to write this post which is about cyber security :)

It is a small Internet.

The first thing you should consider is that Internet is not too big as you think. Most of us think that we are just a little point in a huge Internet ocean, so nobody would notice us. That is incorrect. Hackers use automated systems to search unsecured computers. They can detect you in a few minutes. Really.

Everything is worthy!

Secondly, you may think there is not any valuable thing in your computer but you are wrong. When you use Internet, you can enter your passwords to login the websites. Sometimes you can enter bank account with your login credentials. You can buy some products online with your credit card info. This information is not only stored on your computer, but also passes a lot of computers during transaction. Hackers can reach your passwords easily by using network tracking programs. In addition to this, the documents you saved in your computer include metadata which consists of your personal information. Hackers can steal your identity from that metadata. All the documents you have are valuable.

By the way, let me tell you something about your passwords. Do not set same password for all websites and tools. Always use different passwords. Use upper case, lower case, numbers and different characters (e.g. #$%&?*+) to make your password stronger. I personally set my passwords with more than 10 characters in order to make difficult to determine with password crackers.

Do not trust antivirus programs.

The third thing is that you should not believe your antivirus software in any case. It can not protect you always. You have to update your antivirus software and your operating system regularly. You better put a firewall to your computer. Security softwares are a must especially in Windows. However these precautions are for known threats, not for the new viruses. Keep them up-to-date!

Did you delete them for real?

The last but not least thing is that your files are never deleted from your computer when you delete them. I know this is complex but it is true. The files are stored in your harddrive separately. When you delete a file, it only deletes it's header, not it's body. Even if you click "shift delete" or even if you click "empty recycle bin". All files still can be reachable. Moreover, when you delete something from social media, they are not actually deleted. All social media websites store everything on big databases, similar to the dedicated servers that SingleHop offers (but sometimes less secure). They also keep a copy of all things.

Happy National Cyber Security Awareness Month :)


Tuesday, September 16, 2014

How To Create A Web Application Project With Maven In ECLiPSE

I've written "Maven Tutorial: How to install Maven and how to configure Maven on eclipse?" document and now we are continuing with creating a web app with Maven in Eclipse. You can also watch online video tutorial:

Create a Maven Web Project

One way to create a web app is using command prompt. Open cmd, navigate into your workspace and use this command:

mvn archetype:generate -DgroupId=com.seval -DartifactId=myapp2 -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

Change the application name(DartifactId) and group id (DgroupId) if you want. I give the name myapp2 because I have a console application which name is myapp. This time I give the name myapp2.

This command will create a web app in your workspace. For me it is C:\workspace\myapp2

Import Maven Web Project into Eclipse

You need an Eclipse for JavaEE developers. Go to and download  "Eclipse IDE for Java EE Developers". I've downloaded:

Eclipse Java EE IDE for Web Developers.
Version: Luna Release (4.4.0)
Build id: 20140612-0600
  1. Unzip Eclipse and run eclipse.exe file.
  2. From Eclipse menu, File->Import->Maven->Existing Maven Projects. 
  3. Click Next. 
  4. Choose C:\workspace\myapp2 as Root Directory. 
  5. Make selected pom.xml.
  6. Click Finish.

In second way, you can create a Maven Web App project from Eclipse Luna 4.4. Here are the steps.
  1. Go to File->New->Other->Maven->Maven Project. 
  2. Click Next
  3. Unselect "Use Default Workspace" and choose C:\workspace as a workspace.
  4. Click Next.
  5. Select maven-archetype-webapp from the list. It will be Artifact Id.
  6. Click Next.
  7. Fill the blanks with your project details. Mine is:
    1. Group Id: com.seval
    2. Artifact Id: myapp2
  8. Click Finish.
Run Maven Web App in Eclipse

Be sure you selected JDK7 for your project. Because selecting JRE7 cause error. Therefore check it out from Eclipse Package Explorer. Right Click to JRE, then you can change it with JDK7.

To run Eclipse in Tomcat7, be sure you installed Tomcat7 correctly. I downloaded Tomcat-7.0.42 and unziped into C:\apache-tomcat-7.0.42 folder. Open <TOMCAT_HOME>\conf\server.xml and add this line between <Host> tags.

<Context docBase="C:\workspace\myapp2\src\main\webapp" path="/myapp2" reloadable="true"/>

After that go to Eclipse and right click to Project name, select Run As -> Run Configurations...

Right click to Maven Build from left menu, click "New". So create a new configuration by using the following information. In Main tab:
  • Name: mavenRunOnTomcat
  • Base Directory: ${workspace_loc:/myapp2}
  • Goals: tomcat:run
You can click Browse Workspace and select your project. Click Apply and Click Run.

Open your browser, go to http://localhost:8080/myapp2/ web address, you will see "Hello World" message.

Maven Tutorial: How to install Maven and how to configure Maven on eclipse?

Apache Maven, is a software project management tool. The most powerful feature is able to download the project dependency libraries automatically.

Step 1: Install JDK7

As a prerequiste, you have to install JDK7. You can download from under the title "Java SE Development Kit 7u67". I downloaded jdk-7u67-windows-i586.exe because my computer has Windows 32 bit.

I recommend you to install JDK7 in a simple directory. Because space character in path can cause some problems in Windows later.

Therefore I installed JDK7 in C:\apps\jdk7 and I installed JRE in C:\apps\jre7 directory.

Open System Properties->Advanced->Environment Variables. Add JAVA_HOME environment variable. It will be C:\apps\jdk.

Add Java into Path variable. It will be C:\apps\jdk7\bin.

Open a new command prompt (cmd) and run  java -version to verify that it is correctly installed.

Step 2: Install Maven

Download latest package from web address. I downloaded file, because I am using Windows XP x86 right now.

Unzip the distribution archive, i.e. to the directory you wish to install Maven 3.2.3. I unziped into C:\apps\apache-maven-3.2.3 directory.

Add the M2_HOME environment variable with the value C:\apps\apache-maven-3.2.3.

Add Maven into PAth variable. It will be %M2_HOME%\bin.

Your repository will be C:\Documents and Settings\<UserName>\.m2 directory (;For Windows XP only).

Step 3: Install Eclipse

Download Eclipse IDE for Java Developers from web address. I downloaded

Unzip Eclipse and click eclipse.exe file to run Eclipse. Create C:\workspace folder and give it to Eclipse as a default workspace.

From Eclipse menu, open Window->Preferences->Maven->Installation. Click "Add..." and click "Directory...", choose C:\apps\maven-3-2-3. Click Ok.
Click Finish. Select new Maven installation and click Apply. Then click Ok.

Step 4: Create a Project from Maven Template

I want to store my project into C:\workspace so open command prompt (cmd) and go to that folder. Here is the command:

cd C:\workspace

Run this command to create a Java project with Maven:

mvn archetype:generate -DartifactId=myapp -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
DartifactId is the project name. You can change it as desired.

After you run this command, the new project will be created in C:\workspace\myapp folder. This directory contains a file named pom.xml. Open pom.xml with Notepad++. This is Maven configuration file for this project.

Open cmd, navigate into new project. Then run this command to convert Maven project to support Eclipse IDE:

mvn eclipse:eclipse

Now import the new Maven project into Eclipse IDE as an Existing Maven Projects.

Step 5: Edit Your Project and Run

Open and add some other functions. We will test our project.

Open cmd, navigate into your project folder. Now we can create Jar file by using Maven. Run this command:

mvn package

Open C:\workspace\myapp\target folder, you will see generated Jar file.

Open cmd and navigate into your project folder. Run this command to run your new project:

java -cp target\myapp-1.0-SNAPSHOT.jar

You will see "hello world" message.

How to create jar file from Eclipse?

You can also create jar file by using Eclipse. You will see the pom.xml file from Eclipse package explorer window.
- Right click to that pom.xml.
- Run as -> Maven Build
- Write "clean install" into Goals field.
- Click Apply and Run

This process will create myapp-1.0-SNAPSHOT.jar file under target folder.

Step 6: Add Custom Library to Maven

For example, let's add kaptcha libray. Download zip file and unzip it:

1. Copy kaptcha-2.3.2-jdk14.jar file under C drive. So it will be available like C:\kaptcha-2.3.2-jdk14.jar

2. Open cmd and run this command (Your kaptcha version can be different):

mvn install:install-file -Dfile=c:\kaptcha-2.3.2-jdk14.jar -DartifactId=kaptcha -Dversion=2.3.2 -Dpackaging=jar

Now, the “kaptcha” jar is copied to your Maven local repository. The new library will be seen in (In Maven Repository) :  C:\Documents and Settings\<UserName>\.m2\repository\com\google\code\kaptcha

3. Declare the kaptcha coordinate in pom.xml:


4. Edit your project and build like in the Step 5:

mvn package
java -cp target\myapp-1.0-SNAPSHOT.jar


Friday, September 5, 2014

How to install Apache TomEE on a server

To install Apache TomEE on a server:

1. Go to

2. Download Apache TomEE 1.6 webprofile (

3. Extract the zip file to a temporary folder.

4. Copy the TomEE folder to a short path. Example: C:\apache-tomee-webprofile-1.6.0

5. Open \conf\server.xml in a text editor. Place a “3” in front of each port number. 

Example: “8080” becomes “38080”. Changing port numbers will enable you to use TomEE, Tomcat7 and Apache at the same time.

6. If you are installing Tomcat7 and TomEE in the same server, do not set CATALINA_HOME variable in Windows.

7. Check that TomEE installation. 

Run /bin/startup.bat. 

8. Open http://localhost:38080 in a browser. The default Apache TomEE home page will appear.

Monday, May 19, 2014

My Book Review: Extending Symfony2 Web Application Framework

I got the book "Extending Symfony2 Web Application Framework" which is written by Sébastien Armand. The first release of the book is in March 2014, so it is the latest published book about Symfony2 framework (PHP).

I am a PHP developer for 4 years. I am developing not only websites but also server side scripting in PHP. I used a few frameworks of PHP and I created my own MVC framework too. However Symfony2 is the best framework I've ever used.

First of all, I would like to express Symfony2 to new PHP5 developers. Symfony is a high performance PHP framework for developing MVC web applications. M is model, V is view and C is controller. This framework works in efficient way and allows you to develop a website faster, more secure and more scalable. If you understand the basics of Symfony2 before, then you can buy this book.

This book addresses the developers who already know Symfony2 and PHP5 because it helps you to understand the subject deeply. The books offers features for Symfony2.3 or higher and for PHP5.4 and higher. Examples in the book are based on MongoDB but you can convert it to MySQL and PostgreSQL.

It starts to telling about Services and Listeners which are very importand in Symfony2. As a PHP developer, I didn't know services and listeners that much until I read the book. There is a GEO location example. It shows codes and defines classes. If you want to extend the framework, you should know how to create a class and put it in the service and how to create a listener.

After these concepts, the book continues with commands and templates. It shows how to create a command for resizing user images step by step. For extending templates, it extends Twig which is the flexible, fast, and secure template language for PHP. You can create your own custom Twig tags or your own function by extending Twig. Most of developers who use Symfony2 do not extend Twig or they don't know how to do it. You can learn it in an example in this book, however it shows just one form of extending the template. There are a lot of way to extend the template.

In third chapter, there are useful tips about forms in Symfony2. This part is very comprehensive. In fourth chapter, it shows security tips by giving an example of "Simple OAuth with GitHub". I have been already using Firewall structure for Symfony2 but there are more advanced security options in the book.

Lastly "Extending Symfony2 Web Application Framework" gives examples on doctrine. Doctrine has Object Relational Mapper (ORM) for PHP that sits on top of a powerful database abstraction layer (DBAL). One of its key features is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL), inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication. In the book, there are methods to extend doctrine and entities.

With all this, you will be fully equipped to create any type of extension in Symfony. In the last chapter, it shows how to reuse and share your custom extensions. The examples in the book are sufficient to learn. I benefitted from this book very much. I really recommend book of  "Extending Symfony2 Web Application Framework" to people wanting to learn and use Symfony2 deeply in their projects.

Seval U. / Software Engineer in Turkey

Book Details

Extending Symfony2 Web Application Framework
Publisher : Packt Publishing
Author : Sébastien Armand
Language : English
Paperback : 140 pages [ 235mm x 191mm ]
Release Date : March 2014
ISBN : 1783287195
ISBN 13 : 9781783287192
Topics and Technologies : All Books, Web Development, Open Source

Related Posts Plugin for WordPress, Blogger...