From Miscellaneous

Second year software developer anniversary

I’ve officially been a Microsoft Dynamics Ax developer for 2 years! :-)

All and all it’s been a good development year. I’ve had the opportunity to go to two clients on-site, I attended the Development 3 training and a workshop at Microsoft.
With the support of seniors and management, I have come a long way with Dynamics AX in the last two years. At the same time, if you believe Peter Norvig, I have at least 8 more years to truly become a developer!

Last year I was extremely enthusiastic about my Dynaniversary and posted a celebratory post exactly on the 1st of March. I also wrote a second post two days later detailing my goals for the year. While this anniversary post may be 31 days late, I figured since it was still in the month of March, I am allowed a short reflection on the past year.

What I learned this year (in a nutshell):

  1. Synchronization in Dynamics AX is dangerous
    Let’s just say I learned that if the synchronization is taking way longer than it should be taking, it might be because it’s deleting every record in the database. #dataUpgradeIsFun
  2. Politics are important
    And so is management and project managers and other client-facing roles in the team. As a developer at a software company, you may feel you are the one contributing to the core business activity and you have the most important role to play. This year I learned and saw the importance of client-facing roles to get customers and users on board with the software and the processes.
  3. Regular Expressions
    Jamie Zawinski famously said; “Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.”. This happened to me this year, and I was left a bit disappointed with regex support in X++ (at least with the TextBuffer class).
  4. Unit Testing
    I read up all I can about unit testing from Microsoft and other resources. I had the opportunity to share my finding with our development team.
  5. Manual Testing
    I was asked to look into the options of automating our manual testing process. I am looking into third party testing automation tools build in Dynamics AX as well as Microsoft Test Manager. I went to a testing workshop at Microsoft Schiphol (NL) offices last week, and will unquestionably share a bit more about this in the future.

Review of last year’s goals:

  1. Understand InventoryPartly achieved
    I no longer quiver with fear when I hear “InventDim” or “InventSum” but I still have a long way to go. While I spend hours writing queries for a reservation type form based on inventSum, and can mostly figure out isolated issues with inventory, I don’t feel I have a good overview of the entire module and certainly wouldn’t feel comfortable explaining it to anyone.
  2. Learn the technical side of thingsPartly achieved
    I still haven’t read part 1 of ‘Inside Microsoft Dynamics AX’, but I have read isolated chapters in the book. I however do have a pile of whitepapers on my desk that I’ve read, including ‘Introduction to the SysOperation Framework’, ‘Testing Best Practices’, ‘Deploying customizations across Microsoft Dynamics environments’ and ‘Upgrade best practices’.
    I have also read a few chapters from ‘Code Complete 2’; a book on software construction I can recommend highly.
  3. Ask less help Partly achieved
    I have definitely improved a lot with this issue and disturb senior developers much less than in the past. Still, after reading this post by Ross Williamson, I feel I should continue working on this and strive to figure more things out for myself.
  4. Blog at least once a week Failed
    My last post before this one was two months ago; I definitely need to get my 22 draft posts published…
  5. Join a development real live communityFailed
    I haven’t joined a group yet; I need to work on this for next year.

Goals for next year:

  1. Learn the system technically and functionally (finally read ‘Inside Dynamics Ax’, learn MVC and SysOperation, understand inventory, the product model and of course AX7).
  2. Blog more.
  3. Do Powershell (I have this book, I have to read it and then use it).
  4. Be less awful by this time next year. (à la Steve Yegge and Jeff Atwood)
  5. Above all, be a humble programmer. (à la Edsger W. Dijkstra)

Be a humble programmer? The thing is, the more I learn, the greater the chance that I’ll lose sight of how much I don’t know. I’ll conclude with this quote by Dijkstra – may we all strive to learn more, stay humble and respects the limits of our own abilities:

We shall do a much better programming job, provided that we approach the task with a full appreciation of its tremendous difficulty, provided that we stick to modest and elegant programming languages, provided that we respect the intrinsic limitations of the human mind and approach the task as Very Humble Programmers. – Edsger W. Dijkstra in The Humble Programmer (1972)

Finding the AUC files in a flash: Where to find the AppData folder

Whenever someone experiences a bizarre, inexplicable error, you will see a standard list of steps to try and solve the problem. These standard steps usually range from deleting the user setup on a form, to restarting the AOS.

If the unsolvable issue is limited to one user, a typical task to try is to delete the Application User Cache (AUC) files in the user’s AppData folder.

