Friday, 30 September 2011

Microsoft File Transfer Manager on Windows Server 2008 R2

If you're using Windows Server 2008 R2 and having problem installing File Transfer Manager through the browser and getting the error below, the quickest alternative is to download the Microsoft File Transfer Manager installer itself.

Here's the link:


VBScript: Microsoft File Transfer Manager

There was an error launching File Transfer Manager.

If you are running Windows XP with Service Pack 2 or Windows Server 2003 
with Service Pack 1, this installation may have been blocked. If the gold 
IE Information Bar is present above, please click the bar and select the 
option to 'Install ActiveX'.


*This is the tips from my colleague - James.

Tuesday, 27 September 2011

Dynamics AX batch job relative day parameter

When we add batch job into batch list, it is quite often we need to enter a date into the query. Sometimes we wanted to add them once and works forever, we doesn't want to manually edit the query value every now and then.

Eg. You want to add a report into batch job based on current month, instead of putting a fixed value range of 01/09/2011..30/09/2011, you can put (monthRange(0,0)) or (monthRange()).

All example below will assume today's date is 30/06/2011.
Query value Description
(day(relativeDays))client server public static str day([int relativeDays])

Relative days to today's date. Default to 0 when the 'relativeDays' optional parameter is ignored. Can be offset + or -.

(day(-1)) will gives you 29/06/2011
(day(0)) will gives you 30/06/2011
(day(1)) will gives you 01/07/2011
(dayRange(relativeDaysFrom, relativeDaysTo))client server public static str dayRange([int relativeDaysFrom, int relativeDaysTo])

Relative day range from and to given today's date.
To get past 1 week + next 1 week date, you can use (-7, 7).

(dayRange(0,0)) gives you 30/06/2011 to 30/06/2011
(dayRange(-2,2)) gives you 28/06/2011 to 02/07/2011
(dayRange(0,2)) gives you 30/06/2011 to 02/07/2011
(dayRange(-2,0)) gives you 28/06/2011 to 30/06/2011
(greaterThanDate())client server public static str greaterThanDate([int relativeDays])

Similar to (day()), but give the date of after the offset.

(greaterThanDate(0)) gives you "> 30/06/2011"
(greaterThanDate(2)) gives you "> 02/07/2011"
(greaterThanDate(-2)) gives you "> 28/06/2011"
(lessThanDate())client server public static str lessThanDate([int relativeDays])

Similar to (greaterThanDate()), but the other way round.

(lessThanDate(0)) gives you "< 30/06/2011"
(lessThanDate(2)) gives you "< 02/07/2011"
(lessThanDate(-2)) gives you "< 28/06/2011"
(monthRange(relativeMonthsFrom, relativeMonthsTo))client server public static str monthRange([int relativeMonthsFrom, int relativeMonthsTo])

Similar to (dayRange()), instead of days, it gives months.
(yearRange(relativeYearsFrom, relativeYearsTo))client server public static str yearRange([int relativeYearsFrom, int relativeYearsTo])

Similar to (dayRange()), instead of days, it gives years.

These methods is coming from the class "SysQueryRangeUtil".

*NOTE: It needs the bracket around the method name.
- Correct: (day(0))
- Incorrect: day(0)

More details at:

Sample screenshot
*All screenshot taken at date 30/06/2011.




*This is the tips from my colleague - Matt.

Dynamics AX [SQL Native Client] Connection is busy with results for another command

Earlier today hit an error when trying to do an insert while looping through a ResultSet returned from stored procedure executed from Dynamics AX. The error was "[SQL Native Client]Connection is busy with results for another command".

A quick fix to it is to close the connection before the INSERT.


Connection       sQLConnection;
Statement        sQLStatement;
str              sql;
TestTableA       testTableA;
RecordInsertList rilTestTableA  = new RecordInsertList(tableNum(TestTableA));
boolean          recordInserted = false;

sql = strFmt("EXEC testStoredProc '%1'", dataAreaId);

new SqlStatementExecutePermission(sql).assert();

sQLConnection = new Connection();
sQLStatement  = sQLConnection.createStatement();
resultSet     = sQLStatement.executeQuery(sql);


    recordInserted = true;

    testTableA.Field1 = resultSet.getInt(1);
    testTableA.Field2 = resultSet.getString(2);


sQLStatement.close(); //Close the connection before the insert else it will
                      //cause the "SQL Native Client]Connection is busy with
                      //results for another command" error


You might want to consider turning off the row count in stored procedure as well else you'll get an extra result which is the row count.

Field1      Field2
----------- ----------
100001      TestData1
100002      TestData2

(2 row(s) affected)

Use "SET NOCOUNT ON" to turn it off in your stored procedure.

CREATE PROCEDURE [dbo].[testStoredProc]



SELECT Field1, Field2 FROM SourceTableA


