Monday, 20 February 2017

Online PAN Validation India

Go to following link and enter the PAN number, and you will get the details.

https://www.cvlkra.com/kycpaninquiry.aspx

Friday, 30 September 2016

Report execution error:The permissions granted to user are insufficient for performing this operation. (rsAccessDenied)

Steps for the Error:
Run the IE using the other user (The other user should not be administrator)
Click on the Report Server URL
http://ComputerName/Reports/Pages/Folder.aspx
Report execution error:The permissions granted to user are insufficient for performing this operation. (rsAccessDenied)



Solution:
 Permisson to this user should be give at Site Level settings(upper right hand corner) and also Folder Settings (On the top bar). Permission only at site level settings will not work.

In my case the user belonged to machine, and was included in the (SQLServergroup, users) was not included in the administrator group.

Friday, 2 September 2016

Delete all stored procedures, tables, functions from Database in SQL Server

/* Drop all Foreign Key constraints */
DECLARE @name VARCHAR(128)
DECLARE @constraint VARCHAR(254)
DECLARE @SQL VARCHAR(254)

SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'FOREIGN KEY' ORDER BY TABLE_NAME)

WHILE @name is not null
BEGIN
    SELECT @constraint = (SELECT TOP 1 CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'FOREIGN KEY' AND TABLE_NAME = @name ORDER BY CONSTRAINT_NAME)
    WHILE @constraint IS NOT NULL
    BEGIN
        SELECT @SQL = 'ALTER TABLE [dbo].[' + RTRIM(@name) +'] DROP CONSTRAINT [' + RTRIM(@constraint) +']'
        EXEC (@SQL)
        PRINT 'Dropped FK Constraint: ' + @constraint + ' on ' + @name
        SELECT @constraint = (SELECT TOP 1 CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'FOREIGN KEY' AND CONSTRAINT_NAME <> @constraint AND TABLE_NAME = @name ORDER BY CONSTRAINT_NAME)
    END
SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'FOREIGN KEY' ORDER BY TABLE_NAME)
END
GO

/* Drop all Primary Key constraints */
DECLARE @name VARCHAR(128)
DECLARE @constraint VARCHAR(254)
DECLARE @SQL VARCHAR(254)

SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'PRIMARY KEY' ORDER BY TABLE_NAME)

WHILE @name IS NOT NULL
BEGIN
    SELECT @constraint = (SELECT TOP 1 CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'PRIMARY KEY' AND TABLE_NAME = @name ORDER BY CONSTRAINT_NAME)
    WHILE @constraint is not null
    BEGIN
        SELECT @SQL = 'ALTER TABLE [dbo].[' + RTRIM(@name) +'] DROP CONSTRAINT [' + RTRIM(@constraint)+']'
        EXEC (@SQL)
        PRINT 'Dropped PK Constraint: ' + @constraint + ' on ' + @name
        SELECT @constraint = (SELECT TOP 1 CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'PRIMARY KEY' AND CONSTRAINT_NAME <> @constraint AND TABLE_NAME = @name ORDER BY CONSTRAINT_NAME)
    END
SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'PRIMARY KEY' ORDER BY TABLE_NAME)
END
GO

/* Drop all tables */
DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)

SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'U' AND category = 0 ORDER BY [name])

WHILE @name IS NOT NULL
BEGIN
    SELECT @SQL = 'DROP TABLE [dbo].[' + RTRIM(@name) +']'
    EXEC (@SQL)
    PRINT 'Dropped Table: ' + @name
    SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'U' AND category = 0 AND [name] > @name ORDER BY [name])
END
GO
 
Taken from following link
http://stackoverflow.com/questions/536350/drop-all-the-tables-stored-procedures-triggers-constraints-and-all-the-depend 

Wednesday, 24 August 2016

New Features of SQL Server 2005

Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine (Solved)

Solve following error on extracting data from excel through SSIS, I have  Office  2016 (64 bit) and SSIS on SQL Server 2016 (64 bit)


Exception from HRESULT: 0xC020801C
Error at Package [Connection manager "Excel Connection Manager"]: The requested OLE DB provider Microsoft.ACE.OLEDB.12.0 is not registered. If the 32-bit driver is not installed, run the package in 64-bit mode. Error code: 0x00000000.
An OLE DB record is available.  Source: "Microsoft OLE DB Service Components"  Hresult: 0x80040154  Description: "Class not registered".

Error at Package [Connection manager "Excel Connection Manager"]: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=219816

Error at Import Countries into Excel [Excel Source [38]]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0209302.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.


Download the database engine for Access 2013 from the following location.

https://www.microsoft.com/en-in/download/details.aspx?id=39358

After installing this the issue got resolved.



