Skip to main content

Posts

[LINUX] How to find a specific String in file content with specific file name in specific folder

This is really the dumbest thing ever in linux, there are many many dumb things but this is the dumbest. Ultra trivial task you want to “find a specific string in a file content of specific file type starting from root folder” this is the easiest thing ever, it was not available in Windows XP/98 and because of that I was keeping one JBuilder which can search normally in any java file containing XXX in starting from this folder. But in Windows Vista / 7 this is done EASY just press F3! In Linux on the other hand it is a NIGHTMARE I was having a trivial task which takes… 10 seconds to search for a properties file which contains a default.session.timeout=600 which is a row in this file and this took me more then 30 mins because there are TONS of posts how this is done but none have worked there ware examples using grep, egrep whatever NOTHING is working total CRAP really. So in short I found it somewhere and I want to post it in order to have another POST in google which gives the answer...

Generate JavaDoc with UML diagrams

In my life many times has happened when I am assigned to a totally new project that I have no idea what it is about, that has to go live in 2 weeks and that I have to fix some issues in this ultra strange code sometimes even code written in different language. On my question is there any documentation the answer is: Yes but it is very old or no. So in short they want me to start working on a project with no documentation at all. My second question is is there a javadoc and the anwer is : yeah … kind of … so I am in a project with 30% javadoc with methods in French language for example ( I don’t know even a single word in French) so in short I am loosing 2 weeks to understand what is using what what is the model what is PersonnePhysique  and what is this crazy domain model. I believe this has happened with everyone of you at least once so what can you do ? You can start digging into the java code like crazy ( like everyone of us have tried many times) You can install ...

Using of Collections.emptyList() the right way in Java 1.5+

It is little strange that no one really uses emptyList like he should in Java. So this is small post showing how to use the emptyList method in the Collections class. Question: How to create an empty list ? lets assume that we have a class Book with multiple titles. So the class in our examples will be: import java.util.List; public class Book {       private List<String> titles ;       public void setTitles(List<String> titles) {             this . titles = titles;       }       public List<String> getTitles() {             return titles ;       } } Lets say that in our snippet we have something like :   Book myCrazyBook= new ...

Spring MVC, Spring Bean Validation Framework and validating confirm password / confirm email fields.

How to write validation like confirm password, confirm email and etc in Spring MVC. NOTE: To make bean validation to work its nice to read this tutorial: <a href=" http://wheelersoftware.com/articles/spring-bean-validation-framework.html" ></a> Today I was busy making some validations and implementations on very common scenario: change email and password. So we have a new password AND a new email also for both of them we have a confirm email/password field. And we want to validate everything nicely and to show to the user the real validation message if there is some error. So ... I've to use a form which already uses some annotations like @NoBlank and etc I think everyone of you is using annotations framework if you don't use it SHAME ON YOU !:) Anyway so I've added some fields to existing form bean: private String newPassword; private String confirmNewPassword; private String newEmail; private String confirmNewEmail; Bas...

JavaEE 5 (JSF + JPA + EJB3) using Eclipse

Today I will show you how to create Enterprise Application using Java EE 5 and GlassFish. I will use - Eclipse 3.5 + WTP - GlassFish v. 2.1 - JSF Mojarra implementation. - EJB 3.0. - JPA Toplink essentials implementation. - MySQL No NetBeans or JDeveloper magic involved :) The prerequirement is: Add datasource in glassfish. Read this how you can make this here: http://gochev.blogspot.com/2009/10/creating-datasource-in-glassfish-v-21.html 1) First you need to add glassfish in your eclipse. - Go to Servers View - Right Click, New - Choose GlassFish v 2.1 if you dont have glassfish click on Download additional adapters link choose glassfish wait and restart eclipse. Than try again. 2) Create the database CREATE TABLE ` lesson ` . ` USERS ` ( ` id ` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, ` username ` VARCHAR ( 45 ) NOT NULL , ` password ` VARCHAR ( 45 ) NOT NULL , ` name ` VARCHAR ( 45 ) NOT NULL , PRIMARY KEY ( ` id ` ) ) ENGINE = InnoDB...

Creating DataSource in GlassFish v. 2.1

I will show you how to create a DataSource in GlassFish version 2.1 because there were a lot of properties and I had a lot of problems when I've try to register datasource in glassfish for the first time. 1) You have to download JDBC driver for your database. For example I will use MySQL and I will use Connector/J driver that you can download from mysql official web site. 2) Place the JDBC driver in for example D:\glassfishv21\domains\domain1\lib\ext for example my driver is mysql-connector-java-5.0.4.jar 3) Start the domain for example domain1 (asadmin start-domain domain1) 4) go to http://localhost:4848 and login as admin. By default the username is 'admin' and the password is 'adminadmin' 5) go to Resources/JDBC/Connection Pools -First we will create a connection pool. Click the 'NEW' button -Than you must type: - Name: of the connection pool for example MySQL Lessson - Resource Type: javax.sql.ConnectionPoolDataSource - Database Vendor:...

About Me

Superhero with Java powers && Gamer && (Sci-Fi & Star Wars geek) && Bulgarian Java User Group Fellow Leader && nerds2nerds podcaster && (link: http://java.beer) java.beer guy ? this : null  I believe the above is enough, isn't it ? Anyway if you one of this... well...  non developers ? or HRs or recruiters or something in between ... you can check even my CV  here .