Friday, December 14, 2012

jumpstart with eclipse, maven and tomcat (web/app server)

Q: What is the quick way to setup Eclipse war (possibly ear) project built with maven? 

A: In short: Eclipse + wtp + m2e + m2e-wtp

Sometimes from idea to it's realization is not an easy way.

If you're in a need to quickly setup java war project and you like the tools I do: maven, eclipse and tomcat (or any other server of your choice) following might be useful to jumpstart realizing your ideas.

My requirements

I've searched for a solution that would enable me to:
- use eclipse for application development
- manage server lifecycle directly from eclipse and
- use maven as a build tool.

My choice

Following has been found and based on the short project I've tested it with, it worked very well:
- eclipse - no doubts here (it's my favorite IDE for java development)
- wtp - fits me best for the server management directly from eclipse
- m2e - maven eclipse integration (as I'm in love with maven)
- wtp-m2e - wtp m2e integration (this one I've been missing in the puzzle, but only until today)

As  the last one mentioned was new to me the following video convicted me that it's something I need:

 
(the video is reffered on the official site as well)

After the initial project setup (depicted on the video) right clicking on the project and choosing "Run/Debug As" -> "Run/Debug on Server" does the job of publish and run/debug.

And once you change your project contents automatic republish happens in the background as well.

Sounds like the initial infrastructure setup time for my next project can be the question of seconds rather that hours.

Friday, November 30, 2012

My fedora java 7 update

Today I've migrated to java 7 (Oracle version), as our development environment has been "java 7 enabled".

The transition was "rather" smooth, I just had to follow following description: http://fedorasolved.org/Members/zcat/using-sun-java-instead-of-openjdk

When I mentioned "rather", it was not due to description present on the mentioned site :). After I rebooted I could not login to my xfce (or gnome,...), login screen was shown again even after correct password input.

The problem was caused by my laziness. I didn't really read what I copy/pasted :)

After switching to text mode (Ctrl+Alt+F<X>) I've observed some EOF reported problem right after login. And my bash didn't behave :) I had to provide full path when invoking commands.

When thinking of what I've changed, file: /etc/profile.d/sunjava.sh started to be suspicious, after opening it via:
/usr/bin/sudo /usr/bin/vi /etc/profile.d/sunjava.sh
(yes, path didn't work for me somehow :)

my suspect changed to culprit when seeing the content:
export JAVA_HOME=/usr/java/default
export PATH=\$JAVA_HOME/bin:\$PATH
EOF
after fixing it to:
export JAVA_HOME=/usr/java/default
export PATH=$JAVA_HOME/bin:$PATH
and doing the reboot afterwards, via:
/usr/bin/sudo /usr/bin/reboot
all started to work as expected.

So it seems trivial things might become challenges in my hands :)
Now I see why I became a programmer rather than a doctor :)

Friday, November 23, 2012

Maven java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher

Have you ever faced exception like this?
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.codehaus.plexus.classworlds.launcher.Launcher.  Program will exit.
My use case was that I had installed maven3 and afterwards tried to use maven2. All the environment variables updates have been setup in:
~/.bashrc
However once trying to use maven2 exception appeared (Even in the new terminal session).
Solution was found based on advice present in: http://cyntech.wordpress.com/2011/03/09/maven-2-error/

Running command:
which mvn
revealed the problem, as I still had in my $PATH the maven3 binary. Even if I appended the maven2, it was there on the later position => maven3 was to be used, but with changed $M2_HOME (reffering to maven 2).

Fixing the $PATH did the job for me.

This might not be your case, therefor as a general sum up of possible root causes, I recommend checking: http://stackoverflow.com/questions/6198677/java-lang-noclassdeffounderror-org-codehaus-plexus-classworlds-launcher-launche

Friday, November 16, 2012

Glassfish 3.1.1 OSE with Hibernate Validator 4.3.0.Final

Goal: Use hibernate validator 4.3.0.Final with Glassfish 3.1.1 OSE.

Lately I came across an issue, that I wasn't able to use the latest stable hibernate validator (hiberante validator 4.3.0.Final) with Glassfish 3.1.1 OSE.

Problem is that older version is beeing used as a glassfish module (glassfish/modules/bean-validator.jar). If you check the contents of the package (in MANIFEST.MF) you'd see that version 4.1.0.Final is beeing used.

