Cool Stuff

Try Market Samurai now for free!

Think Outside Inc Stowaway Keyboard
The Solution To Bloging on Your Smartphone

Now Add This - GREAT PRICE!
Cingular 8525 Smartphone

SimpleTech External Hard Drives
Elegant Backup Solutions

Acronis True Image Server
Server Backup Solutions When You Gotta Keep Going

Posts Tagged ‘Web Design & Development’

postheadericon Integrate Google Calendar in your web design

I’ve been asked by a couple people recently about option for coding a calendar function into their websites. While I do like to earn good money and make a handsome profit I feel that coding for the sake of it is not an option. There are so many services and online systems available these days that you can just plug into, why not just use whats available?

Many an anal retentive will explete ‘but it doesn’t look like my website’ or ‘I don’t want to drive traffic away from my site’. Fair enough, Ar’s (you know who you are).

Here’s a nice solution from Google, master of the internet, soon to be master of the world (when he’s finished photographing it at street level) and finally master of the universe (AKA God!).

You can plug in a Google calendar with but a few clicks of the mouse using my easy to use but pricey content management system!

Voila!

 

postheadericon ASP.NET Machine Generated Code

I just started working with a new client in Port Charlotte. They have had a website built by a company in Tampa and how now parted company with that company, so to speak. So I pick up this system and start to go through the coding and it’s build etc, trying to get up to speed as quickly as possible. But something is not right. It’s a struggle, confusing, big, messy. I don’t know why…

 Well I eventually figure out that this website system, asp.net code, classes and modules, forms, and by golly the database and stored procedures have, for the most part be generated by a …. MACHINE! ARGHHHH.

Yes, thats right, the original developers are working with a software tool that allows them to work in plain english (I guess) with a client to spec out the system. They do their high level analysis etc, enter data into the software, press a button and voila! Here is your website sir!

This doesn’t include the design of the site aesthetically, the way it looks etc, which is actually quite nice…

So, what’s my point. Here it is… A machine generated system (i’m going back to database design days years ago when I used software tools to design databases) tends to be broken down into a very low level. What I mean by that is the mathematics and algorithms that do the analysis and create the design tend to go WAY TOO FAR! This means that you end up with a system that is very complex. It explains one reason why my new client decided to jump ship from the pervious developer. The initial development costs where quite low compared to the cost of ongoing development and support. The original developer ended up in the same position as I did. After producing the system with a software tool, they were left looking at it, pondering its complexity and wondering how it all works exaclty.

postheadericon Asynchronus Socket Programming

I’ve recently done some TCP/IP socket programming. The .Net framework provides a some nice features for making asynchronus program calls. One of the most robust is TCP/IP Sockets.

It can be quite confusing at first to understand the way an asynchronous call and callback mechanism works. I find it easier to understand when I look at the flow of the call first. So here is an outline of the flow.

The basic framework of an asynchronus call is:

  1. Declare the socket
  2. Socket.BeginConnect with ConnectCallback address
  3. ConnectCallback.EndConnect
  4. Socket.BeginSend with SendCallback address
  5. SendCallback.EndSend
  6. Socket.BeginRecieve with RecieveCallback address
  7. RecieveCallback.EndRecieve

And these are the actual function prototypes for an asynchronous TCP/IP socket. This is the outline, I’ll post some real code in another post later.

Dim state As New StateObject 

‘ Create a TCP/IP socket.
Dim client As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
‘ Connect to the remote endpoint.
client.BeginConnect(remoteEP, New AsyncCallback(AddressOf ConnectCallback), state)

Private Sub ConnectCallback(ByVal ar As IAsyncResult)
‘ Retrieve the socket from the state object.
Dim state As StateObject = CType(ar.AsyncState, StateObject)

Try
‘ Complete the connection.
state.workSocket.EndConnect(ar)
Catch ex As Exception
End Try
‘now do the send
‘ Begin sending the data to the remote device.
state.workSocket.BeginSend(byteData, 0, byteData.Length, 0, New AsyncCallback(AddressOf SendCallback), state)End Sub ‘ConnectCallback

Private Sub SendCallback(ByVal ar As IAsyncResult)
‘ Retrieve the socket from the state object.
Dim state As StateObject = CType(ar.AsyncState, StateObject)

Try
‘ Complete sending the data to the remote endpoint.
Dim bytesSent As Integer = state.workSocket.EndSend(ar)

Catch ex As Exception
End Try

 ‘now recieve the response
‘ Begin receiving the data from the remote device.
state.workSocket.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, New AsyncCallback(AddressOf ReceiveCallback), state)
End Sub ‘SendCallback 

Private Sub ReceiveCallback(ByVal ar As IAsyncResult)

‘ Retrieve the state object and the client socket
‘ from the asynchronous state object.

Dim state As StateObject = CType(ar.AsyncState, StateObject)
Dim client As Socket = state.workSocket

