Archive for the ‘Technology’ Category

h1

Java Titbits – Filtering files

July 8, 2010

We would have encountered scenarios where we would want to filter certain files within a directory. The traditional method is to get all the files and run through that list and select those that you need. But java  does provide a fileNamefilter class or a fileFilter class that you can use while listing all the files within a directory. (And this has been in jdk since version 1.0 .. something that i didnt know.)

An example to filter all jpeg files in a directory C:\pictures

File myDir = new File(“C:/pictures”);

File[] contents = myDir.listFiles(new FileNameFilter() {

public boolean accept(File directory, String fileName) {

return (fileName.endswith(“jpeg”));

}

} );

You can also use FileFilter if the accept method needs to use any attributes of file object.

h1

Top Ten Firefox Add ons

January 12, 2008

Well you would have come across most of the content posted here. Moreover some of the addons that i have bumped upon are from the tech blogs i visited. I have compiled all of them and listed my favourites here. Most of the addons mentioned would be of help to developers who surf a lot . So without much ado here they are:

1. Stumbleupon – Gateway to surf the best of the internet. It also provides features to bookmark the visited sites and share it with friends and build communities based on your interests. A must for an avid surfer

2. SessionManager – Nice to have addon that helps you to save all the links and restore them when needed. Generally i open a lot of links in my browser and when i need to take a break, i save the entire session using session manager so the next time i restart my laptop i can get to where i left by restoring the entire session.Quite helpful.

3. Send Tab Urls – Another helpful addon i use when i browse at office. It so happens that i cant continue browsing web pages at office and intend to browse them at home at my convenience. But i would need to start it all over from scratch had it not been for this addon. This addon helps me in saving all the links into a mail and send it to a mail address. So when i reach home all i do is open all the links and recontinue my work from where i left at the office. Alternatively the same can be done by saving the session using session manager and sending the .session file created to your email. At your home you just need to save the file at %LOCAL_USER%\Application Data\Mozilla\Firefox\Profiles\1hju3cck.default\sessions

4. Roboform– The needed info is already available in the preceding post.

5. Firebug – A must addon for any web developer who deals with CSS and Java script. Noteworthy feature is that it allows you to edit javascript/CSS and execute it on the fly and see the results.

6. Imacros – Hmm, we have roboform which automates authentication to websites like gmail,yahoo,wordpress,etc. Infact these are the sites that i initially visit. What if there is a means to automate launching all these sites so that in one click all these sites open and i m logged with my account. Thats where Imacro is of use to me. Just as their website say you can automate anything that firefox does.

7. AutoCopy – A software developer survives on the basic skill needed in IT industry: Ctrl+C..Ctrl+V. This addon typically increases productivity of the developer by copying any selected text to the clipboard.

8. Fox Marks Sychroniser – A addon for managing your bookmarks across your computers. I browse a lot at office and any worthy link i add it to my bookmark. I use this tool to create a repository of them at a server and at home i come and syncronise my local bookmarks with that on my server. By doing this i dont stand to lose any of my bookmarks incase my PC crashes.

9. Downthemall – Useful when you are downloading and saving pages on your computer.

10. FireScribe – This is just a fill in. Just to bring the number to 10. Neverthless useful to bloggers who intend to publish their posts in various blogging sites like wordpres, blogger etc.

Hope you found these addons as useful as i did.

~ Maverik

h1

Some internet utilities part – II

January 4, 2008

As promised, here is my next quota of utilities that i found useful on internet. Top on my list is roboform . Well this is a browser addon that can manage passwords for all your sites. Whenever you enter your username and password for any website, roboform stores them so the next time you visit those sites you just need to select the website name in roboform toolbar and it will fill the username and passwords and automatically log you in. There are host of other useful features. You can check them out here . I like the auto fill feature wherein you can create an identity for yourself and then wherever you need to register just click on the identity and select fill forms and roboform fills common details like first name, last name, email id etc.

