Showing posts with label Misc. Show all posts
Showing posts with label Misc. Show all posts

Friday, September 13, 2013

Migrating from Ant to Maven

Sample steps to migrate a java webapp from using Ant to Maven as the build tool.

Install maven


Learn about maven
Look up some maven tutorials and documentation e.g.


Reorganise source files
  • Create a skeleton maven directory structure for your code using an appropriate maven archetype command e.g run commands similar to the following on the command line.

For a war
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=com.mycompany -DartifactId=mywebapp


For a jar
mvn archetype:create -DgroupId=com.mycompany -DartifactId=myjar


  • Copy java source files directories from the ant project to the appropriate maven structure location e.g. C:\maven-migration\mywar\src\main\java\
  • Copy non-java files that are in the classes directory to the appropriate maven structure location e.g. C:\maven-migration\mywar\src\main\resources
  • Copy other web resources (everything else that is not within the classes directory) to the appropriate maven structure location e.g. C:\maven-migration\mywar\src\main\webapp
  • Delete the WEB-INF\lib directory under the maven webapp directory, if that was the location of libraries.


Create dependencies for libraries
  • From the ant project’s WEB-INF\lib directory, go through the libraries one at a time, determining if the library is used directly by your code. If so, add a dependency for the library to your maven project’s pom file. Use a maven central search website to determine dependency details like artefact id etc. e.g. http://www.maven-repository.com/. Mark or identify these as resolved e.g. on a piece of paper listing all the libraries.
  • Next, go through the remaining libraries and figure out which libraries are a dependency of one of the libraries already added. You may need to review the poms of the added libraries. You can see the library poms from the maven central search website. An IDE can also help to identify indirect dependencies e.g. Eclipse has a Dependency Hierarchy feature that shows these. Mark the indirect dependencies you’ve identified as resolved.
  • From the remaining libraries, identify those which are not used by your code directly but are required at runtime or for testing. Add these dependencies to your maven project pom with a runtime or test scope as appropriate. Mark these dependencies and the indirect dependencies that they bring, as resolved.
  • You’ll likely be left with non-maven libraries that aren’t built using maven or which aren’t available on a public maven repository. You’ll need to download packages for these libraries and see if they contain an indication of the libraries that they depend on. You’ll then need to create a pom for these libraries and deploy them to some maven repository e.g. an in-project one, see https://devcenter.heroku.com/articles/local-maven-dependencies
  • Once you have all the libraries matched, refine the dependencies in your pom e.g. to define exclusions for indirect dependencies that you don’t use. You can also override versions of libraries included.
  • Define other aspects of the pom similar to what is found in your ant project’s build.xml file e.g. configuration of the maven-compiler-plugin to generate java 1.6 compatible classes







Thursday, October 25, 2012

Moving from svn to hg on Sourceforge

The following details steps one can take to change the version control system for their Sourceforge project from subversion to mercurial. The steps are mainly based on http://www.alteridem.net/2010/07/28/migrating-from-subversion-to-mercurial/  

Prerequisites
Tortoisesvn
TortoiseHg  

Versions used
Tortoisesvn 1.7.1
TortoiseHg 2.5.1

Steps
  • Create a directory to hold a local copy of your svn repository e.g. c:\svnrepo Create the local svn repository in the newly created directory e.g
svnadmin create c:\svnrepo
  • This process will create a number of directories and files in the c:\svnrepo directory
  • Create an empty file named pre-revprop-change.bat in the c:\svnrepo\hooks directory
  • Initialize the local svn repository for syncing with the remote repository e.g.
svnsync init file:///c:/svnrepo http://svn.code.sf.net/p/myproject/code
  • Sync the repositories
svnsync sync file:///c:/svnrepo
  • This will copy/download files from the remote repository to the local one so it may take some time and bandwidth depending on the size of the remote repository
  • Make some configurations to TortoiseHg. Open windows explorer, right click on any directory and select the TortoiseHg > Global Settings menu. Select Commit in the left hand pane and enter a username. The conventional format is firstname lastname <email>. Select the Extensions option on the left hand pane and tick the convert extension. Click on OK to save these settings 
  • Create a directory to hold a local copy of your hg repository e.g. c:\hgrepo 
  • Create the local hg repository in the newly created directory e.g
hg init c:\hgrepo
  • Convert the local svn repo to hg, putting the results in the local hg repository
hg convert c:/svnrepo c:/hgrepo
  • Push your local hg repository to the remote hg repository
cd c:\hgrepo
hg push ssh://myusername@hg.code.sf.net/p/myproject/mymountpoint
  • This will upload the project files to the remote repository and may take a considerable amount of time depending on the size of the repository and upload speeds.

Sunday, February 12, 2012

Tools

Free and Open Source Tools.

Function Tools
VB.NET IDE Visual Basic Express Edition

