Surendra Sharma

Surendra Sharma

Search This Blog

Thursday, June 27, 2013

How to get random records in Sybase IQ and SQL Server

Use Rand(PrimaryKey) function to get random number along with milliseconds as below


SELECT TOP 5 * FROM Employee Order by RAND( CONVERT(BIGINT,RAND(ID)*1000000000) - DATEPART( Millisecond   ,GETDATE()))

Dunkirk Line Post Office, Pune 411014

Yesterday I got message from Post Office that I received one speed post letter, collect it from Dunkirk Line Post Office, Pune - 411014 within 2 days.

First problem was message was in worst handwriting that nobody understands what the actual address he mentioned is.

Second, anybody doesn’t know about where is Dunkirk Line Post Office.


Thanks to GOOGLE. Finally I was able to view in Google maps.



View Larger Map

It is inside Air Force area.

I never visited before there. I always thought it’s a restricted area.

When you visit from Vimannagar to Chandannagar, at Chandannagar 2nd square [Near to toll tax kind of stuff], take left.

This is the second gate of entrance in Air Force Zone. Go inside.

Security guards will ask you about purpose, ID card.

Make entry in their register.

If you have bike, keep helmet with you otherwise you have walk almost 1 km.
Four vehicles are not allowed inside military premises.

After making entry, go straight [till road end], take left. At last you come in front of Canteen. Park you bike in parking area.

Dunkirk Line Post Office is behind military canteen. Beside SBI ATM [Don’t confuse with ATM. Actually there are two SBI ATM. First ATM inside first entrance gate. Don't go there. Visit to second ATM.]

Always visit post office between 9-11 AM.

I don't understand why government offices are not making people life easier. Whats the use of post office inside military zone for common man?

Monday, June 24, 2013

How to avoid postback on ENTER key press in textbox or How to block ENTER key press in textbox

$(document).ready(function() {

    // Block ENTER key in textbox
    $('#txtSearch').keypress(function(event) {
        if ((event.keyCode || event.which) == 13) {
            event.preventDefault();
            return false;
        }
    });

})

Thursday, June 20, 2013

Find checkbox in row of each grid using JQuery

if ($(grd.rows[i]).find("input[id*='chkDatabase']:checkbox").attr('checked') == true) {
grd.rows[i].style.display = '';
}
else
{
grd.rows[i].style.display = 'none';

}

Get value from Textbox and convert it into upper or lower case in Jquery

//Get value from textbox and convert in UPPER case
var searchStr = $('#txtSearch').val().toUpperCase();

//Get value from textbox and convert in lower case

var searchStr = $('#txtSearch').val().toLowerCase();

Friday, June 14, 2013

How to Auto Increment Build/Version Numbers of Visual Studio Project and get in C#

Open "AssemblyInfo.cs"

Version information for an assembly consists of the following four values:

      Major Version
      Minor Version
      Build Number
      Revision

You can specify all the values or you can default the Revision and Build Numbers
by using the '*' as shown below:

Replace line
[assembly: AssemblyVersion("1.0.0.0")]
with
[assembly: AssemblyVersion("1.0.*")]

Remove or comment out below line
[assembly: AssemblyFileVersion("1.0.0.0")]

Here 1.0.0.0 Means [Major].[Minor].[Build].[Revision],

Now you should get new version number after each time you rebuild project.
C# code to get version number

var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
Label1.Text = string.Format("v{0}.{1}.{2} ({3})", version.Major, version.Minor, version.Build, version.Revision);

When to change each number?
  • Major number when a core piece of the app is rewritten or reworked.
  • Minor version when a new work order is processed
  • Auto increament or leave the build number at zero,
  • Auto increment the revision number every round of testing

In case of auto increament,

  • Build number is the number of days since Dec 31, 1999. 
  • The Revision number is the number of seconds since midnight, divided by 2.

Wednesday, June 12, 2013

How to configure Sybase IQ

a.       Start installation of “Setup” file iq1540_nc_win32_2
Note: - During installation select License copy as option
b.      Create ODBC DSN connection for Sybase IQ from Control Panel -> All Control Panel Items -> Administrative Tools -> Data Sources(ODBC) -> System DSN -> Click Add Button
                                                               i.      On ODBC tab, specify DataSource name = MyDataSource
                                                             ii.      On Login tab, specify
User=<Any User Name>
                Password=<Any Password>
                Action=Connect to a running database on another computer
                Host=<IP Address>
                Port=<Port number>
                Server=<Server Name>
                Database name=<DB Name>
                                                            iii.      Click on OK , OK
c.       Open Start -> Sybase -> Sybase IQ 15.4 -> Interactive SQL
In ODBC Data Source name, browse ODBC that we have created and click on Connect


d.      You can also access GUI based window of Sybase IQ with same steps from Start -> Sybase -> Sybase IQ 15.4 -> Sybase Central