Skip to main content

Posts

Optimize PNG Files

How to optimize PNG files before publishing to Google Play?

PNG optimization removes unnecessary metadata thus, reducing the file size of the PNG file.

Iconography in Android recommends to optimize PNG files, which can be found on this link.

OptiPNG is a free software that can do the task to optimize PNG files, OptiPNG can be downloaded on this link.

OptiPNG is a tool that runs on the command line.

At command line type: Optipng without any parameters to display the options in using the tool.

Or type: optipng -h

To to optimize a single PNG file, type: optipng my_icon.png

OptiPNG  will optimize my_icon.png.

That command will come handy when optimizing two or three PNG files.

When your developing an android applications and there are lot of PNG files that need to be optimized, it will not be ideal to type one by one every single PNG file.

Since OptiPNG is a command line tool, batch file script would be the best choice to automate the process if you're running Windows OS.

Here's …

Windows Active Directory Self password resets - Need and general precautions.

Computer password authentication is a way to protect organizational resources including data from unauthorized access at almost the lowest level i.e. end user level. Every time Users login to their computers they need to enter a password to establish their identity so that unauthorized access to computer could be prevented. However, we are just looking at the positive side of the scenario, on the negative side, it can result in massive productivity loss for the reason that an employee may forgot his password and cannot log into the system resulting in employee downtime.

Taking into picture the scenario that most of the projects require team effort and employees work in collaborative environments, absence of an employee from project arena, for even a little time, could lead to failure in achieving project milestones.

Traditionally, such issues are handled by the organizations’ IT helpdesk team which consumes a significant chunk of their effort and time. The problem becomes even more crit…

Get Process ID using Batch File

PowerShell Excel Get last row and column

PowerShell code snippet below will get Excel last row on the specified workbook.

It will also find last column used.

Use PowerShell ISE to test, just make sure that on D drive there is a workbook with filename Book1x.xlsx.

Or just change the path and the file name to any values.

To release COM object check out this link below:

Technet site on how to release COM Object
Getting Rid of a COM Object (Once and For All)
http://technet.microsoft.com/en-us/library/ff730962.aspx

Here's the code snippet:

==========================

$objExcel = new-object -comobject excel.application
$objExcel.Visible = $True
$objWorkbook = $objExcel.Workbooks.Open("D:Book1x.xlsx")
$objWorksheet = $objWorkbook.Worksheets.Item(1)


$objRange = $objWorksheet.UsedRange
$a = $objRange.SpecialCells(11).row
$b = $objRange.SpecialCells(11).column
write-host "Lastrow:", $a, " Last Column:" $b

$objExcel.Quit()
 [System.Runtime.Interopservices.Marshal]::ReleaseComObject($objExcel)


==============…

Lock computer using PowerShell

To lock a computer using PowerShell, use the old school command prompt and invoke the command in PowerShell.

This can be handy to lock a computer and use Task Scheduler, to run the script at an specified time.

Link below shows on how to set Task Scheduler:
http://quickbytesstuff.blogspot.sg/2014/03/how-to-set-windows-task-scheduler.html

Below is the PowerShell code to lock a computer:


$xCmdString = {rundll32.exe user32.dll,LockWorkStation}

Invoke-Command $xCmdString


Try to run the code on PowerShell ISE to see how it works. It will just lock the computer, and you will need to press Ctrl+Alt+Delete and enter your password to login again.

List Directories Using robocopy

Robocopy command below will lists directories and subdirectories on the path specified.

It will lists folders and sub folders regardless whether the file path is too long.

Path can be a network path or a path on a local drive.

But Robocopy should be present on the system, for Windows 7 and Windows 8 users it should be included already.

For previous versions of Windows or for whatever reason that Robocopy is not on your system.

Download Robocopy on this link below:
http://www.microsoft.com/en-sg/download/details.aspx?id=17657

It's a resource kit for Windows 2003, and it includes Robocopy tool.

Robocopy command lists directories and subdirectories on the given path:

Robocopy /L /E "c:\MyFiles\Project_Notes" null *.* /log:d:\FolderList.txt

Robocopy  /L /E "\\ServerProj\SharedFolder\LongUserFolders" null *.* /log:d:\NetworkFolderList.txt


Robocopy  SourceDestinationFiles to copy or use wildcards (*.*)

  /L :: List only - don't copy, timestamp or delete any files
 …

How to check print queue with PowerShell

Checking print queue manually is quite an easy task for an IT guy but of course for some  users; it is a hard time for them trying to figure out why the printer does not print their documents when they had already click as many as they can click.
As they odds say, that “Patience is a virtue”.  In the digital world, patience indeed is a virtue. Users nowadays, their imagination is far beyond the technology.
They expect things to do in their own way, not how the machine was intended or designed to be.
So much for the drama, let’s get to PowerShell track.
PowerShell provides an easy and smart way to check print queue without any hassles.
Easy and smart way, because two lines alone will have an output that is quite informative.
Print jobs that are stuck in the print queue are easy to clear when it’s only a few of them.
Just like in the real world, when the queue is long is quite frightening to queue when time is a priority.
How the print queue works are same in the real world, it also ta…