Make Your Life Easier With This Software On Your Windows Cognos Server

Steven NgDaily Debug BlogLeave a Comment

Whenever I have to troubleshoot a Cognos Server issue, I always find myself wanting or asking for permission to add some software to make it easier for me to do root cause analysis. So if you’re setting up a Cognos server on Windows, you should consider adding the following software to make your life easier when problems arise.

This post is a subset of my post on my favorite Windows software, but it applies specifically for troubleshooting problems on Cognos servers (and probably other types of servers too).

Built-In Software / Microsoft Software

  • Event Viewer – It’s always handy to check the Application and System events for errors that might be related to a Cognos problem.
  • Task Manager – Use this to identify processes that are creating CPU, Memory and Disk I/O bottlenecks.
  • Steps Recorder – While far from perfect, Steps Recorder is a handy tool that will create an HTML archive file of screenshots to document the steps you took to reproduce a problem. It doesn’t always work, but when it does, it can be very useful.
  • Process Monitor / Process Explorer – Microsoft’s Sysinternals tools Process Monitor and Process Explorer are incredibly useful for checking what files are being locked by the system, or if Cognos is able to find a file it’s looking for.

Essential Software

  • Cmder – Yes, if you like the built-in DOS prompt or Powershell, you can use that instead, but I like Cmder because it is more UNIX-like. When checking logs, you can you use the head or tail command natively. You can also use tools like curl to verify if http requests are being responded to, etc.
  • PilotEdit Lite – If you have a huge log file that you want to look at (after looking at them with head or tail), most editors are going to choke on a large file. PilotEdit Lite (you can pay for more powerful versions of this software) is handy for opening up very large log files for reading.
  • Winmerge – If you are trying to compare multiple copies of a text file, like a config file, then this is a fantastic tool.
  • Atom – While Notepad++ is the go-to text editor for a lot of people, I actually prefer Atom. It’s a lot more flexible and easier to use. The main drawback is that it has a much larger disk footprint than Notepad++, but when you’re trying to analyze a whole bunch of files at once, I find that Atom is a much more stress-free experience. Other viable tools are Visual Studio Code and Sublime Edit.
  • Chrome – This is an opinionated choice, but I feel every server needs a copy of Chrome installed. It is now the most-used browser, but it also has good debugging tools. I use Chrome’s Inspector to check that remote API requests to the Cognos server are coming back in a reasonable amount of time and to check for errors related to web server configuration.
  • DBVisualizer (Free version) – A multi-platform database query tool is always handy if you’re trying to see if a database is having problems.
  • Greenshot – If you need to take a lot of screenshots and send them to Cognos support, Greenshot is very handy because it can save some additional steps of having to paste shots into Paint, etc prior to saving.
  • Windirstat – Sometimes problems are related to drive space. Windirstat is helpful for assessing what files are taking up the most space on your hard drives.
  • 7zip – While Windows has ZIP file support built in, it’s clunky at its best. 7zip is very handy for expanding things like JAR files.
  • Keepass – If you have trouble remembering the various passwords you need to administer your server, Keepass is a good secure password manager to use.

Web Sites / Other

  • VirusTotal – VirusTotal lets you upload a file to check it for viruses against several antivirus software engines.
  • Let’s Encrypt – If you need SSL certificates for your Cognos installation, Let’s Encrypt offers free certs.





Level Up Your Productivity With Crazy Keyboard Macros

Steven NgCoding, Learning, ProductivityLeave a Comment

Taran Van Hemert at Linus Tech Tips has a fantastic video on how to power up your productivity with macro keyboards. Taran does hardcore (as in intensive, not the other one) video editing for Linus Tech Tips, and top pros like him are slowed down by having to memorize keyboard shortcuts and other things to get repetitive tasks done faster.

Taran’s solution is to have specialized macro-enabled keyboards with identifying labels put on the keycaps. For such a nerdy topic, Taran does an incredibly fun deep-dive into the world of macro keyboards. If you don’t believe me, his video has over 1.1 million views at the time of writing. Put in context, we’re talking about a video on keyboard macros, not watching some celebrity trying to eat extremely hot wings. KEYBOARD MACROS.