OK, so how to deal with that? I've found out that I'm not the only one having issue here.
http://stackoverflow.com/questions/10548931/how-to-upgrade-the-hibernate-validator-4-3-0-final-to-the-glassfish-3-1-2

Suggestion gave me some motivation, as it seems to be possible to achieve :)

As I'm using ear, the simple solution provided in answer was not feasable for me (as it was a war case). OK, let's see how far we can get. There are multiple references (finally I ended up with the following 2 links):
I read the later one, as it seemd like a good idea to learn creating modules deployable to glassfish, however even if I created maven osgi bundle it neither contained all the dependencies required nor the descriptor seemed to be OK. Sounds like a wrong way for me then.

Going back to the 1.st link, I found following svn repository and tried to build things: https://svn.java.net/svn/glassfish~svn/trunk/external/source-build
However only once it has been achieved (and the way there was quite long) I realized that this just rebuilds the hibernate validator with it's dependencies, and that is of course not needed, as these are already built and available in public maven repositories :).

OK, going via next steps in the article, I ended up with the following solution:
  1. checked out glassfish sources
    svn co https://svn.java.net/svn/hk2~svn/branches/hk2-gf-3.1.1/
    
  2. updated bean-validation related pom, see my diff:
    Index: pom.xml
    ===================================================================
    --- pom.xml (revision 4105)
    +++ pom.xml (working copy)
    @@ -54,9 +54,10 @@
              maven-bundle-plugin and hk2-maven-plugin together -->
         <packaging>jar</packaging>
         <properties>
    -      <hibernate-validator.version>4.2.0.Final</hibernate-validator.version>
    +      <hibernate-validator.version>4.3.0.Final</hibernate-validator.version>
           <javax.validation.version>1.0</javax.validation.version>
           <slf4j.version>1.6.1</slf4j.version>
    +      <jboss-logging.version>3.1.0.CR2</jboss-logging.version>
         </properties>
         <name>Validation API (JSR 303) version ${javax.validation.version}, Hibernate Validator version ${hibernate-validator.version} and its dependencies repackaged as OSGi bundle</name>
     
    @@ -89,7 +90,7 @@
                             <Embed-Dependency>
                                 <!-- Only specify root artifacts that need to be embedded, everything else
                                      will be pulled in automatically based on Private-Package settings. -->
    -                            *; artifactId=hibernate-validator|slf4j-api|slf4j-jdk14; inline=true
    +                            *; artifactId=hibernate-validator|jboss-logging|slf4j-api|slf4j-jdk14; inline=true
                             </Embed-Dependency>
                             <Export-Package>
                                  <!-- 
    @@ -105,7 +106,7 @@
     
                             <Private-Package>
                                  <!-- Have a private copy of external non-standard dependencies -->
    -                             org.slf4j.*; com.googlecode.jtype.*; org.joda.time.*; org.jsoup.*
    +                             org.jboss.logging.*; org.slf4j.*; com.googlecode.jtype.*; org.joda.time.*; org.jsoup.*
                             </Private-Package>
     
                             <Import-Package>
    @@ -117,6 +118,12 @@
                                    which is a JPA 2 class.
                                -->
                                org.slf4j; org.slf4j.spi; org.slf4j.helpers; version=${slf4j.version}; resolution:=optional,
    +                           org.jboss.logging; version=${jboss-logging.version}; resolution:=optional,
    +                           org.apache.log4j;resolution:=optional,
    +                           org.jboss.logmanager;resolution:=optional,
    +                           com.ibm.uvm.tools;resolution:=optional,
    +                           com.sun.jdmk.comm;resolution:=optional, 
    +                           javax.jmdns;resolution:=optional,
                                javax.persistence.*; version="2.0"; resolution:=optional,
                                *
                            </Import-Package>
    @@ -263,6 +270,13 @@
             </dependency>
     
     
    + <dependency>
    +  <groupId>org.jboss.logging</groupId>
    +  <artifactId>jboss-logging</artifactId>
    +  <version>${jboss-logging.version}</version>
    +            <optional>true</optional>
    + </dependency>
    +
             <!-- We bundle jdk binding inside this OSGi bundle -->
             <dependency>
                <groupId>org.slf4j</groupId>
    
  3. built:
    cd hk2-gf-3.1.1/external/bean-validator
    mvn clean install
    
  4. copied to glassfish modules and removed old one:
    rm ${GLASSFISH_HOME}/glassfish/modules/bean-validator.jar
    cp hk2-gf-3.1.1/external/bean-validator/target/bean-validator-1.1.15-SNAPSHOT.jar ${GLASSFISH_HOME}/glassfish/modules/
    
  5. done :)

