Tuesday, November 30, 2010

Eclipse Ignore File From Output Folders

Typically to  quickly open a file in eclipse most of use the open resource dialog [CTRL+Shift+R] but sometime it also shows the files from other output folders, which is very irritating.

A quick search on google pointed out to this link

http://robmayhew.com/eclipse-ignore-folder/

Friday, June 11, 2010

Abstraction

What is abstraction?

I am not going to re-invent what this means. Just jotting down what it fundamentally means... and what we should keep in mind when we write code.


Dictionary.com definition Abstraction, one of the listed meaning from that link that I like is
"the act of considering something as a general quality or characteristic, apart from concrete realities, specific objects, or actual instances."
 
We have to consider always what can be a general characteristic of this piece of code that I write. It may not be always re-usable, that is where re-factoring helps to re-use and improve these code pieces. 
 
Applying abstraction to code..
a) How best should this be accessed?
b) How can we name it in a manner that conveys the functionality or the purpose properly?

Abstraction and Inheritance are related. In that inheritance passes abstraction to higher level classes. 
In the overall architecture abstraction can be applied at different levels of the architecture. 
 
Benefits of abstraction, quick search on the web shows "
a) Reduce Complexity.
b) Flexibility
c) Maintainable
d) Analysis is easier on properly abstracted system. 
 
The above things can be kept in mind as test cases. If it is too complex, it needs to be abstracted. If the section or system is not flexible, then it needs to be abstracted. The same can be applied for "Maintainability" and "Analysis" If the work is not meeting those goals then it is not properly abstracted.
 
When do you stop abstracting? 
a) When it crosses the point where it is no longer a single meaningful entity of it's own then it should not be abstracted. Otherwise we will have an object that means everything.
b) Time and business constraints are another big factor in writing / developing goode code/systems. We may not have the time=money to do some of these tasks.
 

 
 

Tuesday, May 25, 2010

Navigating the JAVA XML APIs Differences between JAXB, JAXR, JAX-RPX , JAXP and JAXM (yup JAXM!)

 What do the different JAVA XML APIs do? What is it's purpose that is what I am trying to understand, it is an incomplete post, but as and when I complete reading the remaining APIs, I will update the same post.



JAXP JAXB JAX-RPC JAXM JAXR
From      wikipedia for JAXP
It provides the capability of validating and parsing XML documents. The three basic parsing interfaces are:

* the Document Object Model parsing interface or DOM interface
* the Simple API for XML parsing interface or SAX interface
* the Streaming API for XML or StAX interface (added in JDK 6; separate jar available for J
From wikipedia Java Architecture for XML Bindingipedia  (JAXB) allows Java developers to map Java classes to XML representations. JAXB provides two main features: the ability to marshal Java objects into XML and the inverse, i.e. to unmarshal XML back into Java objects. In other words, JAXB allows storing and retrieving data in memory in any XML format, without the need to implement a specific set of XML loading and saving routines for the program's class structure. It is similar to xsd.exe and xmlserializers in .Net Framework rom wikipedia Java APIRPCJAX-RPC) for XML-based ( allows a Java application to invoke a Java-based Web Service with a known description while still being consistent with its WSDL description. It can be seen as Java RMIs over Web services. JAX-RPC 2.0 was renamed JAX-WS 2.0 (Java API for XML Web Services). Sun JAXM Link JAXM is a Java API for SOAP-based XML (document-oriented) messaging. Oracle Link for JAXR Currently there are lots of business registries like eb-XML & OASIS JAXR provides a unified way to access these registries.

Tuesday, January 5, 2010

Patterns and Pattern Languages - Architecture


Notes from the "Roy Fielding's Dissertation"

A design pattern is defined as an important and recurring system construct.

A pattern language is a system of patterns organized in a structure that guides the patterns’ application. Both concepts are based on the writings of Alexander et al. [3, 4] with regard to building architecture.

A pattern defines a process for solving a problem by following a path of design and implementation choices.

Alexander's design philosophy is to identify patterns of life that are common to the target culture and determine what architectural constraints are needed to differentiate a given space such that it enables the desired patterns to occur naturally. Such patterns exist at multiple levels of abstraction and at all scales.

An architectural style as a co-ordinated set of constraints is applied to design space in order to induce the architectural properties that are desired of the system. By applying a style an architect is differentiating the software design space in the hope that the result will better match the forces inherent in the application, thus leading to system behaviour that enhances the natural pattern rather than conflicting with it.

---------------------

Patterns and Pattern Languages as Heuristics for Architecture.

Heuristics are an important aspect of architecture, an important informative tool if implemented correctly. A pattern or a set of patterns can be used as a heuristic for software architecture.









REST Notes.

This blog entry are some personal notes from the original Roy Fielding's dissertation. 



REST Notes.

a) "Form Follows Function" comes from hundred of years of design.
b) The hyperbole of The Architects Sketch may seem ridiculous, but consider how often we see

    software projects begin with adoption of the latest fad in architectural design, and only later discover whether or

    not the system requirements call for such an architecture.
