Dynamics AX 2012

Peço desculpas se estive ausente do blog nos últimos meses, mas estivemos mergulhados no desenvolvimento do Dynamics AX 2012. Não podemos publicar detalhes antes do evento Convergente North America em abril/2011, mas todo o time está bastante empolgado com as novidades que estão vindo.

Algumas informações que já estão disponíveis hoje:

Microsoft Previews Next-Generation ERP
http://www.microsoft.com/Presspass/press/2011/jan11/1-10MSFTDynamicsAX6PR.mspx?rss_fdn=Press%20Releases

Inside Microsoft Dynamics AX – Engineering the future, our next milestone…
http://blogs.msdn.com/b/dax/archive/2011/02/02/the-next-milestone.aspx

Para quem tem acesso ao PartnerSource:

Statement of Direction
http://blogs.msdn.com/b/dax/archive/2011/02/02/the-next-milestone.aspx

Essas informações são pre-release e todas melhorias e funcionalidades estão sujeitas a mudanças sem aviso prévio.

Posted in Uncategorized | 1 Comment

Bad UI Design

We all know examples of bad design in software user-interfaces. Today I just remembered some non-IT cases that always amuse me. Mainly because I’m talking about hardware UI design (which is costly to change, so some extra care should be taken) and, even worse, related to car safety.

Continue reading

Posted in English | Leave a comment

My first code contest

Programming challenges are fun! It’s one of those things that you get better with practice and suddenly you are addicted to it. That mental click that make twenty lines of codes shrink to four, finally seeing a O(log(n)) solution in a O(n2) approach, watching your friends struggle to solve that same problem…

My first fair set of exercises was during Data Structures for Engineering class by professor Imre Simon. Several years later, another list that gave a hard time was Joel’s proposed exercises for the Microsoft interview loop. After this list I realized that I was only at the tip of the iceberg.

So I decided to give it a try. You can easily find dozens of programming contest websites by searching “programming contest” and you can join a local Coding DOJO sessions for a fast ramp-up.

My first one was the Polish SPOJ website. I found it from one of RicBit’s tweets about the Traversing Grid shorten challenge. The goal here is to write the smallest source code. That’s right, it’s ranked by the number of characters at the submitted code. The time to run and memory usage are also considered, but being concise is what they want. The nice thing about SPOJs is that they compile your code online. Nice training sessions.

Give a look at https://www.spoj.pl/SHORTEN/problems/TR_GRID/.

My entry in C has 105 chars, but there is a contestant that reached 78 chars! Note that I’m comparing C language solutions… The PERL winner has only 41 bytes. See results here. I will describe the steps that I went through, but bear in mind that I’m a novice here and there are many tricks that are still to be discovered.

You may want to try at home first before continuing…

Continue reading

Posted in C++, English | 7 Comments

Chained FINDSTRs

Now that I learnt that FINDSTR is more flexible than I thought, a quick post on how to apply chained FINDSTR calls.

For instance, if you need to search all XPOs that have the words “holiday” and “GBR” (Brazilian localization tag). You could use the “/f” switch which accepts a file containing the files to look into. First example to make it clearer:

findstr /i /m /s "holiday" *.xpo > holiday_files.txt
findstr /i /m /f:holiday_files.txt "gbr"

Which will first create a file with the list of files with “holiday” (“/m” switch) and then look in the files from this list (“/f:file”) for the “GBR” occurrence.

A special case would be using the “/f:/” switch which accepts the file list from the console (stdin). So a more direct call would be:

findstr /i /m /s "holiday" *.xpo | findstr /i /m /f:/ "gbr"

Finally, use UniqueOcc to make it beautiful!

findstr /i /m /s "holiday" *.xpo | findstr /i /f:/ "gbr" | UniqueOcc

Of course this will not search “holiday” inside GBR tags. This is another task for a future post.

Posted in Dynamics AX, English | Leave a comment

UniqueOcc: a FINDSTR formatter

The UniqueOcc (from unique occurrence) is a command-line tool that parses the output of the FINDSTR tool that we normally use to search XPO files contents (specially files in the Dynamics AX version control repositories, such as Source Depot).

The FINDSTR is really usefull for searching an entire directory and its subdirectories for XPO files containing specific words. For example, if you want to know which classes, forms, tables, etc. use the Legal Text feature, you would get a fair estimated by running:

C:\Depot\AX\Source\Application\GLS>findstr /i /s "legaltxt" *.xpo

This command will search all XPO files (*.xpo) for the “legaltxt” string, starting in the GLS directory, including all subdirectories (/s) and using an insensitive case (/i) comparison.

The classical FINDSTR output would be:

Classes\NFFiscalDoc_BR.xpo:        #    FiscalDocJourLegalTxt_BR          ...
Classes\NFFiscalDoc_BR.xpo:        #    FiscalDocTransLegalTxt_BR         ...
Classes\NFFiscalDoc_BR.xpo:      SOURCE #postLegalTxt
Classes\NFFiscalDoc_BR.xpo:        #protected void postLegalTxt()
Classes\NFFiscalDoc_BR.xpo:        #    this.postFiscalDocJourLegalTxt();
Classes\NFFiscalDoc_BR.xpo:        #            this.postFiscalDocTransLeg...
Classes\NFFiscalDoc_BR.xpo:        #        nfFiscalDoc.postLegalTxt();
Classes\NFFiscalDoc_DeliverySlip_BR.xpo:      SOURCE #getCFOPLegalTxt
Classes\NFFiscalDoc_DeliverySlip_BR.xpo:        #protected LegalTxt_BR ins...
Classes\NFFiscalDoc_DeliverySlip_BR.xpo:        #    LegalTxt_BR     local...
Classes\NFFiscalDoc_DeliverySlip_BR.xpo:        #        localLegalTxts = ...
Classes\NFFiscalDoc_DeliverySlip_BR.xpo:        #        localLegalTxts = ...
Classes\NFFiscalDoc_DeliverySlip_BR.xpo:        #        localLegalTxts = ...
Classes\NFFiscalDoc_DeliverySlip_BR.xpo:        #    return localLegalTxts
(...many, many, many more lines...)

