Moving out (slowly)

This blog has been dormant for a little less than a year now. This doesn’t bode well for the site (search result ranking, impressions from visitors, etc.). It is time to re-invent, start with a clean slate. This site will still remain intact, I will still respond to comments/queries etc. The next post will be the announcement of the new site and a link to it.

Recovering from the xxx-exploiter attack

At the risk of painting a big circular target across my site, I would like to document how I recovered from a recent hack on my website.

About the Hack/Attack

Information on this is pretty sparse across the internet. I struggled initially to understand what was going on. In the simplest of terms, it is a basic redirection attack. Going to the website URL will take you to a different website (contrary to the URL name, there is nothing adult about the website/content). You will also not be able to login to your WordPress admin dashboard.

However, as long as you have FTP access to your website and a backend way to access the MySQL database (like phpMyAdmin), you can fix this issue without more than a few scratches.

The instructions assume a fair understanding of hosting, website management. PHP knowledge is not essential. If you need additional instructions, feel free to drop a comment and I will be glad to help out.

Cleaning Up

The attack leaves multiple unwanted files/modifications on your website. Cleaning up will therefore take some effort. My best suggestion is to download the entire site onto your local computer. I don’t see any files infected by viruses, but you should scan the entire downloaded folder with a good anti-virus before you begin tinkering around.

Login to your website’s control panel and through a DB access tool such as PHPMyAdmin. Export the entire database as a .sql file and save it on your local machine. We will attack it in a moment.

Starting at the root folder of your WordPress installation, find for the file xxx.php and delete it. You should see some 404.html files as well. Delete them as well.

Impacted wp-content folder from the attack