Show Excel cell as password TextBox

How do we show the Excel cell has password textbox, So that the person cannot view the value of the cell, but the value can be read through VBA.

Right Click –> Format Cells –> Number Tab

Enter  following value and then Click Ok.

;;;**

Friday, 23 October 2015

Default document in web.config.

So why exactly we need to provide the default document
when you type the website name then the first page should come by default.

 www.mysite.com should provide you with login page of the default aspx document, so to provide this following is the process.


The web.config file can be used to set a default document, or list of default documents for your website. Web.config can be used to change the default document (page) for an entire site, or on a directory by directory basis. The default page may be any file.

 I had the system.web option already so I had to use this option.

<?xml version="1.0"?>
<configuration>
   <system.web>
     .. existing text ..
     .. existing text ..
   </system.web>
   <system.webServer>
      <defaultDocument enabled="true">    <!-- this line enables default documents for a directory -->
         <files>      
            <clear/>     <!-- removes the existing default document list -->                
            <add value="Login.aspx"/>     <!-- foo.htm is now the default document  -->                
           
         </files>
      </defaultDocument>
      <modules runAllManagedModulesForAllRequests="true"/>
   </system.webServer>
</configuration>

Refer to this site for more details

http://www.stokia.com/support/misc/web-config-default-website-document.aspx

Thursday, 6 August 2015

Tuesday, 28 July 2015

adodb.connection USER-defined type not defined

In the VBE select Tools -> References... From the dialog box that pops up, and find something like

Microsfot ActiveX Data Objects 2.7 Library or higher number. Select this and then compile



Monday, 27 July 2015

Difference between Single & First in LINQ

Single:
DBContext db = new DBContext();
Customer customer = db.Customers.Where( c=> c.ID == 5 ).Single();
The single  throws exception if multiple records are returned.

The First method provides the first record returned by the query.

First
BContext db = new DBContext();
NewsItem newsitem = db.NewsItems.OrderByDescending( n => n.AddedDate ).First();

Send email in lotus notes via macro

Set a reference to "Lotus Notes Automation Classes". In the code window, go to Tool --> References --> Select 'Lotus Notes Automation Classes".

Sub Send_Email_via_Lotus_Notes()
    Dim Maildb As Object
    Dim MailDoc As Object
    Dim Body As Object
    Dim Session As Object
    'Start a session of Lotus Notes
        Set Session = CreateObject("Lotus.NotesSession")
    'This line prompts for password of current ID noted in Notes.INI
        Call Session.Initialize
    'or use below to provide password of the current ID (to avoid Password prompt)
        'Call Session.Initialize("<password>")
    'Open the Mail Database of your Lotus Notes
        Set Maildb = Session.GETDATABASE("", "D:\Notes\data\Mail\eXceLiTems.nsf")
        If Not Maildb.IsOpen = True Then Call Maildb.Open
    'Create the Mail Document
        Set MailDoc = Maildb.CREATEDOCUMENT
        Call MailDoc.REPLACEITEMVALUE("Form", "Memo")
    'Set the Recipient of the mail
        Call MailDoc.REPLACEITEMVALUE("SendTo", "Ashish Jain")
    'Set subject of the mail
        Call MailDoc.REPLACEITEMVALUE("Subject", "Subject Text")
    'Create and set the Body content of the mail
        Set Body = MailDoc.CREATERICHTEXTITEM("Body")
        Call Body.APPENDTEXT("Body text here")
    'Example to create an attachment (optional)
        Call Body.ADDNEWLINE(2)
        Call Body.EMBEDOBJECT(1454, "", "C:\dummy.txt", "Attachment")
    'Example to save the message (optional) in Sent items
        MailDoc.SAVEMESSAGEONSEND = True
    'Send the document
    'Gets the mail to appear in the Sent items folder
        Call MailDoc.REPLACEITEMVALUE("PostedDate", Now())
        Call MailDoc.SEND(False)
    'Clean Up the Object variables - Recover memory
        Set Maildb = Nothing
        Set MailDoc = Nothing
        Set Body = Nothing
        Set Session = Nothing
End Sub



This is as described by article in  http://www.excelitems.com

Tuesday, 21 July 2015

Search From right side in Excel VBA

Use the  function InStrRev(String searched, String Sought, Start, CompareMethod)

InstrRev(one_two_three,"_") should return 8, so the search is from the right, But the position is returned from the left.







Monday, 20 July 2015

Naming Convention in c#

Pascal Naming Convention
Capitalizes the first character of each word (including acronyms over two letters in length), as shown in the following examples:



PropertyDescriptor
HtmlTag
A special case is made for two-letter acronyms in which both letters are capitalized, as shown in the following identifier:
IOStream
This naming convention is used for 
1) Class Names
2) Method Names
3) File Names


Camel Naming Convention
The camelCasing convention, used only for method parameter names and variables.

capitalizes the first character of each word except the first word, as shown in the following examples. As the example also shows, two-letter acronyms that begin a camel-cased identifier are both lowercase.
propertyDescriptor
ioStream
htmlTag

Expand all columns of cell

Select the top left corner cell between 1 and A. This will select the entire sheet.

Now go and try to expand all the  columns, This should expand all the columns.


Sunday, 19 July 2015

Running macros using hyperlink



VBA programmers deals with macros now and then, and to run the marco by clicking hyperlink should catch the event of clicking of the hyperlink.

The event which does this is
Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
 
As this belongs to the WorkSheet, it should go into the Worksheet 

1. Right click and hyperlink the text you want to hyperlink.

2. Select the developer tab and open up visual basic, or you can do Alt + F11
 3. In the folder “Microsoft Excel Objects” there is a list of the sheets contained within the workbook. Select the sheet that contains the hyperlink.
4. Paste the following code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    'Write your code here
    

End Sub

Friday, 10 July 2015

Screen Shot using Windows Phone O.S. 8.1

Hold your power button, the single button at the bottom on the right side, and simultaneously click the "Volume up"  button on the right side. See your screen shot in the "Photos App"

stop app or whatsapp notification in windows mobile 8.1


  1. Swipt the top down, go to "ALL Settings"
  2. Go to "Notifications+actions"
  3. Find the app you want to change the way notifications work
  4. Just change the "Notification sound" to "none".
See the image of "Notifications and Actions"

 

Friday, 19 June 2015

Trikal Sandhya

Trikal-sandhya-gifted-by-pandurang-Shastri Athavle


Morning Time

कराग्रे वसते लक्ष्मीः करमूले सरस्वती।
करमध्ये तु गोविन्द: प्रभाते कर दर्शनम॥
समुद्रवसने देवि पर्वतस्तनमंडले।
विष्णुपत्नि नमस्तुभ्यं पादस्पर्श क्षमस्व मे॥
वसुदेवसुतं देवं कंसचाणूरमद्रनम्।
देवकीपरमानन्दम कृष्णं वन्दे जगद्गुरुम्॥

Karagre vasate Lakshmeehi Karamoole Sarasvatee | 
Kara-madhye tu Govindah Prabhaate kara-darshanam ||


Vasudeva-sutan Devam Kansa-Chaanura-mardanam |
Devaki-paramaa nandam Krushnam vande jagad-gurum ||

Meal Time
यज्ञशिष्टाशिनः सन्तो मुच्यन्ते सर्वकिल्विषैः।
भुञ्जते ते त्वघं पापा ये पचम्त्यात्मकारणात्॥
यत्करोषि यदश्नासि यज्जहोषि ददासि यत्।
यत्तपस्यसि कौन्तेय तत्कुरुष्व मदर्पणम्॥
अहं वैश्र्वानरो भूत्वा ग्राणिनां देहमाश्रितः।
प्राणापानसमायुक्तः पचाम्यन्नं चतुर्विधम्।।
ॐ सह नाववतु सह नौ भनक्तु सह वीर्यं करवावहै।
तेजस्वि नावघीतमस्तु मा विहिषावहै।।
ॐ शांतिः शांतिः शांतिः।।

Yagna-shishtaa-shinah santo muchyante sarva-kilbishaih | 
Bhunjate te tvagham paapaa ye pachantyaatma-kaaranaat ||



Yat-karoshi yadashnaasi yaj yaj-juhoshi dadaasi yat | 
Yat-tapasyasi Kaunteya tat-kurushva madarpanam ||


Aham vaishvanaro bhootvaa praaninaan deha-maashritah | 
Praanaa-paana samaayuktah pachaamyannam chaturvidham ||



Om saha naa-vavatu saha nau bhunaktu saha viryam karavaa-vahai | 
tejasvi naa-vadhi-tamastu maa vidvishaa-vahai || 
Om shaantih shaantih shaantihi

Sleep Time

कृष्णाय वासुदेवाय हरये परमात्मने।
प्रणतक्लेशनाशाय गोविन्दाय नमो नमः॥
करचरणकृतं वाक् कायजं कर्मजं वा
श्रवणनयनजं वा मानसं वाअपराधम्।
विहितमविहितं वा सर्वमेतत् क्षमस्व
जय जय करुणाब्धे श्री महादेव शंभो॥
त्वमेव माता च पिता त्वमेव
त्वमेव बन्धुश्च सखा त्वमेव।
त्वमेव विद्या द्रविणं त्वमेव
त्वमेव सर्वं मम देवदेव॥