‘ Read data from the remote device.
Dim bytesRead As Integer = client.EndReceive(ar)
Try If bytesRead > 0 Then
‘ There might be more data, so store the data received so far.
state.sb.Append(Encoding.ASCII.GetString(state.buffer, 0, bytesRead))
‘ Get the rest of the data.
client.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, New AsyncCallback(AddressOf ReceiveCallback), state)
Else ‘ All the data has arrived; put it in response.
 
If state.sb.Length > 1 Then response = state.sb.ToString()End If 

 

End IfCatch ex As ExceptionEnd Try
End Sub ‘ReceiveCallback  

I’ll post the state object class and in another post. I found the easiest way to maintain the connection and shut it down was to have the worksocket in the stateobject.

postheadericon Visual Studio 2008

I’ve recently installed Visual Studio 2008 and related software. I was hoping to upgrade and start developing in it as soon as possible.

I’ve generally always been an early adopter, but didn’t move to Visual Studio 2005 until quite late in it’s life cycle. I’ve since decided that was a mistake. It’s far better to be on the curve early than to come in late, or even miss a version and come in a versiion behind. Not a good idea.

Now, I know that Microsoft, God bless them, have had a really hectic schedule with the release of Vista and now Server 2008 and SQL 2008 coming soon. But, for heavens sake, I have a problem with using Visual Studio 2008 in my development environment and it’s a show stopper.

I always develop against a remote Windows server using IIS etc. That is so that I’m effectively running up against an environment that is pretty close to production. I haven’t had any problems with this for the last 4 years.

 I installed Visual Studio 2008 and tried to convert an existing project and VS couldn’t seem to access the development share. I then tried to create a new web application project with the same results.

 I’ve posted a thread on the ASP.NET forum. No replies to that yet…

And I’ve posted a bug report with Microsoft. I know that all environments may be configured slightly differently but if it’s working in Visual Studio 2003 and 2005 I certainly expect it to work in Visual Studio 2008. What a bloody pain!

postheadericon Auto Insurance Affiliate Website

I’ve just put up an Auto Insurance affiliate website, working with some partners of mine. We’ve decided to see if we can get enough low cost traffic using Google Adwords PPC. We are in the conversion testing phase at the moment. The cost per click for US based Google traffic is rising quite sharply, so we’ll have to see what we end up paying to get a decent amount of traffic and how well the two sites we are testing convert.

There are two urls that we are using;
http://www.cheaperautoinsurancequotes.com
http://www.cheaperautoinsurancerates.com

And the landing pages are at;
http://www.cheaperautoinsurancequotes.com/online/auto-insurance/quotes/cheap-auto-insurance-quotes.aspx
http://www.cheaperautoinsurancequotes.com/online/auto-insurance/quotes/auto-insurance-quotes-online.aspx

http://www.cheaperautoinsurancerates.com/auto-insurance/rates/best-auto-insurance-rates.aspx

http://www.cheaperautoinsurancerates.com/auto-insurance/rates/auto-insurance-rates-online.aspx

We are split testing the landing pages and also the two affiliate site to see which is the best converting.

postheadericon Parsing Google Maps HTML

If you cannot afford 10 grand for an enterprise version of the Google Maps API, then you might be stuck having to parse the html form the clunky old maps.google.com website. If that is the case, here’s a snippet of code that seems to work consistently to parse out the lat and lon from the html.

 If HTML.Length > 0 Then
