Archive for March, 2012

March 6th, 2012

Create an Apache Sub-Domain

Not long ago, I was looking information on how to create and configure an Apache sub-domain on my test server.  I found a number of websites covering the subject, but even after editing my httpd.conf file to add the domain and sub-domain entries, the sub-domain would not work!?  So I did more digging and testing and what I found was that the various tutorials and explanations all omitted one crucial element to the puzzle, none of them mentioned that you had to also add a subdomain entry to Windows’ host file! I assumed that since the domain already had an entry, Apache & Windows were smart enough to know that a sub-domain would use the same host entry as the domain, I was wrong! Apparently, Apache & Windows are not that smart, actually they appear to be blatantly stupid!

So the first thing you have to do is edit the httpd.conf file to add the required virtual host entries: 1 for the domain & 1 for the sub-domain

<VirtualHost *:80>
    ServerName www.domain.com
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/websites/www.domain.com"
</VirtualHost>
<VirtualHost *:80>
    ServerName subdomain.domain.com
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/websites/www.domain.com/subdomainFolderName"
</VirtualHost>

But even once this is done, you then have to go and make an entry for both your domain and another for your sub-domain in the Windows Host file.  The values below assume a local test server

127.0.0.1    www.domain.com
127.0.0.1    subdomain.domain.com

Once you make both of these changes, restart your Apache server, and everything should work.  It did for me at least!

Share and Enjoy

  • Google Plus
  • Facebook
  • LinkedIn
  • Twitter
  • Email
  • Print
March 3rd, 2012

MS Access – VBA – Capitalize the First Letter of a String

Below is an example of a function which will capitalize the first letter of a given string.  The second input variable allows you to specify to return the rest of the string as is, or lowercase it.

'---------------------------------------------------------------------------------------
' Procedure : UCase1stLtr
' Author    : Daniel Pineault, CARDA Consultants Inc.
' Website   : http://www.cardaconsultants.com
' Purpose   : Capitalize the first character of a given string
' Copyright : The following may be altered and reused as you wish so long as the
'             copyright notice is left unchanged (including Author, Website and
'             Copyright).  It may not be sold/resold or reposted on other sites (links
'             back to this site are allowed).
'
' Input Variables:
' ~~~~~~~~~~~~~~~~
' sString           String to process
' bLowerCaseTheRest Whether or not the rest of the string should be in lower case or not
'
' Usage:
' ~~~~~~
' UCase1stLtr("hjkwhjkwhkjw12218hjksdjkhNJH", False) -&gt; Hjkwhjkwhkjw12218hjksdjkhNJH
' UCase1stLtr("hjkwhjkwhkjw12218hjksdjkhNJH", True) -&gt; Hjkwhjkwhkjw12218hjksdjkhnjh
' UCase1stLtr("hjkwhjkwhkjw12218hjksdjkhNJH") -&gt; Hjkwhjkwhkjw12218hjksdjkhnjh
'
' Revision History:
' Rev       Date(yyyy/mm/dd)        Description
' **************************************************************************************
' 1         2012-Mar-02                 Initial Release
'---------------------------------------------------------------------------------------
Function UCase1stLtr(sString As String, Optional bLowerCaseTheRest As Boolean = True) As String
On Error GoTo Error_Handler
 
    Select Case Len(sString)
        Case 0
            UCase1stLtr = vbNullString
        Case 1
            UCase1stLtr = UCase(sString)
        Case Else
            UCase1stLtr = UCase(Left(sString, 1)) &amp; IIf(bLowerCaseTheRest, LCase(Mid(sString, 2)), Mid(sString, 2))
    End Select
 
Error_Handler_Exit:
    On Error Resume Next
    Exit Function
 
Error_Handler:
    MsgBox Err.Number &amp; vbCrLf &amp; Err.Description &amp; vbCrLf &amp; sModName &amp; "/UCase1stLtr", True
    Resume Error_Handler_Exit
End Function

Share and Enjoy

  • Google Plus
  • Facebook
  • LinkedIn
  • Twitter
  • Email
  • Print