Issues? well, we'll see later, during testing :) But very first try worked perfectly.

Comments? Feel free to share, as I'm not the osgi expert (yet :)), so some of my updates might ... let's say won't make too much sense.

Monday, October 22, 2012

Solving Eclipse 4.2 unresponsive UI problems

Q: How to fix Eclipse 4.2 unresponsive UI problems?
A: Reserving more memory for it.

Now the long answer comes:
While using Eclipse 4.2 on Fedora 17 I got into problems, that opening Find dialog within the file took around 5-10 seconds.
That is crazy and not the way the things can work to be productive.

However following forum entry gave some hope to me:
http://www.eclipse.org/forums/index.php/mv/msg/367243/896690/#msg_896690
And after applying the suggestion ecilpse came "back to life" :)

So these are the args that worked for me:
-vmargs
-Xms512m
-Xmx1024m

Sunday, September 16, 2012

Generating graphical representation of XSD (XML schema).

Question: Have you ever seen the graphical representaiton of XSD in a way XMLSpy is capable of generating?


Did you ever need to generate similar output via free/open source tools?

Answer: XSD Diagram (http://regis.cosnier.free.fr/?page=XSDDiagram).

When searching for the alternative couple years ago, that was my choice and I didn't regret since then,

Usage is very simple, let's see how works. I'll go step by step in a usage. For a real world example I use as a sample for the xsd the following one (standard web application descriptor schema): http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd

  1. Start XSDDiagram.exe and choose File -> Open (open the downloaded xsd file)
  2. Error is thrown: "Could not find file 'dir/web-common_3_0.xsd'."
  3. OK, so we need reffered xsds as well. Let's get the rest then (web-common_3_0.xsd, javaee_6.xsd, jsp_2_2.xsd and javaee_web_services_client_1_3.xsd).
  4. Copy them to the same dir and reopen the original xsd again.
  5. Click the button in toolbar "Add all toplevel elements"

    or just choose the element you are interested in and click "Add selected toplevel element"
  6. Click multiple times (till all the levels are expanded) the button in toolbar "Expand one level"

    or just click the + sign for those elements you're interested in.
  7. Choose File -> Export Diagram -> (choose the file type feasable for your use case, I chose svg) and save.
  8. You're done!
Output could look like this (please note that schema graphical representation in this case is huge):

Monday, July 30, 2012

fixing incorrect dates in JPEGs on (x)ubuntu

Have you ever faced the problem of incorrectly set date in your camera?
I have, and realized it only after copying data to my laptop.

In my case year was set to previous one. For the solution description, please keep this in mind as I fix the date shift only, however the tools used could fix any other incorrect date setup as well.

Fixing it for the future pics is easy, just update your settings in camera, however how to fix it for the already created pics?
There are 2 places where date update is required:
- fix file properties as well as
- fix EXIF data.

Fixing file date
In linux it's easy. My case was I set up last year instead of this one => after having all the jpegs in one dir, I just ran:
touch -d '+0 year' *
(solution ideas were inspired by: http://superuser.com/questions/122863/linux-shell-change-a-files-modify-timestamp-relatively)

How to fix EXIF data?
Exiftool (http://www.sno.phy.queensu.ca/~phil/exiftool/) seems to do the job easily. Date shift feature using exiftool is described in more detail on: http://www.sno.phy.queensu.ca/~phil/exiftool/Shift.html

I Instaled it first:
sudo apt-get install libimage-exiftool-perl
Moreover there are multiple dates in EXIF, to list them I ran this on the particular file (using exiftool):
exiftool -k IMGP0184.JPG | grep Date
File Modification Date/Time     : 2012:07:30 22:27:57+02:00
Modify Date                     : 2011:07:22 12:48:12
Date/Time Original              : 2011:07:22 12:48:12
Create Date                     : 2011:07:22 12:48:12
Date                            : 2011:07:22
Manufacture Date                : 2011:10:07
-- press RETURN --
To fix EXIF dates on all the relevant files I ran:
exiftool "-AllDates+=1:0:0 0:0:0" *.JPG
That should be it. Let's check the result rerunning the EXIF data listing command:
exiftool -k IMGP0184.JPG | grep Date
File Modification Date/Time     : 2012:07:30 22:28:16+02:00
Modify Date                     : 2012:07:22 12:48:12
Date/Time Original              : 2012:07:22 12:48:12
Create Date                     : 2012:07:22 12:48:12
Date                            : 2011:07:22
Manufacture Date                : 2011:10:07
-- press RETURN --
OK, that worked for me :) Hope it helps you as well.

One more thing, to cleanup backup files created by exiftool I ran following:
rm *.JPG_original

Monday, July 2, 2012

Panorama photo creation in an easy (lazy) way

Q: Have you ever faced the challenge of creating panorama from the set of photos? Did you try to create it manually using your favorite graphics editor? Did you face problem of spending too much time on that?

A: There might be a solution for you. It's called Hugin.

As the homepage (http://hugin.sourceforge.net/) says: "With Hugin you can assemble a mosaic of photographs into a complete immersive panorama, stitch any series of overlapping pictures and much more."

As I'm used to run my favorite programs on Linux as well as Windows, I like the fact that it's capable of running on both, moreover it's open source (which I'm really excited for).

OK, so how it works for me? Maybe some motivating/demotivating pics in the beginning. 
Shots show the views of Ramadevara Betta (Hill) in India I took




Still interested? Let's go then...

Adventure part
Take photos of your interest in a sequence.
My rules follow:
- take at least 2 rows one above each other (make the left-to-right / right-to-left sequence)
- if required, reorder pics after downloading them from camera
- make sure the pics overlap (to be able to identify conneciton points there), rule might be to overlap like 1/4 or up to 1/3 or so

Boring part
1. make sure you have Hugin installed and start it
2. click "1. Load Images..." button
3.  click "2. Align..." button,
4. then be veeery patient, depending on the pics quality and count it might take quite some time
5. after done, "Fast panorama preview is shown" where you can do some final addaptions on the panorama (I usually don't need to do here anything at all)
6. when done close it and click "3. Create panorama..." button
7. when done, you should have your panorama present in tif file
8. that's it

Problem solving
If you're unlucky you might experience the problem that process fails during point 4. No controll points are found and you get error in the aligning console saying: "An error happened while loading image : caught exception: bad allocation"
It seems I was not the only one facing the issue and finally solution has been found:
https://bugs.launchpad.net/hugin/+bug/717944
https://groups.google.com/forum/#!msg/hugin-ptx/HPt0lIFFRr0/3fwBzt-EUJMJ

Problem, based on the discussions, seems to be that cpfind process, one that tries to find the controll points crashes due to problems with memory management.
OK, for me however the fix was, to slow the process a bit down (as by default it seems to be running on 8 parallel threads) and use less threads (also less memory) for analysis.
I anyway preffer the idea of someone else doing the boring job (connecting the pics in this case) rather than me, regardless how long it will take him :)

All right, but how to decrease thread count?
1. go to menu "File" -> "Preferences"
2. go to "Control points detector" tab
3. choose "Hugin CPFind (Default)" and click "Edit..." button
4. update "Arguments" from "--multirow -o %o %s" to "--ncores=1 --multirow -o %o %s"
5. click "OK" buttons
6. I also restarted Hugin (not sure if required)

I tried with switch "--ncores=4" first, but that didn't work for me so I changed to "--ncores=1" and it finally solved/workarounded the problem

What's next?
If interested, give it a try and see.
Feel free to link your panororamas/experiences on creating these in comments :)

Monday, June 25, 2012

let me introduce you project Lombok

Problem: Have you ever been in a situation, when you tough that creating all those boring equals(), hashCode(), toString() methods is quite time consuming and maintaining these is error prone?
SolutionIf so, read on :) Project Lombok might be the answer.

