Skip to content

Instantly share code, notes, and snippets.

@andyhuey
andyhuey / isUserInRole.x++
Created March 3, 2014 15:07
isUserInRole - bad
/// <summary>
/// return true is the specified user is in any of the roles in the roleNames container.
/// </summary>
/// <param name="axUserId">
/// AX user id, e.g. curUserId()
/// </param>
/// <param name="roleNames">
/// container of role names to check. (use role NAME, not label.)
/// </param>
/// <returns>
@andyhuey
andyhuey / isUserInRole.x++
Created March 3, 2014 15:09
isUserInRole - good
/// <summary>
/// return true is the specified user is in any of the roles in the roleNames container.
/// </summary>
/// <param name="axUserId">
/// AX user id, e.g. curUserId()
/// </param>
/// <param name="roleNames">
/// container of role names to check. (use role NAME, not label.)
/// </param>
/// <returns>
static void AjhBase36Test(Args _args)
{
// ajh 2014-05-07: 611.23
// adapted from http://en.wikipedia.org/wiki/Base_36.
// note: handles non-negative integers only.
#define.NBASE(36)
#define.CLIST("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")
int64 base36_decode(str base36_input)
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
namespace MySuit.MySuitV2.BLL
{
public class Utility
{
@andyhuey
andyhuey / AjhTestRSL
Created October 10, 2014 23:11
RecordSortedList test
static void AjhTestRSL(Args _args)
{
CustTable custTable;
RecordSortedList myList = new RecordSortedList(tableNum(CustTable));
boolean moreRecs;
myList.sortOrder(fieldNum(CustTable, AccountNum));
// create a list
while select firstOnly10 * from custTable
@andyhuey
andyhuey / tfpt_ex1.ps1
Last active August 29, 2015 14:16
TFPT query exmple
# Given AX project #, return ID.
param (
[string]$projno = $( Read-Host "Enter project # (e.g. 123.4)" )
)
[string]$tfpt = "C:\Program Files (x86)\Microsoft Team Foundation Server 2012 Power Tools\TFPT.EXE"
[string]$svr = "http://myTfsServer:8080/tfs/defaultcollection"
[string]$projname = "myProjName"
[string]$query = "SELECT [System.Id], [System.Title] FROM WorkItems " +
"WHERE [System.TeamProject] = '$projname' " +
@andyhuey
andyhuey / my_query_alter.php
Created August 28, 2012 01:02
alter a view query
<?php
/**
* implements hook_query_alter().
*/
function MY_MODULE_query_alter(QueryAlterableInterface $query) {
if ($query->hasAllTags('views', 'views_university_search')) {
$ord =& $query->getOrderBy();
if (array_key_exists('location_country', $ord)) {
public static AjhDevLaunchStartupProjects construct()
{
return new AjhDevLaunchStartupProjects();
}
public void openAllProjects()
{
// get the project list, and open all projects.
Array projects;
int i;
ProjectNode sharedProjects, privateProjects, projectNode;
projects = this.getProjectList();
sharedProjects = Infolog.projectRootNode().AOTfindChild('Shared');
// ajh 2013-04-03: my own startup project thing...
case menuitemActionStr(AjhDevStartupProjectAdd):
case menuitemActionStr(AjhDevStartupProjectRemove):
if (firstNode.handle() != classNum(ProjectNode) || !match(#pathProjects, firstNode.treeNodePath()))
{
return 0;
}
return 1;