Friday, January 11, 2013

Difference between DispatchAction and MappingDispatchAction in struts.

DispatchAction action class provides a mechanism for modularizing a set of related functions into single action. This eliminates the need to create separate, independent actions for each function.
MappingDispatchAction is subclass of DispatchAction used towards the same purpose. They are almost same except the way they are designed and used. Both of them rely on use on "parameter" attribute of action in action-mappings.

The main difference is about the way "parameter" attribute is used. In case of DispatchAction, value of  "parameter" attribute is used as attribute in request scope and value of this request attribute is mapped to the function name in the action class.

Eg. if it uses parameter="operation" then, operation attribute will be searched in request scope and it's value (say add) is mapped to the function name.
On the other hand, with MappingDispatchAction value of "parameter" attribute directly mapped to the function name.

Eg. if it uses parameter="add" then add is directly mapped to function name.



Because of above difference  the URL structure is also different. For DispatchAction url contains parameter information for configured parameter(operation). so url could be like

/user.do?operation=add

And for MappingDispatchAction url is simple one which need not to have any parameters for the purpose of function name mapping. So it could be like  

/user.do

Another difference from design point of view is about configuring actions in action-mappings. In case of  DispatchAction single action tag is used.


1
2
3
4
5
6
7
8
<action path="/user" 
         name="userForm"
         type="com.nilesh.action.UserAction" 
         parameter="operation"
         scope="request"
         input="/Welcome.jsp">
    <forward name="Success" path="/user.jsp"></forward>
</action>


and it's generally mapped from a single form having different operations with different values for configured "operation" parameter.
and For MappingDispatchAction we need to use multiple actions in action-mappings so the multiple forms with different values for action attribute of the html:forms.


1
2
3
4
5
6
7
8
9
<action path="/addUser" parameter="add"  type="com.nilesh.action.MappingDispatchUserAction">
<forward name="Success" path="/mappingDispatchUser.jsp"></forward>
</action>
<action path="/deleteUser" parameter="delete" type="com.nilesh.action.MappingDispatchUserAction">
<forward name="Success" path="/mappingDispatchUser.jsp"></forward>
</action>
<action path="/updateUser" parameter="update" type="com.nilesh.action.MappingDispatchUserAction">
<forward name="Success" path="/mappingDispatchUser.jsp"></forward>
</action>

So the difference is just about what you need and how to use.

Thursday, January 3, 2013

Great online tools worth using.

   These days "browser" is the most used application by most of the users on all kind of computers. People wants to do everything online. They want storage online, writing online, reading online, coding online, searching online and so on. We can say people are getting online more because they are getting more online. There are many great tools available online for doing things we used to do offline.
   Following are some of the great online tools or say apps, those are worth using. You might be using few of them already. 


1.  Evernote

Evernote
Evernote is a suite of software and services designed for notetaking and archiving. A "note" can be a piece of formatted text, a full webpage or webpage excerpt, a photograph, a voice memo, or a handwritten "ink" note. Notes can also have file attachments. Notes can be sorted into folders, then tagged, annotated, edited, given comments, searched and exported as part of a notebook. Evernote supports a number of operating system platforms (includingMicrosoft Windows, Mac OS X, Chrome OS, Android, iOS, Windows Phone, and WebOS), and also offers online synchronization and backup services.





The best way to save and view articles, videos and more. When you find something on the web that you want to view later, put it in Pocket. It automatically syncs to your phone, tablet or computer so you can view it any time, even without an internet connection.

JsFiddle is a playground for web developers, a tool which may be used in many ways. One can use it as an online editor for snippets build from HTML, CSS and JavaScript. The code can then be shared with others, embedded on a blog, etc. Using this approach, JavaScript developers can very easily isolate bugs.





4.  PasteBin
Pastebin.com is a website where you can store text for a certain period of time. The website is mainly used by programmers to store pieces of sources code or configuration information, but anyone is more than welcome to paste any type of text. The idea behind the site is to make it more convenient for people to share large amounts of text online.

Pixlr is a cloud-based set of image tools and utilities, including a number of photo editor, as screen grabber browser extension, and a photo sharing service. Founded in Sweden in 2008 by Ola Sevandersson , it was intended for non-professionals. It can be used on PCs, and on smartphones or tablets using an app.
The suite of apps range from simple and playful to advanced photo editing.

Dropbox is a file hosting service operated by Dropbox, Inc. that offers cloud storage, file synchronization, and clientsoftware. Dropbox allows users to create a special folder on each of their computers, which Dropbox then synchronises so that it appears to be the same folder (with the same contents) regardless of the computer it is viewed on. Files placed in this folder are also accessible through a website and mobile phone applications.

Google Drive is a file storage and synchronization service by Google. Google Drive is now the home of Google Docs, a suite of productivity applications, that offer collaborative editing on documents, spreadsheets, presentations, and more. 




Please feel free to suggest any other good online tool.

Sunday, December 9, 2012

Snipping Tool: Windows 7 built in screen capture tool

What do you do when you want to capture a screen shot, part of it or some window on windows machine? Don’t you press “Print Screen” button on a key board then do paste into mspaint and do the required capture, highlight or marking? If you have a windows 7 and you still do it this way only, then let me tell you ‘You live in stone era’.  Don’t you know about Snipping Tool?
 
