Thursday, January 8, 2009

Sometimes you just need to look at the source code

I have been playing around with Dot Net Nuke recently, trying to figure out if I want to move to this as the main core backend for future websites and web applications I build.

One thing I have never liked about DNN is the way it creates urls. This is a link to the Blogs section of the DotNetNuke website and a typical example of what a DNN url looks like. http://www.dotnetnuke.com/tabid/825/default.aspx - with all pages having default.aspx at the end and actually being identified by the tabid number. This is just not a very friendly url and this is one of the main reasons I have avoided using DNN in the past.

With the latest round of research I have been looking for a way to get DNN to use a more friendly url structure such as http://www.dotnetnuke.com/blog.aspx etc...

I was looking at external addon modules to do this such as the cool looking Url Master Module from iFinity a company owned and run by Bruce Chapman from Sunshine Coast, Queensland, Australia http://www.ifinity.com.au/Products/Url_Master_DNN_SEO_Urls/. However, hesitate to commit myself to buying a $95 dollar add-on for every site I build. This kind of expense can really cut into your profit margin.

So today I took a good look at the source for the Friendly Url provider that comes with DNN and came across this setting: urlformat="HumanFriendly" which does exactly what I wanted.

To use this, just open your web.config and locate this tag:

<friendlyurl defaultprovider="DNNFriendlyUrl">
<providers>
<clear>
<add name="DNNFriendlyUrl" type="DotNetNuke.Services.Url.FriendlyUrl.DNNFriendlyUrlProvider, DotNetNuke.HttpModules" includepagename="true" regexmatch="[^a-zA-Z0-9 _-]">
</add>
</clear>

Change it to :

<friendlyurl defaultprovider="DNNFriendlyUrl">
<providers>
<clear>
<add name="DNNFriendlyUrl" type="DotNetNuke.Services.Url.FriendlyUrl.DNNFriendlyUrlProvider, DotNetNuke.HttpModules" includepagename="true" regexmatch="[^a-zA-Z0-9 _-]" urlformat="HumanFriendly">
</add>
</clear>

Save it and refresh your DNN application. Then you will see no tabid is in your urls.
Thanks to this post for helping me figure out the details of how to do this: http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/111/threadid/203804/scope/posts/Default.aspx

What I wanted was right there all along. However, I would not have realized this was built in if I hadn't taken a good look at the source code for the application and seen a switch that was turned off by default to use
Human Friendly urls.

The moral here is that
sometimes you just need to look at the source code.

Tuesday, January 6, 2009

Avoid Shelby v5.08000 etc

Don't update your Shelby systems software from the v5.07000 version to the .08000 version using the current end of the year update. There is a bug in the update and you will have to uninstall Shelby and re-install after getting the older version from support.

That is what I did today, uninstall and re-install the Shelby Systems Church management system after doing a end of the year update last night.