SharpDevelop
Reports for VB.NET applications SQL Server Express with Advanced Services (to design report) + Report Viewer redistributable/control (to display report in .NET application)
Report designer and runtime for VB6 applications Report Manager Designer and ActiveX (http://reportman.sourceforge.net/)
Project management ProjectLibre
Dictionary [offline] Wordweb
Office automation LibreOffice
Setup authoring NSIS with HM NIS Edit for a GUI

Advanced installer free edition

Excelsior Installer

WiX
.NET Obfuscator Eazfuscator.NET
SQLite GUI SQLiteStudio

Sqliteman

SQLite2009 Pro Enterprise Manager
CD Writing CDBurnerXP
Download manager/accelerator DownThemAll firefox add-on
Firewall Comodo Internet Security
Spyware remover Spybot search & destroy
Web server Apache HTTP server
Database PostgreSQL

SQL Server Express edition

MySQL

CUBRID (Web application needs)

HSQLDB (Embedded + Java needs)

SQLite (Embedded needs)
MySQL GUI HeidiSQL

Toad for MySQL Freeware

MySQL Workbench

Adminer

PhpMyAdmin
Disk space viewer WizTree

TreeSize Free
Image resizing Picture Resize Genius

Wiseval Photophant
Telnet client PuTTY
Music player Winamp free edition
Text editor Notepad++
Disk Encryption [On-The-Fly Encryption] FreeOTFE

FreeOTFE Explorer

TrueCrypt
Virtualization VirtualBox
CD Drive emulator VirtualCloneDrive
Startup programs manager Autoruns
Convert/Save documents or web pages as PDF PDF Creator
Asymmetric encryption GPG

Gpg4win
File comparison Winmerge
File compression 7-zip
FTP Client Filezilla
FTP Server Filezilla server
Screen capture Screenhunter free
Perl interpreter ActivePerl
MD5/SHA-1 hash verifier HashTab

DigestIT 2004
Email server hMailServer
Password storage KeePass Password Safe
Website copier WinHTTrack
Software licencing ActiveLock (http://www.activelocksoftware.com/)
Regex editor Rad regex designer (http://www.radsoftware.com.au/regexdesigner/)
Password generator PasswordGen (http://www.sdean12.org/PasswordGen.htm)

PC tools password utilities (http://www.pctools.com/guides/password/)

GRC ultra high security password generator (https://www.grc.com/passwords.htm)

Xyzzy
Email client Thunderbird

Windows live mail
XML Editor foxe - FirstObject Xml Editor (http://www.firstobject.com/dn_editor.htm)

Notepad++
Universal database GUI. Use to manage any DMBS. Squirrel SQL client
Enterprise reporting [report deployment, report distribution, web-based reporting, business intelligence] ART (http://art.sourceforge.net)

Pentaho BI suite Community Edition

Jaspersoft BI suite Community Edition
Bug tracking MantisBT
Convert music/video files to different formats VLC media player
Java decompiler JD-GUI
ETL Pentaho Data Integration [Kettle]
OLAP cube viewer and MDX generator Rex (http://sourceforge.net/projects/whex)

Web based IMAP client [webmail, webmail client] SquirrelMail

Roundcube

AtMail open

Horde IMP
LDAP server Apache Directory Server - ApacheDS
LDAP browser [ldap client] Apache Directory Studio
Difference in database schemas SQL Power Architect Community Edition (http://www.sqlpower.ca/page/products OR http://code.google.com/p/power-architect/)

MySQLDiff (http://www.mysqldiff.org/)
Data generator Spawner (http://sourceforge.net/projects/spawner/)

Dategenerator (http://www.generatedata.com)
Data warehousing database Infinidb Community Edition
Sms library Gsmcomm

SMSLib
.NET library to read or write excel files without having MS office installed NPOI (http://npoi.codeplex.com/)
Generate .NET program documentation from xml comments ImmDoc.Net (http://immdocnet.codeplex.com/)
Profiler for SQL Server Express editions AnjLab sql profiler (http://sites.google.com/site/sqlprofiler/)
Review resource usage by processes Process Explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx)
Manage ssl certificates available to java Portecle
Reminder to take breaks Workrave

FadeTop
Document Management System OpenKM
Merge text files TXTcollector (http://bluefive.pair.com/txtcollector.htm)
Software testing management TestLink
Determine who is using which port TCPView
Manage frequent ip address changes NetSetMan
Unlock files that can’t be deleted because they are locked by some process Unlocker

Friday, January 15, 2010

Convert multiple m4a files to mp3

Use VLC media player called from a batch file. Slight modification of a VLC wiki entry. It's GPLed?

Versions used
VLC media player - 0.9.2

rem @ECHO OFF
rem batch convert m4a files to mp3 (128kb/s encoding with 44100 sampling frequency)

FOR /R %%G IN (*.m4a) DO (CALL :SUB_VLC "%%G")
FOR /R %%G IN (*.m4a.mp*) DO (CALL :SUB_RENAME "%%G")
GOTO :eof

:SUB_VLC
SET _firstbit=%1
SET _qt="
CALL SET _newnm=%%_firstbit:%_qt%=%%
SET _commanm=%_newnm:,=_COMMA_%
REM echo %_commanm%
CALL "C:\Program Files\VideoLAN\VLC\vlc" -I dummy -vvv %1 --sout=#transcode{acodec="mp3",ab="128","channels=2",samplerate="44100"}:standard{access="file",mux="raw",dst="%_commanm%.mp3"} vlc://quit
GOTO :eof

:SUB_RENAME
SET _origfnm=%1
SET _endbit=%_origfnm:*.m4a=%
CALL SET _newfilenm=%%_origfnm:.m4a%_endbit%=.mp3%%
SET _newfilenm=%_newfilenm:_COMMA_=,%
COPY %1 %_newfilenm%
DEL %1
GOTO :eof

:eof