The Pavement
Web Design and Application Develop

A little bit too lastminute.com

September 4, 2007 09:19 by shaun

Way back in April of this year my girlfriend and I decided to go to the Bestival festival that takes place on the Isle of White each year in September.  It's only been going for a few years so isn't really in the same league as Reading or Glastonbury and so tickets don't normally sell out at any where near the same rate but we decided to get ours early anyway so brought a couple from lastminute.com

So lastminute.com got £244 of our money and we got an email informing us that our tickets would be with us 10 days before the event...

A few months past and it was late August.  The Bestival had sold out long ago and it was now 10 days before it all starts and no tickets had arrived.  I emailed lastminute.com and a few days later received a reply telling me not to worry and that the tickets will be with me within the next few days.  4 days before the event and still no tickets, I email again and this time received an automated response thanking me for my email and informing me that I would receive a reply from a human being within the next 4 working days... not very helpful considering I'm meant to be there ticket in hand in less than 4 days time!

A couple of calls to a computer later shouting YES and NO in all the right places and I finally got to talk to a human being, they said they would look into the problem for me, great I thought, I'm sure they got lost in the post and they can just reissue the tickets.  But then i received an email this morning:

Greetings from lastminute.com

Please note that as per the update from the supplier, there has been a
technical error due to which your booking was not processed. They have
tried their level best to secure tickets for you. However, there are no
more tickets left for the event.

Thus, we have processed a full refund for the booking. The refund of GBP
244.90 will be processed to the original form of payment within the next
7 days.

I apologise for any inconvenience caused, please do not hesitate to
contact us should you require any further assistance.

Regards,

Sylvester Chiu
Customer Services Team
lastminute.com

How disappointing!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

And I think the worst thing is that the email comes from an unmonitored account so the only way to discuss this with them further is to shout YES and NO at a computer again!  This is the problem with internet only companies, They are all too keen to sell you the services/products but they don't have the customer support to back this up.

Rant over...

Technorati Tags: ,

Tags:
Categories: General
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Prompting the user to save thier Changes

August 28, 2007 10:51 by shaun

I'm sure we've all done it at some point, spent ages on a web page updating some information only to lose the changes for some reason.  Sometimes its not your fault i.e. the server goes down whilst you're in the middle of making a change but sometimes your just to quick for your own good and navigate away from a page without saving the change.  whatever happens it can be extremely frustrating!

A recent client has asked me to warn users when they are about to navigate away from a page before saving their changes.  They wanted this warning to appear if the users clicks a link within the application or uses the browser back button or closes the window. One easy solution to this is the window.onbeforeunload javascript event.

This event will fire whenever the user leaves the page.  You can also pass the event a custom message to display in the warning box.  To wire this into your page simply add the ProjectDataChanged() function call to the onchange event of any controls that can alter data on the page.

function ProjectDataChanged()
{
    window.onbeforeunload = ShowProjectDataChangedWarning;
}

function ShowProjectDataChangedWarning()
{
    return 'Navigating away from this page will cause you
    to lose any changes you have made. Please use the publish
    button(s) at the bottom of the page to save your changes.';
}

To stop the message from appearing (when the user successfully saves) call the CancelCheck function.

function CancelCheck()
{
    window.onbeforeunload = '';
}

Hope this helps..

Tags:
Categories: Web Design | Javascript
Actions: E-mail | Permalink | Comments (3) | Comment RSSRSS comment feed

Move a window when its title bar is off the screen

August 22, 2007 04:41 by Shaun

This is something that has bugged me for years.. finally a solution!

  1. Hold down Alt + Spacebar
  2. Press the M key
  3. Use the arrow keys to relocate the window
  4. Press the Enter key when you have the Window in the desired location.

 

Tags: Tags:
Categories: General
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

Broadband Woes

August 21, 2007 12:19 by Shaun

I moved house a few weeks ago and I’ve finally unpacked all the boxes and spoken to the various companies I have something to do with to tell them my new address.  Although listening to automated touchtone messages again and again is never that pleasurable most companies (bank, mobile phone, utilities etc) managed to handle my move request with ease.  That was except for one... the dreaded broadband provider; they have been so utterly useless I feel compelled to tell the world!

