Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

flag

verify that atleast one check box checked in the grid
Friday, 27 January 2012 11:09
// verify that atleast one check box checked in the grid



function CheckAtleastOneisChecked(checkBox) { var frm = document.forms[0]; var flag = false; var cnt = 0; for (var i = 0; i < document.forms[0].length; i++) { if (document.forms[0].elements[i].id.indexOf(checkBox) != -1) { if (document.forms[0].elements[i].checked) { flag = true cnt = cnt + 1; } } } if (flag == false) { alert('Atleast one check box should be checked.') return false }

}

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/JxxbnShP2uw/14489

 
Javascript for verifying that atmost single record is selected in the grid
Friday, 27 January 2012 11:02
// Javascript for verifying that atmost single record is selected in the grid



function ChecksingleSelected(checkBox) {

var frm = document.forms[0];
var flag = false;
var cnt = 0;

for (var i = 0; i < document.forms[0].length; i++) {
if (document.forms[0].elements[i].id.indexOf(checkBox) != -1) {
if (document.forms[0].elements[i].checked) {
flag = true
cnt = cnt + 1;
}
}
}
if (cnt > 1) {

alert('Only record can be seleccte/checked.');
return false;
}

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/xXSwjmM3MZ8/14487

 
Remove Duplicate characters from string - C#
Wednesday, 10 November 2010 16:06
Remove Duplicate characters from string - C#.


public string RemoveDuplicates(string p)
{
StringBuilder sb = new StringBuilder();
char[] word = p.ToCharArray();
bool flag = false;
for (int i = 0; i < word.Length; i++)
{
flag = false;
for (int j = (word.Length - 1); j > i; j--)
{
if (word[i] == word[j])
{
flag = true;
break;
}
}
if (!flag)
{
sb.Append(word[i]);
}
}
return sb.ToString();
}

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/29LIsbii-6E/12619

 
Finnish flag days 1.1
Tuesday, 25 May 2010 07:00
About Finnish flag days
A free internet calendar subscription, which contains Finnish flag days (in Finnish). The calendar updates automatically, so it is always up-to-date. IMPORTANT! Please se your iCal to update weekly. It will no do this by default.

Read more: http://www.apple.com/downloads/macosx/calendars/finnishflagdays.html

 
Introducing the optparse-simple gem
Tuesday, 11 May 2010 10:32
The optparse-simple gem uses a Polyrex document to fetch, and validate command-line arguments into a simple hash.

*installation*

sudo gem1.9.1 install optparse-simple

Successfully installed optparse-simple-0.2.0
1 gem installed
Installing ri documentation for optparse-simple-0.2.0...
Updating class cache with 3148 classes...
Installing RDoc documentation for optparse-simple-0.2.0...


Polyrex schema: options/option[name,switch,alias,value,mandatory]/error[msg]

*example*

require 'optparse-simple'
args = %w(-s --list=45 refresh filename filexx3)
h = OptParseSimple.new('/home/james/learning/ruby/optionsx.xml', args).to_h
#=> {:list=>"45", :sort=>nil, :refresh=>nil, :file1=>"filename", :file2=>"filexx3"}


file: optionsx.xml















Note: The error messages within each option are positioned by priority (mandatory being 1st, followed by value).

Resources:
- jrobertson's optparse-simple at master [github.com]
- Using OptParseSimple [dzone.com]

*update: 11-May-2010 @ 5:23pm*
To catch errors use the RuntimeError case e.g.

require 'optparse-simple'

begin
args = %w(-s --list=45 refresh filename filexx3 dhgf)
h = OptParseSimple.new('/home/james/learning/ruby/optionsx.xml', args).to_h
rescue RuntimeError => myStandardError
puts myStandardError
end
#=> invalid option: dhgf not recognised


see Handle exceptions in Ruby [dzone.com]

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/CKarMibsZDk/11315

 


Taxonomy by Zaragoza Online