Skip to main content


Showing posts from November, 2014

Unable to print word 2010 document

Assuming the printer is setup properly, and able to print from PDF, notepad or other software and also able to print from printer driver test page.
But when printing a specific word document in Word 2010, it will just show "Not responding" the document will hang and will not print.
There is no restriction set on the document but cannot print.
Try steps below:

Click on the "File" tab, click on the "Review" menu.
From the "Review" tab, select "tracking" change the option from:
"Final: Show Markup" to "Final".

Check image below:

Save the document or save it to a different file name.
And try printing again, if everything goes right the document will be able to print.
Paper tray settings will also cause a problem with printing the document.

Documents from another party that retain printer settings on the document will not print if the printer of the other party does not have same settings on what is currently retain on …

Android R not generated

Ever encountered why Android R is not generated?
One quick solution is to delete the “gen” folder hoping, that it will be generated again since the folder is auto generated. But it works sometimes.. 
But if Android will not auto generate the R and problem will be not washed away.
And after deletion the problem still exists, and even after cleaning the project.
So now what?
If the XML in the "res" folder, such as the "layout" XML and "drawables" XML (drawable-hdpi, drawable-xhdpi etc..) if the XML has errors on any of these folders, it will cause R not to be generated.
If the XML are all okay and still R is not generated. 
Then open the drawables folder, if any of the PNG or any images its filenames has to be in lower case and filenames should only contain lower case letters and numbers.
So images on the drawable folders which has Upper Case letters will cause the R not to be generated.
File names of images on the drawable folder which has symbols will also cause …

Folder Redirection still points to old server

Folder Redirection still points to old server for Windows 7.

A quick work around is to create a hosts file on the workstation with the old server name but the IP Address points to the new server.

Be sure to make a backup of the users folder before making any changes.

DON'T MAKE an A record (or a host record) on the DNS server for the  old server, or you will end up with a disaster. Just the hosts file on the workstation.

Hope it helps.. :)

Linux Bash Shell get x days ago

Bash script to get x days from current date.

Get yesterday's date, 2 days ago or any desired date prior from the current date.

Here's the script with comment on each line:


xdate1=$(date -d "-1 day" +"%Y%m%d")
echo $xdate1
#will return yesterday's date
#Output sample:

xdate2=$(date -d "-2 day" +"%Y%b%d")
echo $xdate2
#will return 2 days before the current date
#Output sample:

#below is just an example on how to cut the variable into year, month and day of the month

#if xdate1 has the value of -20141001
#will return 01
#will return the date of the month

#if xdate1 has the value of -2014Oct01
#will return Oct
#will return month

#if xdate1 has the value of -2014Oct01
#will return 2014
#will return the yea

echo $xcutYear1 $xcutDateMonth2
#will display the year and the month

#xToday will return todays date
xToday=$(date  +&…

Excel VBA get x days ago

A quick code snippet to get yesteday's date or a week before from the date the macro is executed.

Sub xDate()

Dim yesterdaysdate, aweekbeforefromtoday

aweekbeforefromtoday = Format(DateAdd("D", -Weekday(Date) - 1, Date), "dd-mmm-yy")

yesterdaysdate = Format(DateAdd("D", -1, Date), "dd-mmm-yy")

MsgBox yesterdaysdate
MsgBox aweekbeforefromtoday

End Sub

A variable can be set to easily change the desired number of days before the current date. 
xMinusDays = -2
yesterdaysdate = Format(DateAdd("D", xMinusDays, Date), "dd-mmm-yy")

xMinusDays is set to -2 will return 2 days before the current date

If  xMinusDays is set to -5 then it will return 5 days before from the current date


VBA code below will return x days ago depends on the value set on the parameter.

To implement in VBA code:


Sub xDate()
Dim xMinusDays
xMinusDays = -365
Dim xdays

xdays = Format(DateAdd("D", xMin…

PowerShell search file contents

PowerShell has a lot of features that makes life of a System Administrator easier.

But if you haven't learned PowerShell then it’s quite hard to appreciate the beauty of it.

Learn PowerShell and you will learn to love the power it brings.

On this example below, is quite a good and useful feature.

Log files are quite important, it will help to record data and keep track or monitor any activities on the system.

Example, if you have a log file or ".txt" files that keeps track of IP Addresses that connects to a particular server.

And need to check whether a particular IP Address has connected to the server.

One way, of course is to open one by one the log files.

Another way is to automate the process using PowerShell and let PowerShell do the task.

The code snippet below will browse through the text files in a directory and PowerShell will read or get the contents of  the text file and will check if the string specified will match its content.

If the string matches the cont…

PowerShell Move or copy files with specific date

Below is a simple PowerShell code that will move, list or copy files on a specific date.

Assign or change specific date on $xCompareDate to any desired date.

Of course, PowerShell has option also to move, list or copy files older or greater than x days.

But if there is a need to have a specific date, this script will come handy.


$xfile = Get-ChildItem  -Path d:\Logs -File |

#Get the full path, file name and the creation time of the file
Select-Object FullName, CreationTime |
Where-Object {
      #convert the creation time to string to compare dates
      $xfile = $_.CreationTime.Date.Month.ToString()  + "/" + ($_.CreationTime) + "/" +  ($_.CreationTime).Date.year.ToString()

      $xCompareDate=  "10/21/2014"

    #conditional statement if files are equal to the date compared
    #then do something if the same 
    if ($xfile -eq $xCompareDate) {
     #Display or list the full path and the filename
     #for files that will matc…

Run PowerShell script in Task Scheduler

How to run a PowerShell script using Windows Task Scheduler?

Please see image below on how to setup PowerShell script using Windows Task Scheduler.

In Program/Script textbox, type:

PowerShell.exe or type the whole path to PowerShell.exe

In Add arguments (optional) textbox type:

   -WindowStyle Hidden -File c:\Monitor.ps1

   -WindowStyle Hidden === optional parameter to hide the PowerShell script when it runs

   -File c:\Monitor.ps1 === path parameter where the script resides

Check out this Technet link for optional parameters on how to launch PowerShell.

Or you can just put the parameters on batch file and call the batch file via the task scheduler.

Type line below on a notepad and save it as a batch file ".bat".

PowerShell.exe -WindowStyle Hidden  -File c:\Monitor.ps1

To change the password for a Task Scheduler already set in Windows, check out link below:…

How to open a text file in Excel?

Excel can read and open text files.

Excel, Word or any text editing software can read, open any text file.

When opening the file on Excel, formatting will be an issue.

If text file values or data need to arrange by columns or by rows, then it could be daunting to import the file to Excel.

But if the text file is properly formatted, like values are separated by tab, comma or other symbols to segregate values or basically any delimiter characters Excel will open the text file as CSV or comma separated values without any issue.

If the text file exported from a program that has delimiters or any text file separated by delimiters then importing process to Excel will be easier.

Values will be separated based on the delimiters detected on the file.

If the file delimiter is a "tab" character or tab-delimited text file, values or data will be separated based on "tab" spacing.

"tab" refers to the actual tab, which correspond to number of spaces.
Word &quo…