Friday, September 12, 2008

Windows Folder Share / Mapping Issue

Just hit a problem... "The network folder is currently mapped with a different username/password" even though from "My Computer" I can't see anything mapped...

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 ">" /delete

Re-map network drive. Worked like a charm!


Thanks Mr. Epperson!!!!

Create a MD5 Hash in VB.Net

Creating a compliant MD5 Hash was a tough find for VB... I looked all over the place and found people doing all kinds of thing for hashes... But I needed one that would be the same as a Perl/PHP hash... After a lot of searching, I mashed together (as most of us do) a couple of ideas about the cryproservices and string building to come up with this...


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

One of the things that I don't like about Oracle's .Net Library is that sometimes you want more than the reader, but less than the DataAdapter.... So here is my little function to grab a reader and then return it as a data table. It returns nothing if there is nothing return


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

This is a VB.NET Function to Check an e-mail address with 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.)

  1. Select a user that need access
  2. 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.
  3. Goto Setup HRMS > Security > Core Row Level Security > Security by Dept Tree
  4. Add New Value
    • Add the permission list from #1
  5. Goto Setup HRMS > Security > Core Row Level Security > Refresh SJT_CLASS_ALL
  6. Add run control
  7. Select refresh all
  8. Run process
  9. Repeat 5-7 for Setup HRMS > Security > Core Row Level Security > Refresh SJT_OPR_CLS
  10. Goto Setup HRMS > Security > Core Row Level Security > Security Data Inquiry
  11. Goto Page #3; User Security Data
  12. 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!
Add to Google