Yesterday, while searching for some solution on this (with having in mind the tutorial of spring roo I've read quite some time ago where these could be handled by AOP using annotations) I've found as a possible solution project Lombok:
http://projectlombok.org

Lombok demo and features list
I really like their demo video, if you want an introduction to this project, make sure you watch it:
http://projectlombok.org/
And there is also quite nice feature list available: 
http://projectlombok.org/features/index.html

Encouragement
OK, so what's next? Am I brave enough to go for it? While doubing it I've found out I'm not the only one:
http://stackoverflow.com/questions/3852091/is-it-safe-to-use-project-lombok

That gave me some encouragement. So let's go and try it.

I have some small open source project, so let me show you my code prio and after the change to give you an overview (or rather motivation :)).

Code snippets comparison
See:
  • eclipse generated methods:
    // eclipse generated methods way
    public class Schedule implements Serializable {
    
    ...
    
     @Override
     public int hashCode() {
      final int prime = 31;
      int result = 1;
      result = prime * result + ((bgImage == null) ? 0 : bgImage.hashCode());
      result = prime * result + (blank ? 1231 : 1237);
      result = prime * result + (clear ? 1231 : 1237);
      result = prime * result + (live ? 1231 : 1237);
      result = prime * result + ((name == null) ? 0 : name.hashCode());
      result = prime * result
        + ((presentations == null) ? 0 : presentations.hashCode());
      return result;
     }
    
     @Override
     public boolean equals(Object obj) {
      if (this == obj)
       return true;
      if (obj == null)
       return false;
      if (getClass() != obj.getClass())
       return false;
      Schedule other = (Schedule) obj;
      if (bgImage == null) {
       if (other.bgImage != null)
        return false;
      } else if (!bgImage.equals(other.bgImage))
       return false;
      if (blank != other.blank)
       return false;
      if (clear != other.clear)
       return false;
      if (live != other.live)
       return false;
      if (name == null) {
       if (other.name != null)
        return false;
      } else if (!name.equals(other.name))
       return false;
      if (presentations == null) {
       if (other.presentations != null)
        return false;
      } else if (!presentations.equals(other.presentations))
       return false;
      return true;
     }
    
     @Override
     public String toString() {
      return "Schedule [presentations=" + presentations + ", bgImage="
        + bgImage + ", name=" + name + ", blank=" + blank + ", clear="
        + clear + ", live=" + live + "]";
     }
    
    }
    
  • Lombok way:
    // lombok way
    @ToString
    @EqualsAndHashCode
    public class Schedule implements Serializable {
    
    ...
    
    }
    
  • manually written ones with Equals/ToString/HashCode Builders:
    // manual way using Equals/ToString/HashCode Builders
    public class Schedule implements Serializable {
    
    ...
    
     @Override
     public int hashCode() {
      return new HashCodeBuilder()
      .append(this.getPresentations())
      .append(this.getBgImage())
      .append(this.getName())
      .append(this.isBlank())
      .append(this.isClear())
      .append(this.isLive())
      .toHashCode();
     }
    
     @Override
     public boolean equals(Object obj) {
      if ( !(obj instanceof Schedule) ) return false;
      Schedule castOther = (Schedule) obj;
      return new EqualsBuilder()
       .append(this.getPresentations(), castOther.getPresentations())
       .append(this.getBgImage(), castOther.getBgImage())
       .append(this.getName(), castOther.getName())
       .append(this.isBlank(), castOther.isBlank())
       .append(this.isClear(), castOther.isClear())
       .append(this.isLive(), castOther.isLive())
       .isEquals();
     }
    
     @Override
     public String toString() {
      return new ToStringBuilder(this)
      .append("\n presentations", this.getPresentations())
      .append("\n bgImage", this.getBgImage())
      .append("\n name", this.getName())
      .append("\n blank", this.isBlank())
      .append("\n clear", this.isClear())
      .append("\n live", this.isLive())
      .append("\n")
      .toString();
     }
    
    }
    
