Thursday, January 31, 2019

JAVA - How to solve REF/OUT method parameters

JAVA doesn`t support REF/OUT method parameters (=parameters that could be changed in method to another value).

But you can define class instance, which can be passed and used as REF:

1) Prepare this help class with one int variable:
public class ParamWrapperInt {
  public int value;
}
2) Use it:
private boolean methodName( ParamWrapperInt _maxMinorDimension ) {
  ...
  /* work with int */
  _maxMinorDimension.value = ...
  ...
  return true;
}

Wednesday, January 30, 2019

WIN OS - How to get IP address from MAC address

"arp -a" command display context of actual ARP table.

You could use this code for find IP address by MAC address:


PS: For refreshing ARP cache you can use:
netsh interface ip delete arpcache

Wednesday, January 9, 2019

AX - How to split string to parts

The field custVendExternalItem.Description contains value "PO885895/C".

For split to strings with "/" delimiter use this code:
List list = new List( Types::String );
ListEnumerator listEnumerator;
int iCounter;
...
/* split field custVendExternalItem.Description */

list = strSplit( custVendExternalItem.Description, "/" );
                                    
listEnumerator = list.getEnumerator();    
iCounter = 1;
while ( listEnumerator.moveNext() ) {                
   if ( iCounter == 1 ) tmpTable.PO_number = listEnumerator.current();
   if ( iCounter == 2 ) tmpTable.revision = listEnumerator.current();
                
   iCounter++;  
}