*Updated 02/10/2012
One of my co-worker told me if this issue occur due to running stored procedure, run it without EXEC keyword will resolve it as well. I haven't test this yet but thought I should just update this post.
Eg. EXEC sp_testStoredProc 'param'

Wednesday, 21 September 2011

Classic explorer UP button / status bar free space

If these questions brought you here, you probably need "Classic Explorer":
- Missing UP button in Windows Explorer
- Missing status bar free space in Windows Explorer

In Windows Vista, Windows 7 or Windows Server 2008 / 2008 R2, two of the useful features has been removed from Windows Explorer, they're the "UP" button and "Status bar free space".

Classic Explorer return these features to you, download and install it, the "UP" button and "Free space" will show up the next time you start up Windows Explorer.


After installation and restart Windows Explorer, if the features still doesn't shows up, you might need to enable it. Another reason would be when you're still new with it, you might have accidentally & unconciously disabled it.

Follow these steps to enable/show it:
  1. Open Internet Explorer
  2. Right click on the toolbar and click on "Classics Explorer Bar"

  3. It will prompt and ask whether you want to enable the Add-on, check the "ExplorerBHO class" and click "Enable"

If you're on server and the above doesn't seems to works for you, you might want to enable browser extention as well.
  1. Go to Control Panel > Internet Options > Advanced (tab)
  2. Check the option "Enable third-party browser extensions" and click OK

Monday, 19 September 2011

Reset Nokia E71 phone

Lost my HTC Desire last week at Copenhagen, sad case.
Was given a replacement this week - Nokia E71, felt like back to stone-age.
Will temporarily use it till Android Ice-Cream-Sandwich is released.

I found that the menu is not user friendly, for those who look for quick reset of the phone, here's the key:

  1. *#7780#
    Enter that into your phone using the keypad, then it will prompt for confirmation to reset to factory default. This only reset all the settings to default factory settings, it doesn't wipe out the data.
  2. Change to "General" profile
  3. *#7370#
    Enter that into your phone using the keypad, then it will prompt for confirmation to format the phone and wipe out the data on the phone (but not on the memory card). It will restart the phone when it is done.

In case you need the default security key/pin, it is: 12345

Friday, 9 September 2011

Swap ThinkPad Fn & Ctrl key

For those who hate the position of the Fn & Ctrl key on the new ThinkPad, follows this steps to swap them.

  • Boot up your machine
  • Press the blue ThinkVantage button
  • Press F1 into BIOS
  • Goto Config > Keyboard and Mouse > Fn and Ctrl Key Swap
  • Change it to “Enabled”
  • Hit “F10” to save and exit

Wednesday, 7 September 2011

Windows Server 2008, interact with session 0 UI (net start ui0detect)

net stop ui0detect
net start ui0detect


In Windows Server 2003, you can connect to console session of the server by 'mstsc.exe /console', but this has been deprecated in Windows Server 2008. So, what happens if you have some Windows services which sometimes prompt up dialogue at the console session? If you’re new to Windows Server 2008 and coming from 2003, you might stuck for a while thinking how you can get to those dialogue, worry not, it has a built-in capability which enables you to view and to interact with the session 0 UI from your session.

if the service that is associated with an application tries to display UI elements in session 0, a built-in capability in Windows Server 2008, Windows Server 2008 R2 and in Windows Vista enables you to view and to interact with the session 0 UI from your session”.

Let’s get straight to our scenario.

One of our client is using Dynamics AX2009, although AX2009 runs batch within AOS, but there’re certain batch job won’t works that way. Eg. A batch job which instantiate Excel file, read and write to it.
It has to be run using the legacy batch framework. We use FireDaemon to setup AX client to run as a Windows service. In Windows Server 2003, the AX client will start up at session 0, if you need to interact with this AX client, you can connect to it through 'mstsc.exe /console'. But the session 0 has been made non-interactive in Windows Server 2008 and the AX client runs in that session, so how do we connect to it when we need to look at the AX client?

This is what we do:
1. Logon to the server
2. Run this command in command prompt
    (you’ll need to start the command prompt in elevated mode – right click, Run as administrator)

    IF “Interactive Services Detection” is disabled
    (enable and start it)
   - sc config UI0Detect start= auto
   - net start ui0detect

    IF “Interactive Services Detection” is enabled/manual
    (restart it)
   - net stop ui0detect
   - net start ui0detect

What it actually do is to start the UI0Detect service and prompt the user if there's a dialogue in session 0. The prompt allow user to switch from current session into the "special desktop" of the session 0 which only has interaction with the application who trigger the dialogue.

"Interactive Services Detection", this is the "UI0Detect.exe"

Running the "net stop ui0detect" and "net start ui0detect" will prompt up a window allowing you to switch to the session 0 UI. Click on the "Show me the message"

When you're done, just click on "Return now" to return to your normal desktop

Example of the UI in session 0. In this session, you only see that application itself, there won't be any Start menu, taskbar, & etc.

More references at: