Tuesday, October 8, 2013

[OUTLOOK] How to Setup Gmail Account on Microsoft Outlook

Tools => E-mail Account...
Add a new e-mail account => Next button => POP3 =>

[Screenshot 1]

User Information

  1. Enter your name
  2. Enter your email address
Logon Information
  1. Enter full gmail address as User Name
  2. enter your gmail account password
Server Information
  1. Incoming mail server (POP3): pop.gmail.com
  2. Outgoing mail server (SMTP): smtp.gmail.com
Then click on More Settings... button


[Screenshot 2]

Internet E-Mail Settings window => Click on Advanced tab
  1. Incoming server (POP3): 995
    Check the check box This server requires an encrypted connection (SSL)
  2. Outgoing server (SMTP): 465
    Check the check box This server requires an encrypted connection (SSL)

Tuesday, September 24, 2013

[JavaScript] Code Snippets

Redirect to the page with code below to close the window right away.
<script type="text/javascript">
window.open('','_self','');
window.close();
</script>


Thursday, May 2, 2013

[C#] How To Add JavaScript or CSS Dynamically To Page Header


Add JavaScript Dynamically To Page Header
string strJS = "<s" + "cript type=\"text/javascript\">";
strJS += "ADD YOUR SCRIPTS HERE";
strJS += "</" + "script>";
LiteralControl myJS = new LiteralControl();
myJS.Text = strJS;
Page.Header.Controls.Add(myJS);

Add CSS Dynamically To Page Header
string strCS = "<style type=\"text/css\">";
strCS += "ADD YOUR CSS CLASSES HERE";
strCS += "</style>";
LiteralControl myCS = new LiteralControl();
myCS.Text = strCS;
Page.Header.Controls.Add(myCS);
Short version: Page.Header.Controls.Add(new LiteralControl("<style type=\"text/css\"> CSS CLASS HERE }</style>"));

Tips: add /r and/or /n for new line

Wednesday, May 1, 2013

[C#] Convert String Array (string[]) to comma delimited string


string[] arrStrings = new string[] { "string1", "string2", "string3" };
string strDelimited = String.Join(",", arrStrings);

Result: string1,string2,string3

Thursday, April 18, 2013

[SharePoint] Upload File To Document Library Using SharePoint Object Model - Authenticate or Anonymous Access



using Microsoft.SharePoint;    //SharePoint
using System.IO;                //Stream

//if  Anonymous Access, document library must set to allow anonymous to add items
string strSharePointURL = "http://www.sharepoint.com";

if (txtUpload.HasFile)
{
    if (txtUpload.PostedFile.ContentLength > 0)
    {
        //string strFileName = txtUpload.PostedFile.FileName;
        string strFileName = txtUpload.FileName;

        Stream fStream = txtUpload.PostedFile.InputStream;
        byte[] bStream = new byte[fStream.Length];
        fStream.Read(bStream, 0, bStream.Length);
        fStream.Close();

        SPSecurity.RunWithElevatedPrivileges(delegate()
        {
            using (SPSite objSite = new SPSite(strSharePointURL))
            {
                using (SPWeb objWeb = objSite.OpenWeb())
                {
                    SPFolder libraryFolder = objWeb.Folders["Document_Library_Name"];
                    objWeb.AllowUnsafeUpdates = true;

                    libraryFolder.Files.Add(strFileName, bStream, true);
                }
            }
        });
    }
}
//In html code
<asp:FileUpload runat="server" id="txtUpload"/>

Monday, April 15, 2013

[SQL] Get Date Only - Date Only No Time

DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)

Sunday, April 14, 2013

[MAC]: How To Burn ISO Disc Images

  1. Insert a blank disc.
  2. Start Disk Utility.
    • BY: Finder -> Applications -> Utilities -> Disk Utility
    • OR: LauchPad -> Other -> Disk Utility
  3. From the File menu, choose Open Disk Image and select the ISO to be burned.
  4. In the list of volumes, you will now see an item representing the ISO file. Select it.
  5. Click the Burn button and follow the instructions.