Wednesday, December 29, 2010

How to set ${user} property in Eclipse?

Select Preferences -> Java -> Code Style -> Code Template -> Section Comment -> Type
You can replace the author tag by whatever value you need and it will have an effect on new generated classes.

${user} uses the value of the user.name environment variable. You can check it via System.getProperty("user.name").


There are several solutions:
  • define it via command line:
    C:/eclipse/eclipse.exe -vmargs -Duser.name="someUserName"
    
  • define it via eclipse.ini:
    -showsplash
    org.eclipse.platform
    --launcher.XXMaxPermSize
    256M
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Duser.name="someUserName"
    -Xms40m
    -Xmx512m
    

Tuesday, December 28, 2010

My Bookshelf - Part Zero

Each software developer spend some amount of time reading IT books. I have several reading directions and special sequence of  reading. I think it would be interesting to share my virtual bookshelf: books which I've read and books which I'm going to read.

Here are books' categories:
  • Design, Patterns, Refactoring and Architecture
  • Agile Technique
  • Tools
  • Learning and Career Development
  • Java and JVM Languages
  • Other
I'm sure I will extend this list, but this one is OK as start point.

Maybe it will be good to group books by authors as well. Will see. Definitely, I have to try this approach as well.

In the next part I'm going to post about "Design, Patterns, Refactoring and Architecture" bookshelf.

Wednesday, December 15, 2010

Java Build Tools and Future

It's always interesting to read comparison of Java build tools. There are two major player so far: Ant and Maven. But, I'd like to know more about other tools. 