So as obvious from the samples, instead of writing/maintaining the code you can rather just annotate. (Btw. if there were no lombok way, I'd go for Builders way => manual writing + maintaining).

Integration
The great thing is that there is a simple integration with maven (that is the build tool of my choice). See instructions:
http://projectlombok.org/mavenrepo/index.html
Moreover integration with Eclipse seems really straitforward too (all the autocompletition as well as Outline view work as expected or rather unexpectedly well).

Some more motivation
To encourage lazy developers (like me) even more, there are things available for:
- getters and setters (@Getter, @Setter)
- logging (depending on your logging library: @CommonsLog, @Log, @Log4j, @Slf4j)
- there is even more, but for the rest I might not be brave enough ( yet :))

Behind the scenes
OK, sounds nice, but how it works internally?
In fact lombok generates expected methods/fields to the target class. So the nice thing is that you don't need it during runtime/deployment. Once compiled, classes will contain the stuff.

How do you guys feel about it? Would you give it a try? Or do you have some other approach on this? Feel free to share your ideas/feelings.

code syntax highlighting in blog posts


Problem: Need to syntax highlight the code in the blog posts (to improve it's readability).
Solution: github's gist (http://gist.github.com/)

OK now what's the story? I tried to find some simple solution for me to be used in the blogger.com in the dynamic templates.
I've found: gist. 
As one of the quite popular proposals on stackoverflow said :
http://stackoverflow.com/questions/679189/formatting-code-snippets-for-blogging-on-blogger

What is gist?
(Copy pasted from their site) "Gist is a simple way to share snippets and pastes with others. All gists are git repositories, so they are automatically versioned, forkable and usable as a git repository."

Sounds good. But when trying it didn't work for the blogger and dynamic templates.
After some googling found following post:
http://blog.moski.me/2012/01/gist-with-bloggers-dynamic-views.html
and that worked for me!

So since from now on, you can expect some nicely highlighted code snippets in my posts :)