I use a macro-enabled keyboard for my day-to-day as well, although not to the degree that Taran does. I use a now-discontinued SteelSeries Apex gaming keyboard, which has 22 programmable keys. Don’t let the “gaming” label turn you off – this keyboard boosts my productivity every day. I have 10 keys for launching apps that I’m constantly using all day, and the remaining 12 are used for constantly used functions in Atom, my IDE.

I had never heard of the Hasu USB Converter mentioned in Taran’s video, but I’m definitely getting one once they come back in stock (I wouldn’t be surprised if they’re sold out because of the Taran’s video). I have a label printer and spare keyboard, so I would probably go nuts making an Atom-focused keyboard where I can hit a single key to perform an action as opposed to relying on Atom’s command palette.

Bonus: If you want to see how hardcore Taran is at video editing, he has a 4-hour+ tutorial on Premiere Pro video editing that’s got 1.4M views (what!?). Full disclosure, too long, didn’t watch.

Postgresql Tip: Sometimes the translate function is easier than replace or regexp_replace

Steven NgDaily Debug BlogLeave a Comment


If you’re trying to replace the contents of a string in Postgresql (or Microsoft SQL Server, which uses a similar syntax) , your first instincts are probably to use the replace or regexp_replace function.

They’re both useful and handy, but there is also a translate function, which you might not know about. After all, who has time these days to read documentation? 

Translate lets you replace multiple characters simultaneously in a string without having to resort to nesting a bunch of replace functions or know any regular expressions.

Translate Explained

The syntax of the translate function is:

translate(text_to_transform, find_character_list, replace_character_list)

Let’s break down the function parameters.

text_to_transform is the string you want to search and replace

find_character_list is a list of characters you want to substitute

replace_character_list is a list of replacement characters

Both character_lists are a simple string. In general, both lists should have the same number of characters.

Replacement is based on matching the index (i.e., the position of the character in the list) of the characters in the find_character_list and replacing them with the matching index in the replace_character_list.

If, however,  find_character_list is longer than replace_character_list, occurrences of the extra characters in find_character_list are removed.

Since the example in the Postgresql documentation for this function isn’t the clearest, I’ve rewritten the example a little:

select translate('1234543355', '143', 'axy')
>> a2yx5xyy55

As you can see, ‘1’ is replaced with ‘a’, ‘4’ is replaced with ‘x’, and 3 i s replaced with ‘y’.

Let’s see what happens when we shorten the replace_character_list parameter:

select translate('1234543355', '143', 'ax')
>> a2x5x55

In this example, ‘1’ is replaced with ‘a’, ‘4’ is replaced with ‘x’, and ‘3’ is dropped altogether, since there is no matching replacement at position 3 in the replace_character_list parameter.

Real World Examples

So now let’s take a look at a real world use case for this by looking at the the last sentence of the previous section of this post. WordPress changes “dumb” apostrophes to smart apostrophes. Data with characters like smart apostrophes can cause problems in certain applications, so let’s say I wanted to translate them back to dumb apostrophes:

select translate('In this example, ‘1’ is replaced with ‘a’, ‘4’ is replaced with ‘x’, and 3 i s replaced with ‘y’', '‘’', '''''')
>> In this example, '1' is replaced with 'a', '4' is replaced with 'x', and 3 i s replaced with 'y'


Another common example is take a date string and make it look like a number. If you make the replace_character_list an empty string, all of the characters in find_character_list will be dropped.

select translate('2019-01-30 11:46:20','-: ','') 
>> 20190130114620

Note that the result above is actually a string instead of a number. Taking this example a step further,  you can translate a real date into an integer by doing this:

select translate(now()::varchar(10),'-','')::bigint
>> 20190130






Generating a Non-Expiring API Token for Facebook Insights

Steven NgDaily Debug Blog1 Comment

If you’re trying to write your own script to download your Facebook Page’s Insights information, or if you’re using Extrata, you need a Facebook API key. The problem with the keys is that they are short-lived by default, and it’s not obvious how to get one that doesn’t expire.