The AppData folder is hidden inside the user’s folder, and can be in different locations on different servers. I can get a little lost looking for the AppData folder… Luckily I have made a mind-blowing discovery this week: Windows have a thing called path variables or system variables. Some programmers use them to do amazing things, but the simplest way to use them is to type them in windows explorer.

     For example, on any windows server, open explorer and type: %Appdata%

    Hit enter.

    You will see the Application Data folder.

    Wow.

Back to AX, to the delete the AUC files:

  1. Close the user’s client.
  2. Open explorer, type %Appdata%.
  3. Delete the all files ending with .auc.
  4. Open the client.
  5. Celebrate your victory over the mysterious error! (or move on the the next desperate step on the list)

Additional tips:

  • If you frequently have to clear out the Appdata folder, get a batch script like this one.
  • Try the same thing for other system folders like %temp% or %programdata%.
  • Learn more about system variables here. Find out how you can set up your own and use them in scripts.

Hope this nifty trick saves you time and impresses your friends!

X++ syntax highlighting with WP-GeSHi-Highlight

While I was setting up this blog, I installed WP-GeSHi-Highlight for X++ syntax high lighting. I wrote about it here. At the end of that post I wrote that I would edit the CSS of the plugin to make it look more like the X++ Editor.

I make a few small changes, this is what I have come up with so far:

  1. /// <summary>
  2. /// This job is used as an X++ sample (From Wikipedia's Microsoft Dynamics AX page)
  3. /// </summary>
  4. public static void xppTest3(Args _args)
  5. {
  6.     UserInfo userInfo;
  7.     ttsbegin;
  8.     select forupdate userInfo
  9.         where userInfo.id != 'Admin'
  10.            && userInfo.RecId == 1234567890;
  11.     while (userInfo)
  12.     {
  13.         userInfo.enable = NoYes::No;
  14.         userInfo.update();
  15.         next userInfo;
  16.     }
  17.     ttscommit;
  18. }

and this is the same code in the MorfX editor in 2012.
X++ code example

The original CSS produced this result:
CSS

I removed the dot from the line numbers and make the numbers turquoise. I also made the line height less. If you by chance use WordPress to write about X++ and have the WP-GeSHi-Highlight plugin, you are welcome to the changes I made to wp-geshi-highlight.css. The changes are small, but it just makes me feel a bit more at home with the way the code is displayed.

X++ syntax highlighting for WordPress

I’m still setting up the blog and was looking for a syntax highlighter plugin for X++. I tried a few highly rated syntax highlighters. Most does not have X++ support, so I tried using C++ and Java. All of the plugins formatted the code nicely and made the comments green, but of course did not make X++ keywords like select and while blue.

I consider X++ to be a niche, so I was surprised to find WP-GeSHi-Highlight that has support for X++. It’s highly customizable with arguments and CSS.

The plugin uses GeSHi highlight system, a .php library for formatting syntax on the web. I saw two other WordPress plugins based on GeSHi, but haven’t tried them yet:
Developer Formatter
WP-SynHighlight

It displays X++ code in WordPress like this:
CSS

Here’s the same code in the MorfX editor in 2012:
X++ code example

I’m going to try it and see how it goes. I’ll probably also make a few changes to the CSS to see if I can make it look more like the MorfX editor. I’ve noticed that it does not make integers red or comments italics, as you can see above.

UPDATE: I changed the CSS so that it looks a bit more like the MorfX editor. You can download the updated CSS at the end of this post.

Hello world!

I thought I would just leave the default WordPress first post title. For a blog of this nature it just felt too appropriate to spend any time on a more creative title.

Around six months ago I became a Microsoft Dynamics AX developer. Before I started working as an AX developer, I had never heard of Axapta, Dynamics Ax or any ERP software for that matter. Some of my friends where SAP developers, but I mostly pretended to know what that entailed. I was vastly unprepared for the world of programming that awaited me.

Form about the very first day I realized I wanted to write everything that I learn down. I was constantly getting stuck with simple tasks and had to disturb a senior developer to explain rudimentary things to me. I had a notepad, but I frequently did not have enough time to write everything on paper, especially if it involved a few lines of code. I knew I needed a blog.

It’s been six months since I started developing, so why start it now?

  • I am busy working on a data upgrade form Ax 4.0 to Ax 2012. It’s not what I expected at all. It’s a lot of trial and error and I would like to document our experiences.
  • Recently two developers started at my company. Like me, they have zero AX experience. While helping them, I realized I have actually come a long way since starting out. I learn new things every day, so the sooner I start writing them down the better.
  • I want to start studying for the Development certification and this will be a good platform to make and save study notes.
  • I had a fourth reason and as soon as I remember what it was, I’ll come back and edit this post.

Welcome to my blog where I save snippes of code and study notes of everything I learn regarding Axapta/ Microsoft Dynamics Ax and X++!