As all my loyal readers will already know (that's a joke as I think there are probably 2 of you) I am not at all a fan of Shelby Church management system. This just makes it worse. I am a programmer and have created programs and updates that had errors in them, we all do no matter how much we test. However, I don't continue to encourage people to install my software KNOWING there is an issue and it may completely fry their install. That is just bad business practice. Granted most people will be doing an update from an 8000 version to a later 08000 version which should work fine, but for those of us like me who were still using an earlier 07000 version at least warn us not to install the 08000 version. Come on.

Wednesday, December 31, 2008

Happy New Year

Happy New Year everyone.
2008 was a wonderful year, with the birth of my first child and everything else that happened. I hope and believe 2009 can and will be even better.

Saturday, December 13, 2008

Arena

eJOn Edmiston posted a great response to a little rant I put in his comments wondering why Arena was not open sourced. Here is a link to his post http://churchcrosstalk.typepad.com/jonedmiston/2008/12/why-ccv-didnt-release-what-is-now-arena-as-open-source.html

And you should really check out his blog in general http://churchcrosstalk.typepad.com/jonedmiston/


I have re-posted a comment I made in response to that post below, and hi-lighted the part about creating a "competing" open source church management solution.


Thank You so much for the response.

I did not realize when I posted the "rant" on the comment that your church was the one who created Arena.

Given the continuing support you would have felt compelled to provide your decision makes a lot of sense. It is just frusterating to be the IT guy at a church of 500 looking for a new church management system and realize there is no way we could ever afford the best system out there, the one with all the features we could REALLY use and\or want. Honestly even for a "small" church no other system really comes close to matching the features of Arena so good job. And thanks for deciding not to just keep the project in house but to share it with the world.

All that being said if there are people reading this who would like to join me in creating an open source church management system for the rest of us, probably based off a Dot Net Nuke backend, please let me know.

Thursday, November 13, 2008

Kati

Its been a while since I have posted on here.

I have hit a mid to long term pause on the CHMS project due to my not having enough paid time in the week to get all my other Chapel Hill work done and my having other things to do with my volunteerable time.

I am working on an update for the Central Homeschool Family Ministries site, including some front end design work and more back end functionality improvements. The online web base school class registration system I built for them was one of the first real ASP.NET web applications I ever built and is still the largest programming project I have ever worked on.

I am spending most of my free time with Kati and Kristen these days. Being a dad is great and Kati is growing so fast. I love her so much and feel so blessed.

Saturday, September 27, 2008

Postmodern Math

Last Saturday I wanted to do something just for fun since we take Saturday’s as our Sabbath. Thinking about fun things to do (that are free since money is tight right now because car registrations came due this week) I decided I wanted to go to the library and get some books on math. This is something I do every once in a while, and we have been watching a lot of the show Numbers lately (Netflix is great) so my brain has been in a math mode.

We took Kati to the library for the first time, which we enjoyed much more than she did, and Kristen got some books on house design and scrapbooking. I brought home and armload of fun looking books about math and mathematicians.

The first book I ended up reading was Philosophy of Mathematics: an introduction to the world of proofs and pictures by James Robert Brown. C 1999 published by Routledge an imprint of the Taylor & Francis Group. ISBN 0-415-12275-9

This ended up being a fascinating general overview of the different strains of philosophy behind mathematics. I never realized there was so much debate among mathematicians about how to think about how math works.

There were several strains of thinking represented in the book but one debate that stood out was the question of whether mathematical concepts actually exist in some sort of platonic abstract realm of existence and mathematicians just discover these truths, or if mathematics is really just a social construct. The author believes in the platonic version of math and after reading the book I mostly agreed with him, but think he puts too much of a hard separation between the realm of math and the world we actually live in.

I found it particularly interesting to note that some of the extreme questioning of reality that has been connected with postmodernism has also made its way into mathematical philosophy. In particular chapter nine on how human’s follow “rules” especially when working from an existing sequence of numbers and seeking to extend them.

Suppose a teacher gives the following list of numbers to her student and asks them to extend the sequence (see page 133-134) 1, 4, 9, 16, …. “What is the next number? The student will likely answer 25. Why? Probably he will reason that the sequence obeys the rule of taking each number in turn and squaring it, i.e. 1 squared, 2 squared, 3 squared, 4 squared, and so on; the next number in the sequence would then be 5 squared which is 25.

But what if he answered 27? Would this be wrong? His reasoning might be as follows: The sequence is growing by adding successive odd prime numbers to the elements of the sequence. The odd primes are: 3, 5, 7, 11, 13, 17, …. Thus the sequence is:

1
4 = 1 + 3
9 = 4 + 5
16 = 9 + 7
.
.
.

And so the next number in the sequence is 16 + 11 which equals 27.”

Both of these are reasonable continuations of a mathematical sequence and the only sense in which one answer could be considered wrong has to do with the teachers “intentions” but are her intentions enough to justify considering one answer wrong?

The book goes on to give more extreme examples of a student following a rule to the best of his ability and getting an answer that is “obviously wrong” or is it? The answer given is absolutely not the one the teacher expected or intended, and would be considered wrong by most people, but is it really?

A mathematician named Kripke extended an argument by one named Wittgenstein on this topic to give the following set of arguments.

Causation is just regularity – nothing more; our inferences about the future are based on custom and habit – nothing more. Thus in this view:

  • · There is no fact of the matter about whether the teacher/questioner meant one sequence rather than another.
  • · The only way to solve the problem is to abandon the view that meaningful sentences purport to correspond to facts. Language does not word by being representational.
  • · However, this is not to abandon language. There are many useful things that various ‘language games’ can do.
  • · The conditions for the use of any language game involve reference to a community, all of whom play the same game.
  • · Ultimately, we act without hesitation, without justification; but this is not to act wrongly. In following a rule we simply do what we think is right. There is nothing deeper. But it is not enough to do merely what we think is right. ‘To think one is obeying a rule is not to obey a rule. Hence it is not possible to obey a rule “privately”; otherwise thinking one was obeying a rule would be the same thing as obeying it.
  • · We are trained by others, and we are judged to be following a rule correctly when we give the same answers as other members of the community. There is a strong tendency for all members of the community to give the same answers – a shared ‘form of life’. This is just a brute fact, like Hume’s regularities in nature. There is no explanation for this, no hidden cause: ‘What has to be accepted, the given, is – so one could say – forms of life.
  • · Our answers are (in some loose sense) in accord with the rule; but they are not caused by it. We do not grasp a rule which then determines our behavior; we do not agree in expanding a sequence because we share a common conception of some mathematical function. Rather, we say that we share a common conception because we agree in our answers, we agree in how we go on expanding the sequence.


The author of the book finds this conclusion “wholly absurd and thinks it ridiculous to say that it is only an amazing coincidence that we all agree in developing a sequence in the same way.” He concludes that “something is wrong with the premises of any argument that leads to this absurd outcome, and concludes that there are, after all, independently existing mathematical entities and we can grasp them, just as the Platonists have been claiming all along.” (Page 144-145)

I tend to agree with the author though I find Kripke’s argument to be challenging and I hate to link myself in any way with a Platonic view of the world. What do you think? Answer in the comments below.


Several times in the book, the author expressed what I would term a “negative view” toward religion, which I found to be interesting in a book on math. However I found his conclusion, especially coming from someone with this negative view of religion to be challenging.

“The real action today – the living philosophical issues for working mathematicians – cluster around visualization and experimentation. The clarification of this cluster of problems presents us with our greatest challenge. If our philosophical duty lies anywhere it is here, after the elimination of poverty which, of course, must be the first duty of all.”

How is it that a secular anti religious mathematician can view “the elimination of poverty” as “the first duty of all” and so many Christians can seem to view this issue as being unimportant compared to questions like “what style of worship is best?” Shouldn’t all Christians treat this issue as being at least one of our first duties?

Thursday, September 18, 2008

Image Upload Web Service in VB.NET

Image Upload Web Service in VB.NET


We are going to be doing and in house pictorial directory here at Chapel Hill this fall. I want this directory to be integrated with our website and allow us to view the directory pictures online.

The process as I envision it would include a family taking some time out of their Sunday or Wednesday night to have a picture taken. The photographer would take a family picture as well as individual pictures and transfer these to a computer. It would be ideal if the pictures transfered as they were being taken. We would then have a piece of software that would allow us to look up the info we have for this family, update it if needed, and upload pictures for the family and for each family member.

This software will need to re-size the images down from the hi-quality images taken by the camera to something that is a web appropriate size, upload the image, and update the family / individual profile to indicate which image belongs to them.

In order to do this, I needed a way to upload an image to a website using a VB program. I decided I would use a web service to do this and through some Google research I was able to put together a web service to do this.

Here is the code I used for the web service with a web form to test it out.
When I have finished the vb program I will post that code.

First the web service
-----------------------------------------------
Public Function UploadImage(ByVal imgdata() As Byte, ByVal FileName As String) As Integer
'Find the path on the server of our apps images folder
Dim FilePath As String = Server.MapPath("images")

'strip the path and .jpg etc out of our filename
Dim i As Integer = InStrRev(FileName, "\")
FileName = Mid(FileName, i)
Dim j As Integer = InStr(FileName, ".") - 1
Dim k As Integer = Len(FileName)
FileName = Mid(FileName, 1, j)

'Create a memory stream to hold the image data
Dim MS As New System.IO.MemoryStream(imgdata)

'Convert the memory stream to a bitmap image
Dim BM As New System.Drawing.Bitmap(Image.FromStream(MS))

'Convert the bitmap to a png and save it in our images folder
BM.Save(FilePath & FileName & ".png", Imaging.ImageFormat.Png)

'eventually we will create a database entry for this image and return the image ID
Return 1
End Function

---------------------------------------------------

Now the VB code for the web form
------------------------------------------------
Imports System.IO
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ws As New localhost.ImageUpload
Dim fs As Stream = FileUpload1.PostedFile.InputStream
Dim img(fs.Length) As Byte
fs.Read(img, 0, Convert.ToInt32(fs.Length))

ws.UploadImage(img, FileUpload1.PostedFile.FileName)
End Sub
End Class

---------------------------------------------------------

I hope someone finds this useful.