c) Dissertation focuses on the junction between software and networking.
d) A set of architectural constraints become an architectural style.
e) REST provides a set of architectural constraints that, when applied as a whole, emphasizes scalability

    of component interactions, generality of interfaces, independent deployment of components, and intermediary

    components to reduce interaction latency, enforce security, and encapsulate legacy systems. I describe the

    software engineering principles guiding REST and the interaction constraints chosen to retain those principles,

    contrasting them to the constraints of other architectural styles.

Points about Software Architecture.



a) Abstraction. ( A complex system will contain many levels of abstraction, each with it's own architecture,

    this is a recursive feature until it goes to the most basic level where it cannot be decomposed any further.).

b) A system has multiple operational phases. (Startup, initialization , normal processing, re-initialization and shutdown).

    And each operational phase has its own architecture.

c) Architectural design and source code structure design are two separate activities.
d) A component is defined by it's interface and the services it provide rather than the implementation behind it's interface.
e) Data
f) Configurations
g) Properties
h) Architecture encompasses both functional and non functional.
i) Choosing the right architectural style for a  network-based application requires an understanding of the problem domain  and thereby the communication needs of the application, an awareness of the variety of architectural styles and the particular concerns they address.












Monday, January 4, 2010

Architecture Study Notes - Heuristics

The following are notes from the book "The Art of Systems Architecting"
By Mark W.Maier and Eberhardt Rechtin
Heuristics
  1. Do not assume that the original statement of the problem is necessarily the best, or even the right one.
  2. In partitioning choose the elements so that they are independant as
    possible; that is, choose elements with low external complexity and
    high internal complexity.
  3. The eye is the finest architect. Believe it. Simplify. Simplify. Simplify.
  4. Build in and maintain options as long as possible in the design and implementation of complex systems. You will need them.
For a heuristic to be selected, the following must be true.
  1. The heuristic must make sense in the original problem domain, and shoud
    show a direct effect between cause and effect; it should reflect the
    success or failure of a system.
  2. The heuristic should be useful in solving more than the original problem.
  3. The heuristic should be easily rationalized in less than 5 minutes.


Architecture process:-

  1. Orientation (More Business , less technical).
  2. Orientation is purpose analysis , problem structuring , solution structuring, harmonizing and selection-abstraction.
  3. Purpose analysis is a broad based study of why the capability or system of interest has value?
  4. Value Model - an explicit model of the most important stakeholder's preferences.






Also discover new heuristics from technical journals, books, project reports, management treatises and conversations.

Generating heuristics:-
  1. Humor in heuristic.
  2. Use words that transmit the :thrill of insight" to the eye of the holder.
  3. For maximum effect try descriptive and prescriptive messages.
  4. Do not create a heuristic where it only has meaning to its creator.
  5. Rather than creating conditional heuristic, rather create one, where it analyzes the conditional statement.
Applying Heuristic:-

  1. If it works, then it is useful.
  2. Knowing when and how is as important as what and why.
  3. When applied early to the solution space it is best.
  4. Too much of a good thing make make it worse, strive for a balance.
  5. Practice. Practice. Practice.





Conclusion:

They provide the successive transitions from
qualitative, provisional needs to descriptive and prescriptive
guidelines, and thence to rational approaches and methods.





Thursday, September 10, 2009

JVM Bind Exception Port Already In Use (Windows)

a) To find the application that is using the port in windows use this command from the prompt: netstat -a -n -o