Repost new blog notification to social networks

Problem: How to automatically send status notifications on the new blog posts on blogger to google+, facebook and twitter?
Solution: Two step approach worked for me:
1. use official blogger to google+ integration (to post to google+)
2. use "+Rob Mcgee" (to repost from Google+ to facebook and twitter)

How to achieve it? Go on reading.

Official integration blogger to google+.
Follow the instructions here:
http://support.google.com/blogger/bin/answer.py?hl=en&answer=1752748
Or more specifically, to merge the profiles do so here:
http://www.blogger.com/switch-profile.g

Google+ to Facebook and Twitter reposting
Use the site with the official instructions: http://gplus.sagg.im/
I've found this approach on:
http://lifehacker.com/5868019/how-can-i-post-to-facebook-twitter-andor-google%252B-all-at-the-same-time

In fact I need to test it somewhere, so if you see this post in all these 3, it should be working fine.
Let's see :)

Saturday, May 5, 2012

me-tv 1.4.x built from source on xubuntu 11.10

Q: How to run the latest me-tv 1.4.0.9 on xubuntu 11.10 (64bit)?
For solution, go on reading :)

Motivation for me-tv
I'm the user of me-tv as for me it's the most comfortable solution of watching dvb-t on linux. It has simple ui showing me all the needed in one screen:
- video in the upper part as well as
- per channel schedule shown bellow.
For me it means no time wasted in menu clicking / new dialogs / ...

Motivation for latest version
vlc backend support (as opposed to xine only backend support in 1.3.x versions)

Status research
As in repos there is still 1.3.x version available and I'd like to use the latest one, let's do some research.

Q: What is the latest version?
Short A:  Currently it's 1.4.x
Long A: Based on this link: https://answers.launchpad.net/me-tv/+question/182263 there is new maintainer (original is gone) - Frédéric Côté (frederic-cote) and he restarts development of me-tv in 1.4.x branch that seems to be merge of stable 1.3 (xine based) and 2.0.x (xine/vlc/gstreamer based). The good news here is the usage of vlc as backend. Finally! :)

UPDATE:
hey, after writing this post, I've found that there exists me-tv development PPA: https://launchpad.net/~me-tv-development/+archive/ppa
And for the that's my choice. For those still interested in compiling from source, go on reading.

