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