To avoid scrolling and filter it a lot to find which artefacts do have the string you are looking for, you can use the ‘/m’ switch, which will output:

Classes\NFFiscalDoc_BR.xpo
Classes\NFFiscalDoc_DeliverySlip_BR.xpo
Classes\PurchCopying.xpo
Classes\PurchFormLetter.xpo
Classes\PurchFormLetter_Invoice.xpo
Classes\SalesCopying.xpo
Classes\SalesFormLetter.xpo
Classes\SalesFormLetter_Invoice.xpo
Data Dictionary\Base Enums\LegalTxtSection_BR.xpo
Data Dictionary\Extended Data Types\LegalTxtDescription_BR.xpo
Data Dictionary\Extended Data Types\LegalTxtId_BR.xpo
(...)

For those curious C++ programmers, the ‘/m’  switch is equivalent to:

Continue reading

Posted in C++, Dynamics AX, English | Leave a comment

Apresentação RU-5 do Dynamics AX 2009

Adicionei no blog o arquivo PowerPoint com a apresentação das features de RU-5 do Dynamics AX 2009, conforme mostrado no encontro de parceiros realizado no dia 09/agosto/2010. Lembrando que os tópicos foram:

  • Transferência de Crédito de ICMS (Fábio Vazquez)
  • Melhorias na área contábil – Book Numbers & Transaction Text (Djalma Franco)
  • Nota Fiscal Eletrônica (Rodrigo Matiazo)
  • Importação (Rodrigo Matiazo)

Coloquei o arquivo em dois formatos:

[]s

Posted in Dynamics AX, Português | Leave a comment

The Monty Hall problem

O problema de Monty Hall é famoso por mostrar como a probabilidade não é intuitiva.

O cenário é simples. No show de Monty Hall, ele apresenta três portas (A, B e C). Uma delas possui um prêmio (um carro) e as outras duas não. Bem, as outras duas contêm um bode (goat) em cada uma, mas o participante não pode levar o bode para casa…

O participante escolhe uma das portas (e.g. porta A). Monty Hall então abre uma das outras duas portas (e.g. porta B), mostrando ao participante que ela contém um bode. Feito isso, o participante pode optar entre ficar com a porta que ele escolheu (porta A) ou mudar para a outra porta (porta C). A pergunta é: a melhor estratégia é mudar ou ficar com a porta original?

A maioria das pessoas argumenta que simplesmente não faz diferença. Depois que Monty Hall abriu a porta com o bode, a segunda escolha é a que vale. Logo, qualquer escolha tem 50% de chances de ganhar o carro. Além disso, a primeira escolha só faria diferença se o participante ganhasse logo de primeira o prêmio, aí sim a segunda escolha seria uma soma de probabilidades.

Afinal, faz diferença mudar ou não? Faz diferença. A melhor estratégia é sempre trocar, o que aumenta a chance de ganhar para 67% (2/3).

Continue reading

Posted in C++, Math, Português | 2 Comments

Mais dicas do Configurador CNAB

Adicionei mais dicas para Grupo de Layouts do Configurador usado para gerar arquivos CNAB e NFe de serviços. Elas têm aparecido em blogs e fóruns. Espero que sejam úteis.

Veja em http://www.daniellandi.com/?page_id=99.

Posted in Dynamics AX, Pagamento Eletrônico, Português | Leave a comment

Extrair consulta T-SQL (SQL Server) de um objeto Query

Depurar um objeto QueryRun, Query, QueryBuildDataSource ou FormBuildDataSource no Dynamics AX 2009 pode ser enganoso. Visualizar dados no Dynamics AX Debugger é confuso e usar a opção SQL Trace às vezes não é suficiente.

O método QueryBuildDataSource::toString() é ótimo para visualizar a consulta SQL em texto:


query.dataSourceNo(1).toString()

Mas, como todos já devem ter tentado, o resultado não é uma consulta T-SQL e assim não é compatível com SQL Server.

Desenvolvi um método para extrair uma consulta T-SQL de um objeto Query que é usado na minha ferramenta Configurator Debug. Ele é simples e longe de estar otimizado, mas atende ao escopo da ferramenta (consultas criadas pelo assistente do Configurador usadas no Pagamento Eletrônico). Veja exemplos aqui de consultas em DAX-SQL e T-SQL.

Continue reading

Posted in Dynamics AX, Português, X++ | Leave a comment

Extract T-SQL (SQL Server) statement from Query object

Debugging a faulty QueryRun, Query, QueryBuildDataSource or FormBuildDataSource can be tricky in Dynamics AX 2009. Visualizing data on the Dynamics AX Debugger is cumbersome and using the SQL Trace option is sometimes not enough.

The QueryBuildDataSource::toString() method is great to visualize the SQL statement as text:


query.dataSourceNo(1).toString()

But, as everybody has probably tried, it is not a T-SQL statement and thus not compatible with SQL Server.

I developed a method to extract a T-SQL statement from a Query object which I use in my Configurator Debug tool. It is quite simple and far from optimized, but it handles the scope of that tool (queries created by the Configurator wizard used in Electronic Payments). See examples here of DAX-SQL and T-SQL.

Continue reading

Posted in Dynamics AX, English, X++ | Leave a comment