Welcome To My Blog

This blog contains posts that may benefit ordinary visitors or programmers (particularly .NET programmer).
To view posts related to particular subjects, click the link under Labels.

Friday, June 24, 2011

Paparkan Semula Folder Yang Tersembunyi

Salam sejahtera semua.

Pernahkah anda alami situasi di mana pendrive anda dijangkiti sejenis virus yg mana semua folder yg berada di root folder di sembunyikan dan digantikan dgn shortcut? Walau pun virus berjaya dihapuskan dari pendrive dan sistem komputer tapi anda masih gagal memaparkan semula folder-folder tersebut.

Bagaimana anda atasi masalah tersebut?

Ada pelbagai cara yg dicadangkan di forum-forum internet. Antaranya kita diminta mengubah registry dgn menggunakan arahan regedit.

Saya mencuba kaedah-kaedah yg dicadangkan malangnya ia gagal memaparkan semula folder-folder yg tersembunyi tersebut.

Rupanya ada cara yg lebih mudah dan berkesan untuk mengatasi masalah tersebut iaitu dgn menggunakan arahan DOS yg namanya ATTRIB.

Arahan ATTRIB ialah arahan utk setkan attribute sesuatu folder dgn H (hidden), S (system), A (archive), dan/atau R (read only).

Cara penggunaannya:

Utk sistem Windows XP,
  1. Klik Start => Run...
  2. Dlm kotak Run, taip cmd dan tekan Enter.
  3. Anda akan melihat Command Window yg berwarna hitam.
  4. Jika pendrive adalah F:, taipkan arahan berikut di command prompt dan akhiri dgn menekan Enter:
  • attrib -s -h f:\*.* /s /d
(Arahan di atas bermaksud buangkan attribute System dan Hidden dari semua fail termasuk directory dan sub-directory yg berada di drive F:.)

Utk sistem Windows 7, gantikan arahan di langkah (1) & (2) di atas dgn langkah berikut:
  1. Klik butang Start
  2. Dlm kotak Search, taip cmd dan tekan Enter.


Friday, June 17, 2011

Calculating Dates with Years and Months

Hi. Good day everybody...

Some people may wonder how to calculate the date difference between two date values in Excel. It may be easy if you just want to show the difference in floating number (number with decimal). For example, if the first date is a birth date stored in cell B1 and you want to show the difference in cell B2 as number of years, you can simply write the expression in cell B2 as the following:

=(TODAY()-B1)/365

On the other hand, if you want to show the answer as number of years and months, it's not that simple. The expression can be as long as the following (or may be even longer):

=IF(MONTH(TODAY())>=MONTH(B1),
(YEAR(TODAY())-YEAR(B1))&" years "&(MONTH(TODAY())-MONTH(B1))&" months ",
(YEAR(TODAY())-YEAR(B1)-1)&" years "&(12+MONTH(TODAY())-MONTH(B1))&" months ")

Anyway, what the above expression means ...
IF the MONTH in today's date is greater than or equal to the MONTH in cell B1, calculate number of years using the YEAR in today's date minus the YEAR in cell B1 and calculate number of months using the MONTH in today's date minus the MONTH in cell B1. Otherwise, if the MONTH in today's date is less than the MONTH is cell B1, calculate number of years using the YEAR in today's date minus the YEAR in cell B1 minus 1 and calculate number of months using the MONTH in today's date minus the MONTH in cell B1 plus 12. In other words, if the person's birth date not yet reach its anniversary, we have to minus 1 to the difference of years and add 12 to the difference of months.