Other utility i found useful is crossloop. This software is really useful when you want to remote desktop to any machine over internet. Helps when your troubleshooting your brother’s or your family’s PC. You can right away download and use it. There is a nice article on this available here.When i tried to connect to my friend’s laptop over internet it was very slow. it takes a lot of time to render. Instead i would suggest him to put his laptop over internet so that i can remote desktop. That would be a little faster. Yet this tool is very handy when the other party is naive at using computers.

Hmm..well someday i ll also write some must have firefox add-ons that increase your productivity and ease certain manual tasks.

Till then,Its good bye from your host.

~ Maverik

h1

Some internet utilities part – I

January 1, 2008

This post is to share with you some tools and utilities that i have bumped upon while i keep surfing the internet. A few of them are freewares and a few of them are commercially sold. These tools have helped me increase my efficiency and provide accesability and i hope you find them as useful as i did.

So first to start with is Purplenova web server. This easy to install and configure software is useful when you want to host your files and access the same from internet (that means from anywhere). I have run this ftp software from my home laptop so that i can access certain files from my office. Apart from providing plain ftp access, this software provides a host of other features like hosting web sites, exposing web services, etc. Although these features come with the commercial version 😦 . A cool feature is that you can subscribe to RSS feeds so whenever i upload a file you can get a notification. Another one is you can categorise your files for public or private access. The file that is only privately shared has to be accessed by hitting the url. I have created my internet share at http://maverikpro.purplenova.net/ .

Next on my list is Terminals.A remote desktop client which you can use to store and configure different RDP connections. Earlier I used to save each RDP connection on desktop and double click them when i needed to connect. Managing all the saved connections was cumbersome and the desktop looked ugly . This utility manages all the connections without making your desktop look ugly. Since it shows each connections in a tabbed pane, switching between connection is easy. A must download for anyone who remote connects to different hosts for file upload, deploy, troubleshoot etc.

Well will end the Part one of this post here. Stay tuned to for more updates on this topic

And Wish you a very happy and a prosperous new year 2008

-Maverik

h1

Remote Debug a web application using eclipse

November 26, 2007

Eclipse has become the defacto IDE to develop enterprise applications in java. The architecture provides capabilities to support new features by adding plugins for the same. And there are host lot of plugins available for eclipse. For more info click here . Inspite of providing lot of features, developers are not aware of them and hence dont use them to simplify tasks. One of the important aspects of enteprise web applications is debugging. This post will tell you on how to debug web applications using eclipse. The Application server used for this example is JBOSS 4.0.2. I hope the steps specified here would be similar when used with other applications servers.

First specify a breakpoint at which you want the run time execution to stop. You can do this in eclipse by double clicking on the left pane of java editor. Next go to JBOSS_HOME\bin. Open the run.bat file in notepad and search for “8787” . You would hit at a line like this

JBOSS run.bat

Delete the REM statement at the start of the line. By doing this you are enabling JBOSS to run in remote debug mode. Build your war file using MAven/Ant and deploy it in JBOSS_HOME\server\default\deploy folder.Save the run.bat file and double click on it to run JBOSS.

Now come back to eclipse. Once you have configured breakpoints in eclipse. Click on Run->Open Debug Dialog. Right Click on Remote Java Application and choose new. A new application based on the class name that contains break point is displayed. Now in Connection properties (right pane) specify the port 8787. A typical configuration for remote debug in eclipse looks like this :

Remote Debug Configuration in eclipse

You are done with all the settings. You just have to click on debug to start remote debugging your web application. Open the debug perspective if eclipse prompts you so. You can add break points dynamically, know values of variables at run time by right clicking on that variable and selecting watch. Remote debugging is very useful for a newbie in a project to learn about the flow of web application. Hope you find this post useful for your day-today project work.

TitBit to deploy web applications using maven : Developers need to redeploy their war files to JBOSS\..\deploy folder whenever they make changes to the code. This manual operation is tedious as the developer has to do three operations : Build the war file, copy to JBOSS\..\deploy and start the JBOSS server. The last two operation can be done through maven 2.x plugin for JBOSS. For more info about the plugin visit Maven-JBOSS-Plugin