Krushnaaya Vaasudevaaya haraye Parmaatmane | 
Pranata-klesha-naashaaya Govindaaya namo namah ||


Kara-charan-krutam vaak-kaaya-jam karmajam vaa 
shravana-nayanajam vaa manasam va-aparadham | 
Vihitam-avihitam va sarva-me-tat kshamasva jaya jaya karunaabdhe 
Shree Mahaadeva Shambho ||



Tvameva maataa cha pitaa tvameva tvameva bandhush-cha sakhaa tvameva | 
Tvameva vidyaa dravinam tvameva tvameva sarvam mama deva-deva ||


From
http://www.speakingtree.in

Saturday, 19 October 2013

.Net with MQ Series sample

What is MQ Series?
System for sending messages between multiple platforms, It supports multiple platforms, protocol. This help us to transfer data from one system to another.

Installation of MQ Series.
The MQ Series consists of server and client, I downloaded the trial version of same from IBM site. You need to install the server & client on different machine, I tried to install on same but it did not work for me.

Server:
WS_MQ_V7.1.0.3_TRIAL_FOR_WINDOWS_ML

Client:
mqc7_7.0.1.6_win

Install the server, For below provide domain username.  Also "IBM Websphere MQ" will run using this username.





Tick the checkbox "Continue with this user account".


 Once installed and before configuring "IBM Websphere MQ Explorer." just make sure service   "IBM Websphere MQ"  is running.

Creating Queue Manager:
In the explorer, create an new Queue manager, call this QUEUE_MANAGER.


 
Creating Queue:
Click New->Local Queue, name it QUEUE_LOCAL






Creating Channel:
Select Channels--> New "Server-Connection Channel"
Name the channel as  SVR_RCV_CHANNEL

Once your server is ready, Install client in local machine.

Next is to code the connection with MQ Series.

Create a New Windows Form Application.

Add new class to it as "MQClass".

Following parameters are required to initiate connection to the MQ Series:
 1) Host Name: Machine name where server is installed.
2) Channel Name: Channel through which you are planning to connect to the server.
3) Port on which the Server is listening, Default port is 1414.

AddReference: amqmdnet.dll which is located in your bin folder

Include namespace: IBM.WMQ;

Connecting to the MQ Series server
public string ConnectMQ()
        {    
           String strReturn = "";
            try
            {
                //MQEnvironment.Port = 1414;
                //MQEnvironment.Channel = channelName;
                //MQEnvironment.Hostname = "localhost";

                Hashtable properties = new Hashtable();
                properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);
                properties.Add(MQC.HOST_NAME_PROPERTY, "hostmachinename");
                properties.Add(MQC.PORT_PROPERTY, 1414);
                properties.Add(MQC.CHANNEL_PROPERTY, "SVR_RCV_CHANNEL");
               // properties.Add(MQC.USER_ID_PROPERTY, "UserName");
               // properties.Add(MQC.PASSWORD_PROPERTY, "hhh");

                queueManager = new MQQueueManager("QUEUE_MANAGER ", properties);
                strReturn = "Connected Successfully";
            }
            catch (MQException exp)
            {
                strReturn = "Exception: " + exp.Message;
            }
                  return strReturn;
        }

 User the same user through which you are running the MQ Series service.

If you get the Error "mqrc_not_authorized" then make sure the Admin user is not blocked, which is by default blocked.

Go to Channels--> ChannelAuthrizationRecords and remove the blocked user.





Delete the channel authorization record if any.



Once you have connected to Queue manager using channel, Now it's time to pass some message and read the message.
Let's see how to pass the message to the queue,

public string WriteMsg(string strInputMsg)
        { 
            string strReturn = "";
            try
            {
                //first get the queue object, by connecting to queue created
                mqQueue = queueManager.AccessQueue(QueueName,

                MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);

                message = strInputMsg;
1
                //create the message which has to be passed to queue.
                mqMessage = new MQMessage();

                //add some content to the message               
                mqMessage.WriteString(message);

                mqMessage.Format = MQC.MQFMT_STRING;
                queuePutMessageOptions = new MQPutMessageOptions();
                //go with the default message options
                mqQueue.Put(mqMessage, queuePutMessageOptions);

                //return success message
                strReturn = "Message sent to the queue successfully";

            }

            catch (MQException MQexp)
            {
                strReturn = "Exception: " + MQexp.Message;
            }

            catch (Exception exp)
            {
                strReturn = "Exception: " + exp.Message;
            }
            finally
            {
                if (mqQueue.OpenStatus)
                    mqQueue.Close();

            }
            return strReturn;
        }