how to protect the x++ source code - x++

Is there a way to protect or hide custom code written in X++ for AX customization. I have made some new custom Forms, Tables, ...etc, on AX and i would like to hide the source code of my customizatzaion.

It's not possible. You can only protect you code by using the correct layers.
You could always scramble/obfuscate your code, there are tools that do this like this one:
http://www.aximprove.co.uk/
However hiding your code or scrambling it is a bad idea. It goes agains everything AX stands for. When you create a product as an ISV, you partners have the right to extends that functionality for their customers. And when a customer wants to customize the solution that the partner provided, they also should be able to do that when they have the correct license. That would be impossible when the code is scrambled.
Also, imagine debugging that code...
No customer/partner should accept that a solution written in X++ is scrambled.

I do not believe this is possible. From whom are you trying to hide the code?
One solution to hide your code would be to completely remove the layer (.aod file) that you created your customizations on. However, this would take all of your modifications out of the application along with the code.
The only way to keep source code hidden from another user is to make sure that they do not have an X++ Source Code security license on their application.

Definitely you can't. The X++ code in Dynamics AX is open by definition and there is no way to obfuscate or lock the source code for users or another partners if they have a development license.
You have your code protected by layers, but it is impossible by definition to hide it.

No you can only obfuscate your code. If you want to keep functionality private, you can put code in a .NET assembly.
Like Klaas said, almost no customer would accept this. I personally wouldn't accept the code, and I work for a large customer. I need to be able to debug immediately. If your code causes an issue that stops our production, that's $150k/hour...that's why I'm on-site and available 24/7. I doubt you can provide that guarantee too.

Related

Is there a way to set Event ID on EventLog sink (in Serilog)?

I took a look at Serilog.Sinks.EventLog at Github and noticed there doesn't seem to be a way to set the Event ID of the logged event (example IDs here).
Would there exist a way to modify the sink so that it'd be possible? Perhaps with some kind of specially formatted message? I don't know if I should put this here or on Github, I'll try here first. :)
There isn't a mechanism currently for this - designing one seems tricky (but ultimately it'd be a great addition to the project!)

How to make sure that a form is only opened once?

Is it possible to make sure a user only can open one instance of a specific form, for instance CustTrans from CustTable?
Modal form is not an option. Some sort of Singleton pattern?
You can use the global cache for this, more info on MSDN: http://msdn.microsoft.com/en-us/library/aa891830.aspx. However a lot of the time the use of the global cache is a sign of bad design.
You can use the global cache to implement a singleton pattern as demonstrated here: http://www.axaptapedia.com/Singleton_pattern
Also consider alternative solutions to your problem, for example the one used on inventory journals. When you open the lines for a journal, it is marked as "in use" so no one else can open that particular journal.
Side note: I believe what you are trying to achieve is a bit of an anti-pattern. Dynamics AX uses dynalinks to link forms together. All of this functionality will be lost if you implement this.

Excel add-in with seamless Undo: possible?

I am considering implementing an Excel add-in using COM (not VBA) that will manipulate data in the worksheet.
I am going to need this add-in to seamlessly integrate with the Undo stack.
More specifically:
Any changes this add-in makes to the data need to be undoable by the user (through the standard Undo action)
The items on the Undo stack before the add-in action takes place need to be preserved
In my (albeit perfunctory) research so far, it is unclear whether or not Excel can allow for this. If it does not, this is a showstopper, and the add-in will have no value.
My question: is it possible? This is more of a "yes or no" question than a "how" question, as I need to know if I am embarking on a wild goose chase or not. However, any pointers on how it can be done would be a bonus.
Seems like it is not possible after all.
The Application.OnUndo method clears the current undo stack and places itself on top.
There doesn't seem to be anything else related to customizing undo.
It is possible.
Application.OnUndo registers an undo sub for the currently executing sub:
sub ImMakingChanges()
cells(1,1).interior.color = vbyellow
application.onundo "Undo the stupid color", "RemoveMyStupidChanges"
end sub
sub RemoveMyStupidChanges()
cells(1,1).interior.colorindex = xlnone
end sub
Obviously, saving a previous state in the wild is generally a nightmare. But here you go.
Also, your undo sub will need to be visible to the general public so that Excel can find and call it.
Apparently, this is not possible and there are no plans to support it even in Office 2013, as per the response by an MSFT employee on this thread.
Seems like it is possible after all
This can be done, but you'll have to write a pretty involved Undo handler.
Here's a link that well tell you exactly
how: http://www.jkp-ads.com/Articles/UndoWithVBA01.asp
Fortunatly the link has full sourcecode and it looks ironclad so you should have no problems.
I'll be happy to hear how/if this worked for you.
PS: here's the same link in Dutch: http://www.jkp-ads.com/Articles/UndoWithVBA01NL.asp

