Wednesday, January 30, 2008
Postal Piracy
So I may be a little late to the whole buying things off the internet thing, I prefer to talk to people once in a while, especially when making a purchase. Call me old fashioned.
But today I had to buy something off line as the item isn't carried in stores, I also received a gift card to Amazon.com a while back (two posts in one day, both having something to do with Amazon....weird. I promise I really don't hate those guys) and I noticed something. The post office is making a killing.
For example today I had to order a little infrared sensor for a Tivo box. The little light attached to a wire cost me 6.99 pre tax. Not to shabby at all. So I go to the order page, and they are charging me 4.47 to ship the 4 oz item. So they are charging me ~63% of the cost of the item just to ship it. And it is just the basic shipping. It isn't like i chose to overnight the damn thing.
Is it me or is that a bit high. And that isn't even the worst one. I bought off of Amazon a set of guitar picks for $0.62, thats right less than a dollar. And those swindlers charged me 3 bucks for shipping and handling. Its not like they even packed it with care. The envelope came with the packing slip sloppily stuffed all wrinkled with the picks.
I dunno, the post office claims they are having hard times and they keep upping the cost of stamps in order to make ends meet and all that. But it seems to me that their coffers are pretty full if they are charging 206% of cost of item in order to ship.
I'm going back to buying everything at the store...
Labels: rant
posted by Tom Becker at
|

404 Pages
So I came across this
article on Slashdot today. And it is just baffling. Amazon was awarded a patent for a custom 404 page (file not found) , not the generic one that IIS serves up, but a custom one that will try to make suggestions of pages that you were looking for based on the URL or search criterea.
I really hope that this gets overturned or something. I don't know how the patent office works, but this is ridiculous. The custom 404 has been around for a while and I'm sure someone could find an example of one before Amazon claims that they came up with the idea.
Since every major website I'm willing to be has one that is if that's webmaster worth anything (and not including this blog since I don't have one. I'll just blame that on me being a developer now and that not having a custom 404 page is just a feature). So will Amazon go after people with a patent infringement? Can we expect either Amazon to sue the likes CNN, MSNBC, Microsoft, or Best Buy? Or should we see these companies with the "infringement" paying Amazon every time they serve up a 404 page? Not to mention all the small homegrown sites. And does this apply to internal sites as well? How will Amazon enforce this?
I dunno, but it will be interesting to see what happens. Maybe nothing. Only time will tell I suppose
posted by Tom Becker at
|

Monday, January 28, 2008
FormsAuthentication vs WindowsAuthentication
Well it seems that I have wasted an entire day last work working on authentication and a log out for the application that I'm working on. I say wasted cause it won't work with my project but it was pretty interesting to work with. Here's the run down.
The users want to be able to log out of the web application that I'm building for them. Not an unreasonable request. But there are standards in place that say I must use this homegrown application called AppSec to handle all of our security needs. Keeps everyones security in one place, pretty nice right? But there is a caveat to using AppSec. We must use WindowsAuthentication in order to talk to the AppSec web service.
I thought that we could get around this by using FormsAuthentication and logging into a windows domain that way. But how AppSec requires that IIS have anon. turned off in order to work. So back to square one.
But here is the code to log someone in and out of a windows domain using FormsAuthentication, in the .Net 2.0 framework.
Private Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal lpszUsername As String, _
ByVal lpszDomain As String, _
ByVal lpszPassword As String, _
ByVal dwLogonType As Integer, _
ByVal dwLogonProvider As Integer, _
ByRef phToken As IntPtr) As Boolean
' Declare the logon types as constants
Const LOGON32_LOGON_INTERACTIVE As Long = 2
Const LOGON32_LOGON_NETWORK As Long = 3
' Declare the logon providers as constants
Const LOGON32_PROVIDER_DEFAULT As Long = 0
Const LOGON32_PROVIDER_WINNT50 As Long = 3
Const LOGON32_PROVIDER_WINNT40 As Long = 2
Const LOGON32_PROVIDER_WINNT35 As Long = 1
That is the function that you will have to call in order to log in. Here is the function call:
isvalid = ValidateLogin(username, password, domain)
If isvalid Then
FormsAuthentication.RedirectFromLoginPage(username, True)
Else
'display error message
End If
Now you have to change your web.config file to use forms authentication instead of Windows
<authentication mode="Forms">
<forms loginurl="~/login.aspx" name="TestLogin" timeout="20" path="/" protection="All" />
</authentication >
After that you should be able to log in to your windows domain.
And to log out is just as easy:
FormsAuthentication.SignOut()
I got most of this code from
this AspAlliance article, but at the time of posting the text of the article doesn't seem to be loading.
Labels: .NET
posted by Tom Becker at
|

