Wednesday, November 19, 2008
Andrew Maxell McLaurin
Andrew Maxwell McLaurin; 7lbs 8 oz; 8:39am
>>>> Click Pictures to go to web Album.....
Wednesday, November 5, 2008
OCR / Image Recognition / Form Recognition
If anyone needs a .Net API for doing Image recognition, Mitek Systems have a great one for sale. It is fast and very easy to implement.
Example:
Mitek.Loadconfig(ConfigFile)
Mitek.Loadimages(Images())
Mitek.Run
ResultsXML = Mitek.xmlresults
That easy!
Tuesday, October 14, 2008
Remove Pesky Dos / Soft Line breaks in VI (VIM)
I hate it when you are trying to import a text file and the importer doesn’t like it cause there are ^M + \n line breaks in the middle of fields….
In vi, use:
:%s/\r\n/ /g
To turn them into spaces..
Saturday, October 4, 2008
Open a directory of text files and display them in a text box
another without having to open them all in a tabbed editor or open a
bunch of notepads. On a form named MainForm, add buttons Named:
LoadOutputFiles, NextFile and PreviousFile; add a label named
OutputPosition; Copy and paste the code below...
Dim OutputFiles as String()
Dim LoadedID as Integer
Dim TotalNumberOfFilesLoaded as Integer
Public Class MainForm
Private Sub LoadOutputFiles_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles LoadOutputFiles.Click
If Not FolderBrowserDialog.SelectedPath.Length > 1 Then
If Not FolderBrowserDialog.ShowDialog =
Windows.Forms.DialogResult.OK Then
Exit Sub
End If
End If
OutputFiles =
System.IO.Directory.GetFiles(FolderBrowserDialog.SelectedPath) 'Add a
filter to the 'GetFiles' function for *.txt etc...
TotalNumberOfFilesLoaded = OutputFiles.Length
Array.Sort(OutputFiles) 'Sort the Files
LoadedID = 0
ReadNextFile(LoadedID)
End Sub
Sub ReadNextFile(ByVal ID As Integer)
If OutputFiles Is Nothing Then
Exit Sub
End If
If ID = TotalNumberOfFilesLoaded Or ID >
TotalNumberOfFilesLoaded Then
ID = 0
LoadedID = 0
End If
If ID = -1 Then
ID = TotalNumberOfFilesLoaded - 1
LoadedID = TotalNumberOfFilesLoaded - 1
End If
Dim fs As IO.StreamReader = Nothing
Try
fs = New System.IO.StreamReader(OutputFiles(ID))
OutputText.Text = fs.ReadToEnd
fs.Close()
Catch ex As Exception
If Not fs Is Nothing Then
fs.Close()
End If
End Try
OutputPosition.Text = String.Format("{0} of {1}", LoadedID + 1,
TotalNumberOfFilesLoaded)
End Sub
Private Sub NextFile_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles NextFile.Click
LoadedID -= 1
ReadNextFile(LoadedID)
End Sub
Private Sub PreviousFile_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles PreviousFile.Click
LoadedID += 1
ReadNextFile(LoadedID)
End Sub
End Class
Active Directory Data / Time Converter; pwdLastSet, accountExpires, lastLogonTimestamp, lastLogon, badPasswordTime
Found a cool tool to convert AD’s really strange date/time format to real readable format. Very useful if you don’t have time to write your own and look at the ldap side of AD a lot…
Wednesday, October 1, 2008
Insert Key on a iMAC running Parallels
To toggle the insert key… (cause when it is on and you hot space it overwrites your text)
Hold ‘FN’ and hit the Zero key on your keypad (the set of numbers under your right hand)
Table Counts on a field accross the entire Database
Ever need to look for a value in a field across the entire DB? Have 10k+ Table that have your particular field? Here is a plsql package that I create to help in tracking where a person’s ID (emplid) shows up in the DB. Takes about 3 minutes to process 1 emplid.
Usage: select * from table(tablecounts_pkg.mbi_tablecounts('<<EMPLID>>') ) ;
CREATE OR REPLACE PACKAGE SYSADM.tablecounts_pkg
IS
-- Looks for all PS tables (Joins on User_tables to make sure it is a table) and does a count on that table based on EMPLID.
TYPE outrec_typ IS RECORD (
var_table VARCHAR2 (30),
var_rowcount NUMBER
);
TYPE outrecset IS TABLE OF outrec_typ;
--Usage select * from table(tablecounts_pkg.tablecounts('1978614') ) ;
FUNCTION tablecounts (emplid VARCHAR)
RETURN outrecset PIPELINED;
END tablecounts_pkg;
/
CREATE OR REPLACE PACKAGE BODY SYSADM.tablecounts_pkg
IS
FUNCTION tablecounts (emplid VARCHAR)
RETURN outrecset PIPELINED
IS
out_rec outrec_typ;
CURSOR tablenames
IS
SELECT a.table_name
FROM SYS.user_tab_cols a, user_tables b
WHERE column_name = 'EMPLID' AND a.table_name LIKE 'PS%' AND a.table_name = b.table_name;
table_row_count NUMBER;
stmt VARCHAR (200);
BEGIN
FOR x IN tablenames
LOOP
stmt := 'select count(*) from ' || x.table_name || ' where emplid = ''' || emplid || '''';
--DBMS_OUTPUT.put_line (stmt);
EXECUTE IMMEDIATE stmt
INTO table_row_count;
IF table_row_count > 0
THEN
out_rec.var_table := x.table_name;
out_rec.var_rowcount := table_row_count;
PIPE ROW (out_rec);
END IF;
END LOOP;
RETURN;
END;
END tablecounts_pkg;
/
Tuesday, September 30, 2008
Annoying Visual Studio Behavior (Auto format stops working)
Of late I have had this annoying thing happen to my Visual Studio 2005 environment where it stops formatting my code for me. So would call me lazy… J I am… I had tried resetting the environment to be a Visual Basic Env etc… etc… nothing worked.
To fix it I found a link to an MSDN forum:
http://social.msdn.microsoft.com/Forums/en-US/csharpide/thread/870c32f4-464b-4701-986a-290fc996a570/
Short Version:
Reset the environment completely…
AdamPe States:
“You need the /resetuserdata Switch
1. Shut down all instances of Visual Studio 2005.
2. Click Start, the choose Run....
3. Type "devenv.exe /resetuserdata".
Easy when you know how!!”
More details here:
http://msdn2.microsoft.com/en-us/library/bb245788(vs.80).aspx
Tuesday, September 23, 2008
Frustrating CI Issue PSBusComp error
Here is what I am doing:
Pulling the rows to insert directly from the DB
Connecting to a CI via JSL to the App server
Start the Loop to pump the data in
The first rows go in well
The the App server kills the run after 1 or two rows
Session is reset
I have interactive mode off, get and edit history are also off.
It seems to be specific to this component, or component type (the size?). Our Admins tell me it is a segmentation falt and the process is killed by the OS. Thanks Mr. OS! :)
There doesn't seem to be any Cobol or really intensive people code. Technically this shouldn't matter as interactive mode is turned off and I don't get to the point of saving, so it should be triggered.
I don't know if it matters, but I am going to check to see if 'Expert Entry' is enabled on the user that is connecting to the app server.
More to come....
Thursday, September 18, 2008
Using PL/SQL to Grant Permissions to Role(s) or Person(s)
DECLARE
CURSOR myviews
IS
SELECT view_name
FROM SYS.user_views
WHERE view_name LIKE '%A_Z%';
BEGIN
FOR x IN myviews
LOOP
BEGIN
EXECUTE IMMEDIATE 'GRANT SELECT ON ' x.view_name ' TO COOL_PROGRAMMER';
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ( 'GRANT SELECT ON SYSADM.'
x.view_name
' TO COOL_PROGRAMMER; '
SQLERRM
);
END;
END LOOP;
END;
PeopleSoft: Stop Save of a page from PeopleCode
For some reason I had an issue figuring out how to stop the saving of a page… Then I was doing something completely unrelated and said, “DUH!!!”
To stop a save during validation in PeopleCode throw an error… Use only in the SaveEdit event. Don’t use it in FieldDefault, FieldFormula, RowInit, FieldChange, Prepopup, RowInsert, SavePreChange, or SavePostChange
Error “Some String”;
You can use the MsgGet, MsgGetText functions too, if you add your own entries to the catalog.
PeopleCode: Change Options in a Drop down List
In PeopleSoft it is “easy” to change the drop down list options on Row-init …
This is from a co-worker. Used to change the options that students see for attendance (for specific class type)
If …… Then
/* Clear the current dropdown
values */
CLASS_ATTENDNCE.ATTEND_REASON.ClearDropDownList();
CLASS_ATTENDNCE.ATTEND_REASON.AddDropDownItem("ALCT", "Allowed
Cut"); CLASS_ATTENDNCE.ATTEND_REASON.AddDropDownItem("CANC",
"Cancelled"); CLASS_ATTENDNCE.ATTEND_REASON.AddDropDownItem("OTHR",
"Absent Other");
CLASS_ATTENDNCE.ATTEND_REASON.AddDropDownItem("PRES", "Present");
CLASS_ATTENDNCE.ATTEND_REASON.AddDropDownItem("SECT", "Second Cut");
CLASS_ATTENDNCE.ATTEND_REASON.AddDropDownItem("SICK", "Sick");End-If;
Tuesday, September 16, 2008
Clean Up PeopleSoft Registry entries from CIs
re-build then and re-register them etc etc... but the problem is that when I
have to update the client end, and re-register the tlb methods, I don't have a
'Clean-Up Entries' check box.
So.... To clean the registry from the last registered TLB, take the .reg file which starts:
Get your favorite text editor that has Regular expression capabilities (I use Crimson Editor, just casue it is free and does a lot of neat things).
[HKEY_CLASSES_ROOT\TypeLib\{D991A0F6-EFDC-480E-A3B7-DED9BB542536}\PeopleSoftGeneratedKey]
@="Sun Aug 31 23:45:09
2008"[HKEY_CLASSES_ROOT\TypeLib\{D991A0F6-EFDC-480E-A3B7-DED9BB542536}\1.0]
@="PeopleSoft_PeopleSoft"[HKEY_CLASSES_ROOT\TypeLib\{D991A0F6-EFDC-480E-A3B7-DED9BB542536}\1.0\0\win32]
@="c:\\ps\\8.49\\bin\\client\\winx86\\PeopleSoft_PeopleSoft.tlb"
Find: @.*
Replace with nothing
Find: \*\*.*
Replace with nothing
Turn off Regular Expression
Find: [
Replace with: [-
Copy and Paste the whole .Reg file to excel, and sort the column A-Z, to make the longest (deeper branches first) entries go to the top of each group, copy and paste it back to the reg file. Save it to a new name so you have your orignial, and then run it... the [-Branch Name] removes each entry.
Monday, September 15, 2008
CIs: Connecting to PeopleSoft Jolt sever from VB.net. Why & How. Part 4
Sunday, September 14, 2008
CIs: Connecting to PeopleSoft Jolt sever from VB.net. Why & How. Part 3
[If you are looking to Load 100k+ rows into PeopleSoft quickly, this isn't the post for you! This is a multi post piece on Component Interfaces. Hopefully it is informative reading...]
Part 3
MS Exchange 2007 Inbound SMTP
All I can say is "wow"... M$ has done a lot of work and made turned out a very slick offering. Can be Very complicated and very flexable, but does well to help the admin along the way.
Everything was pretty straight forward in setup; even for a guy who is no windows pro by any stretch...
The one issue I did hit was getting an SMTP Recieve connector to accept incoming mail.
I had setup the hub transport on the primary server to accept SMTP on port 25 etc, etc, from all addresses etc, etc... (After failing to setup a locked down version, I delete it all and started over with a wide open setup -- which still failed...ugh)
I turned on protocol logging for the connector, and was watching the log file as I sent mail... I was always getting:
550 5.7.1 Unable to relay,
Then I found a post by Wilbert De Graaf at
http://forums.microsoft.com/technet/showpost.aspx?postid=742464&siteid=17&sb=0&d=1&at=7&ft=11&tf=0&pageid=2
Which discribed my issue and point to http://technet.microsoft.com/en-us/library/aa997170.aspx to solve it...
Short Version:
Each incoming SMTP connection (From untrusted servers...) connects as "ANONYMOUS LOGON" and this user has to have permission to accept incoming mail ie the permission to "SMTPAcceptAnyRecipient"...
to do this go to to Exchange Management Shell and run
Get-AdPermission -Identity "SMTP RECIVEVE Connector Name" format-table -view Identity
Look at the "NT AUTHORITY\ANONYMOUS LOGON" user and its rights.
Make sure it has 'ms-Exch-SMTP-Accept-Any-Recipient' not denied.
But I am guessing, since you have this issue that it is either denied or not there at all....
To add the correct permissions run:
Add-AdPermission -Identity "SMTP RECIVEVE Connector Name" -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights ms-Exch-SMTP-Submit,ms-Exch-SMTP-Accept-Any-Recipient
it might tell you that it has one or more of these rights already... oh well... it adds the missing ones and you should be good to go.
Saturday, September 13, 2008
CIs: Connecting to PeopleSoft Jolt sever from VB.net. Why & How. Part 2
Part 2
If these already exist, obviously just add missing parts...
CLASSPATH=C:\PS\8.49\web\psjoa\psjoa.jarPATH=C:\PS\8.49;C:\PS\8.49\jre\bin\client
C:\PS\8.49 is where my PeopleTools is located.
As for what is needed for a peopleTools CI only environmnet, you don't need to whole thing. Here are the files that are needed:Everything under .\jre and \webIn .\bin\client\winx86:
dbghelp.dll msvcp71.dll msvcr71.dll psapiadapter.dll psbtunicode.dll pscmnutils.dll pscompat.dll pslibeay32.dll pspetssl.dll trio.dll zlib1.dll
PeopleSoft_PeopleSoft.reg & PeopleSoft_PeopleSoft.tlb are what you get when you build the PeopleSoft APIs from appdesigner.
In order to get familiar with the code, I'd like to suggest that you take a look at the demo code that you can generate by right clicking on your CI from app designer and selecting the generate visual basic template. This is in VB6-or-less layout in a .bas file.
Checking a Peron's Roles within PeopleCode
For manually securing object or doing some kind of filtering, it is regularly useful to know what roles a person has in their user profile. Peoplesoft provides a global variable to give you access to the person’s roles.
Example:
Local array of string &Roles;
Local integer &I;
&Roles = %Roles;
&doTransfer = True;
For &I = &Roles.Len To 1 Step - 1
If &Roles [&I] = "My Special Role" Then
&doTransfer = False;
End-If;
End-For;
Friday, September 12, 2008
CIs: Connecting to PeopleSoft Jolt sever from VB.net. Why & How. Part 1
Windows Folder Share / Mapping Issue
Found an amazingly helpful blog at:
http://travisepperson.blogspot.com/2007/01/windows-network-folder-specified-is.html
Short version:
dropped to command line i.e. "start Run cmd"
Ran: net use
found the the offending share.
net use "
Re-map network drive. Worked like a charm!
Thanks Mr. Epperson!!!!
Create a MD5 Hash in VB.Net
Imports System.Security.Cryptography
Public Function Md5Hasher(ByVal StringToHash As String) As String
Dim md5Crypter As MD5
md5Crypter = MD5CryptoServiceProvider.Create
Dim DataBytes() As Byte = md5Crypter.ComputeHash(Encoding.Default.GetBytes(StringToHash ))
Dim strbldr As StringBuilder = New StringBuilder
Dim i As Integer
For i = 0 To DataBytes.Length - 1
strbldr.AppendFormat("{0:x2}", dataMd5(i))
Next
Return strbldr .ToString
End Function
Oracle Data Reader to Data Table VB.Net
Function GetReaderAsDataTable(ByVal sql As String, ByVal Envrionment As String, Optional ByRef OtherOraConnection As OracleConnection = Nothing) As DataTable
Try
Dim OutputDataTable As New DataTable
Dim x As Integer
Dim cmdfunc As New OracleCommand
If OtherOraConnection Is Nothing Then
Me.ConnectToOracle(Envrionment)
cmdfunc.Connection = mbiUser_Admin.OracleFunctionlib.oraConnection
Else
cmdfunc.Connection = OtherOraConnection
End If
cmdfunc.CommandText = sql
cmdfunc.CommandType = CommandType.Text
Dim drFunc As OracleDataReader
drFunc = cmdfunc.ExecuteReader
If Not drFunc.HasRows Then
Return Nothing
Else
Dim DataRowString(drFunc.FieldCount - 1)
For x = 0 To drFunc.FieldCount - 1
OutputDataTable.Columns.Add(drFunc.GetName(x), drFunc.GetFieldType(x))
Next
While drFunc.Read
For x = 0 To drFunc.FieldCount - 1
DataRowString(x) = drFunc(x)
Next
OutputDataTable.LoadDataRow(DataRowString, True)
End While
Return OutputDataTable
End If
Catch ex As Exception
Try
HttpContext.Current.Session("msg") = (ex.Message & vbLf & vbCr & sql)
Catch ex1 As Exception
'Not in a HTTP Session; you can do something with the msg if you want... like return it to the user would be nice... but with most of my stuff just knowing that the sql didn't return anything is good enough. Robust, no, but usable.
End Try
Return Nothing
End Try
End Function
Monday, September 1, 2008
Check an E-mail address with VB.NET Regex
Function CheckValidEmail(Optional ByVal inputEmail As String = Nothing) As Boolean
If inputEmail Is Nothing Then
Return (False)
End If
Dim strRegex As String = "^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" + "\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" + ".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
Dim re As Regex = New Regex(strRegex)
If re.IsMatch(inputEmail) Then
Return (True)
Else
Return (False)
End If
End Function
Friday, August 1, 2008
Setting Up Row Level Security (For Depts.)
- Select a user that need access
- Goto the user profile and note the permission list that the user has for Row level Security.
- Note: whom ever else has the same permission list in this field will have the same row level security. Change this as appropriate.
- Goto Setup HRMS > Security > Core Row Level Security > Security by Dept Tree
- Add New Value
- Add the permission list from #1
- Goto Setup HRMS > Security > Core Row Level Security > Refresh SJT_CLASS_ALL
- Add run control
- Select refresh all
- Run process
- Repeat 5-7 for Setup HRMS > Security > Core Row Level Security > Refresh SJT_OPR_CLS
- Goto Setup HRMS > Security > Core Row Level Security > Security Data Inquiry
- Goto Page #3; User Security Data
- Put in the person's UserID and check the last item on the list, does it have the DEPT you need?
- If not, fix it... :) if yes.. Yay!! good Job!
Thursday, May 1, 2008
Oracle Data Reader as XML Document
Public Function GetReaderAsXML(ByVal sql As String, ByVal Environment As String, Optional ByRef OtherOraConnection As OracleConnection = Nothing) As XmlDocument
Dim cmdfunc As New OracleCommand
If OtherOraConnection Is Nothing Then
If Not oraConnection.State = ConnectionState.Open Then
Me.ConnectToOracle(Environment)
End If
cmdfunc.Connection = oraConnection
Else
cmdfunc.Connection = OtherOraConnection
End If
cmdfunc.CommandText = sql
cmdfunc.XmlCommandType = OracleXmlCommandType.Query
cmdfunc.BindByName = True
cmdfunc.XmlQueryProperties.MaxRows = -1
Dim XmlReaderOut As System.Xml.XmlReader
XmlReaderOut = cmdfunc.ExecuteXmlReader
Dim XmlDocOut As New System.Xml.XmlDocument
XmlDocOut.PreserveWhitespace = True
XmlDocOut.Load(XmlReaderOut)
Return XmlDocOut
End Function