‘we have something back so
‘get important part of string
Dim s1 As String = geo.Substring(geo.IndexOf(“viewport:{center:{“), 200)
Dim intStartPos As Integer = s1.IndexOf(“{lat:”, 0) + 5
Dim intEndPos As Integer = s1.IndexOf(“}”, intStartPos)
Dim intCommaPos As Integer = s1.IndexOf(“,”, intStartPos)

‘now assign the strings to lat/ lon vars
_lat = s1.Substring(intStartPos, intCommaPos – intStartPos)
_lon = s1.Substring(intCommaPos + 5, intEndPos – (intCommaPos + 5))

End If

postheadericon Essential Objects – Treeview

I’ve just finished a web project that I used the Essential Objects TreeView control.

I had thought initially that it would be relatively easy to configure. I’ve used a number of Essential Objects controls before and always found them fairly intuitive to use.

However, the TreeView was anything but intuitive. At the designer level it looks pretty straightforward. Just like the Tabstrip I thought. And initially all seemed well. But I had a real problem making sense of the data binding. Of course, its data driven so that would be a problem.

I thought I’d got it sorted out fairly early on, and then I realized that the data binding of each node was not what I expected.

The programming examples for the Treeview are, unfortunately non-existent on the essential objects website. Instead, they refer you to the menu control examples. This was pretty frustrating, as I was on a tight deadline and just wanted a Treeview example, nice and straight forward like. Please feel free to post this if you want.

So, this is how I bound the Treeview and got the correct itemID’s established.

Private Sub tvCookClass_ItemDataBound(ByVal sender As Object, ByVal e As EO.Web.NavigationItemEventArgs) Handles tvCookClass.ItemDataBoundTry
‘set the itemid based on the dataset array index
e.NavigationItem.ItemID = CType(e.NavigationItem.DataItem, DataRow).ItemArray(0).ToString
If e.NavigationItem.Level.Equals(1) Then
‘this is the student level data
‘position 4 is the class data for each payment
e.NavigationItem.Value = CType(e.NavigationItem.DataItem, DataRow).ItemArray(4).ToString
End If
Catch ex As Exception
End Try
End Sub 

One really neat feature is the customItem control. This allowed me to quite easily embed an editor feature inside the Treeview. This was a relief after the problems I had binding the thing in the first place.

This is what the maintenance list looks like;
cookschool1.gif

This is what the editor looks like. You just click on the row to display the editor.
cookschool2.gif

So eventually I got a pretty neat solution using this control. It will require some work to get the thing looking a little better. I might even look at changing the editor so it goes below the selected node, rather than right next to / over it. But it’s nice to be able to update or edit the data with a couple of mouse clicks, without posting to a different form.

I would definitely use it for other projects. I didn’t have time to put it into an AJAX wrapper but next update I’ll try that too.

postheadericon Visual Studio 2005 Upgrade

When I first installed VS 2005 I did so with a version prior to SP1. This created a problem for me when I tried to upgrade a project from VS2003 to VS2005.

I didn’t know that Microsoft had created a new “website” project template, which had replaced the 2003 web application.

The first point to note here is that there must have been hundreds of thousands of web applications already in existence and no doubt many thousands of developers waiting for the new release and eager to upgrade. It must have been very disappointing; well actually, very frustrating to try and upgrade and find out that your good old reliable web application was superseded by a “website” project.

This is one of the things that really annoys me about Microsoft. They are so eager to make the tools available to anyone with half a brain and an inkling that they might be able to program or develop systems. What they end up doing is trying to hide any levels of complexity to make the tools easier to use. This is not always a bad thing, hell, I don’t want to go too low level, I’m not that smart! But, they created a new website project template, trying to make the tool easier to use and at the same time, seem to have thrown the old web application model away?

Anyway, the web application model was provided by a plug-in (snicker) and in VS2005 SP1 it’s actually a template.

So, after an initial attempt and then looking at the ensuing mess (web application upgraded to website project; believe me, that isn’t a pretty sight!), I was able to upgrade fairly well after installing VS 2005 SP1.

I really had few problems after that. Quite a few warnings about obsolete syntax errors, which I updated in short order.

One interesting problem that did arise was trying to debug the project after conversion. I obviously changed the web server settings to use .NET 2.0 instead of 1.1. I then couldn’t debug the project until I had setup a separate application pool for the wp3.exe process. It seems you can’t run the old .NET 1.1 and .NET 2.0 processes side by side in the same application pool.

So I’ve been developing a new system in VS 2005 and have immediately found the new master page addition to be extremely useful. I’ll explain that in a future post.

postheadericon Bulletin Boards / Membership Site Systems

I’ve been looking at some bulletin board systems recently. I want something that I can easily integrate into existing sites and new sites that I’m putting up.

I looked at phpBB which has been around for a while and seems to be well liked. It’s also free, which is nice… I was toying with the idea of that and then looked at vBulletin, which is another that is highly regarded, Mark Joyner uses it so it’s good enough for me! It costs $180 for a site license, so it’s not too bad price wise…

Both of these are PHP systems with mySQL on the backend. Then I looked as some ASP systems. Web Wiz Forums looks pretty good and megaBBS gets a lot of good reviews too.

There’s also a WordPress plugin called bbPress that looks OK. Seems like it might be in fairly early stage of development though.

Anyway, I’ve got a number of systems running PHP on Windows 2003 with mySQL on the backend. No problems there, but PHP isn’t a language that I develop in, so I’m really looking for ASP or ASP.NET.

If you have any recommendations or experience of these products, or others that you know of, please let me know…

Thanks
Steve

Oh, look what I found here at Wikipedia  for ASP Forums and PHP Forums and this is a review site I was looking at earlier.

postheadericon The Joys Of XML

I’m currently working on a project that requires posting and reading response online using XML. I’m not talking about web services here, it’s a plain old POST of an XML file, response is returned as copious amounts of XML, read that and build a web form based on the contents (yawn), have website user make selections and POST that back as plain old XML, get another response back as, yep you guessed correctly, XML and read that, make a decision based on the contents and voila, we’re done.

 I’m a little bit surprised that the company that runs this service, the bowels of which I am groping around in, has not developed a SOAP API or Web Services API that can be programmed against without the raw manipulation of XML (i.e. text) data. I’ve used the Amazon, PayPal and EBay API’s and while there is a hefty learning curve it is far more intuitive, in my humble opinion, to code against an API than against raw XML.

Whenever I start having to parse text files, I don’t care if we have XSD files and a schema, yada yada ya, I feel like I’m using old technology that is cumbersome, although it does the job, right. I know that the legacy of XML and the use of text goes back a long way, when it was far more difficult, time consuming etc to open up a port and configure a firewall, so passing text through was an easy solution.

I can only guess that this company has so much legacy code and systems that the move to a SOAP API and web services infrustructure is still in the pipeline. Just as there are still tons of companies that still use EDI right?




Authorize.Net Merchant - Click to Verify