Thursday, May 27, 2010

Test pad : Regex

Make sure you select the chk box which says ("Regular Experssion") before you start processing your file


. . Any single character. Example: h.t matches hat, hit, hot and hut.
[ ] [ ] Any one of the characters in the brackets, or any of a range of characters separated by a hyphen (-), or a character class operator (see below). Examples: h[aeiou][a-z] matches hat, hip, hit, hop, and hut; [A-Za-z] matches any single letter; x[0-9] matches x0, x1, …, x9.
[^] [^] Any characters except for those after the caret “^”. Example: h[^u]t matches hat, hit, and hot, but not hut.
^ ^ The start of a line (column 1).
$ $ The end of a line (not the line break characters). Use this for restricting matches to characters at the end of a line. Example: end$ only matches “end” when it’s the last word on a line, and ^end only matches “end” when it’s the first word on a line.
\< \< The start of a word.
\> \> The end of a word.
\t \t The tab character.
\f \f The page break (form feed) character.
\n \n A new line character, for matching expressions that span line boundaries. This cannot be followed by operators ‘*’, ‘+’ or {}. Do not use this for constraining matches to the end of a line. It’s much more efficient to use “$”.
\xdd \xdd “dd” is the two-digit hexadecimal code for any character.
\( \) ( ) Groups a tagged expression to use in replacement expressions. An RE can have up to 9 tagged expressions, numbered according to their order in the RE. The corresponding replacement expression is \x, for x in the range 1-9. Example: If \([a-z]+\) \([a-z]+\) matches “way wrong”, \2 \1 would replace it with “wrong way”.
* * Matches zero or more of the preceding characters or expressions. Example: ho*p matches hp, hop and hoop.
? ? Matches zero or one of the preceding characters or expressions. Example: ho?p matches hp, and hop, but not hoop.
+ + Matches one or more of the preceding characters or expressions. Example: ho+p matches hop, and hoop, but not hp.
\{count\} {count} Matches the specified number of the preceding characters or expressions. Example: ho\{2\}p matches hoop, but not hop.
\{min,\} {min,} Matches at least the specified number of the preceding characters or expressions. Example: ho\{1,\}p matches hop and hoop, but not hp.
\{min,max\} {min,max} Matches between min and max of the preceding characters or expressions. Example: ho\{1,2\}p matches hop and hoop, but not hp or hooop.
\’ Matches either the expression to its left or its right. Example: hop\’hoop matches hop, or hoop.
\ \ “Escapes” the special meaning of the above expressions, so that they can be matched as literal characters. Hence, to match a literal “\”, you must use “\\”. Example: \<>

Tit-Bits

Synchronizing Hashmap :

private Map values = Collections.synchronizedMap(new HashMap());



Tit-Bits

______________________________________________________________________

Synchronizing Hashmap :


private Map values = Collections.synchronizedMap(new HashMap());

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

Generate Random numbers :

The below code generates random numbers under 100


Random randomGenerator = new Random();
for (int idx = 1; idx <= 10; ++idx){
int randomInt = randomGenerator.nextInt(100);
log("Generated : " + randomInt);
}


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

Generate Random String:


String correlationId = RandomStringUtils.randomAlphabetic(8)


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

Class.java

Fetch class details from an object at runtime:

TestClass obj = new TestClass();
Class objClass = obj.getClass();
String strPackage = objClass.getPackage().getName();

The Class obj has various methods to fetch info on the list of methods, constructors , member variables.

Wednesday, May 26, 2010

sharpen

under Title bar -
Filters > enhance > sharpen

cropping

  1. open pic
  2. click on the crop button available on the tool box
  3. or right click on the image, click on tool > Transform Tools > crop
  4. select the section of the image and double click
  5. right click the image click on scale image
  6. select the scale ratio
  7. save image

Monday, May 24, 2010

Log 4j filter

Intro :

The log4j filter allows you to filter out logger statements based on the textual message in the logger . its helpful if you want to get rid of few logger statements for debugging purpose



ex :


<filter class="org.apache.log4j.varia.StringMatchFilter">

      <param name="StringToMatch" value="=================" />

      <param name="AcceptOnMatch" value="false" />

</filter>







this would not log the below log statement in the console


LOGGER.debug("The XML is ================="+ swRequestXml.toString());


test private

Testing private blog

Friday, May 21, 2010

Reading from Properties File