Sticky notes associated with web page - how to?

I have this idea for a project. Associated with any web page, i want to create notes that will be saved locally in a database, the notes will be reloaded automatically from that database the next time i visit the same page.
Creating the note is easy, but i'm looking for how to link the notes to the web page url and how to keep aware of the active web page. Any idea?
(Note: i have come to this searching on the internet: http://webkit.org/demos/sticky-notes/ - this is part of WebKit Open source projects) - this is about what i'm looking for.
Thank.
Browserdependent probably. You'll have to have a plugin for every browser type.
IE might be doable via the COM interface, but that probably would require starting IE via a way you control. So that probably will have to be a plugin too.
For browser independence, there are quite a few challenges in this one. One way would be to implement a proxy server and watch for text/html content....this will work for most of the general cases, but not every case. Handling frames for instance... which resource is the "parent" and which is the "child"? Which one contains the sticky note? I think you would have to inject some client side javascript to keep track of things, and that might break some websites.
protonotes.com is a web service version of this. Not sure how they do it though.
Actually, Daniel H hit the nail on the head mate: http://www.protonotes.com
It does exactly as you want, in fact it gives you two options to store your data, the first is hosted, the second is your own mySQL db - protonotes pipes the data from the tack-on style notes to your own db, if you prefer. This means that you're not the only person who can see the notes - access is granted by a unique 'group' key.
I've just deployed protonotes as our main online review tool for two reasons, we can save our own data, and it lacks some features which I generally label "dubious" anyway.
It's simplicity is great, the only thing I'm aware of that could cause a prob is that it dumps a bunch of stuff in the global namespace - if that's a potential problem for you.
d

Is It Ever Justified To Open A New Window/Tab From A Hyperlink?

Simple question, spurred on by the removal of the target attribute in HTML 4.0 Strict and XHTML 1.0 Strict.
I personally don't think so, as web users become more savvy, they'll ask for a new window from the browser. It annoys me when a website does this a lot.
I think the question is sort of subjective. It could be good if you're launching a javascript game or something.
Here's Neil Turner's reasons not to do it.
On social content sites like Digg or reddit I prefer links to be opened in a new window/tab, as I am constantly going back to the original page to grab more links to look at.
That being said, I think that wherever you can you should allow a logged-in user to make the decision for themselves. I know Digg allows users to choose how they want links to behave.
I think this is pretty subjective, so I'll just give my opinion as a user. I prefer if it's just the default behavior. If I want it in a new tab, I'll middle-click.
If you're going to open it in a new window, warn me like this [new window] or something.
As a law, there is an exception to every law. Although in most cases simple links are best, sometimes links in a new window are just what is needed.
For example, I very much enjoy blogs and forums that open any external links in a new window, so I don't loose track of the original post I was reading.
Another good place to put them is when you click on a picture to get a larger version in an internet store or something.
You really have to evaluate this on a case-by-case basis, but my opinon is that in the end both are necessary for a good UI.
I do if it is an external link, other than that it is probably a bad idea.
The only time I force a new window is when the page I'm designing is ment to be used as a Web Part for a Sharepoint site.
I look at it this way, if you force a new window, you have taken choice away from the user. That's bad.
With two exceptions, the answer must be a resounding "no".
Rationale: Yes, as others have already pointed out there are many cases where I prefer to have a link opened in another tab. But thanks, I'll make the determination of when and which myself. The basic tenet of the web is that the user is sitting with a user agent, a.k.a. web browser. The browser is in other words an agent on behalf of the user. If I'll want a particular link opened in another tab, I'll command-click (or ctrl-clik on another OS), and if I don't, then I'll click regularly. When a link on a web page opens the link in a new tab without my asking, it annoys me no end and breaks the predictability and familiarity of the web.
Exception 1: When clicking to see a large version of a picture or some other plain pop-up window. I see this as a separate topic.
Exception 2: Fully Ajaxy web applications, which seem to set aside most of the rules of the web anyway.
Yes, in web apps it sometimes makes sense to use a popup window when pulling up something ancillary that you need to look at without losing the content on the page.
For instance, I have used popups to display reports. In those cases (which are situational), users needed to look at the report and the screen at the same time, not navigate away to a reporting interface.

Resources