Snipping tool is a free and simple screen capturing tool which comes built in with windows 7. This is another good built tool in Windows 7.

For opening Snipping tool, 
Click windows button and start typing “snipping tool” > You will see “Snipping tool”  under Programs. > Right click on it and select ‘Pin to Start Menu‘ or ‘Pin toTask Bar’ so that you can find it immediately when you need it.


Snipping Tool

When you want to take a snap of something, open a corresponding window and open this tool. There are three simple menus :








New Options

New : Select what you want to capture

     Free Form Snip: Capture free area of any shape.
    Rectangular Snip: Capture rectangular area.
    Window Snip: Capture an open window.
    Full Screen Snip: Captures full screen.
 
Cancel :  Use this if you want to minimize Snipping tool. Particularly when you want to capture different window than currently opened one.
 
Options : Use this to edit some preferences. 

Snip Editing
Once you have captured the snap, this tool opens your snip and provides you options to Save it, Get a new one, Edit it with colorful pens, Highlight area and an Eraser to undo pen and highlight editing.


 One Extra tip, not related to Snipping tool :
“You can take a snap of some window by opening that window and  “Alt + Print Screen” then paste into mspaint !!”

Sunday, December 2, 2012

Free Personal Source and Version Control Solution: Use SVN over Dropbox.

   Want to use some source control and version control tool for your personal use? And don’t want to use public repositories github? And also want to save your all source over a safe, reliable and sharable cloud? Then simplest and free solution is to use SVN, a very good version control tool, and save your SVN repository over your Dropbox account which will save your source over a safer cloud.

   For doing this download and install SVN tortoise client and Dropbox application on your machine. I hope you have an account on Dropbox : a file hosting service operated by Dropbox, Inc. that offers cloud storage, file synchronization, and client software(description copied from Wikipedia). Dropbox takes care of storage, safety, backup and sync for you.

   Once you have installed Dropbox and configured your account, you will be able to see your Dropbox folder on C:\Users\[YourUsername]\Dropbox. By default it syncs all of your Dropbox folders but you can select the folders to be synced from 

Dropbox > Preferences > Advanced > Selective sync.

   Now you are ready to create SVN repository over Dropbox. You just need to follow following simple steps:

1. Go to Dropbox folder, Create a new Folder, it’s your repository so name it accordingly. Right click on this new folder and select
 
Tortoise SVN > Create Repository here
 
Then you will see a dialog saying Repository Created as shown here..
2. Click on ‘Create folder structure’ to create trunk/branches/tags structure inside this new repository.


3. Bang!! Your repository with folder structure is ready now. Click ‘Start Repobrowser’  for opening repo-browser. Remember don’t ever ever ever modify this folder(your repository folder) of your own.  As this folder is SVN repository, it’s structure and data inside it is meant for SVN only.

4. Now you need to add your source code to your own SVN repository.  For that do this :

Right click on your workspace folder > TortoiseSVN >  import > give URL of a folder under trunk (you can copy URL of trunk from repo-browser and add required folder name to it after ‘/’ ) into ‘URL of repository’ > Ok. 

5. You have added your workspace to repository but it’s not versioned yet on your machine. For that right click on workspace folder and SVN Checkout the new imported folder from repository.

6. Once you have mapped your workspace to your local SVN repository, you can use your workspace and commit files as you were committing to standard SVN repository. Those files will just be committed to local repository.

  But don’t be curious about where these files go inside repository folder on your local machine, leave it to the SVN. Also don’t do any modifications to this repository folder. SVN takes care of everything.

7. Now your source code is inside your Dropbox folder that you should mark for sync from your machine if you are using selective sync. If you do manual sync of your Dropbox then keep good practice to sync this repository folder to Dropbox whenever you do any commit or changes that you must do from repo-browser only. Also keep in mind that this folder on Dropbox should also never be modified manually.

     You also can share this Dropbox folder to your teammates through Dropbox share and your teammates can use this folder directly as SVN repository. 

Thursday, November 22, 2012

How to listen music on mono bluetooth headset on android phone.

    Mono bluetooth headsets have single stream connections, so you can't stream music on them.  But Nokia phones have option to play music via bluetooth which can play music directly on even mono bluetooth headsets.
A2DP bluetooth headsets are dual stream so music can be directly played on them.


     But if you have mono bluetooth headset and android phone you can't listen music on it but only can make and receive calls. You are stuck :( 
But don't worry, there are few apps on android market which enable you to listen music on mono bluetooth  headset.



BTMono Off

     BTmono is very simple and light weight application available on android market, which can stream your media over mono bluetooth headset.


     For using this app switch on your phones bluetooth, connect your bluetooth with paired bluetooth headset, open BTmono app and click on ON button then android robot on the screen will put it's one hand up and you are ready to go. Then just play music and it will be streamed to your mono bluetooth headset.
BTMono On








There are two versions of this app available on the market, free version and paid one. The only difference that matters is what happens when you get a call while listening to music. On free version when you drop a call received while listening to music, music resumes on speaker instead of bluetooth headset and that is little embarrassing eeew. While on paid version music resumes on headset when a call is dropped. so it's your call to choose free or paid version of BTmono.
The music quality on bluetooth headset using this app is not up to mark and that's because it's mono headset.  But remember this app is really helpful to utilise your otherwise useless mono bluetooth headset.