static {
InputStream is = null;
try {
is = DataSource.class.getClassLoader().getResourceAsStream(
"LocalDS.properties");
objDSProp = new Properties();
objDSProp.load(is);
String Value = objDSProp.getProperty("key");


} catch (IOException e) {
e.printStackTrace();
} finally {
if (is != null) {
try {
is.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}

}

Wednesday, May 19, 2010

List Of Oracle System Tables

System Table Description
ALL_ARGUMENTS Arguments in object accessible to the user
ALL_CATALOG All tables, views, synonyms, sequences accessible to the user
ALL_COL_COMMENTS Comments on columns of accessible tables and views
ALL_CONSTRAINTS Constraint definitions on accessible tables
ALL_CONS_COLUMNS Information about accessible columns in constraint definitions
ALL_DB_LINKS Database links accessible to the user
ALL_ERRORS Current errors on stored objects that user is allowed to create
ALL_INDEXES Descriptions of indexes on tables accessible to the user
ALL_IND_COLUMNS COLUMNs comprising INDEXes on accessible TABLES
ALL_LOBS Description of LOBs contained in tables accessible to the user
ALL_OBJECTS Objects accessible to the user
ALL_OBJECT_TABLES Description of all object tables accessible to the user
ALL_SEQUENCES Description of SEQUENCEs accessible to the user
ALL_SNAPSHOTS Snapshots the user can access
ALL_SOURCE Current source on stored objects that user is allowed to create
ALL_SYNONYMS All synonyms accessible to the user
ALL_TABLES Description of relational tables accessible to the user
ALL_TAB_COLUMNS Columns of user's tables, views and clusters
ALL_TAB_COL_STATISTICS Columns of user's tables, views and clusters
ALL_TAB_COMMENTS Comments on tables and views accessible to the user
ALL_TRIGGERS Triggers accessible to the current user
ALL_TRIGGER_COLS Column usage in user's triggers or in triggers on user's tables
ALL_TYPES Description of types accessible to the user
ALL_UPDATABLE_COLUMNS Description of all updatable columns
ALL_USERS Information about all users of the database
ALL_VIEWS Description of views accessible to the user
DATABASE_COMPATIBLE_LEVEL Database compatible parameter set via init.ora
DBA_DB_LINKS All database links in the database
DBA_ERRORS Current errors on all stored objects in the database
DBA_OBJECTS All objects in the database
DBA_ROLES All Roles which exist in the database
DBA_ROLE_PRIVS Roles granted to users and roles
DBA_SOURCE Source of all stored objects in the database
DBA_TABLESPACES Description of all tablespaces
DBA_TAB_PRIVS All grants on objects in the database
DBA_TRIGGERS All triggers in the database
DBA_TS_QUOTAS Tablespace quotas for all users
DBA_USERS Information about all users of the database
DBA_VIEWS Description of all views in the database
DICTIONARY Description of data dictionary tables and views
DICT_COLUMNS Description of columns in data dictionary tables and views
GLOBAL_NAME global database name
NLS_DATABASE_PARAMETERS Permanent NLS parameters of the database
NLS_INSTANCE_PARAMETERS NLS parameters of the instance
NLS_SESSION_PARAMETERS NLS parameters of the user session
PRODUCT_COMPONENT_VERSION version and status information for component products
ROLE_TAB_PRIVS Table privileges granted to roles
SESSION_PRIVS Privileges which the user currently has set
SESSION_ROLES Roles which the user currently has enabled.
SYSTEM_PRIVILEGE_MAP Description table for privilege type codes. Maps privilege type numbers to type names
TABLE_PRIVILEGES Grants on objects for which the user is the grantor, grantee, owner, or an enabled role or PUBLIC is the grantee
TABLE_PRIVILEGE_MAP Description table for privilege (auditing option) type codes. Maps privilege (auditing option) type numbers to type names

Handy SQL Scripts

List Tables in oracle database

select * from tab;

Monday, May 17, 2010

Useful Links

  1. Encode html to simple text

Linked

Linked

What is linked ?

Linked is a downloadable html page which can be set as your browsers home page and customized to dock all your favorites (links to webpages) . Linked enables you to arrange the links in a hierarchical manner for quick access. This is much faster than navigating through your favorites in your browser.


Download Linked







How do I install it ?

To install linked all you will have to do is download the Linked.zip file available in the download section. Place it on the folder of your choice and set the Linked.html file as your home page in your browser.

How Do I Add Folders ?

Open the ‘data’ folder and open one dataset1.xml (dataset2.xml,dataset3.xml can also be used as per your requirement). Add the below tag to create a new folder. Provide unique id for each folder. Provide the name for the folder .



MAILS



How Do I Add Links under my folder ?




MAILS

Gmail

http://gmail.com ]]>




Quick Access to Google :

Clicking on the Linked image on the page will directly take you to Google search page

Linked Quick search :

Enter your search text in the text box provided under the Linked image to do a quick google search

What Linked Cannot do :

You will not be able to dynamically add links to your xmls. There is no provision to add links programmatically . Every time you need to add a new link you will have to edit the xmls.


Compatibility :

Works fine on IE and Mozilla . Has not been tested on other browsers


Known Issues :

On IE you will have to disable security pop up blocker to ensure smooth usage


Download :


Download Linked