Saturday, January 19, 2008
Geocaching
So recently I've started geocaching. For those who have no idea what I'm talking about, geocaching is where you take a GPS unit and put in a set of lat and long coordinates, go to that location and there is something hidden. It is like modern day treasure hunting. The containers that are hidden can be anything from a gallon Tupperware container to a little magnetic key holder. And they can be anywhere, my brother-in-law told be about one that was at a Starbucks.
So anyway, they have a little piece of code to show your stats that you can put on your website. So that is the new thing on the right side of the screen.
As of right now I've only found 2, but I may actually do some hunting today. We'll see.
I may also go to the motocross expo tonight at the coliseum. Go see some crazy people doing back flips. They also have a bike show up there too, so I can go drool over the fancy bikes until I can afford a new bike. Not that I don't' love my current one
Labels: geocaching
posted by Tom Becker at
|

Tuesday, January 8, 2008
Uploading a file into an Oracle Blob
I was actually pleasantly surprised how easy it was to upload a blob into an Oracle database from a .NET app. I had been putting off this part of the app off for quite some time, and I am just about done with the rest of it so I thought it was about time. And I'll share the code here with you:
I just used a standard ASP.Net file upload control in the front end (not included here), and the code behind was just as simple
'file upload control
fileName = Me.fupAttach.FileName
'friendly name for the file
friendlyName = Me.txtFriendlyName.Text
'quick description
FileDesc = Me.txtFileDesc.Text
'Since a blob is just a byte array, the file upload control has a nice built in
'option to convert the file into a byte[]
Dim btAry As Byte() = Me.fupAttach.FileBytes
'The rest is just basic Oracle
Dim conn As New OracleConnection
Dim comm As OracleCommand
conn.ConnectionString = .Common.ProjectConnectionString
conn.Open()
comm = New OracleCommand("############", conn)
comm.CommandType = CommandType.StoredProcedure
comm.Parameters.Add("IN_FILE_NAME", OracleType.VarChar, 500).Value = fileName
comm.Parameters.Add("IN_FRIENDLY_NAME", OracleType.VarChar, 1).Value = friendlyName
comm.Parameters.Add("IN_FILE_DESC", OracleType.VarChar, 220).Value = FileDesc
comm.Parameters.Add("IN_FILE_BLOB", OracleType.Blob).Value = btAry
comm.ExecuteNonQuery()
And that is it. Like I said pretty easy. I was actually very surprised how little I found on the internet to do this. Most of the other examples I found were using a standard HTML upload filed, back from classic ASP days.
Hope this helps.
Labels: .NET, Oracle
posted by Tom Becker at
|

Sunday, January 6, 2008
The beginning
I have finally set up a blog on this site like I had planning to for quite some time. I am using Blogger. A pretty neat little piece of software if I do say so.
I guess I should probably introduce myself a little bit. I am a web programmer from Richmond, VA. I started out my professional career on the "dark side" as a web master, as I was finishing my CS degree. And now I am a full on web developer, and I still have some of my old web master tendencies of over analyzing pretty much every website I visit.
posted by Tom Becker at
|
