Wednesday, November 30, 2011

Inputs and Conditional Processing in Batch File

To get input from the console in a batch file and assign it to a variable  the following syntax works very well.

set /p name=Debug Y/N?

Then you can Echo %name% to print the contents of that variable.

To conditionally check for the content of that variable

IF "%name%" == "y" (other dos commands go here...) Without the enclosing braces :-)


I found it particularly usefull to start my jboss with some agents disabled conditionally based on what options I choose, that way I can still play around with multiple agents and debugging options without having to maintain multiple copied of the run.bat files, which is messy !!!

Tuesday, November 29, 2011

Split String on every UpperCase Letter, String Modify Array and String Join the array as a single word.


For example we have a string like “thisIsTheDay”

http://stackoverflow.com/questions/3752636/java-split-string-when-an-uppercase-letter-is-found

1.String sample = “thisIsTheDay”;
2.String[] sampleArray = sample.getChartType().split("(?=\\p{Lu})");
3.sampleArray = (String[])ArrayUtils.removeElement(sampleArray, "this");
4. String newStringName  = StringUtils.join(sampleArray," ");

Line 1: Declares a sample string.

Line 2: Splits the string for every unicode character that it encounters.

Line 3: Removes any unwanted words from the new array.

Line 4: Joins the elements of the array as a new word.

Friday, November 18, 2011

Debug CSS

Debug your CSS and layouts using Yahoo Debug CSS

https://github.com/yahoo/debugCSS

debugCSS is meant to be loaded on an existing page to highlight potentially broken, malformed or legacy (X)HTML.


Visit the above link for more information.

Tool to bulk rename files in windows

This is a very usefull to bulk rename files in a folder with most pattern and extension matching options.

www.spacetornado.com/Renamer/

String substitution



To substitute words in String.

String exampleString = " There is %s disturbance in planet %s ";
String newString = String.format(exampleString,new Object[]{"a","mars."});
System.out.println(newString);

Output :  There is a disturbance in planet mars.

Alternatively you can also use the MessageFormatClass

http://download.oracle.com/javase/6/docs/api/java/text/MessageFormat.html




Thursday, November 10, 2011

JSF Icefaces Accessibility

We have a JSF based application, and this is our experience in making the website more accessible.

Accessibility guidelines from the web.



Tools to check for accessibility 



Making your website font scale and resizeable. Typically websites show three (3) A alphabets and prompt the user to resize.
AAACreate the above as links and pass in a value to resize the body font.
document.body.style.fontSize = newSize + "em";
Key issues/challenges that were faced :-

  • JSF popups with dialog boxes were not picked up by JAWS reader. Had to provide a separate entry point for those pages to be shown as a separate popup window and not within the application itself.
  • Wherever we had a drop down based change listener we had to implement an action listener with a "go" button.
  • Flash based fusion charts font sizes were not re-sizeable http://forum.fusioncharts.com/topic/10527-how-to-auto-resize-text/page__p__41271__hl__resize__fromsearch__1#entry41271
  • To resize flash movies via a script in your website please see  http://swffit.millermedeiros.com/
  • Basically flash can be set as a percentage of the parent container div to resize. 
  • Providing alt text for images. 
  • Providing table headers for tables where the th were not rendered due to improper use, the accessibility reader tools need the th to read the column headers. 
  • No multi row headers. 
  • Images pixelating if you increase the zoom of the page, but you can provide alt text for those pages.  
  • Auto complete drop downs need to have a different layout. 
Update:

For example if you have section headings in a page (not the html title of the page). What JAWS would allow you to do is to pick a list of headings on a page and navigate directly to that section that contains the heading. So it is essential for your pages to contain headings.

Update:
To make tables more accessible,
this is an awesome post on how to make it more accessible.

http://www.usability.com.au/resources/tables.cfm

Will update more on this blog.



Tuesday, November 8, 2011

CSS Cross browser shadow

.shadow {
-moz-box-shadow: 3px 3px 4px #000;
-webkit-box-shadow: 3px 3px 4px #000;
box-shadow: 3px 3px 4px #000;
/* For IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000')";
/* For IE 5.5 - 7 */
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000');
}

http://robertnyman.com/2010/03/16/drop-shadow-with-css-for-all-web-browsers/

CSS Cross browser shadow for divs