Saturday, May 7, 2011

AX 2009: Enhancing your editor scripts

As an AX developer, I find myself using the built-in editor scripts that come with AX a lot. I noticed that there are several times when I would like to have a template for a display method. I create a lot of custom reports that use display methods and  it would save me time if I could build them from a template. The great thing about AX is that if you want something, you can always build it yourself.

I decided today that I was going to go ahead and jump into the Editors Scripts class and build my own display method template. I was surprised at how easy it was. I decided to look at the class that gets called when using the scripts/templates right click option.

It turns out the class being called is named EditorScripts. I took a look at the class and the method "template_method_parm" was the closest to what I was looking for. All this method does is create a dialog to get the parameters used to create the template and passes them to another method.

The parm method calls a class called xppSource and passes it the parameters that were supplied via the dialog.. In the xppSource class there was a method named parmMethod that accepts the parameters and creates the actual template.

So, all it takes is two simple methods. Once I create the two new methods for my display method template, it should be available on the right-click menu. Below is the code I used to create the template_method_display method in the EditorScripts class:

The above code creates a new dialog that requests that the user select a datatype and variable name for the display method, then passes that information to the xppSource class method "displayMethod" which I created:
This method takes the type name and the variable name from the previous dialog and formats it into a string and adds the word Display before them and the parens after "()". The code then creates a code block "{" and indents the code. Creates the return statement and ends the code block "}". 

In the end you get the following on your righ-click screen (ALT+R):


Then when you select display, you are greeted with the following dialog:
Then you must enter your desired values:
Finally, you select OK and you get your method template:

Once you create this template you can have a new display method in a matter of seconds and you can save yourself valuable keystrokes. Go ahead and have fun with the editorScripts class and increase your productivity!

Thursday, May 5, 2011

Social Coding?


When I first started writing code the general stereotype of a coder was that of a loner geek sitting in front of a computer in his mom's basement. This stereotype has gone on to cause a decline in the number of Computer Science students that this country produces every year.

We may have rightfully earned this reputation (I have at times called myself an indoor enthusiast). There are, of course, still plenty of message boards filled with smug coders who think that they are above helping a "n00b" or who are tired of students looking for homework help. These people were, until recently, the vocal minority. They were the ones screaming the loudest and that was all anyone heard.

Recently, this stereotype has changed. Now people are seeing developers as cool, sheik (thanks for pointing out my error Ellie) chic, and interesting people who have a wide variety of interests and who have social lives. This is evidenced by the influence and reach of programmers through Twitter and by a  number of code hosting/social networking sites that have recently started cropping up. There a plenty of places now for Coders to go and find other people who are interested in the same projects and languages. There are sites for finding open source projects like Ohloh, Project Kenai, Launchpad.Net, Git Hub, Source Forge, and Google Code (I'm sure there's even more than that).

There are sites like DZone and Stack Overflow that help bring the community together and solve problems. These communities help programmers from all over the world share ideas, knowledge, and allow for easier collaboration.

The Social Web has been able to bring together like minded people from all over the world and has helped to make computing better for everyone.It has also, hopefully, put to rest many of the bad stereotypes about computer programmers. This should also help to increase the number of students who choose Computer Science as their major and increase awareness of the need to begin teaching computer science in primary school. If you are a programmer (or a parent) find out why schools should teach computer science and the facts about CS education.


Saturday, April 30, 2011

Exporting Labels with .XPO's in Dynamics AX 2009

     As an AX developer, I have learned that there is (almost always) at least two ways to accomplish any task inside the Microsoft Dynamics AX Environment. I have had the opportunity to work with several consultant developers   and I was (and still am) surprised by the fact that none of them knew the procedure for importing and exporting .XPO files with labels. Instead what they do is provide you with either an XPO (if you are lucky, most times they send a layer even if they only changed one object) and a label file. You must then take the AOS offline so that you can copy the label files over and then restart the AOS. This can be a real hassle, especially if you are receiving these updates several times a day (it is even more annoying when you find out that they gave you an older label file and some labels are missing).
     I found this so surprising (and aggravating) that I decided to do a little Google research and what I learned was that there is no Good information out there about how to perform this procedure. So I am taking it upon myself to make this information available. You're welcome Internet:
     I set up a new test project and I created a new report and a new menu item for that report. I created a new label (@HLY739) for it:
Next, you must export the project:
Then you need to make sure that you check the box that says"Export Labels":
For my purposes, I have unselected all the languages and only selected English (United States). If you or your company uses additional languages you should check those here.Then click OK and you should get the export completed message in the compiler output window:
If that is successful, then you are ready to import the XPO into another environment:
Make sure that you have selected the radio button for application objects and labels (you can also do just the application objects or just the labels). If you select the show details check box and then click on the Labels tab, you can see all of the labels in the project an can even manually select weather or not you would like to import the label. 
Then for the last step, you can check and make sure that the label was imported correctly:

As you can see, the label has been successfully added to the new environment with absolutely no down time! 

Thursday, January 27, 2011

This is NOT the year of the Linux Desktop!

Every year around this time there are a ton of blog posts and news articles about how this will finally be the year of Linux on the Desktop. NO IT WON'T! I love Linux, I use it all the time, I think that there are several terrific distributions. I even switched my parents over to Ubuntu. The problem exists, not just with Linux, but with the rest of the software development world. Below are the four reasons why I think that this still won't be the year.

Timeliness
Whenever something new comes out it, almost always, isn't immediately available for Linux. The Linux versions of software, despite being released later, are usually a revision behind the Windows and Mac versions. Even Google is guilty of this. I can't get my own wife to switch over because she uses Picasa and the Linux version is missing several key features, besides being much slower in the picture upload process.

Gaming
The personal computer is very much an entertainment device. People enjoy playing games on their computer. If they can not play all of the latest games, then people are not going to choose your operating system. Valve recently released their Steam client on the Mac. The Mac run a version of Unix, which is very similar to Linux. Valve still hasn't released a Steam client for Linux and has stated that they don't plan to either.

I will admit that Play On Linux is pretty awesome and I have done some preliminary testing with it and the Steam client does run on it (although it is pretty buggy and crashed a lot). I was able to play a few games and they seem to run reasonably well. I was also impressed by the ease of installation. The downfall is that Play on Linux does not make every single game run on Linux and they will always be running in some form of emulation mode. This emulation mode will make the game performance less than what it would be if it ran natively. To gamers, every bit of performance matters!


Hardware
While every new iteration of Linux adds more hardware support and better drivers (Nvidia finally got dual monitors working correctly in Ubuntu 10.10 and Xorg broke it). There are still way too many pieces of hardware that either don't work right or don't work at all. Most of the Linux hackers out there can find a way around this, which is great for us, but not so awesome for everyone else. Wireless connectivity is still pretty broken and I have yet to find a distribution that doesn't make me want to shove and icepick through my eye during the connection process.


Marketing and Public Relations
Finally, we have the real issue with Linux. Marketing and public relations is all but non-existent. Word of mouth is great, but it is keeping Linux relegated to a small community. If you want other people to use it, get some major software companies to start porting applications to Linux (hell, Microsoft makes Office for the Mac, it shouldn't be that difficult). Make some commercials, get some more hardware vendors to ship machines already dual booted so people can play with it.  DO SOMETHING AS A GROUP FOR ONCE! There is a very large community of Linux users and Linux based companies. Create some sort of non-profit marketing consortium that will push the Linux agenda forward.

There have been some exciting developments and uses for Linux based electronics and I will continue to use them, but I just don't think that Linux will hit critical mass without a concentrated marketing effort and the support of hardware and software suppliers.