Parallely, speak with your host and have them reset your account. Once reset, upload a coming soon page (something like this [Download Files] or this [Download Files]

The easy parts are over, next you need to fix the .htaccess files. Starting with the website root, search for all .htaccess files. Not all are infected/need to be removed, some are simply put by your plugins to prevent direct access to plugin folders. Search for any Redirect instructions. I found one in my uploads folder

Redirect 301 / http://{nasty-url-here}/loading/

Clean up all such redirects. You can also take a step further and build a stronger .htaccess file by following the instructions in the next section. With this, your website is all cleaned up, let’s look at the database you have exported.

Open the .sql file and search the hacker’s URL. You may/may not find it. However, you will likely find that the field user_login in the tcic_users table has been replaced to with the hacker’s id. Replace this to your original user id. It is better to change the password, but let’s wait to upload the database before making the change.

Using PHPMyAdmin, import the database by uploading the .sql file. Then go to the tcic_users table and click on Edit against the line with your user id. For the field user_pass, enter the password of your choice in the Value field and set function as MD5 (See image below). You can also double check the values in the other fields and make changes if required. Once you are all set, click on Go and the password is changed.

This concludes the part of cleaning up. However, I recommend reading further on the next page on how you can fortify your wordpress against similar attacks.

Enable email draft deletion in Outlook

At work, I often work from different machines and some of them are cocooned behind different networks. This makes it quite difficult to pick up things like reviewing a document or preparing a list. The one constant feature across is being able to use Outlook to access company emails. Rather than emailing the work-in-progress documents to myself, I save them as drafts.

Bloated Drafts FolderIn the end, I usually end up with a bloated Drafts folder and I deeply missed being able to delete a draft directly from the compose window. I thought I had to fix the problem by customizing outlook forms and almost began searching where to start on Google, when I realized I should probably look at customizing the ribbon.

  • Begin composing a new Mail, click on File and choose Options
  • In the next pop-up, select Customize Ribbon
  • There will be two listboxes. In the first one on the left, change the Choose commands from to All Commands
  • In the right side, the drop down Customize the Ribbon would be Main Tabs. The space below would show New Mail Message. Click on the text to select it (don’t click on the checkbox).
  • Click on the New Group. A new entry New Group (custom) will show at the bottom of the list
  • Click on the Rename button and change the display name to anything of your choice. I named it Action and for good measure, selected an icon with a cross in it
  • Now, back to the list on the left. Scroll till you see Delete, it will be between a couple of other delete actions that pertain to tables. Select it and click on the Add >> button.
  • You can now see Delete under your custom group
  • Click on Ok and you are good to go

Here is the final result.

Delete Action added to Ribbon Tab

You can use this method to add any existing action to your ribbon tabs without having to customize forms. The actions remain even after you reopen Outlook.

PS: You will have to do this in each instance of Outlook you run, i.e. across workstations

Download editable vector badges in Photoshop

Badges are everywhere, you see them on posters, banners. You can add them to your next project by downloading the zipped PSD below and editing it to suit your need. No part of the badge is rasterized, so have fun scaling them up or down.


Showcase of badges


118.5 KiB

[WordPress Plugin] – The WP Wingman

I was link-surfing from a question on and ended up with an article that referenced a plugin called The Dude. That inspired me to create a plugin that gives you random articles from Barney Stinson’s The Bro Code.

Installation is simple, just unzip and activate the plugin. You should be able to see it in your WordPress Admin Dashboard like this.

WP Wingman in Action

Sounds interesting? Download it from the link below or head over to GitHub and fork it to make the plugin legendary.

The WP Wingman
The WP Wingman
Version: 1.0
7.5 KiB

Many needles in a haystack – The excel solution

I am sure you have received a huge table of data in excel and have to search for a few keywords (not just one). As an example, let’s say you receive a huge list of employee names, ids etc from HR of employees who need to complete a particular training. You want to identify if any of your team members is on that list. Even with a small 10 member team, searching becomes a chore. Here is how to create a simple macro that can be invoked anytime to perform a looped search.


Open a new excel workbook. Save the workbook as an Excel Macro-Enabled Workbook. The workbook will get saved with a .xlsm extension. Press Alt+F11 to open the VBA IDE. You will see the Project Explorer to the left. Right click on Microsoft Excel Objects, choose Insert from the menu and select Module. We will be adding our code to this module


Now back to the excel sheet (grid). There is not much setup to do here; Our macro will work with any selection irrespective of the column/row. In any case, if you want to format and beautify this, go ahead and do so.


On to coding. Double click the Module (most likely called Module1) and add the following code

Option Explicit
' MACRO to perform looped find
Public Sub LoopedFind()
    ' How to use
    ' 1> Select the range of cells which need to be searched
    ' 2> Invoke the LoopedFind macro (Alt+F8 -> Select LoopedFind)
    ' 3> Navigate to the folder where the excel sheet to be searched is located
    ' 4> Results will appear as new columns in the same sheet
    Dim FileName As Variant
    Dim SrcWkbook As Workbook
    Dim SrcWksheet As Worksheet
    Dim DestWksheet As Worksheet
    Dim RangeSource As Range
    Dim Cell As Range
    Dim FoundCell As Range
    Dim SrcFilePath As String
    Dim SrcFileName As String
    Dim SrcWksheetName As String
    Dim RowNum As Long
    Dim lColumn As Long
    Set RangeSource = Application.Selection
    Set DestWksheet = ActiveWorkbook.ActiveSheet
    ' Show File Open window with only xls files. If you are
    ' looking for .xls (not the newer fancy .xlsx ones)
    ' changes below
    FileName = Application.GetOpenFilename( _
        FileFilter:="Excel Files (*.xlsx), *.xlsx", _
        FilterIndex:=1, _
        Title:="Select a Workbook")
    If FileName = False Then Exit Sub
    Application.DisplayStatusBar = True
    Application.StatusBar = "Macro started"
    Set SrcWkbook = Workbooks.Open(FileName:=FileName)
    For Each SrcWksheet In SrcWkbook.Sheets
        SrcFilePath = SrcWkbook.Path
        SrcFileName = SrcWkbook.Name
        SrcWksheetName = SrcWksheet.Name
        For Each Cell In RangeSource
            ' Identify the last column with data for the current row
            lColumn = DestWksheet.Cells(Cell.Row, Columns.Count).End(xlToLeft).Column + 1
            Application.StatusBar = "Currently Finding : " & Cell.Value & " in " & SrcWksheet.Name
            Set FoundCell = SrcWksheet.Cells.Find(what:=Cell.Value, _
                    LookIn:=xlValues, Lookat:=xlWhole, MatchCase:=False)
            If Not FoundCell Is Nothing Then
                RowNum = FoundCell.Row
                DestWksheet.Cells(Cell.Row, lColumn).Value = "› " & SrcWksheetName & " » " & FoundCell.Address
            End If
            Set FoundCell = Nothing
        Next Cell
    Next SrcWksheet
    SrcWkbook.Close Savechanges:=False
    Application.StatusBar = False
End Sub

I won’t go too much into details, but here is the basic algorithm.


  • Allow user to select the file which needs to be searched in (your haystack basically)
  • Loop through each sheet in the user selected workbook
  • For each cell in the selected source, find if the value exists in the sheet of the opened workbook
  • If match found, populate the next available column beside the cell value being searched (needle) with the worksheet name and cell address

Save the workbook. Add some data to test. I have put in names of some cricketers in my workbook like the image to the right. To search, I select the data and press Alt+F8. This brings the list of available macros. Once you choose "LoopedFind", the code begins executing and you can choose the file with the large amount of data. The final results are here to see.


DestWksheet.Cells(Cell.Row, lColumn).Value = "› " & SrcWksheetName & " » " & FoundCell.Address

This line above is the code that outputs the worksheet name and address. However, you can change this to suit your purpose. If you need a specific data retrieved you can manipulate FoundCell.Address to reference another column in the row where data is found and get its value. (Somewhat like a Dynamic VLOOKUP that picks up the filename at runtime)

I wish I had taken some effort to put this piece of code earlier. Not just with names, ids, I see this sheet being useful in a number of places. For one, whenever we work on a release in the mainframe environment, we create an impact analysis report. It is usually a mammoth sheet with the list of all copybook changes and the impacted programs. Out of the 1000 rows, my team would be responsible for a smaller fraction of programs. Instead of manually checking my list of programs against the IAR, I could perform this looped find and quickly know how many my team’s programs are impacted.

Hope you found this useful. Share your thoughts and feedback through the comments section.

Playground – Photo filter effects with Photoshop Gradients

I was recently creating album art for the BBC radio series “Cabin Pressure” (here are the final covers). I realized that the end result looked a lot like the filters in Instagram/effects in some Android camera apps. It is actually quite easy to get the end result and trust me there is no right/wrong way to do this.


2 Step Easy Filter
Click to zoom
  • Take an image of your choice and open it in Photoshop
  • Create a new layer above this and give it a nice gradient. In our example, I have given a light green (#8fd042) to dark green (#4f951f) circular gradient
  • Reduce opacity to 50% and change layer blending to “Darken”
  • Create one more layer above this and give it another gradient. I have used a circular gradient with blues (#4f7abc -> #74edf1) with the center of the gradient focused on the statue of the fish.
  • Change layer blending to “Divide”
  • Presto! You now have some cool effects on your photo. Play around with Layer blending options, Opacity and different color gradients to create cool effects

Show off your outputs in the comments section below!

[Tutorial] Create a folder structure in Excel

I am creating a knowledge repository for my team and I wanted to create a neat index file. The aim is to have a tree structure and the end result to be a HTML page. I have started with the HTML Kickstart framework and with some help from the internet, I am in the progress of creating a nice intranet page for the repository (I will probably add a post on my experience once complete). In the meanwhile, I need a temporary index that I can share with others so that they can access documents right away.

I decided to go the Excel way, but without macros or other complex steps. You too can create a basic tree structure for any folder to help you keep track of its contents. So if you have the folder ready and Microsoft Excel is just a double-click away, let’s get started.
1 As always start with a blank new workbook. The screenshots are from Excel 2013, but would work on pretty much every version from 2003.

2 Hide Gridlines. From the ribbon, goto View and uncheck the Gridlines box to remove the grid and be left with a blank white worksheet.

3 Adjust Column Widths. Select fifteen columns from C through Q to 4. Here are the screenshots on how to do it.

4 Navigate to the folder of choice and with the Shift Key pressed, right click on an empty area of the folder. In the contextual menu, select Open command window here.

5 List the contents of the directory (including sub-directories) into a text file by issuing a dir /s /b > tree.txt command from the command window.

6 Open the text file tree.txt (it will now be visible in the Explorer window) and copy the entire content. Paste the content into columns A & columns C of the excel worksheet.

7 Select contents of Column A & Column C and sort them on Column C by alphabetical order.

8 Select all cells of Column A and change the font color to White (or the background color of the sheet if you have at some point changed it).

9 Split data into columns with text to columns by selecting all data in column C and the Text to Columns option on screen. The delimiter is \.

10 Select all the cells from column C to Q with data and we shall apply some conditional formatting to make the content look better. From the Home tab in the ribbon, select Conditional Formatting and click on New Rule. From the popup window, select “Use a Formula to determine which cells to format” and enter the following formula =AND(NOT(ISBLANK(C2)),C2=C1) Please note that I have filled data from row 2 and cell selection has started from C2
After entering the formula, click on Format and make the following changes. First, within the Font tab, set Color as White (or the worksheet background color). Next, in the border tab, give a right border of your choice. I have chosen a dotted grey line.

11 Here is the resultant screen after conditional formatting.

12 You can hide (or even delete) the columns which contain the information upto the current folder. In my example, I was in the FirefoxPortable folder and I could hide/delete all columns that contained D: or Program Files or FirefoxPortable. It reduces clutter and makes the sheet more presentable.

13 Create hyperlinks in column B to navigate to the directory/file within seconds by entering the formula =HYPERLINK(A2,8) in cell B2. There is nothing magical about the number 8, it is just that it represents a mouse icon in Wingdings. You can choose your own font and your own text instead of 8

14 Finally, drag the bottom right corner of cell B2 till the last row with data. This copies the formula in cell B2 making all other cells in Column B a hyperlink.

There you go, a navigable Folder structure right out of Excel.

Excel Macro : Repetitive Ctrl+C (and some more)

My Excel skills are being tested quite often now. I had to work on a repetitive task to close a large list of support incidents. The input list of incident numbers were in an excel sheet and for each, I had to go to the incident management software and update some fields (primarily drop-down selections) prior to closure. As any gamer would attest, it is not much fun having to switch between two sides of the keyboard when also working with a mouse. Hence the act of Ctrl+C & Ctrl+V would be interrupted by having to use the down arrow and get to the next cell. I decided to write an Excel Macro that would go to the next cell below, select it and copy it. If you think it would be tough, think again. Here is the code.

Public Sub NextRowCopy()
    Dim currRow As Integer
    currRow = ActiveCell.Row
    currRow = currRow + 1
    Range("C" & currRow).Select
End Sub

I pasted this in a new module in my workbook (Alt+F11 » Right Click Workbook in Project Explorer to the left and Insert » Module). As you would have guessed, the incident numbers were in column C. After saving the macro, I went back to the workbook. I pressed Alt+F8 to see the NextRowCopy macro in the popup window. Selected it and clicked on Options, assigned it a shortcut Ctrl+Q (again for the same reason that Q was to the same side of the keyboard as C).

Once I updated the Incident, I would do a Ctrl+Q and I would have the next incident number to be worked on.

The And Some More part

Most of the fields to be updated in the system were dropdown selections, but there was a standard text to be updated as well. I couldn’t copy it from excel since it would change my cursor location and I didn’t want to have to open a notepad and cycle three windows for this. I searched for a multiple clipboard manager and decided to use QuickTextPaste. It lets you assign shortcuts to predefined text, run programs and more.

My task was completed and while looking back at my macro, I think I could have had excel do the copy of the predefined text as well. Let us say that the existing data was from columns A through N. I could add the text I needed to paste in Column Q and have the macro check where I was currently and move to the right cell.

Public Sub NextRowCopy()
    Dim currRow As Integer
    currRow = ActiveCell.Row
    currCol = ActiveCell.Column
    If currCol = 3 Then
        ' We are in the incidents column. Switch to column O
        currCol = "O"
        ' We are in new column O, switch to column C in the next row
        currCol = "C"
        currRow = currRow + 1
    End If
    Range(currCol & currRow).Select
End Sub

Each time the macro ran, my clipboard had either the incident to be searched or the text to be entered to close the incident. Total time saved:  30 minutes