Facebook makes you jump through hoops to get such a key. Out of all the services I’ve done API work with, Facebook is the only one where you can’t get a permanent key in less than a minute.

I searched for multiple solutions, but some of them were outdated, or didn’t explain the steps that clearly. I’m going to try to do that for you here.

As you read the instructions, click on any of the screen shots below to see the image in full size. Note that I ran through this process several times to verify the process, so some of the timestamps on the screenshots may not be in sync.

At any point during the process, you may be re-authenticated by Facebook. Do what you need to do to complete the authentication, and you will be allowed to continue to the next step.

I’ve marked a couple of “checkpoints” where you need to copy a piece of text that will be used later in the instructions.

Create an App

Go To:

If you haven’t already logged in, log in using your Facebook account.

After you’ve authenticated, click on My Apps, and in the resulting menu, choose “Add New App”

You’ll get a popup. Provide a Display Name for your application. Use something self-explanatory like “My Facebook Insights Data”

Click on “Create App ID”.

You may be challenged with a Captcha or other security notice. Do what you need to do and submit.

Your app will be created. You might be asked to provide additional information, but you can skip that step. At this point, you want to create a Page Access Token.

Create a Page Access Token

To create a Page Access Token, you need to go to the Graph API Explorer, which is available in the Tools menu in the header. Alternatively, you can simply go to this link.

Important Note: For these instructions, I’m using the new Graph API Explorer. At the time of writing (January 2019), this was in “Beta”, but it may be live by the time you read this post. If the Beta is still active, you will see a banner at the top of the Graph API Explorer Page with a “Try it out now!” link. Click on that link before proceeding with these instructions.

In any case, Facebook may change the layout and structure of the site without notice, so these instructions may not be valid when you read them.

At the Graph API Explorer page, click on the dropdown beneat “Facebook App” and select the name of the App you created in the previous step.

Click on the User or Page dropdown. Depending on your situation, you may get put on one of two paths.

  1. A menu option called “Get Page Access Token”
  2. A subheader “Page Access Tokens” with a list of pages you have access to.

Item 2 will generally only appear if you’ve already gotten a page access token in the past for the app.

Path 1

If you got Item 1 above, click on the “Get Page Access Token” option.

You may be authenticated and asked for additional information.

If you get the popup above, click “Continue as [your user name]”

If you get the popup above, click on “Choose what you allow”. The popup below will appear.

Select the Page(s) you’d like your App to have access to. This list is based on your personal account ID. Facebook already knows what pages you administer and will only let you choose from one of them. If you don’t see the page you want, it means you need to get administrative access for that page.

Path 2

If you got Item 2 above, click on the Facebook page for which you’d like to access via Facebook’s API in that drop down menu.

Enable Insights Permission

Go to the “Add a Permission” dropdown and click on Other. This will make more permissions visible in the drop down. Scroll down and click on “read_insights”.

This will add “read_insights” to the Permissions box above the drop down. It might appear in green text as shown below.

Click on “Get Access Token”. Note you may be re-authenticated at this step. Accept and/or submit whatever you need to continue.

If the “read_insights” permission was green, it will probably turn black after this step.

Go back up to “User or Page” and re-select the name of the Facebook Page you’d like to generate a token for. This will repopulate the Access Token field at the bottom of the rightmost pane.

Click on the blue info icon (the letter “i” in a blue circle). You should get an information balloon for the current short-lived token.

Checkpoint 1

In the information balloon, make sure there is a row with the label “Page”. To the right of a label is a number, a colon, and the name of the page. For example: 12345678 : My Page Name

Write down or copy that number, because we will need it later.

In the row with the label Scopes, make sure that “read_insights” is in the list. If it is not, you need to retry all the steps in this section (“Enable Insights Permission”)

Generate Expiring Tokens

Click on the Open in Access Token Tool. This will open up a new tab or window in your browser. Note that every time you click on this button or a “Debug” button, a new tab will appear. You might want to keep track of which new tab was opened by which action you took.

The new tab will be an Access Token Debugger window. Below the heading is a text box containing a long random string, which is your short-lived Access token. It is the long blurred out box in the image below.