I’ve had an account with Be (bethere.co.uk) for about a year, their service had been reliable but their quoted 24 meg download speed has been more like a 4 or 5 ever since we signed up.  I gave them a call to let them know I was moving and was surprised when they said they had no procedures in place for moving house… I mean come on; it’s hardly that unusual is it!  Instead I would have to close down my old account (at a cost of £50) and then re-open a brand new account (at a cost of £24) that’s £74 for an existing customer to simply move house, a little on the steep side I think!  On top of this there systems were unable to cope with me using the same email address to sign up for the new account so I’m forced to use my work email address…

Anyway after a week of waiting around I logged onto their website only to be told that there was a problem activating my line, I called the help desk (Bulgaria) and was told that there was no problem and that the website would be updated in a few hours.  The next day the website still showed an issue so I called again and was told there wasn’t a problem.  On the third day, still an issue was flagged so I called only to be told that they have now got a brand new moving house procedure and I was one of their guinea pigs, hurrah!  Then they told me it’s gone horribly wrong and so we will still have to cancel your account and place a new order.. Only you can’t place the new order yet as the line is now unavailable due to them trying to move it over…

Anyway to cut a long story short it’s been 2 weeks since I tried to get broadband at my new place, I’m now told my line should be active in the next 4 weeks, that’s 6 weeks and £74 just to move house… nice service Be!

Rant Over!

Tags: Tags:
Categories: General
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Adding and Removing Users from AD Groups

August 3, 2007 11:48 by Shaun

Many organisations use their Active Directory services to assign security policies to their internal software and the one I’m currently working for is no different. The web application I’m currently developing extracts the username from the HTTP header and then queries the Active Directory service to see if that user belongs to a particular AD group. I have been implementing functionality to allow the application to add and remove users from this group and I thought I’d give a brief overview of how this is done…

The first thing you need is a service account username and password that has full control of the AD group you wish to modify, you can then implement the following to add a user to this group, just plug in the correct strings for your particular setup:

public void AddUserToRAPSGroup(string userName)
{
   //Retrieve entry using LDAP
   DirectoryEntry LDAPentry = new DirectoryEntry("LDAP://" + <AD Server Name>);
   LDAPentry.Username = <AD Server Name> + @"\" + <AD Username>;
   LDAPentry.Password = <AD Password>;
  
   //Set up a search object using the userName as a filter
   DirectorySearcher dsUser = new DirectorySearcher();
   dsUser.SearchRoot = LDAPentry;
   dsUser.PropertyNamesOnly = true;
   dsUser.PropertiesToLoad.Add("sAMAccountName");
   dsUser.Filter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=" + userName + "))";
  
   //execute the search and retrieve the user
   SearchResult srUser = dsUser.FindOne();
   DirectoryEntry deUser = srUser.GetDirectoryEntry();

   //now get the ad group
   DirectorySearcher dsGroup = new DirectorySearcher();
   dsGroup.SearchRoot = LDAPentry;
   dsGroup.Filter = "(&(objectClass=group) (cn=" + <AD GroupName> + "))";
   SearchResultCollection results = dsGroup.FindAll();
   bool isGroupMember = false;
   if (results.Count > 0)
   {
      DirectoryEntry group = GetDirectoryEntry(results[0].Path);

      object members = group.Invoke("Members",null);
      foreach ( object member in (IEnumerable) members)
      {
         DirectoryEntry x = new DirectoryEntry(member);
         if (x.Name != deUser.Name)
         {
            isGroupMember = false;
         }
         else
        {
            isGroupMember = true;
            break;
         }
      }
  
      if (!isGroupMember)
      {
         group.Invoke("Add", new object[] {deUser.Path.ToString()});
      }

      group.Close();
   }
}
Tags: Tags:
Categories: .NET
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

Converting a String to an Enum

July 31, 2007 09:35 by Shaun

I’ve come across the need to covert a string to an enum value on numerous projects in the past, each time I google the answer, implement it and then completely forget!  One solution I found was to construct a huge switch statement, this is obviously a bad idea.  For one it’s a waste of energy typing it all out plus it won’t deal with any future changes to the enum.  Instead have a look at the following code:

object Enum.Parse(System.Type enumType, string value, bool ignoreCase);

 Here’s  an example for a colour enum:

(Colour) Enum.Parse(typeof(Colour), "Green", true);

Easy huh!

Tags: Tags: ,
Categories: .NET
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

