Category Archives: Programming

Glassfish Runtime Dissapeared in Eclipse

Opening Eclipse (Mars, Java 8) today I am finding my GlasshFish Runtime missing.  I am sure this is a widespread issue at this point.  I have double checked that my GlassFish Tools plugin for Eclipse was installed and it still is.  I have a feeling I am going to be waiting around for a fix at this point.  Not a good start to trying out GlassFish for a new interop web project I am working on to interface with our archaic JDE implementation!

EnterpriseOne F4211FSEditLine – Price and Cost

I spent another week of my life struggling through the F4211FSEditLine and End Doc business functions. I was having trouble keeping the price/cost in sync between the ST and the OT when modifying the order through the business functions.

According to Oracle documentation, changes must be made to the ST in order to have the OT take them. Changes first made to the OT do not sync back to the ST. Fortunately, I wasn’t doing this so it was not my problem. It was appearing almost as though the OT was ignoring the product cost and instead trying to figure out the unit cost by dividing the extended amount (which was from prior to the quantity modification) and coming up with a calculated unit cost that wasn’t accurate.

I am embarrassed to say that I spent almost my entire last work week troubleshooting this issue. I have created a JDEDebug.log file to XML converter (available on this site at JDELOG2XML) which helps my troubleshooting efforts tremendously.

I found a real simple answer to my problem and will show some of my lack of training in JDE as a result. In the F4211FSEditLine business function, there are two parameters I had wrong. They were szCMProgramID and szCMVersion. I was passing in the program that was calling the business function instead of the order entry program and version that I wanted.

As soon as I corrected this, my price/cost was updating correctly because I was now using appropriate settings for our system based upon the processing options set in P4210.

Proper szCMProgramID and szCMVersion usage in F4211FSEditLine.
Proper szCMProgramID and szCMVersion usage in F4211FSEditLine.

Change JDE Debug on the Fly

Like me, if you work with JD Edwards than you probably dream about turning Debug on and off in JD Edwards EnterpriseOne on the fly. Too often it is unacceptable to have to log out of JD Edwards and back in. Also, leaving debug mode on all the time is a performance issue.

There is a business function in JD Edwards that allows you to turn debug on and off on the fly. This business function is best utilized in an interactive application that can also tell you what mode the session is currently in.

JD Edwards Business Function to Change Debug Settings

The business function that can change the log setting is located in B9600482. In the actual code for B9600842 there is a function call ChangeLogSettingOnFly which invokes the changeLogSettings built in API function. This function takes two parameters. The first one specifies the parameter. In this case it is “Output”. The second parameter sets the value. In the case of this setting, a “1” means that debug is on and output=file and “0” means output=none.

If you are simply calling B9600482/ChangeLogSettingOnFly from your application, use an EV01 data type variable and pass in a “1” to turn on debug and a “0” to turn it off.

JD Edwards Business Function to Check Debug Settings

If you simply want to check whether or not debug mode is on and output is to file, you can call B9600482/ChangeLogSettingOnFly and pass in a “2” and it will return a “1” to the same variable if debug is on or a “0” if debug is off.

Application

You can either program this function to turn debug on and off in a specific application that you would like to trace, or you can create and application that turns it on and off globally for a user. This simple application is seen in the screen shot below. On form load, it calls B9600482/ChangeLogSettingOnFly to check the current setting. Then, the event rule code for the button click toggles back and forth between passing a “0” and a “1” into the function.

JDE Screenshot that shows a toggle button to implement B9600482 - ChangeLogSettingOnFly function.
This application simply toggles the JDE debug logging on and off in JDE EnterpriseOne

Use this simple process to change JD Edwards debug on the fly in JD Edwards EnterpriseOne.

PHP Include vs Require

To include or to require? To include_once or require_once? In designing web pages with PHP there is a good chance you will encounter the need to include other PHP script files or HTML files. Good web design would include a template of some sort which allows pages to share a header, footer, sidebar or other similar facets. In PHP there are several commands that help you include code from another file. These are include, include_once, require, require_once.

Check out the following code segments to see how each option would work.

PHP include

<?php
     // include the code from header.php whenever encountered
     include "header.php"; 
 
?>

PHP include_once

<?php
     // include the code from header.php only the first 
     // time encountered
     include_once "header.php"; 
?>

PHP require

<?php
     // include the code from header.php whenever encountered and fail 
     // if it is not found. Throws fatal E_COMPILE_ERROR.
     require "header.php" 
?>

PHP require_once

<?php
     // include the code from header.php only the first time encountered 
     // and fail if it is not found. Throws fatal E_COMPILE_ERROR.
     require_once "header.php" 
?>

Choosing the correct method is important. If you have a page where you must determine if a user is logged in and that routine is in an external file, then you would want to make sure to use require or require_once to make sure that the page doesn’t execute without that validation passed. If you have a page that displays something relatively unnecessary then an include or include_once might be sufficient.

Create a QR Code with Javascript

I was browsing around the web and found something I never even thought about. How about creating QR codes on your website. Obviously JavaScript would be a great tool set to implement this on. I am going to work on a tutorial of how to create QR codes on WordPress and update this soon. This is the benefit I see. You are on your laptop browsing through a traditional browser and you want to transfer that session on a web page from your laptop to your mobile device. What better way than your web session being translated into a QR code?

I will post javascript later once I have the tutorial ready. For now, check out these resources that I have found to start my journey.

If you have Adobe InDesign, they make some libraries available for you. Check out the Adobe Blog Article.

Here is an example to do this in pure JavaScript with some JQuery Libraries. Pure JavaScript QR Code Generator with JQuery.

Active Directory Bulk Manager Update in PowerShell

If you run an organization on Active Directory, it is inevitable that you will have turnover occur that requires a bulk update to the manager fields in Active Directory. You can do this by hand, but that is now what great IT staff does. Great IT staff find a way to script this process knowing they will end up doing it over and over again. Here is a very simple way to do a bulk manager update in Active Directory using PowerShell and Excel.

Build the List of Updated Managers in Excel

First we need to put together an Excel file that holds the user ID and the new manager ID. You can get this list however you would like, but putting it in Excel as seen in the screen shot will get a good start towards making this data available to loop over in PowerShell.

Excel file showing user ID and manager ID columns
Build our list of users to update the manager field in Active Directory.

 

PowerShell Script to Update Active Directory from Excel

Here is our PowerShell script. It is fairly simple. Check the comments to see what the code is doing.

#create excel object
$excelFile=New-Object -ComObject "Excel.Application"
#set file path
$file = "M:\My Documents\Projects\Set Manager\User-Manager.xls"

#open excel file
$excelWorkBook=$excelFile.Workbooks.Open($file)
#set worksheet to the active one
$excelWorkSheet=$excelWorkBook.ActiveSheet

#set our start row
$currRow=2
#get the first userID and managerID values
$userID = $excelWorkSheet.Range("A$currRow").Text
$managerID = $excelWorkSheet.Range("B$currRow").Text

#check if userID and managerID have values(loop will die when either one encountered is blank
IF ($userID -and $managerID) {
	do {
	#make the change
	Get-ADUser -Identity $userID | Set-ADUser -Manager $managerID
	echo "$userID now has manager $managerID"	
	#increment the row
	$currRow++
	#get the next userID and managerID
	$userID = $excelWorkSheet.Range("A$currRow").Text
	$managerID = $excelWorkSheet.Range("B$currRow").Text
	} While ($userID -and $managerID) #loop as long as userID and managerID have values
}
#close workbook
$excelWorkBook.Close()

Talend Impossible to Initialize the Connection

Are you trying to add a connection in Talend to Microsoft SQL Server and receiving the “Impossible to Initialize the Connection” error?

In certain versions of Talend Open Studio for Data Integration, there are issues related to Microsoft SQL Server SSO.  Single Sign On (or Windows authentication) does not seem to properly work in Talend Open Studio until version 5.2.1.

In previous versions, you would have to substitute the desired pass through authentication with SQL Server authentication.  Beginning in Talend Open Studio 5.2.1 it appears to finally be corrected.

If you haven’t updated yet and desire to use SQL Server connections in Talend, then now is the best time ever!

Talend Open Studio for Data Integration: Lesson 2 – Creating a MS SQL Connection

The first thing you need to do once you have a Talend Project created is define your connections that data will be extracted from or where it will be written to.

Microsoft SQL Server is a good example of a database that many users will need to work with in ETL, so we will cover how to add that to your project in Talend.

1.  Create the Connection in Talend Repository

In your open project, look for the Repository.  This is where you will find many different objects available within your Talend project.  Specifically for adding a connection, we are going to expand the Metadata category within the repository.  Then you will need to right-click on “Db Connections” and choose “Create Connection”

Step 1 in Creating a Microsoft SQL Connection in Talend ETL
In the Talend project repository, right click on Db Connections under Metadata to add a connection to MS SQL

 

2.  Enter MS SQL Connection Name

You will then be prompted with a dialog box that will walk you through creating your connection.  In the first box which is step 1/2, enter at least a name for your connection and then click Next.

Step 2 in Creating a Microsoft SQL Connection in Talend ETL
Enter a name for your Microsoft SQL connection in Talend ETL

3.  Enter MS SQL Connection Details

Next, enter the details needed to define your connection.  Make sure to use SQL server authetication by entering a Login and Password.  Currently, Windows Authentication with SQL Server 2008 is not consistent.  After you have entered the details click “Finish”

Step 3 in Creating a Microsoft SQL Connection in Talend ETL
Enter the MS SQL connection details and click Finish

 

4.  Verify

You will now see your connection under Metadata in the Talend Repository

Adding a MS SQL connection in Talend Open Studio ETL
You will now see your Microsoft SQL connection created in Talend ETL

Talend Open Studio for Data Integration: Lesson 1 – Creating a Project

The first step in creating an ETL project in Talend Open Studio for Data Integration is to create the actual project definition. The project serves as a container for resources, including database connections, job scripts and contexts. When the application is launched, it will use a default folder in the installation directory named workspace. When a project is created, the project exists in a sub-directory in the workspace directory.

See the screenshot from Talend Open Studio for Data Integration 5.1:

Notice we have typed in a name of “OurFirstProject” in the Create a New Project field.  When we click the Create… button we get a dialog box that comes up and allows us to add a Project Description.  Clicking Finish then saves our project and gives us a new view in Open Studio as seen below.

At this point we can highlight the project we want and click Open, or we can use any of the other features.  When you arrive at this screen as the opening screen, simple click Create… to start a new project.

Lesson 4: Creating an HTML File

Even if you know how to write HTML and have all of the tags memorized, you still need to know how to create a file that the web server will access. When a web server service is installed on a workstation, it will generally create a directory to hold your web server documents.

If using Microsoft Internet Information Services, and you have installed the web server service, then you should find a directory called “wwwroot” on your hard drive. The options for this server are usually found by going to Control Panel/Administrative Tools/Internet Information Services Manager. There you can do things like configure IIS, set the home directory and set the permissions.

If you are using Apache, you will find an httpd.conf file in the location where you installed Apache. This file is going to control the Apache web server and setup things like the home directory. By default, Apache uses a directory called htdocs for the web server directory.

Ok, so you have figured out where to put your documents. Now, how do you create the file that the web server will use? The easiest way is to simply create a new file on your computer called index.htm or index.html. Often, file extensions are hidden, so you need to make sure your file is actually index.htm rather than “index.htm.txt”. Using notepad is a good way to get started, but as you write more complicated code, a tool like will help by color coding your written code.

Now to make our first HTML file, we will take the entire code segment found in Lesson 3 and paste it into our blank index.htm file. Save this file to your web server directory. If this web server is running on your own computer, you can probably just type localhost into your web browser and you should be redirected to your web server which will display your default page.

By naming your document index.htm chances are good that you will be making it your default page, but we will get more into default pages in Lesson 5 and 6 where we will cover IIS and Apache configurations respectively. See you soon!