b) The next step is to kill that application or process that is using that port. Use the taskkill command from the prompt: taskkill /F  /PID 1056 where 1056 is the process id.


Friday, July 31, 2009

Friday, July 17, 2009

http://xfront.com

xfront.com sheds some really good insights on XML schema namespace managing and versioning, and strategies to adopt.

Thursday, July 16, 2009

Normative Architecture

A normative architecture is one based on codes and communications.

a) Where naming patterns of objects can be applied.
b) XML Schemas can be used within an organization so that different systems can be adaptive to change(s) within an organization.
c) A central normative repository in an project would also be very usefull in terms of applying security, and modularising products.
d) In my mind even certain apsects of the frameworks, if it is backed by a database design would allow it to scale and also be descriptive. One can argue that frameworks can also reflect/extend or other ways and capture this information, however there would be more control over what can be added and prevented when a framework si backed by db schema.

Just reading up on architecture ... and gathering some points.





Thursday, July 9, 2009

CodeNaut: Tabbed Command Window (Windows)

CodeNaut: Tabbed Command Window (Windows)

Tabbed Command Window (Windows)

For regular desktop development where you need to have multiple command windows open I found this http://sourceforge.net/projects/console/ utility very usefull.

a) Name your command windows and set default locations, and open them as a tab.
b) Set wallpapers for command windows.
c) Copy and paste text. 

I wish you could highlight specific words in the command window that will be a cool feature to have.


Tuesday, May 5, 2009

Publish DB Documentation using Schema Spy

You can create database documentation and relationship diagrams in a jiffy using
"Schema SPY". Schema Spy allows you to generate the metadata about the database and all sorts
of statistics that are helpfull at a glance. It supports multiple databases to generate the schema documentation of course if you are a java developer it should be more simpler, to get this configuration working.


You may optionally need a graphical library to draw the relationships called graphviz.

Other dependencies are to have the driver jar files in the class path and execute the schema spy jar from the command line.

Thursday, April 30, 2009

Multiple Faces-Config.xml in your JSF application.

Modular JSF code.

Facelets are a great templating tool for JSF and can also give performance benefits when you properly structure the way you load the pages.

If you want to modularize your web application by packing the backing beans in separate jar files, the JSF specification allows you to do that. All you have to do is pack the beans in a separate jar

file and in the META-INF folder you put your faces-config.xml file. According to the JSF specification all the jar files that contain a faces-config.xml are also automatically loaded.

You can also pack the jsp files that are specific to the module in the same jar. The trick you define a custom class that implements "com.sun.facelets.impl.ResourceResolver" interface and in your web.xml file add the facelet parameter to tell your web app to use the new custom resource resolver.


<code>
<context-param>
<param-name>facelets.RESOURCE_RESOLVER</param-name>
<param-value>my.very.small.company.CustomResourceResolver</param-value>
</context-param>
</code>


The resource resolver has one single method to implement and here is a snapshot of that code.


<code>
public URL resolveUrl(String path) {
try {
if(null != path && path.contains("/CUSTOM_INCLUDE/")){
path = path.substring(path.indexOf("/CUSTOM_INCLUDE/") + 20);
URL url = THISCLASS.class.getClassLoader().getResource(path);
return url;
}
// Default ResourceResolver
return Resource.getResourceUrl(FacesContext.getCurrentInstance(), path);
} catch (IOException e) {
throw new FacesException(e);
}
}
</code>


Though this mechanism works for the jsp pages and the java files as separate sub modules, if the code depends on CSS or java script then that does not get included properly. A new framework is available on java.net called "weblets" that looks much better than the above approach.

Debugging MySql queries using My-Sql proxy.

MySql introduced a cool new utility called MySql proxy which allows you to route the queries to the database via a proxy.

The proxy utility has a lot of features and one of the very basic features is to log the queries that are routed through it and log the time taken for the query execution. This helps when you want to tune the application.

Download the utility and unzip it to a location, configure the proxy port as mentioned in your datasource and configure the original database port in your proxy. It comes bundled with a few sample scripts supported by a programming language called "lua" (btw just heard about this ). Dont worry about the new programming language, the sample scripts are good enough to get you started.


Another surprise bonus was if you have hibernate /other applications in your web layer you can see how many queries that are run against the database.