CommandField Causing IsPostback = False

July 30, 2007 12:12 by Shaun

I’ve just spent the whole morning trying to get to the bottom of some really strange page behaviour on my current project.  I have a gridview control with a command field being used to fire the RowDeleting event.  I noticed that when the delete button was clicked the IsPostback property was returning false.  This caused all of my page initiation code to be executed for a second time.  After hours of trying to find the problem it turns out this is an ASP.NET 2.0 bug that occurs when the commandfield has a button type of ‘Image’. 

<asp:CommandField ButtonType="Image" HeaderText="Delete" ShowDeleteButton="true"
                DeleteImageUrl="~/Images/delete.png" />

After changing the attribute to ‘Link’ the IsPostback property correctly returns True.  The problem with this solution is that you loose any nice icons being used and are left with text.  To fix this you can add an image tag to the DeleteText attribute as shown below:

<asp:CommandField ButtonType=Link HeaderText="Delete" ShowDeleteButton="true"
                 DeleteText="<img src='Images/delete.png' style='border:none;' />" />

Hope this saves someone a bit of time in the future…

Tags: Tags: ,
Categories: .NET
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

iSight Screensavers

July 23, 2007 18:56 by Shaun

I was having a quick browse of the download squad feed this morning and came across these screen savers for macs with isights (built in or otherwise).. great idea!

Tags: Tags: ,
Categories: Apple
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

Wildcard String Replacement in C#

July 23, 2007 17:31 by Shaun

I was recently faced with the task of removing a bunch of tags from a string I was manipulating in C#. The string class has a whole bunch of inbuilt methods that can be used to manipulate its contents, one of those being the .Replace method. I was hoping that this method could deal with wildcards, this would make the removal of any html tags easy using syntax such as:

thestring = theString.Replace("<a>*</a>");

Unfortunately there didn’t seem to be any such functionality. So I started to write my own utility method to do such a task.  This turned out to be more complex that I first reckoned, the code I have included below works just fine when removing <a> tags that contain an href attribute.  The code can be called as so:

theString = Utils.WildCardReplace(theString, @"<a href="*>", string.Empty);

And here’s the implementation:

public static string WildCardReplace(string strString, string strOldValue, string strNewValue)
       {
            bool oldValueFound = true;

            //split out the start and end values using the wildcard
            string strStart = strOldValue.Substring(0, strOldValue.IndexOf('*'));
            string strFinish = strOldValue.Substring(strOldValue.IndexOf('*') + 1);

            while (oldValueFound)
            {
                //get the index of the first occurance of this string
                int indexOfStart = strString.IndexOf(strStart);
                int indexOfEnd;
                if (indexOfStart != -1)
                {
                    //get the index of the first appearance of the end string
                    indexOfEnd = (strString.IndexOf(strFinish, indexOfStart)) - indexOfStart + 1;
                }
                else
                {
                    indexOfEnd = -1;
                }

                ////did we get matches
                if (indexOfStart == -1 ||
                    indexOfEnd == -1)
                {
                    //no so jump out of the loop
                    oldValueFound = false;
                }
                else
                {

                    //yes, get the complete substring to replace
                    string strBitToReplace = strString.Substring(indexOfStart, indexOfEnd);

                    //do the replace
                    strString = strString.Replace(strBitToReplace, strNewValue);
                }

            }

            return strString;
        }

This will remove the opening a tag. The standard Replace method can then be used to remove all the orphaned closing tags.

Please feel free to reuse/improve the code as you wish.

Tags: Tags: ,
Categories: .NET
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

Bug in CollapsiblePanelExtender - Flashing in IE6

July 19, 2007 16:31 by Shaun

This is a word of warning for anybody developing with the AJAX Control Toolkit using IE7. I deployed my code onto a test server today and started to run through it before unleashing it to the test team. The company I am developing for use IE6 across their estate but I had been developing and testing using IE7. Its only when I clicked through the app using IE6 I discovered that partial page updates no longer work. After a lot of searching on the internet I discovered this is a bug that has yet to be fixed with the CollapsiblePanelExtender within IE6. The page is correctly performing a partial page update but the browser decides to redraw the whole page anyway.. very frustrating!

Does anybody know of a workaround for this? Or an alternative CollapsiblePanel control?

Tags: Tags: , ,
Categories: .NET
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed