tag:blogger.com,1999:blog-55209000245370248432024-03-04T20:59:08.720-08:00Richard GolebiowskiNo words wasted! Getting to the point about the work I do, the problems I deal with, and some links to posts about where I work.Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.comBlogger148125tag:blogger.com,1999:blog-5520900024537024843.post-26176686176501862832024-02-28T08:14:00.000-08:002024-02-28T08:14:22.550-08:00Salesforce - Export Developer Console Query ResultsAfter the query is run, rught click on the query results and select <b>Inspect</b>. Look for the table tag, and then click <b>Copy</b> and then <b>Copy element</b>. Paste the copied results into Excel.Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-25853083948528122342023-12-19T08:33:00.000-08:002023-12-19T08:33:22.294-08:00Logitech C920 - Not Recognized by Windows 11For me, the issue was caused by the USB ports. The webcam would not work on the USB hub that I was using with my laptop, a ThinkPad, and it would only work on certain ports on the ThinkPad USB-C Dock Gen 2.Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-40380833022283830552023-07-26T16:05:00.000-07:002023-07-26T16:05:21.664-07:00Windows 10 Polish Key Combinations<p style="font-size: 22px">Install the Polish language pack. Then use the following key combinations for the Polish characters:<br></p>
<p style="font-size: 22px">
Right-Alt + Z = ż<br>
Right-Alt + X = ź<br>
Right-Alt + S = ś<br>
Right-Alt + C = ć<br>
Right-Alt + L = ł<br>
Right-Alt + O = ó<br>
Right-Alt + E = ę<br>
Right-Alt + A = ą<br>
Right-Alt + N = ń<br>
</p>Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-65773011717436520062023-03-29T03:43:00.004-07:002023-03-29T06:59:34.878-07:00A Simple Collatz Proof<b>A Simple Collatz Proof</b>
Proof by exhaustion and reductio ad absurdum.<br><br>
1. It has already been proven that the Collatz conjecture is true for a large set of odd numbers. This is the set Po. The largest number in the set is Pn.<br>
2. The Collatz series for all numbers n repeats at the interval 4n + 1. This set, the extended set of the Collatz series for all odd numbers, is the set Pi. For Pn, there are an infinite subset of numbers in Pi that are greater than Pn. This is the set, Pm.<br>
3. Consider the next highest odd number, an odd number that is the largest number in the Po set plus two: N = Pn + 2.<br>
4. Either some number in the Collatz series for N will be equal to a number in the Pm set or a number in the Po set, or they will not. If no number in the Collatz series for N is equal to a number in either set, there would exist an infinite set of odd numbers where the Collatz conjecture is false, with a series of numbers that never intersect with the series of numbers where the conjecture has been proven true. Given the size of the Pm set and the Po set, this is impossible! Therefore, the conjecture is true for all numbers.<br>
5. Q.E.D.<br><br>
Note: I separated out the Pm set to show that for any odd number that is tested, there will always be an infinite set of odd numbers known to be true for Collatz that are greater than the number being tested. So, even when the numbers in a series are rising, they can still intersect with a number that, indirectly, has been proven true for the conjecture.<br><br>
Example for step 2: For n = 27, the Collatz series will be the same for 27, 4(27) + 1, 4(4(27) +1) + 1, 4(4(4(27) +1) + 1) + 1, and so on. And this would extend with all of the numbers that make up the Collatz series for 27: 41, 31, 47, 71, 107, 161, 121, 91, 137, 103, 155, 233, 175, 263, 395, 593, 445, 167, 251, 377, 283, 425, 319, 479, 719, 1079, 1619, 2429, 911, 1367, 2051, 3077, 577, 433, 325, 61, 23, 35, 53, 5, and 1.
Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-41650003358447849162022-12-09T07:25:00.000-08:002022-12-09T07:25:08.842-08:00Windows - Microsoft Edge browser pops up after logging inI've been dealing with this issue on a new laptop and had an aha moment this morning. The lock screen settings in MS Windows might cause the browser to open after you log in when the lock screen preview background is set to Windows spotlight. This behavior seems to be inconsistant.Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-70308570405675650822022-08-29T10:26:00.004-07:002022-08-29T10:26:55.916-07:00Golang - "no required module provides package" errorWe all make simple mistakes every now and then. In my case, I missplelled a file name, so the file extension was not ".go". It took me some time to figure out because of the error message.Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-2636206679095932932022-06-07T02:54:00.005-07:002022-06-07T03:42:41.889-07:00Math - My Collatz Conjecture ProofWhile doing some math courses on Coursera, I came accross the Colatz conjecture and decided to give a try at the proof. I show that the Collatz function is equal to te function f(n) = 3n + b, where n is the number and b is the least significant bit (LSB).<br/><a href="https://docs.google.com/document/d/e/2PACX-1vQu2pm8LugVZSfkWxA9DDIAoNtnbbyU0sVALQXekrd0vEzaCWn7CR8hD741usPMn5elL3nd2fmxFZWx/pub" target="_blank" rel="nofollow">Link to my proof.</a>
Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-27664317125672454612022-05-23T16:34:00.002-07:002022-12-08T11:47:00.448-08:00jQuery - AJAX to change the value in an Input boxI made a form with two input boxes, one with an id of vaue2 and another with an id of value3. The value in the value3 input gets loaded with a value from the database when I tab from value2 to value3. This is the form:
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
<form action="{{.Page}}" name="form1" id="form1" method="POST" target="iframename" onsubmit="event.stopPropagation(); event.preventDefault();">
<table id="input4Form" style="vertical-align: middle;">
<tr>
<td></td><td colspan="4"><b>{{.Title}}</b></td>
</tr>
<tr>
<td style="text-align: right;">{{.Label1}}</td>
<td><input id="value1" type="text" name="value1" title="{{.In1_Title}}" maxlength="60" onkeydown="if (event.keyCode == 13) document.getElementById('input2search').click()"/></td>
<td> </td>
<td style="text-align: right">{{.Label2}}</td>
<td><input id="value2" type="text" name="value2" title="{{.In2_Title}}" maxlength="60" onkeydown="if (event.keyCode == 13) document.getElementById('input2search').click()"/></td>
<td> </td>
<td style="text-align: right">{{.Label3}}</td>
<td><input id="value3" type="text" name="value3" title="{{.In3_Title}}" maxlength="60" onkeydown="if (event.keyCode == 13) document.getElementById('input2search').click()"/></td>
<td> </td>
<td><input type="button" id="input2search" value=" Go " onclick="event.stopPropagation(); event.preventDefault();loadBySubmit2('form1');"/>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
document.getElementById('value2').addEventListener('keydown', getdefAD);
document.getElementById('value1').focus();
function getdefAD(val1){
if (val1.keyCode == 9) {
$.post('erp/getDefaultValue?attr=' + $("input#value2").val() +'&id=' + $("input#value1").val(), function(data) {
if (data) $("input#value3").val(data);
});
}
}
</script>
</code></pre><br/>
This is the response handler to return a value from the database:
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
//Get default value for attribute
func getDefaultValue(w http.ResponseWriter, r *http.Request) {
sA := "attr"
sP := r.URL.Query().Get(sA)
sA = "id"
sI := r.URL.Query().Get(sA)
if dataAccess.IsStringInSlice(sP, dataAccess.SlcAD_Default) {
sR := dataAccess.GetERPADDefault(sP, sI)
fmt.Fprintf(w, "%s", sR)
} else {
//sR = dataAccess.GetERPADDefault(sP, sI)
//fmt.Fprintf(w, "%s", sR)
// fmt.Println("Not found")
return
}
}
</code></pre><br/>
Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-63489093797002732352022-05-07T16:35:00.002-07:002022-05-07T16:35:46.568-07:00Golang - Display Active Directory thumbnailPhoto attribute as HTML IMGI'm working on an application to list all of the active directory attributes that are set for a user. The application uses "encoding/base64" and "github.com/go-ldap/ldap". To display the tumbnai imag, I used this HTML:
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
"<div style='width:400px;'><img src='data:image/jpg;base64," + b64.StdEncoding.EncodeToString(attrE.ByteValues[0]) + "'/></div>"
</code></pre><br/>
This is the code that iterates through all of the returned AD attributes and creates the HTML text:
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
var sHTML string
var sA []string
for _, entry := range strcAttrs.Entries {
for _, attr := range entry.Attributes {
sA = append(sA, attr.Name)
}
}
sort.Strings(sA)
for _, attE := range sA {
for _, entry := range strcAttrs.Entries {
for _, attrE := range entry.Attributes {
if attrE.Name == attE {
if ldapAccess.IncSlcStdAttrs(attrE.Name) {
sHTML = sHTML + "<span style='text-decoration: bold; background-color: green'>"
} else {
sHTML = sHTML + "<span style='text-decoration: bold;'>"
}
sHTML = sHTML + "attribute: " + attrE.Name + "</span><br />"
var attr string = ""
for _, attr = range attrE.Values {
if ldapAccess.Include(attrE.Name) {
if ldapAccess.IsDate64(attrE.Name) {
sHTML = sHTML + "Date: " + ldapAccess.ConvertStringToDate64(attr)
} else {
if ldapAccess.IsDateZ(attrE.Name) {
sHTML = sHTML + "Date: " + ldapAccess.ConvertStringToDateZ(attr)
} else {
sHTML = sHTML + attr
}
}
} else {
if (attrE.Name) == "thumbnailPhoto" {
sHTML = sHTML + "<div style='width:400px;'><img src='data:image/jpg;base64," + b64.StdEncoding.EncodeToString(attrE.ByteValues[0]) + "'/></div>"
} else {
sHTML = sHTML + "Not Displayed"
}
}
sHTML = sHTML + "<br/>"
}
}
}
}
sHTML = sHTML + "<br/>"
}
</code></pre>
Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-58829760055355614152022-04-28T11:27:00.001-07:002022-04-28T11:28:38.211-07:00Golang - Converting from Java and JSP to Golang and a TemplateI'm working on converting a Java web application to Golang. Converting the JSP to a template was fairly straight forward.<br/>
In Java, I have this function to load the form:<br/>
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
@RequestMapping("/valueinputDateLoadAD")
public ModelAndView valueinputDateLoadAD() {
Map<String, Object> myModel = new HashMap<String, Object>();
myModel.put("page", "ldap/dateLoadAD/");
myModel.put("label1", "Filter:");
myModel.put("title", "Last update date in the form YYYYMMDD or Res. ID");
myModel.put("input1_title", "AD Last Update Date or Res. ID");
return new ModelAndView("input2Form", myModel);
}
</code></pre><br/>
The JSP form:
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
<form action="${page}" name="form1" id="form1" method="POST" target="iframename" onsubmit="event.stopPropagation(); event.preventDefault();">
<table id="input2" style="vertical-align: middle;">
<tr>
<td></td><td colspan="3"><b>${title}</b></td>
</tr>
<tr>
<td style="text-align: right;">${label1}</td>
<td><input style="min-width: 300px;" id="value1" type="text" name="value1" title="${input1_title}" maxlength="60" onkeydown="if (event.keyCode == 13) document.getElementById('input2search').click()"/></td>
<td> </td>
<td><input type="button" id="input2search" value=" Go " onclick="event.stopPropagation(); event.preventDefault();loadBySubmit2('form1');"/>
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
</td>
</tr>
</table>
</form>
</code></pre><br/><br/>
In Golang, I have this structure and function to load the template:<br/>
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
type StrcP1 struct {
Page string
Label1 string
Title string
In1_Title string
}<br/>
func valueinputDateLoadAD(w http.ResponseWriter, req *http.Request) {
logger.NLog.Info().Msg("valueinputDateLoadAD called")
strcP := StrcP1{Page: "dateLoadADGroup", Label1: "Filter:", Title: "Last update date in the form YYYYMMDD or Res. ID", In1_Title: "AD Last Update Date or Res. ID"}
tmpl, err := template.ParseFiles("_resources/html/form/input2Form.html")
if err != nil {
logger.NLog.Error().Err(err).Msg("valueinputDateLoadAD: file parse error")
http.Error(w, "Something went wrong", http.StatusInternalServerError)
return
}
err = tmpl.Execute(w, strcP)
if err != nil {
logger.NLog.Error().Err(err).Msg("valueinputDateLoadAD: template execute error")
http.Error(w, "Something went wrong", http.StatusInternalServerError)
}
}
</code></pre><br/>
And this is my template:<br/>
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
<form action="{{.Page}}" name="form1" id="form1" method="POST" target="iframename" onsubmit="event.stopPropagation(); event.preventDefault();">
<table id="input2" style="vertical-align: middle;">
<tr>
<td></td><td colspan="3"><b>{{.Title}}</b></td>
</tr>
<tr>
<td style="text-align: right;">{{.Label1}}</td>
<td><input style="min-width: 300px;" id="value1" type="text" name="value1" title="{{.In1_Title}}" maxlength="60" onkeydown="if (event.keyCode == 13) document.getElementById('input2search').click()"/></td>
<td> </td>
<td><input type="button" id="input2search" value=" Go " onclick="event.stopPropagation(); event.preventDefault();loadBySubmit2('form1');"/>
</td>
</tr>
</table>
</form>
</code></pre>Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-55804178838545316352022-04-08T11:28:00.001-07:002022-04-08T11:29:10.462-07:00Golang - Working with active directory date attributesSome simple functions I wrote to convert AD date attributes to dates as stings.
<br />
<br />
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
//Converts a string passed in with the millisecond count to the date in the form yyyy-MM-dd HH:mm:ss as a string
func convertStringToDate64(strDate string) (string, error) {
uD, err := strconv.ParseInt(strDate, 0, 64)
if err == nil {
return time.Unix((uD/(10000000))-11644473600, 0).Format("2006-01-02 15:04:05"), nil
}
return "", nil
}
//Converts a string passed in the form yyyyMMddHHmmss.0Z to the date in the form yyyy-MM-dd HH:mm:ss as a string
func convertStringToDateZ(strDate string) (string, error) {
uD, err := time.Parse("20060102150405", strings.Replace(strDate, ".0Z", "", 1))
if err == nil {
return uD.Format("2006-01-02 15:04:05"), nil
}
return "", nil
}
</code></pre>
<br />Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-64343570167742472932022-04-05T02:41:00.003-07:002022-04-05T03:34:24.107-07:00Golang - Query Salesforce by using the Salesforce APII've been learning how to query Salesforce by using the Salesforce API. Here is a simple example that uses the Salesforce query from my last post to query a custom object for values from two related tables. I am using the simpleforce package.<br/><br/>
1 - Function to connect to Salesforce:<br/><br/>
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
var (
SfURL = "https://mysite.my.salesforce.com/" //Custom or instance URL, for example, 'https://na01.salesforce.com/'
SfUser = "me@email.org" //User name of the Salesforce account //"Username of the Salesforce account."
SfPassword = "MyPassword" //Password of the Salesforce account.
SfToken = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" //Security token, could be omitted if Trusted IP is configured.
)
func CreateClient() *simpleforce.Client {
client := simpleforce.NewClient(SfURL, simpleforce.DefaultClientID, simpleforce.DefaultAPIVersion)
if client == nil {
// handle the error
fmt.Println("Unable to create client.")
return nil
}
err := client.LoginPassword(SfUser, SfPassword, SfToken)
if err != nil {
// handle the error
fmt.Println("Unable to log in.")
fmt.Println(err)
return nil
} else {
fmt.Println("SF logged in!")
}
// Do some other stuff with the client instance if needed.
return client
}
</code></pre><br/><br/>
2 - Function to query Salesforce. I pass in the query from my last blog post, "Select Project__r.Name, Geographic_Area__r.Country_Code__c from Project_Geographic_Area__c"
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
//Query Salesforce using the passed in SOQL script
func GetByS(strQ string) {
client := CreateClient()
result, err := client.Query(strQ) // Note: for Tooling API, use client.Tooling().Query(q)
if err != nil {
// handle the error
fmt.Println(err)
return
}
for _, record := range result.Records {
// access the record as SObjects.
fmt.Println(record)
//Example 1
ifvP := record.InterfaceField("Project__r") //get the interface
strP := ifvP.(map[string]interface{})["Name"] //get the string
fmt.Println("Project:", strP)
//Eample 2
strC := record.InterfaceField("Geographic_Area__r").(map[string]interface{})["Country_Code__c"] //get the string from the interface
fmt.Println("Country", strC)
}
}
</code></pre><br/><br/>Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com1tag:blogger.com,1999:blog-5520900024537024843.post-8962631930682084992022-04-05T01:58:00.002-07:002022-04-05T01:58:34.059-07:00Salesforce - SOQL query for values from relate objectsUnlike TSQL, SOQL does not use joins on related tables (objects). Instead, the related object is referenced directly in the query by replacing the 'c' at the end of the custom object name with 'r'. In the following example I have three custom objects, Project_Geographic_Area__c, Project__c, and Geographic_Area__c. The Project_Geographic_Area__c has a foreign key field, Project__c, to the Project__c table, and a foreign key field, Geographic_Area__c, to the Geographic_Area__c table. I want to query Salesforce for the Name field from the Project__c table and the Country__Code__c field from the Geographic_Area__c table. So, replacing the ‘c’ with an ‘r’ in the names of our related tables and appending the field names, the resulting query is “Select Project__r.Name, Geographic_Area__r.Country_Code__c from Project_Geographic_Area__c.”Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-45894744766215656782022-03-11T11:58:00.003-08:002022-05-17T15:49:33.940-07:00Golang - Add a user to an active directory groupA simple Golang function that I wrote to add a user to a group in AD.
<br />
<br />
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
//func ModifyGroup
// strUDN: User DN
// strGCN: Group CN
// strType: flag to Remove or Add the user from the group
func ModifyGroup(strUDN, strGCN, strType string) bool {
var bR bool = false
ldapConn = ldap_Bind() //Get a connection
strGDN, _ := GetDN(strGCN) //Get the group DN using the group CN
modify := ldap.NewModifyRequest(strGDN, []ldap.Control{})
log.Println("ModifyGroup on User: ", strUDN, ", Group: ", strGCN, ", Type: ", strType)
if strType == "Remove" {
modify.Delete("member", []string{strUDN})
}
if strType == "Add" {
modify.Add("member", []string{strUDN})
}
err := ldapConn.Modify(modify)
if err != nil {
log.Println(err)
} else {
bR = true
}
return bR
}
</code></pre>
<br />Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com1tag:blogger.com,1999:blog-5520900024537024843.post-73754024437085622992022-02-17T09:34:00.002-08:002022-02-17T09:34:45.050-08:00SQL - Connecting to Integration Services Access is DeniedI was trying to get into SQL Server Integration Services (SSIS) and received the "Connecting To The Integration Services Server On The Computer "X" Failed With The Following Error: "Access Is Denied." error. I checked the permissions in Component Services, DCOM Config, Microsoft SQL Server Integration Services, and had permission, so I knew that I had permissions. What worked for me was to run SSMS as adminitrator.Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-38642626095291086002021-10-15T13:33:00.005-07:002021-10-15T13:33:51.774-07:00Tomcat - Unable to locate persistence units errorI recently was working on updating the libraries for a Java web application and was unable to connect to the database. Stepping through the program in Tomcat I saw that it was giving me the "Unable to locate persistence units" error. This puzzled me for a long time, so I decided to take a closer look as I stepped through the application. The actual error message in the exception was "unrecognized persistence.xml version 2.2"! So I reverted back to version 2.1! Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-5000087439893030942021-10-15T08:03:00.002-07:002021-10-15T08:54:49.201-07:00Tomcat - Service will not start, incorrect function error in Windows System LogThe Tomcat service would not start. I checked the Windows System Log and found the following error.
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsoWRmDgCQZs6E4kX7NVtHYKoR_xQGRnZlawkVpdcv5vk73DURJGMU_4HgH6jIMvQT2snaAPQxYF4NZyY2XyzHQKCY0mwVnq3yXubhytnGOW_TRnnDAibuqbgG3n1LZRIoejwIyH6rXEM/s821/forblog0.jpg" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="320" data-original-height="297" data-original-width="821" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsoWRmDgCQZs6E4kX7NVtHYKoR_xQGRnZlawkVpdcv5vk73DURJGMU_4HgH6jIMvQT2snaAPQxYF4NZyY2XyzHQKCY0mwVnq3yXubhytnGOW_TRnnDAibuqbgG3n1LZRIoejwIyH6rXEM/s320/forblog0.jpg"/></a></div>
This was caused by Java version on the system not matching the Java version in Tomcat. Check the current Java version in Windows by opening a command prompt and executing "Java - version". Then check the version in Tomcat by executing Tomcat#w.exe, where # is the Tomcat version number, located in the bin folder under your Tomcat install. Check the Java tab and check the entry for Java Virtual Machine. These are my settings with the corrected setting in Tomcat:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb7d23lmVCVNwZyGF_465z-oWMJ13NMgW0ttCi_ZTlHvawTTZwN_Zj5FckmGlESGq8OSv2SyPDVBrujDcMpU6mWNC3o03C8jJ1Jwm8EH8EKIyQiOuAE8M7ZDei9Fr6OjlrRmvc8Acz8W8/s770/forblog.jpg" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="320" data-original-height="162" data-original-width="770" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb7d23lmVCVNwZyGF_465z-oWMJ13NMgW0ttCi_ZTlHvawTTZwN_Zj5FckmGlESGq8OSv2SyPDVBrujDcMpU6mWNC3o03C8jJ1Jwm8EH8EKIyQiOuAE8M7ZDei9Fr6OjlrRmvc8Acz8W8/s320/forblog.jpg"/></a></div>Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-51515176887997329482021-09-20T15:53:00.000-07:002021-09-20T15:53:15.193-07:00TSQL - Simple Recursive ExampleI needed to change a field in a table that holds the tree structure for menues in Unit4 ERP. The fields involved were the parent_menu_id, menu_id, and client. So parent_menu_id would be the folder, menu_id would be the folders or menu item, and client is the field to be updated. The paren_menu_id at top of the tree is REP05. This is the update query.
<br />
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
WITH RecQry AS
(
SELECT aagM.menu_id
FROM aagmenu aagM where parent_menu_id = 'REP05'
UNION ALL
SELECT Child.menu_id
FROM RecQry PARENT, aagmenu CHILD
where CHILD.parent_menu_id = PARENT.menu_id
)
update aagmenu
set client = '*'
where menu_id in
(
select menu_id from RecQry
)
</code></pre>
<br />Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-79809352393696572732021-08-23T11:55:00.003-07:002021-08-23T11:55:55.938-07:00TSQL - Assign A Sequential Number To Each Record In A Group I needed to insert records from one table into another table and add a sequential number, field seq, that was group on an id field, GroupId. This CTE was the eastiest way that I found to add the number. <BR>
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
UPDATE t
SET seq = GROUPSEQ
FROM (SELECT seq, [GroupId], row_number() OVER (PARTITION BY [GroupId] ORDER BY [GroupId]) GROUPSEQ
FROM [TableMemo]) t
</code></pre>
Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-33087285849922075512021-08-18T11:06:00.003-07:002021-08-23T11:56:10.622-07:00TSQL - Add a Sequential Number Field I needed to insert records from one table into another table and add a sequential number that started at a certain value. This was the eastiest way that I found to add the number. Just add an int field to the source table and add the values using an update. So in the following code, id was the int field that I created, and I add numbers begining with 6001. <BR>
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
DECLARE @id INT
SET @id = 6000
UPDATE Table
SET @id = id = @id + 1
</code></pre>
Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-31503398873872850022016-09-25T07:01:00.002-07:002016-09-25T07:01:51.211-07:00Word - Mail Merge a Document to Separate FilesI was asked to help mail merge a document and save the result to a file name based using values from the some merged fields. I found some code <a href="http://stackoverflow.com/questions/12594828/how-to-split-a-mail-merge-and-save-files-with-a-merge-field-as-the-name" target="_blank">on Stack Overflow</a> by Søren Francis and modified it to loop. </ br>
<br />
My steps:
<br />
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
Sub OutDoc()
'
' 1) Merges active record and saves the resulting document named by the datafield
' 2) Closes the resulting document, and advances to the next record in the datasource
'
' Based on code by Søren Francis 6/7-2013 at href="http://stackoverflow.com/questions/12594828/how-to-split-a-mail-merge-and-save-files-with-a-merge-field-as-the-name
Dim DokName As String 'ADDED CODE
Dim strFolder As String
Dim fDone As Boolean
fDone = False
' Set the destination folder
strFolder = "C:\Projects\ForAdam\FinalDocs\"
' Start at the first document
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdFirstRecord
Do
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord
.LastRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord
' Set the document name
DokName = .DataFields("ResID").Value & .DataFields("First").Value & "_Contract"
End With
' Merge the active record
.Execute Pause:=False
End With
' Save then resulting document. NOTICE MODIFIED filename
ActiveDocument.SaveAs2 FileName:=strFolder + DokName + ".doc", FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles _
:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts _
:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
' Close the resulting document
ActiveWindow.Close
' Now, back in the template document, advance to next record if there is a next record
If ActiveDocument.MailMerge.DataSource.ActiveRecord <> ActiveDocument.MailMerge.DataSource.RecordCount Then
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdNextRecord
Else ' Flag that we are done
fDone = True
End If
Loop Until fDone
End Sub
</code></pre>
<br />
Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-24493634494906776172016-04-15T09:58:00.001-07:002016-04-19T08:09:04.273-07:00Tomcat - Update SSL certificateI spent the day updating the server certificate with new certificates from <a href="http://www.godaddy.com" target="_blank">Godaddy</a> to provide a more secure connection to the site. Adding the new cert to IIS was a snap but adding it to Tomcat just wasn't working. I was finally able to get it to work by following the information <a href="http://www.lazynetworkadmin.com/knowledgebase-mainmenu-6/2-windows/150-export-ssl-certificate-from-iis-and-import-into-tomcat" target="_blank">located here.</a> Basically I just exported the certificate from the certificate store on the IIS server as a pfx file.
<br /><br />
My connector setting in the Tomcat server.xml file:
<br />
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
<Connector port="8443" connectionLinger="20000" connectionTimeout="60000" protocol="HTTP/1.1" keystoreType="PKCS12" keystorePass="youwish" keystoreFile="webapps/iis_export.pfx" sslProtocol="TLS" clientAuth="false" disableUploadTimeout="true" enableLookups="true" secure="true" scheme="https" maxThreads="150" SSLEnabled="true"/>
</code></pre>
<br />
Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-85448491397430284402015-11-04T02:57:00.001-08:002015-11-04T02:57:04.956-08:00MS SQL Error Log FilesYes, there are backup application log files and they can be very helpful in figuring out the cause of a backup failure. In my case I was getting the "Backup BACKUP failed to complete the command BACKUP DATABASE database_name. Check the backup application log for detailed messages.", "Backup Error: 3041, Severity: 16, State: 1" error like the following:
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih17M9W3aDxuqgEhqgsVm-pgeeVANV4EJi1usonY0KWb-Y9M1G9QrXCp2rgy1fhkExoJSnIuuHsojsKBvgtHFUqLsDIkDqRO4JtdTxNMlVhVE1PxHoqQxMUQckXVc7dXefIjNdaDL8iMI/s1600/_ABlog1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih17M9W3aDxuqgEhqgsVm-pgeeVANV4EJi1usonY0KWb-Y9M1G9QrXCp2rgy1fhkExoJSnIuuHsojsKBvgtHFUqLsDIkDqRO4JtdTxNMlVhVE1PxHoqQxMUQckXVc7dXefIjNdaDL8iMI/s320/_ABlog1.JPG" /></a></div><br />
Checking the log file, which on my server is located in the "SQL\MSSQL12.MSSQLSERVER\MSSQL\Log" folder, I get the following:
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_X8U52g8Qj2yCj_waDbXaGn_tjX5oCffW0pw4SaK9IVCmYQx5gktI33UIttJn4flNk8EXB4f6AFVyhynqHcKqukhHtA9drGJy48tInztlotu2bfyVJFaf0_7_HgWCD7XYN_zDaBnegbM/s1600/_ABlog2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_X8U52g8Qj2yCj_waDbXaGn_tjX5oCffW0pw4SaK9IVCmYQx5gktI33UIttJn4flNk8EXB4f6AFVyhynqHcKqukhHtA9drGJy48tInztlotu2bfyVJFaf0_7_HgWCD7XYN_zDaBnegbM/s400/_ABlog2.JPG" /></a></div>Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-80744030158584606102015-10-08T12:44:00.001-07:002015-10-08T12:57:32.011-07:00Java - Search for AD Groups and List Group AttributesAdded the ability to search for AD groups and get a Group's Attributes to my LDAP class:
<br />
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
/**
*
* @param groupName The name of the AD group.
* @return The AD attributes for the group or null if error.
* @throws NamingException
*/
public Attributes getADGroupAttributes(String groupName) throws NamingException {
this.userName = null;
String searchFilter = "(&(objectClass=group)(cn=" + groupName + "))";
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration<SearchResult> results = ctx.search("dc=MYDOMAIN,dc=LOCAL", searchFilter, searchControls);
SearchResult searchResult = null;
if(results.hasMoreElements()) {
searchResult = (SearchResult) results.nextElement();
//make sure there is not another item available, there should be only 1 match
if(results.hasMoreElements()) {
this.strRes = "Matched multiple groups for the group name: " + groupName;
return null;
}
}
else{
this.strRes = "No groups found";
return null;
}
return searchResult.getAttributes();
}
/**
*
* @param groupName The group name to search for. Can use wild cards.
* @return A comma delimited list of the AD group names
* @throws NamingException
*/
public String searchforADGroup(String groupName) throws NamingException {
this.userName = null;
String searchFilter = "(&(objectClass=group)(cn=" + groupName + "))";
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration<SearchResult> results = ctx.search("dc=MYDOMAIN,dc=LOCAL", searchFilter, searchControls);
SearchResult searchResult = null;
String strGroups = "";
if(results!= null) {
try {
while(results.hasMore()) {
searchResult = (SearchResult) results.nextElement();
strGroups = strGroups + searchResult.getAttributes().get("cn") + ",";
}
} catch (Exception e) {
}
}
else{
this.strRes = "No groups found";
return null;
}
return strGroups;
}
</code></pre>
<br />
Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0tag:blogger.com,1999:blog-5520900024537024843.post-54249935179859295812015-10-07T04:34:00.004-07:002015-10-07T04:34:57.760-07:00JQUERY - Object doesn't support property or method 'addEventListener' ErrorWorking on the new site and it works on my laptop for IE but loading from the site in IE it would come up was frozen. Nothing worked. Using the developer tools in IE I saw that I was getting the "Object doesn't support property or method 'addEventListener'" error in jquery. Added the following in the header of the JSP page fixed the problem:<br />
<pre style="background-color: #eeeeff; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
<meta http-equiv="X-UA-Compatible" content="IE=edge;" />
</code></pre>
<br />
<a href="https://forum.jquery.com/topic/jquery-2-1-1-min-js-object-doesn-t-support-property-or-method-addeventlistener" target = "_blank">Thanks To</a>Rich Golebiowskihttp://www.blogger.com/profile/03558242481179691981noreply@blogger.com0