Get current database name in SQL server.
Monday, June 14, 2010
Monday, June 7, 2010
Calculate gunning fog index in .Net
"Gunning fog" index is designed to measure the readability of English writing paragraphs. The result shows normally an estimate of the "number of years" of education he/she needs to understand the text on a first reading the text paragraph.
So here is the formula ...

Here is sample code to calculate gunning fog index written in VB.Net
//some variables
Dim inputText As String = txtInput.Text
Dim ltr As String
Dim wordCount As Integer
Dim sentenceCount As Integer
Dim syllableCount As Integer
Dim complexCount As Integer
Dim i As Integer
Dim inWord As Boolean = False
Dim vowels As String = "aeiouy"
TextBox1.Text = ""
' First make the input string case insensitive.
inputText = inputText.ToLower()
For i = 0 To inputText.Length() - 1
ltr = inputText.Substring(i, 1).ToLower
If ltr = "'" Then
' do nothing in case of apostrophe
ElseIf (ltr >= "a" And ltr <= "z") Then ' check for alphabetic input
If Not inWord Then ' new word
wordCount += 1 ' so add 1 to count
End If
inWord = True
Else ' could be space, full stop, comma etc
inWord = False ' no longer in word
' check if end of sentence
If (ltr = "." Or ltr = "?" Or ltr = "!" Or ltr = ":" Or ltr = ";") Then
sentenceCount += 1 ' add 1 to count
End If
End If
Next
Dim input As String = inputText.Length() - 1
Dim ch As Char
Dim inVowel As Boolean = False
' syllable count is zero if no input
If (input <>Then
syllableCount = 0
complexCount = 0
End If
' e at end of word doesn't count as a vowel
ch = inputText.Substring(inputText.Length - 1)
If (ch = "e") Then
input -= 1
End If
'For Each ch In inputText
' If (vowels.IndexOf(ch) >= 0) Then
' If Not inVowel Then
' syllableCount += 1
' End If
' inVowel = True
' End If
'Next
Dim word As String
Dim pieces As String()
'Replace all what is not needed here
inputText = inputText.Replace(".", " ")
inputText = inputText.Replace(":", " ")
inputText = inputText.Replace(";", " ")
inputText = inputText.Replace("?", " ")
inputText = inputText.Replace("!", " ")
inputText = inputText.Replace(",", "")
inputText = inputText.Replace("'", " ")
inputText = inputText.Replace(" ", " ")
'Now make pieces
pieces = inputText.Split(" ")
syllableCount = 0
complexCount = 0
For index As Integer = 0 To pieces.Length - 1
word = pieces(index)
word = word.ToLower().Trim()
Dim pattern As String = "[aeiouy]+"
'Handle vowels
Dim count As Integer = Regex.Matches(word, pattern).Count
If word.EndsWith("e") Then
count -= 1
End If
'some special cases
If word.EndsWith("cial") Or word.EndsWith("tia") Or word.EndsWith("cius") Or word.EndsWith("cious") Or word.EndsWith("giu") Or word.EndsWith("ion") Or word.EndsWith("iou") Then 'Or word.EndsWith("sia") Or word.EndsWith("ely") Then
count = 1
End If
syllableCount += count
If count <>Then
count = 1
End If
If count >= 3 Then
complexCount += 1
End If
Next
'Now display all results on GUI
TextBox1.Text += "Words: " & wordCount.ToString() & Environment.NewLine
TextBox1.Text += "Sentences: " & sentenceCount.ToString() & Environment.NewLine
TextBox1.Text += "Syllable: " & syllableCount.ToString() & Environment.NewLine
TextBox1.Text += "Complex Words: " & complexCount.ToString() & Environment.NewLine
TextBox1.Text += "Fog index: " & (0.4 * ((wordCount / sentenceCount) + (100 * (complexCount / wordCount)))).ToString() & Environment.NewLine
TextBox1.Text += "Flesch-Kincaid Reading Age: " & (206.876 - (1.015 * (wordCount / sentenceCount)) - (84.6 * (syllableCount / wordCount))).ToString() & Environment.NewLine
Thursday, June 3, 2010
Ad Hoc Reporting Tools
Reporting tools are applications that are used to analyze, report and present data in a better way. This may run as stand alone tool and can be integrated with any system.
Here are few ad hoc reporting tools that i have found amazing. These provide easy integration with your data and wizard base approach to build reports at design time. You are not supposed to be a professional software or database engineer to use these tools, but with a normal knowledge of your system and database you may handle it comfortably.
Izenda
-------------------------------------------------------------If you are looking for some open source solution, please take a look
Reporting Tools (Open Source)
Reporting tools are applications that are used to analyze, report and present data in a better way. This may run as stand alone tool and can be integrated with any system.
Here are few open source reporting tools...
BIRT (Business Intelligence Reporting Tools)
Pentaho
OpenReports
DataVision
Jasper
Tuesday, June 1, 2010
SQL Prompt (Redgate) Alternatives
SQL Prompt is a great tool for intellisense in SQL environment while working with queries, it enables the development environment to show tables schema and other information in a quick and effective format.
Here are few alternatives for this...
SQL Buddy: An open source tool that helps user to work with query management with SQL server.
SoftTree SQL Assistant: A powerful tool that provides intellisense in many databases i.e Oracle, SQL Server, DB2, Sybase, MS Access, PostgreSQL, and MySQL. Also it provides API for developers for integration.
Technical specifications:
| Disk space - 11.2 MB, Memory - 128 MB, CPU - Pentium or compatible | |
| OS - Windows 2000/XP/2003/Vista/2008/7 | |
Supported database systems:
| |
| Supported database connections: MySQL connector,OCI, SMO, ODBC, ADO.NET |
Sunday, May 30, 2010
Love for All, Hatred for None

Love for All, Hatred for None is a self explanatory message that the world really needs these days. There is a discussion around about the lack of tolerance and excess of extremist view. Conflict between expectations and views is natural but the best practice is to control your emotions and just protest in a reasonable manner, but never try to abuse anyone.
To follow this message you are not supposed to be Muslim, Christian, Jew, Hindu etc, but the only requirement is humanity. Just take a look at these links and find people that are following this message in true manner since long.
Thursday, May 27, 2010
HP OpenView Alternatives
HP openview is a network management system of Hewlett Packard.
Nagios: Open source monitoring system for mac, linux and unix platforms.
OpenNMS: Open source monitoring system for linux platform.
Few more
Subscribe to:
Posts (Atom)





