Posts

Showing posts from 2010

SQLServer

There are 3 functions which are used to query metadata from SQL Server databases. sp_tables sp_columns sp_stored_procedures There do take parameters to filter the data being queried based on certain criteria.

Browser

If a http call does not return anything until a certain time , you will see time out. So if request processing is going to take long time before you even generate a single bit of response, then you better return some dummy character or something in the meantime to stop browser from timing out. location.replace does take you to new URL but this new URL does not remain in history while location.href does go in history.

Java Encryption/Decryption

Java does not always throw exception while decoding a text using different key than the one used for encoding it. Though the decoded text will be garbage. So dont rely on throwing exception if the key is incorrect. Character.getType(character) returns a in value which stands for a category to which character belongs. esp. the value returned as 28 stands for OTHER_SYMBOLS and it is normally non-printable junk characters.

Multithreading

Multithreading Inter-thread communication  Each thread has its own stack, which also means its own copy of shared global variables ( static and non-static both ).  so updates from one thread may not necessarily be visible to another in time.  This will cause inconsistencies. This is especially important in multi-core systems where each thread might end up on a different core and each core may have it its own local cache which the thread is using. The updates by one thread may not be readily synced with main cache and hence not visible to other threads. The same issue may also arise due to compiler optimizations;  the sequence of instructions may get reordered by jvm and compiler.  This will still produce consistent results within single thread but other threads are not guaranteed to see this consistency. Java provides two ways to deal with  these issues.  synchronized access, volatile variables.   When you try to have synchronized access of a code block or method, only one

XML

These are fairly generic issues and utilities can be developed or may already exist to solve the following tasks: XML Schema => data model XML data + XML Schema to data model mapping => XML data import

JEE

HttpServlet implements Serializable. JAX-RPC : Java API for XML based RPC. In reality JAX-RPC uses a protocol like SOAP but the complexity is hidden from developer. All a developer needs to do is following. Server Side : 1. Define a interface by extending javax.rmi.Remote ( SEI ) which specifies remote methods. 2. Create implementation class. 3. Use wscompile to generate WSDL and mappings service 4. Package and deploy the web service.( Th3e tie classes , which are used to communicate with clients are generating at this time by app server). Client Side : 1. use wscompile to generate and compile stub files 2. Code client class as following: Create stub object. (Stub)(new MyHelloService_Impl().getHelloIFPort()) Set the enpoint address stub._setProperty (javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, args[0]); Cast stub to SEI object and make the procedure call. We can only use the jAX-PRC support types as param

Jar Search

One of my colleague sent this to me. $ find . -name '*.[jwes]ar' | while read LINE; do grep -q OMSourcedElementImpl "$LINE"; if [ $? -eq 0 ];then echo "$LINE"; jar tvf "$LINE" | grep OMSourcedElementImpl;echo;fi;done

Math.abs()

Math.abs(-9223372036854775808L) == -9223372036854775808L = Long.MIN_VALUE

JAXBContext

This class is the entry point for JAXB API. One must get instance of this class first and then from this instance, marshaller, unmarshaller or validator instances can be obtained.

WADL

Web Application Description Language : This link(http://research.sun.com/techrep/2006/abstract-153.html) describes this format. WADL is designed to provide a machine processable protocol description format for use with such HTTP-based Web applications, especially those using XML.

XHTML

XML mark up language that mirror HTML. XHTML is application of XML and it can be parsed using any XML parser, while HTML reqires lenient HTML specific parser. XHTML document needs to be well-formed. XHTML elements and attributes are case sensitive. To avoid mistakes it is recommended to include js and css in separate files and include those in XHTML doc.

i18n, L10n, g11n

Internationalization : The process of designing a software application so that it can be adapted to various languages and regions without engineering changes. Localization : The process of adapting a internationalized software to a particular region or language by adding locale-specific components and translating text. Globalization/NLS ( Native Language Support: The combined process of internationalization and localization

JavaScript

1. Problem with window.onload window.onload = function(){ alert("welcome"); } Javascript code is not run until all images are finished downloading (this includes banner ads). The reason for using window.onload in the first place is that the HTML 'document' isn't finished loading yet, when you first try to run your code.