Monthly Archives: February 2012

Linux

Installing Fedora Core 16 from USB

So as I’ve said we’ve been replacing all the computers here at work and that’s lead to a plethora of spare computers, I mean it’s to the point of overflow as even I am looking at them all wondering what the hell to do with them all.

So I was on Staples site the other day and found the coolest thing, it’s a hot swap bay that you can use to read all the data on those 40 gig drives that are multiplying around here like Tribbles.  Then it occurred to me that I could use it to format each of the half dozen 40 gig drives with a different OS.  Whoo Hoo we have achieved nerdvana!!!  A different OS every week and just label the drive with what’s on it.  True greatness.  In any case FC16 is going to be the first and here is how you make an installation USB for it from the good folks over at fedoraproject.org:

  1. Download the LiveUSB Creator program for Windows from http://fedorahosted.org/liveusb-creator.
  2. Either: click the Browse button under the Use existing LiveCD label, browse to the location where you previously downloaded a Fedora Live ISO file, and select that file.
    select a Fedora Live ISO file from the drop-down menu that LiveUSB Creator presents under the Download Fedora label. Note that image files are large and that it is probably impractical to use LiveUSB Creator to download an image file if you do not have a broadband connection to the Internet.
  3. Click Create Live USB.

     

     

     

Visual Basic

Sending an email with Visual Basic

Imports System
Imports System.Net
Imports System.Data
Imports System.Net.Mail
Imports System.IO
Imports System.Net.NetworkCredential
Imports Microsoft.SqlServer.Dts.Runtime

<System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _
<System.CLSCompliantAttribute(False)> _
Partial Public Class ScriptMain
 Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase

Enum ScriptResults
 Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
 Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
 End Enum

Public Sub Main()
 Dim oReader As StreamReader
 Dim sTo As String
 Dim sFrom As String = "EnterpriseAccountTeam@pdstech.com"
 Dim sCC As String
 Dim sMessage As String
 Dim sSubject As String
 Dim sJob_State As String
 Dim sJob_Status As String
 Dim sBranch As String
 Dim sRec() As String
 Dim sLine As String
 Dim linefeed As String = Constants.vbCrLf
 Try
 'open file
 oReader = New StreamReader("C:\Taleo\TCC\Prod\Export\Requisition\EmailFile.csv")
 While oReader.Peek <> -1
 sLine = oReader.ReadLine()
 sRec = sLine.Split(Convert.ToChar("|"))
 sTo = sRec(0)
 sCC = sRec(1)
 sSubject = "A new requisition has been assigned to you. Req No: " + sRec(2) + " Job title: " + sRec(3)
 sMessage = "City: " + sRec(4) + linefeed + "State: " + sRec(5) + linefeed
 sMessage += "Client: " + sRec(6) + linefeed + "Job state: " + sRec(7) + linefeed
 sMessage += "Job status: " + sRec(8) + linefeed + "Branch: " + sRec(9)
 'Send Mail
 MailSend(sTo, sCC, sFrom, sSubject, sMessage)
 End While
 oReader.Close()


Catch ex As Exception
 Dts.TaskResult = ScriptResults.Failure
 End Try
 Dts.TaskResult = ScriptResults.Success
 End Sub
 Public Sub MailSend(ByVal ToMail As String, ByVal ToCC As String, ByVal From As String, ByVal Subject As String, ByVal Message As String)

Dim smtpclient As New SmtpClient
 Dim mailmessage As New MailMessage
 Dim fromadd As New MailAddress(From)

smtpclient.Host = "10.1.0.10"
 smtpclient.Port = 25
 smtpclient.Credentials = CredentialCache.DefaultNetworkCredentials
 mailmessage.From = fromadd
 mailmessage.To.Add(ToMail)
 mailmessage.CC.Add(ToCC)
 mailmessage.Subject = CStr(Subject)
 mailmessage.Body = CStr(Message)

smtpclient.Send(mailmessage)

End Sub
End Class
Visual Basic