OK, let's do the job.
Installation steps of me-tv 1.4.x (working for me):
1. download latest stable tgz archive, for me it was https://launchpad.net/me-tv/1.4/1.4.0/+download/me-tv-1.4.0.9.tar.gz (however link is on the main page, check for the latest one: https://launchpad.net/me-tv)
2. unpack it and get in dir
3. install dependencies (I installed all the dependencies listed on: https://answers.launchpad.net/me-tv/+faq/352)

sudo apt-get install build-essential gettext debhelper autotools-dev libxml-parser-perl pkg-config devscripts libtool intltool libgnomemm-2.6-dev libgnomeuimm-2.6-dev libgtkmm-2.4-dev libgnet-dev libsqlite3-dev libvlc-dev libxine-dev libdbus-glib-1-dev libunique-dev

moreover I had to install these:
sudo apt-get install libxml++2.6-2 libxml++2.6-dev gnome-common libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev

4. prepare / start compile/install
./autogen.sh
./configure --prefix=~/Desktop/apps/me-tv_1.4
make
make install

5. now it's time to cross fingers, try to start it:
cd ~/Desktop/apps/me-tv_1.4/bin/
./me-tv-server

got error:
2012-05-05 08:19:06: Me TV Server 1.4.0.9 started
2012-05-05 08:19:06: An unhandled exception was generated
2012-05-05 08:19:06: Error: The Me TV database version does not match the Me TV server version.

OK, seems we need to cleanup configuration (as I've used on the same PC also older version):
mv ~/.me-tv/ ~/.me-tv_backup
it didn't help => as suggested here (https://bugs.launchpad.net/me-tv/+bug/886367) I did also:
mv ~/.local/share/me-tv ~/.local/share/me-tv_backup

one more try:
./me-tv-server
no error
./me-tv-client
we're done! :)

OK, now let's make sure no confusion with the older version happens:
sudo apt-get remove me-tv

There are still things to be fixed, like server auto start as well as integration with UI, however these I'd await from upstream.
For me it's worth using 1.4.x version and that my cpu doesn't need to be burning on 100% with xine any more. Cool!

Tuesday, May 1, 2012

music sync for android on linux

Q: What are the options for managing music on android based device on linux?
A: Banshee, Clementine, ...

First make sure device is connected via usb cable :)

For Banshee:
- start banshee
- import music via: right click (and hold) Libraries -> Music and choose Import Media -> Folders -> Choose Folders (please note that it won't scan the music if it's too deep in subdirs, for me it worked only up to level artist/album/songs)
- wait for scan to complete
- as you connected the device, you should see it in Devices -> [Device name] -> Music
- drag and drop anything from Libraries -> Music to Devices -> [Device name] -> Music
- moreover you can manage (remove,...) your library on the device by activating Devices -> [Device name] -> Music and doing the needed

For Clementine:
- start clementine
- import music via menu: Tools -> Preferences -> Music Library
- choose Add new folder
- wait for scan to complete
- as you connected the device, you should see it in Devices -> [Device name]
- in Library right click on album and choose Copy to device
- choose Destination (your [Device name]) and click OK
- moreover you can manage (remove,...) your library on the device by activating Devices -> [Device name] and doing the needed


Then sync happens, whenever device is disconnected you're done

phone contacts migration - Sony Ericsson W580i to Samsung Galaxy Y

Q: What is the simplest way to get all the contacts from Sony Ericsson W580i to Samsung Galaxy Y?
A: Send them via bluetooth.

I've seen various ways to achieve this on web, however the most of them are via some PC tools. This seems to be at least for me unnecessary. I've found the answer in the comments of one that kind of PC tool based approach.

When trying to migrate all of my contacts I just needed to copy them via bluetooth:
- in w580i went to contacts
- chose More -> Options -> Advanced -> Send all contacts -> Via Bloetooth
- found the target device, sent and voila! done :)

xml anonymization

You might already have been in the situation, where you needed to ask very specific question at some public forum/mailing list that is however coupled with particular XML content.
And possibly the content should not be seen by public.
I needed to, so I checked the options.