On this page, you need to verify a few things.

  1. That the Type is Page
  2. That the Page ID matches the Facebook Page you want insights for
  3. That the Scopes contains the “read_insights” permission

After making sure that this token is correct, click on the Extend Access Token button. The button will disappear and a new box will appear at the bottom of the page.

You should now have a token that expires in two months.

Note that sometimes you will get lucky and get your never expiring token at this step. If that’s the case, copy the token in the text box at the top of the page and save it in a safe place. You can ignore the rest of the instructions.

Click on the “Debug” button (with a gray background) beside the new Token. As mentioned earlier, this will open up a new window or tab in your browser.

Verify the information for this new token. Make sure that it is a Page Token and that it expires in two months and has the “read_insights” permission.

Copy the token at the top of the page (to the left of the blue “Debug” button).

Generate Non-Expiring Token

Go back to the browser tab that had the Graph API Explorer.

Paste that token you copied (that expires in 2 months) in the “Access Token” field at the bottom of the left pane. You’ll notice that the contents of the pane refreshed. The “User or Page” field might say “User Token” instead of for the page you want, but you can ignore that for now.

Click on information icon (letter “i” in a light blue circle) to get the information for the key you just pasted. Verify that there is a Page row and that the Scopes row contains “read_insights”. Also, the Expiration Time should be two months in the future.

At the top of Graph API explorer, there’s a text box that should contain “me?fields=id,name”. Replace this text with the Page ID you copied earlier from Checkpoint 1. If you forgot to do that, it’s the numeric portion in the Page row from the Access Token Info popup from the last step. At the end of the Page ID you pasted, add the text “?fields=access_token”

For example, if your Page ID is 12345678, then the contents of the box should be 12345678?fields=access_token

Click on the blue Submit button at the top of the page.

Checkpoint 2

You should receive a JSON object with two attributes: access_token and id. Copy the contents of the access token (but don’t include the two quotation marks). You might need this later.

Go back to the information icon (letter “i” in a light blue circle) in the Access Token field and click on it. The information for the token should remain unchanged. Click on the “Open in Access Token Tool” button.

This will open yet another browser tab with the Access Token Debugger.

In this window, the verify the information for your token. Make sure the Type is Page. You should notice that in the Expires row, the value should be “never”. You now have a non-expiring Facebook Insights Access Token. Copy your token, which is in the text box above the Access Token Info table (the one with the blue Debug button on its right) and save it somewhere safe.


If this step didn’t work, I find that pasting the access token from the JSON object you copied at Checkpoint 2 into the text field in the Access Token Debugger and clicking on the Debug button will also produce a never expiring token.

Keep in mind that at any time Facebook can throw a wrench into the process and make these instructions invalid. I’ll try to make edits to this post periodically to make sure it’s up-to-date.

Quick Hit: Programming Font Preview Tool

Steven NgBusiness Intelligence, CodingLeave a Comment

Over at, you can try out various programming fonts to see how they look with some sample code you can paste in yourself.

You might be asking, “But Steven, a monospace font is a monospace font is a monospace font. Why should I care?”

In programming in particular, you want to be able to visually spot the difference between doppelganger characters, especially when skimming. For example, a lowercase “l”, capital “I” and a number “1” look the same when you’re not looking carefully. Same goes for an uppercase “O” and the number “0”, or with ticks “`” and apostrophes “‘”. On some fonts, periods and commas look too similar. I’m sure you get the idea now.

Another consideration is font sizes. While some fonts have easily differentiated letter forms at large font sizes, they may not at smaller sizes. If you zoom out in your text editor or IDE to see more code occasionally, then this can also be a problem.

Personally, I prefer unambiguous characters, because it makes spotting bugs related to misspelling or incorrect characters much more quickly. At the very least, I have to have zeroes with a slash in them. Even though I know capital “O” normally is wider and “rounder” than a “0”, I will invariably mistake the two when skimming text.

For what it’s worth, if you do business intelligence, fonts are important for reports too. In particular, numerals in tables. For example, Hoefler & Co fonts get special treatments for numeric tables. You should check out one of their explainers on how (and why)  they ensure that numbers look right in tables.