Archiving a file in Visual Basic

Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.IO

<System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _
<System.CLSCompliantAttribute(False)> _
Partial Public Class ScriptMain
 Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase

Enum ScriptResults
 Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
 Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
 End Enum

Public Sub Main()

Dim sOriginalFile, sArchivedFile, sDate As String

sOriginalFile = "C:\Taleo\TCC\Prod\Export\Requisition\Requisition.csv"
 sDate = Year(Date.Today()).ToString() & Right("0" & Month(Date.Today()), 2) & Right("0" & Microsoft.VisualBasic.DateAndTime.Day(Date.Today()), 2) & "_" & Hour(Now) & "_" & Minute(Now) & "_" & Second(Now)
 sArchivedFile = "C:\Taleo\TCC\Prod\Export\Requisition\Archive\ReqExport\Requisition-" & sDate & ".csv"

File.Move(sOriginalFile, sArchivedFile)

Dts.TaskResult = ScriptResults.Success
 End Sub

End Class

Visual Basic

Checking a file for content in Visual Basic

Imports System
 Imports System.Data
 Imports System.Math
 Imports Microsoft.SqlServer.Dts.Runtime
 Imports System.IO

<System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _
 <System.CLSCompliantAttribute(False)> _
 Partial Public Class ScriptMain
 Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase

Enum ScriptResults
 Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
 Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
 End Enum

Public Sub Main()
 Dim oReader As StreamReader
 Dim intLines As Integer
 Dim strLines As String

Dts.TaskResult = ScriptResults.Success
 intLines = 0
 strLines = ""
 oReader = New StreamReader("C:\Taleo\TCC\Prod\Export\Requisition\Requisition.csv")
 Do While Not oReader.EndOfStream
 strLines = oReader.ReadLine()
 intLines = intLines + 1
 Loop
 oReader.Close()
 oReader = Nothing
 If intLines < 2 Then
 File.Delete("C:\Taleo\TCC\Prod\Export\Requisition\Requisition.csv")
 Dts.TaskResult = ScriptResults.Failure

End If

End Sub

End Class

Rant

Rant about really bad software

Okay, I could have been the greatest salesman in the world if someone would provide me something worth selling.  Something that made life easier and automated or at least eased the pain of something that I was having to do all the time anyways.  My rant today involves time keeping software which for this session we’re going to call ClockMe.  Now ColckMe is web based and is basically an online time sheet.  The premise is that you log in from any internet enabled device and submit your time, your manager receives an email and clicks the link from his computer, tablet, cell phone and approves or declines the time and then the time is downloaded into the payroll system.  Short sweet and comes with a happy ending (a paycheck people, minds out of the gutter).  Let’s take a look at how bad programmers spoil happy endings…

Now ClockMe is built on PostGre SQL and is written in Python and hosted on Rack Space.  That’s three hits for me, I’m not paying a Microsoft or Oracle surtax and Rack Space is well rated.  I love open source and dependability.  That’s where this love affair ends.  After you log on the world gets really, really dark…

Let’s start from the beginning, I need to enter my time.  I log in and get to my time sheet:

My time is based on in/out – lunch – in/out and that is this entry screen:
[show how bad tab stops are]

And then there is how the time should be allocated, ideally if the employee is smart we give them access to pick their assignment, under no circumstances do you let them pick their pay type.
[show manual pay type allocation]

Now if you are doing different assignments throughout your week, odds are you have different overlords you report to for those different assignments.  This system treats every employee as they only report to one ‘approval process’ so you can only have a single manager approving time for all assignments:
[Show how this is a pain to deal with]

Group and roll selection is as bad if not worse than any program I’ve ever seen.  I’ve got 200 groups in my list and they show me 10 and I have to go through the whole thing making sure I remember to hold control to select them.  This isn’t bad programming this is sadistic.
[Screen shot of the abomination]

Manager logins, you should never include a character in your usernames that would make someone have to select it, a double click should render the username completely copyable.  Now this may have been done by us but I’m not sure why they would allow for user names like that.