Here are some interesting links: 
    Top 3 Java build tools:
      I don’t want to mention the other tools. The list isn't small. I'm not sure if it worth spending time for learning/investigating new build tools. We should follow the trends.

      Ant and Maven are good enough for any projects. But Gradle evolves really quickly. So, we can get additional "big" player on Java build tools field.

      Friday, December 10, 2010

      How to use Dropbox as SVN repository?

      You probably know about such cool stuff as Dropbox. So, I use it as on-line SVN repository for my own projects. It gives me an opportunity to have my own repository everywhere.
      Check this post before go ahead: How to use Subversion & Dropbox to create an effective work management/backup system

      So, 1) you have to create SVN repository in some Dropbox folder; 2) do the checkout from this folder on every work machine where you need to do something with your SVN repository. That's it.

      Thursday, November 25, 2010

      Review: The Pomodoro Technique by Francesco Cirillo

      Some time ago I read this book "The Pomodoro Technique" by Francesco Cirillo




      Sunday, October 31, 2010

      Why Should I Attend Conferences?

      I'm mainly a Java developer. But, I always do some "diving" around new technologies, trends and just around other interesting stuff (read blogs, watch screencasts, etc.). And it's not enough for me. So, I've decided to attend some conferences. Here is the chronological list of conferences I've attended:

      1. Ruby Bar Camp (September 26, 2009)
      2. Ruby Shift (May 21, 2010)
      3. Agile Base Camp (January 23, 2010)
      4. Agile Base Camp (May 29, 2010)
      5. PyCon Ukraine (October 23-24, 2010)
      All these conference related to non-Java technologies. And what? The main benefit I've got is the real face-to-face communication with technology addicted people.
      I've seen great, good and ugly presentations. This experience has opened my mind. Why?
      Every conference which I've attended gave me the additional energy for the next attempts to learn something new, something great and interesting. Even if it's unpopular in my company and inside my local developer's community.
      These conferences showed me the real people which stand behind the blog posts, forum posts, frameworks and libraries.
      I'm a 100% sure that every developer must attend a conference just to feel the spirit of community.

      Saturday, September 11, 2010

      Review: Pomodoro Technique Illustrated

      I've got a real pressure because I had to learn TOO many different things simultaneous. And I had very small time frame to do the job in time. I needed some tool which can help me to organize all my learning activities.
      I remembered about Pomodoro. Without any delay I started reading this book: Pomodoro Technique Illustrated: Can You Focus - Really Focus - for 25 Minutes?, by Staffan Noteber

      Chapter 1: One Activity at a Time
      Pomodoro concepts overview. Author present simple examples which help us to understand the real value of this technique.

      Chapter 2: Context
      This chapter describes how our brain works. Basic ideas and simple worlds. It’s really pragmatic approach based on applicable examples and associations.

      Chapter 3. Mechanics
      This chapter help us to understand the Pomodoro process in action: Pomodoro sets, Activity, Iteration, breaks, Activity Inventory, Records.

      Chapter 4. Interruptions
      Clarifies the difference between the Internal and External interruption and gives several advices how to manage them.

      Chapter 5. Estimate
      Explains basic technique for Pomodoro estimation and estimate analysis.

      Chapter 6. Adapt
      This chapter shows some Pomodoro best practice: tools, length of Pomodoro, breaks, progress sheet, prioritizing, mind maps, reviews etc.

      Chapter 7. Team
      The last chapter, it gives some advices how to apply Pomodoro technique to pair work.

      In general this book opened my mind. I'm going to try Pomodoro. The most beautiful thing it that this time management technique is very simple, has small set of rules and tools.

      Summary: well written book, short and pragmatic. Good start point to learn Pomodoro technique and adapt it to your own needs.

      Thursday, August 12, 2010

      (J)Ruby or Groovy for scripting in Java environment

      It's my dilemma. And I come to the conclusion that (J)Ruby is a better choice:

      Groovy
      1. Groovy provides easily integration with existence Java code-base.
      2. Groovy is easy to learn for Java developers
      3. Groovy has the similar "power" as (J)Ruby
      4. Grails has "support" from SpringSource
      5. Groovy/Grails has competitor inside SpringSource - Spring Roo.
      6. Groovy has evolving community.

      Ruby
      1. JRuby can be integrated in existence Java code-base but no so good as Groovy
      2. Ruby has amazing community (tutorial, screencasts, books, etc.)
      3. Ruby language is "super sexy", but I think it's because of hype in community ;-)
      4. Engine Yard is big player in Ruby community. It supports JRuby and Rubinius projects
      5. Ruby can be run not only on JVM! So, I can reuse my Ruby-knowledge in different environments
      6. Ruby is faster then Groovy.
      7. Ruby has good support on *nix environments, but there are some issues with popular gems on Windows.
      I know that all these ideas are subjective and you can select own pros/cons.

      The another main item against Groovy is that there are so many JVM languages (Groovy, Jruby, Scala, Jyton, Clojure) and they are change each other in popularity from year to year. Groovy, Scala, Clojure are JVM based mainly (Clojure has CLR implementation). It's hard to get some expensive time to dive deeper in each of them.


      Conclusion is pretty simple - use the right tool for the job.

      Friday, April 30, 2010

      Oracle UNDO DBF issues

      Oracle 10.2 is installed on Windows XP SP3.

      Useful references:

      1. Switch Undo Tablespace
      2. Fun with UNDO tablespaces
      3. ORA-01548: active rollback segment '_SYSSMU1$' found, terminate dropping tablespace
      4. Oracle Init.Ora & SPFile
      5. Automatic UNDO Management in Oracle9i

      Problem description:
      UNDO dbf file was f**ed up, it have to be removed and replaced.

      Create temp tablespace and switch UNDO to it:
      sqlplus> create undo tablespace UNDO_RBS1 datafile 'path_to_new_undo_dbf' size 500M AUTOEXTEND ON MAXSIZE 3900M;
      sqlplus> alter system set undo_tablespace=UNDO_RBS1;
      
      sqlplus> select status from v$rollstat;
      STATUS
      ---------------
      ONLINE
      PENDING OFFLINE
      PENDING OFFLINE
      ONLINE
      ONLINE
      ONLINE
      ONLINE
      ONLINE
      ONLINE
      ONLINE
      ONLINE
      You can't drop or offline if status show offline pending.
      Restart DB:
      sqlplus> shutdown immediate;
      sqlplus> startup;
      
      And now try to drop undo tablespace:
      sqlplus>alter tablespace UNDOTBS1 offline;
      sqlplus>drop tablespace UNDOTBS1 including contents and datafiles;
      *
      ERROR at line 1:
      ORA-01548: active rollback segment '_SYSSMU1$' found, terminate dropping
      tablespace
      
      Cause of The Problem
      An attempt was made to drop a tablespace that contains active rollback segments.

      Solution of The Problem
      In order to get rid of this error you have to follow following steps.

      1)Create pfile if you started with database with spfile.
      sqlplus> create PFILE from SPFILE;
      You can use the next command to get path to spfile (in my case pfile was located at "D:\oracle\product\10.2.0\admin\A7\pfile\init.ora.1252010112825" ):
      sqlplus> show parameter spfile

      2)Edit pfile and set undo management to manual.
      undo_management = manual

      3)Put the entries of the undo segments in the pfile by using the following statement in the pfile:
      _CORRUPTED_ROLLBACK_SEGMENTS=(_SYSSMU1$,_SYSSMU2$,_SYSSMU3$,.....)
      ###########################################
      # System Managed Undo and Rollback Segments
      ###########################################
      undo_management=MANUAL
      undo_tablespace=UNDOTBS1
      _CORRUPTED_ROLLBACK_SEGMENTS=(_SYSSMU1$)
      

      4)Mount the database using new pfile:
      sqlplus> shutdown immediate;
      sqlplus> startup mount pfile='fullpath to pfile'
      

      5)Drop the undo segments,
      sqlplus> drop rollback segment "_SYSSMU1$";

      6) Drop Old undo tablespace.
      sqlplus> drop tablespace UNDOTBS1 including contents and datafiles;

      7) Add the new undo tablespace:
      sqlplus> create undo tablespace UNDOTBS1 datafile 'path to new undo table space' size 500M AUTOEXTEND ON MAXSIZE 32000M;
      sqlplus> alter system set undo_tablespace=UNDOTBS1;
      

      8) Remove temp undo table space:
      sqlplus> alter tablespace UNDO_RBS1 offline;
      sqlplus> drop tablespace UNDO_RBS1 including contents and datafiles;
      sqlplus> shutdown immediate;
      

      9) Change the pfile parameters back to Undo_management = AUTO and modify the parameter Undo_tablespace=new_undo_tablespace_name and remove the _corrupted_rollback_segments parameter:
      ###########################################
      # System Managed Undo and Rollback Segments
      ###########################################
      undo_management=AUTO
      undo_tablespace=UNDOTBS1
      #_CORRUPTED_ROLLBACK_SEGMENTS=(_SYSSMU1$)

      10) Startup the Database:
      sqlplus> startup

      NOTE: In step #3 I've tried to use _OFFLINE_ROLLBACK_SEGMENT = (_syssmu1$). But it didn't work.

      Monday, April 26, 2010

      How to change the default editor in Ubuntu?

      The default editor in Ubuntu is nano. But I like Vim.

      $ sudo update-alternatives --config editor
      

      And You will get the next:

      There are 6 choices for the alternative editor (providing /usr/bin/editor).
      
        Selection    Path                    Priority   Status
      ------------------------------------------------------------
      * 0            /bin/nano                40        auto mode
        1            /bin/ed                 -100       manual mode
        2            /bin/nano                40        manual mode
        3            /usr/bin/mcedit-debian   25        manual mode
        4            /usr/bin/vim.basic       30        manual mode
        5            /usr/bin/vim.nox         40        manual mode
        6            /usr/bin/vim.tiny        10        manual mode
      
      Press enter to keep the current choice[*], or type selection number: 4
      update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode. 
      
      Select 4, in this case and that's it.

      How to use SUDO without password in Ubuntu?

      I don't need to type password all the time when I use sudo in Ubuntu.
      $ sudo visudo
      
      Type the next thing at the end of the opened file:
      username ALL=(ALL) NOPASSWD: ALL
      
      Save and close this file.

      Thursday, April 22, 2010

      How to setup Ruby/Rails development environment, Part 2 - E-TextEditor

      There are tons of text editors which are good enough for Ruby/Rails/web development. And it's not so easier to choose the "best" editor.
      I'd like to talk about my top three editors which like the most:

      Notepad++
      It's the base text editor on my workstation. It has active community, plug-in repository developing fast enough. But, this editor doesn't have Rails syntax highlight, here I mean ERB files. So, for Rails editing I have to skip it (for now)
      Vim
      Cross-platform text editor. It has BIG, super active community with tons of plugins.

      E-TextEditor
      It's Textmate clone for Windows.

      There are two choices for using these text editors:
      1. Use Notepad++/E-TextEditor (or other editors) on host machine and connect to Ubuntu VM via tool such as ExpanDrive.
      2. Use Vim via SSH (Putty) terminal. You'll have got plain linux terminal with all restrictions, but in this case you shouldn't install such tool as ExpanDrive which cost some money.
      So, I will describe first solutions in this post and second - in the next post.

      E-TextEditor and ExpanDrive
      I assume that you install both e-texteditor and ExpanDrive.
      Now, we can create some Rails project:
      $ rails bar
      And check IP address our Ubuntu VM:
      $ ifconfig
      eth0      Link encap:Ethernet  HWaddr 00:0c:29:2b:58:78
                inet addr:192.168.72.132  Bcast:192.168.72.255  Mask:255.255.255.0
                inet6 addr: fe80::20c:29ff:fe2b:5878/64 Scope:Link
                UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                RX packets:185 errors:0 dropped:0 overruns:0 frame:0
                TX packets:191 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:1000
                RX bytes:20339 (20.3 KB)  TX bytes:33193 (33.1 KB)
                Interrupt:18 Base address:0x2000
      Now open ExpanDrive and setup connection to VM:

      As you can see my Ubuntu VM disk is mapped to host machine and I can use it for my Rails development.
      Now, we can use any Windows based text editor and made modification directly on Ubuntu VM disk:
      For Rails scaffolding we use SSH/Putty terminal.


      References:
      How to setup Ruby/Rails development environment, Part 1 - Ubuntu VM

      Friday, April 16, 2010

      How to setup Ruby/Rails development environment, Part 1 - Ubuntu VM

      The most popular Ruby/Rails development platform isn't Windows. There are a lot of plug-ins, tutorials and blogs about Ruby/Rails on *nix like system. But, I'm Windows user (yes I know, Linux - rules!), so how can I use all community knowledge and easily apply it?
      I've decided setup VMWare VM with Ubuntu Server v.9.10. And perform all Ruby/Rails development there via Putty (SSH).
      I assume that You have installed Ubuntu VM.

      This post is base on the next articles:

      Step 1: Install Ubuntu VM - done 
      Step 2: Install Putty on Windows 
      Step 3: Configure Putty - Ubuntu VM connection
      Check Ubuntu VM IP: ifconfig. Apply this VM IP in Putty setting. All next steps will be performed via Putty console 
      Step 4: Update Ubuntu installation
      sudo apt-get update
      sudo apt-get dist-upgrade
      

      Step 5: Install all necessary libs
      sudo apt-get install build-essential
      sudo apt-get install ruby ri rdoc mysql-server libmysql-ruby ruby1.8-dev irb1.8 libdbd-mysql-perl libdbi-perl libmysql-ruby1.8 libmysqlclient15off libnet-daemon-perl libplrpc-perl libreadline-ruby1.8 libruby1.8 mysql-client-5.1 mysql-common mysql-server-5.1 rdoc1.8 ri1.8 ruby1.8 irb libopenssl-ruby libopenssl-ruby1.8 libhtml-template-perl mysql-server-core-5.1 libmysqlclient16 libreadline5 psmisc
      Step 6: During installation MySQL will ask to setup credentials:
      user = "root"
      password = "root"
      Check Ruby version
      $ ruby -v
      ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
      Step 7: Install RubyGems
      wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.6.tgz
      tar xvzf rubygems-1.3.6.tgz
      cd rubygems-1.3.6
      sudo ruby setup.rb
      
      sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

      Step 8: Install Rails
      sudo gem install rails 
      Step 9: Install SQLlite
      sudo apt-get install sqlite3 libsqlite3-dev
      sudo gem install sqlite3-ruby    
      Step 10: Install MySQL client
      sudo apt-get install libmysqlclient-dev
      sudo gem install mysql
      Step 11: Test your Rails instalation
      $ rails myrailsapp

      Friday, March 05, 2010

      UI prototyping gets easier

      A wireframe or mockup screens always help us quickly define UI design direction. It helps team to concentrate on business and skip UI details for the next round.
      It's not easy to choose some "good" tool for UI prototyping. There are a lot of freeware and payware solutions.
      So, we've got dilemma.

      I've choose the next directions:
      • free tool for easier prototyping UI stuff
      • or tool which can be used in other areas, so, knowledge accumulated with UI prototyping can be re-used.
      Some time for googling and I've got: 
      Plus, Pencil Project, you should take a look, opensource tool for making diagrams and GUI prototyping. It's pretty simple and get the thing done tool, IMHO. 
      If you choose to use PowerPoint, you should collect some UI components library for easier UI composing, etc. I've found several good examples.