How can I anonymize xml?
Google pointed me to - xmlanonymizer (http://code.google.com/p/xmlanonymizer/)
After some stuggling I even found the way to use it.

To get the very latest version, you need to import svn hosted source and build yourself:
- import svn project to eclipse (http://xmlanonymizer.googlecode.com/svn/trunk/), I imported it as Java project afterwards
- Configure -> Convert to Maven project (you need m2e plugin in eclipse installed to do this)
- build as maven project (for example via cli: mvn clean install)
- anonymize your content:
java -jar target/XMLAnonymizer-0.0.2-SNAPSHOT.jar in.xml -outfile=out.xml -overwrite=true
 where in.xml is the xml you need to anonymize and out.xml is the output file

OK, so now you (should) have it running.
 As per default only xml text and argument values are anonymized

But what if you need to go a step further?
I summed up my needs in the bug report there (http://code.google.com/p/xmlanonymizer/issues/detail?id=1):
- I'd need to have also element names anonymized
- I'd like to do anonymization via random digit/char rather than next digit/char in the sequence (as for the xml with maaaaany elements I came to situation, that there were no more element names left => endless loop)
- I'd like to keep anonymized character case sensitivity (lower/upper case)

and finally attached the patch, as the implementation was quite easy



Monday, March 5, 2012

The mixed feelings of the Joe the bug reporter

To report or not to report, that's the question. Bad start? Well, right it is :)

Today I decided to spread some feelings on bug reporting.
Don't expect some rules list or checklist for the perfect process. I think there are many other places that perfectly cover that.
This post doesn't even deal with those having bug reporting as a job. But rather those of us, who care about how comfortable they can live in the world of software (preferably free one).

No it's not to be one of those purely technical posts, but rather philosophical one. I think the title expresses it.

Bug reporting motivation
So what are the ideas I have on my mind when reporting a bug?

Sometimes I feel like a hero. Cause I'm the guy who found it, and moreover I'm the one who reported it.That matters, right?
This can be tricky as I might be so blinded by my motivation, that I don't even try to find if the bug is already reported and if so the heroic feeling disappears fast.

The most of the time, I can't wait to see the bug fixed, or at least some activity from the development community happening on it.
As for some reason I feel like: "Hey, this is the one that's the most important!" at least for me :).

OK, but is there something wrong with my expectations having too high? Probably not. The only person to get in bad mood is only me, anyway. If it didn't work the way expected.

What is the point then?
I think bug reporting, is just another way of communication. Moreover it's quite often a communication with the strange people you've never met and probably never talked to. Would you (or rather I) expect these guys to be completely focused on my statements considering them to be the top importance, if there are hundred others talking to them in parallel?

Moreover some of my requests might sound stupid or out of their focus.
None of the bugs I've ever reported included sponsoring or any other volunteer contribution :)
Why do I then expect 24/7 availability of project contributors for my ideas? Well not sure, but still I do :)
Probably the motivating part for the solvers can be if they simply care, or I'm not the only one facing an issue.

So based on all my previous experiences in bug reporting, I should try to keep my emotions as low as possible and deal on technical level.

Hey, but there aren't only the bad days.
From time to time, when you just report and forget, but keep notified, nice things happen.

I've experienced activity or even solution on some of my old timers (that can be even nostalgic) :)

Or things like this happen:
https://issues.apache.org/bugzilla/show_bug.cgi?id=52598
- the project maintainer expresses the situation on project clearly (in the Comment 1) => all my mis-expectations are gone :)
- but suddenly it's getting solved => hey! that was cool, I didn't expect, honestly.


In this place I'd like to express the big thanks to all those who care about bugs in their software and communicate the progress/or reality of the project to community.
And from the perspective of reporters, big thanks to those patient with the progress and cooperative or even proactive in solution.

So that's it for today.
Did anyone come this far in reading? No, I can't believe :)

Feel free to share your experiences in comments (or feel free not to :).

Saturday, February 11, 2012

maven web app development

I came to point where I needed to build simple java based web application that would have as short as possible deployment time.

OK this is the way I had to follow, hope it can help to make your path simple :)

1. The first decision I made was to go for embedded web server => Jetty can do the job.

2. Maven and jetty are friends => can be run using: jetty:run
config details can be found on:
http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin

Where the benefit is that you won't even need to build war (save quite some time during deployment), to have your web app up and running.

3. But I needed to debug when launching from eclipse (using m2e plugin).
Tried a solution with m2e having: MAVEN_OPTS set + remote app debug, as suggested:
http://docs.codehaus.org/display/JETTY/Debugging+with+the+Maven+Jetty+Plugin+inside+Eclipse

this however didn't work for m2e, seems I'm not the only person with this problem, see: http://comments.gmane.org/gmane.comp.ide.eclipse.plugins.m2eclipse.user/7565


4. So I tried: m2e-webby integration:
https://docs.sonatype.org/display/M2ECLIPSE/Integration+with+Maven+WAR+Plugin
and it works great!
It even reads my pom.xml jetty relevant config.

Feel free to spread your experiences in comments section with java web apps development and what is your perfect setup.