Wednesday, March 09, 2011

Sending to a group of external email in Outlook

Normally if you want to send to external email, you would add the email directly to your new mail. However, if you need to send a mass mail of more than a thousand, like send mail to all your clients, it will be a headache.

Fortunately, there is a facility call "distribution list". However, you will still have to add the recipients one by one. Here is a way where you can send to a distribution list without having to add recipients one by one.

1. Start Outlook.
2. File>New>Folder
3. Type the name you want to use
4. Select “contact items”
5. Choose “Contacts” from the list.
6. Click “OK”.
7. From the main Outlook window choose File> Import and Export…
8. Choose “Import from another program or file
9. Click Next
10. Choose “Comma separated Value (windows)”
11. Click Next
12. Use the “Browse” button to select the email list.
13. Click “Do not import duplicate items”.
14. Click Next
15. Select the newly created folder from contacts.
16. Click “ok”
17. Click “Finish” when import completes.

When you want to send the mail, you can just go to contacts and choose the name of the distribution list. Should you need to keep the recipients from seeing other emails in the list then just add the list to BCC. Click the "TO" then select the list name (don't double click) and click "BCC".

Editing the list is easy. On the menu bar click "Go" then choose "Folder list" and you can find the list name in the contacts folder.

Thursday, February 24, 2011

Vista taskbar blinking

Recently my taskbar have been blinking on and off and it really annoys me. This happens when I "auto hide" the task bar. If I don't hide then the blinking does not exit but then it took space on my desktop.

From the internet blogs I manage to find the solution. Just simply turn on the network icon. I did not notice when I turned it off. It has been on for a long time before that.

Anyhow, it worked.

Friday, February 18, 2011

MsAccess utility to calculate offset time.

There is a requirement from user to calculate time difference in minutes between two date. The requirement is that you will not count the time from 6pm to the next day 9am.

Since we know that stored procedures and user defined functions cannot work in MsAccess if you want to use the database in web pages, you will have to do it in the views itself.

The formula is as follows.

tat: IIf(DatePart("d",[CREADATETIME]) <> DatePart("d",[ACKDATETIME]),IIf(DatePart("w",[CREADATETIME])=7,DateDiff("n",[creadatetime],[ackdatetime])-2520,IIf(DatePart("h",[creadatetime]) >18,DateDiff("n",Format([ackdatetime],"m/d/yyyy"),[ackdatetime])-540,DateDiff("n",[creadatetime],[ackdatetime])-900)),DateDiff("n",[creadatetime],[ackdatetime]))

It looks awful to concatenate the iifs but it works.

The script has a few conditions.

1. If it is Saturday, it will offset the time from 3pm to the next Monday 9am (2520 min).
2. If it is weekday and greater than 6pm, calculate the time from 9am (540 min) of the second date.
3. If is normal hours and span more than one day then offset by 15 hours (900 min)
4. If both date are on the same day then just calculate the difference between the two date.

MsAccess user function

MsAccess can add user function in modules and used in MsAccess. However, never try it if you want to use it on web sites. It will fail with the message "function xxx not found". Even if you put the function in View, it will still fail.

Monday, December 20, 2010

Database access utility in PHP

Added a class library to sourceforge.net to access to database using ODBC/PDO. http://sourceforge.net/projects/jh-php-class/.

The readme file and the PHP_basic_Class.htm will show you how to run the commands.


Wednesday, December 15, 2010

JH-JS-CLASS

Decided to post the whole Javascript class on to Sourceforge. Posting it here is not so convenient as the postings cannot allow for <,>, and &. Moreover, when user copied the codes, it might cause problems if the text copied breaks the code by inserting newline character.

In future, I will describe the code here and leave the code at sourceforge if the codes are some library I created and added to the basic_class.js file. The URL is http://sourceforge.net/projects/jh-js-class/

Tuesday, December 14, 2010

CalendarPopUP explained.

In my earlier post I have a calendar function listed. Although I have never tried to explain the codes that I have posted. The following is an attempt to do so.

The function has there parameters. First parameter is the ID of the input field. There is a problem with IE on getElementsByName thus I cannot use name of the input field for cross browser compatibility purpose.

Second parameter is the date format. The input accepts YMD, DMY, MDY format only. As said before, user can add their own formats. It is quite straight forward.

The third parameter is not user definable. It is intended for the popup to call back to $cP to change the month.

The overall functionality of this code is to create a popup window and insert a calendar using Javascript. When user clicks on the date in the calendar. This value is returned to the input field which calls the $cP function.

When user changes month, the popup calls back to $cp by passing back the same parameter plus a date which is one month before or after the current month. $cP will see the new parameter and replaces the popup with a new calendar.

The following is a line by line explanation of the function.

The function first creates the array for parsing the month information for display purpose.

It then check whether the third parameter is defined. This is used by the popup window to call back by passing a new date. If it is defined then the curdate is set to the new date otherwise curdate is the os date.

curmth and curyr gets the month and year of the curdate for use when choosing background of the calendar.

fdm gets the new date by setting the day of the month of curdate to 1. This change is for getting the weekday of the first day of the month.

ldm stores the last month's date. The if condition address a problem with "Date" function. It seems that "Date" function cannot take negative Month while trying to get last month date. If the month is already 0 it switch to reducing the year by one and set month to 11 otherwise just minus the month by 1.

ndm is the next month's date. Both ldm and ndm is used in the calendar for user to click on and change the month.

fdm is trying to set itself by deducting the day of the week from it. "setDate" is a javascript function to add days to a date. The days can be negative. (Interestingly even if you set the days to -0, it still deducts a day from the date.) The purpose of this function is to ensure that the first date chosen is the first row first column of the calendar. The first column is of course "Sunday".

The first day of the month may not be Sunday. Thus, I need to find out which day of the last month, counting back from the first day of the current month, is a "Sunday".

If I can find the first Sunday date then I could add the rest of the days to the calendar by filling them sequentially. Now I am ready to set the calendar.

The next few lines is just to create the document of the popup window. You can use document.write to create any DOM. Obviously, I am writing to the popup window. Thus I set obj to the opened window's document object.

It is quite tedious to use document.write. However, I have no choice as I do not want to create the actual web page physically.

After creating the necessary CSS, I create the the table. One of the lines compose the last month's date and next month's date with the current month displayed between them. This will allow user to change date by clicking on either side of the current month.

Next, we create the body of the calendar itself. A loop within a loop ensures that there are 5 rows of 7 columns created each filled with a date from fdm which is increased by 1 day each loop. The onclick attrbute will set the calling input field with the date value if clicked.

The iGray and iWhite class is to set the date background to gray if it is not current month.

The switch option is to set the format of the date according to the second parameter of the $cP function.

The fdm is increased by one day.

You would be curious to know what is the if condition doing in the first loop. Well, we all know that if the first day of the month is a "Saturday" and the month may be 30 or 31 days. 5 rows with 7 columns may not be enough to fill all the days of the month. It is therefore necessary to add one more row if fdm after the fifth row is greater than 29. That is to say, it is not already at the next month's date. 29 is chosen because if Saturday is 1, 30 and above will be on the 6th row. Feb 29 will never fall on the 6th row.

The rest of the code is to close the table and add a "close" for user to avoid choosing a date.

obj.close is there because if you don't close it. The window popup will hang for a considerable time before showing the content.

obj.focus is there if you happen to click on the main window while the popup window is still open. I can't help you if you minimize the popup window. Any subsequent calling of $cP will not wake it from minimize condition.