Blog

Posts written in September 2011.

  • Published on
    -
    3 min read

    My Alienware m11x Review

    Alienware M11xOn hearing Dell have officially acknowledged there is an issue with all Alienware M11x screen hinges (duh!) regardless of warranty status, I decided to write a belated review on my experience of owning this very laptop.

    After having a Dell XPS M1210 since 2007, I thought it was about time I looked for a more substantial piece of kit. I believe I still would have been completely happy with my M1210 to this very day if it wasn’t for the dependence of 64 bit architecture on some key software applications I use.

    The thing that really impressed me about the m11x was the portability factor. It really is quite a marvel on how the guys at Dell managed to pack so much high spec goodness in such as small light-weight package. I decided to go all out on my laptop specification. As my Dad has always told me: “Always get the best for the time”, especially since technology progresses so fast nowadays and you want your piece of kit to last as long as it can. Very wise my old man!

    So my specification is as follows:

    • Processor: Intel i7 1.5Ghz (overclockable to 2.6Ghz)
    • RAM: 8GB
    • Hard Disk Drive: 320GB
    • 2GB nVidia Geforce GT 540M Graphics Card
    • Flashy lights!!! (as standard)

    All this for around the £1000 mark. Not bad considering I paid in excess of over £1200 for my old Dell XPS laptop and I was getting quite a lot for my money compared to other gaming machines on the market. A laptop with this setup doesn’t fail to impress when it comes to Windows Experience ratings:

    Alienware M11x Experience Index

    The experience rating is based on a non-overclocked processor running at 1.5Ghz. I will be interested to see how the rating fairs when the processor has been overclocked…soon as I figured out how to do this.

    The Good, The Bad and The Ugly

    The Good

    Aside from the form factor, the Alienware M11x manages to pack a real punch when performing any task. From opening Notepad (lol!) to playing the most performance and graphic hungry games. I will admit, I am not much of a gamer but my experiences with playing Dirt 3 has been absolutely phenomenal especially with compared to its console counterparts. The icing on the cake has to be playing games externally through a High Definition TV via HDMI.

    The cool customisations and light effects you can make to the keyboard, front and logo lights will satisfy the inner geek. A really nice touch to keep your hardware looking different.

    The build quality is similar to what I’d expect from Dell. The good and bad. The matte black soft-touch finish allows the laptop to be somewhat scratch resistant and not much of a finger-print magnet compared to earlier editions of the M11x. All panels and covers are rock solid and all sockets and ports are nice and grippy!

    Battery life is greatly increased thanks to the nVidia Optimus switchable graphics, which automatically detects if the application you are running needs full graphics power. I manage to get around 5 hours battery life through general use.

    The Bad

    Only a minor gripe based on my personal preferences is there is no hard drive status light. My previous Dell laptop had this status light to show me how much my disk drive is working. Useful if your computer is locking up.

    It would be nice to have an additional powered USB socket to charge more than one appliance when my Alienware is switched off.

    The Synaptics touchpad is as responsive as all the other touchpad’s I’ve used in the past. So no issue there. I am just not too keen on the honeycomb textured surface. The finger doesn’t glide as fluidly as I would have liked.

    The Ugly

    The well known issue I stated at the beginning of my post – faulty screen hinge. I had known that there have been numerous issues with the hinges even before I made my purchase. You would have thought by the third iteration of the M11x this issue would have been solved by now. Unfortunately, it hasn’t.

    The problem I have been experiencing from day one is the keyboard touching the screen when the lid is closed. This has resulted in marks on various points on my screen. Unfortunately, by the time I noticed the damage was done. It seems that the keys on the keyboard are not aligned correctly with the base of the unit.

    I will be sure to get both screen and hinges replaced.

    Conclusion

    Overall, I'm really pleased with the laptop. My only gripe is the hinge issue ruining my screen.

  • Published on
    -
    2 min read

    Add MemoryStream File To Kentico Media Library

    I needed to be able to pass a file that was stored in a MemoryStream into my Kentico Media Library. In my case, the file was a dynamically generated PDF.

    I couldn’t find anything on the web on how I would achieve this. So I decided to have a go creating my own method based on the Media Library API and some very basic examples, as you can see below:

    public static string AddFile(MemoryStream file, string fileName, string description, string mediaLibrayName, string folder, string fileExt)
    {
        string cleanFileName = MakeValidFileName(fileName).Replace(" ", "-");
    
        string folderDirectory = HttpContext.Current.Server.MapPath(String.Format("/MyWebsite/media/{0}/{1}/", mediaLibrayName, folder));
    
        string mediaFilePath = String.Format("{0}{1}.{2}", folderDirectory, cleanFileName, fileExt);
    
        if (!File.Exists(mediaFilePath))
        {
            #region Create File in Media Library Directory
    
            //Check if directory exists
            if (!Directory.Exists(folderDirectory))
                Directory.CreateDirectory(folderDirectory);
    
            file.Position = 0;
    
            FileStream outStream = new FileStream(mediaFilePath, FileMode.Create, FileAccess.Write);
            file.WriteTo(outStream);
            outStream.Flush();
            outStream.Close();
    
            #endregion
    
            #region Add file info to Kentico Media library
    
            //Media Library Info - takes Media Library Name and Website Name
            MediaLibraryInfo libraryInfo = MediaLibraryInfoProvider.GetMediaLibraryInfo(mediaLibrayName, CMSContext.CurrentSiteName);
    
            // Get Relative Path to File
            string path = CMS.MediaLibrary.MediaLibraryHelper.EnsurePath(mediaFilePath);
    
            //Create media file info item
            MediaFileInfo fileInfo = new MediaFileInfo(path, libraryInfo.LibraryID, folder);
    
            fileInfo.FileTitle = fileName;
            fileInfo.FileDescription = description;
    
            // Save media file info
            MediaFileInfoProvider.ImportMediaFileInfo(fileInfo);
    
            #endregion
    
            return String.Format("/MyWebsite/media/{0}/{1}/{2}.{3}?&ext=.{3}", mediaLibrayName, folder, cleanFileName, fileExt);
        }
        else
        {
            return String.Empty;
        }
    }
    

    The method I created is generic enough for you use in your own Kentico site. It provides all the necessary parameters needed  to add an image to a media library of your choice. For example:

    AddFile(fileMemStream, “Marketing Issue", “Monthly Marketing Info”, "Private", "Premium Folder", "pdf");
    

    As much as a like using the Kentico CMS platform, I find their API documentation some what lacking in examples on how to use certain methods, especially for a new Kentico developer like myself. I am hoping this is something that will change in the near future.

  • I’ve been busy lately integrating a payment provider into a site I am working in. After looking at the best payment providers, it came down to either using PayPal or Google Checkout. In the end I decided to use Google’s payment provider (as you can probably tell from my post title).

    Before I start this post, I assume you have already created a sandbox Google Checkout account and know your way around setup and integration.

    For my own Google Checkout integration, I needed to be able to add new transaction item in my database only if a customer has ordered an item and if their payment is approved. This is where Google’s call-back notification service comes into play.

    I decided to use an synchronous notification process based on one the sample code that can be downloaded here: http://code.google.com/p/google-checkout-dotnet-sample-code/downloads/list.

    Just using the sample code provided by Google out-the-box caused issues. It seems that the code samples do not correctly reflect version changes to the payment provider. One of the repeating errors I got was: “Expected serial number was not contained in notification acknowledgement”.

    Google Checkout ErrorList

    You will only receive this error only if you are using API version 2.5 and have “Notification Filtering” enabled in account settings. Unfortunately, notification filtering is something I needed to ensure both Google Checkout and my database transactions were in sync.

    The Integration Issue error log showed me that the transaction serial number was not getting populated from my call-back notification page.

    Google Checkout Error XML Detail

    After a lot of debugging it became apparent that the notification page provided by Google Code sample was wrong! It was missing a key case statement: “authorization-amount-notification”. Once this was added no more errors occurred.

    If you are using the “notification_extended.aspx”, “notification.aspx” or “notification_handshake.aspx” code samples. Be sure to make the following change:

    <%@ Import Namespace="System.IO" %>
    <%@ Import Namespace="GCheckout" %>
    <%@ Import Namespace="GCheckout.AutoGen" %>
    <%@ Import Namespace="GCheckout.Util" %>
    <script runat="server" language="c#">
    
      public string SerialNumber = "";
    
      void Page_Load(Object sender, EventArgs e) {
        // Extract the XML from the request.
        Stream RequestStream = Request.InputStream;
        StreamReader RequestStreamReader = new StreamReader(RequestStream);
        string RequestXml = RequestStreamReader.ReadToEnd();
        RequestStream.Close();
        // Act on the XML.
        switch (EncodeHelper.GetTopElement(RequestXml)) {
          case "new-order-notification":
            NewOrderNotification N1 = (NewOrderNotification) EncodeHelper.Deserialize(RequestXml, typeof(NewOrderNotification));
            SerialNumber = N1.serialnumber;
            string OrderNumber1 = N1.googleordernumber;
            string ShipToName = N1.buyershippingaddress.contactname;
            string ShipToAddress1 = N1.buyershippingaddress.address1;
            string ShipToAddress2 = N1.buyershippingaddress.address2;
            string ShipToCity = N1.buyershippingaddress.city;
            string ShipToState = N1.buyershippingaddress.region;
            string ShipToZip = N1.buyershippingaddress.postalcode;
            foreach (Item ThisItem in N1.shoppingcart.items) {
              string Name = ThisItem.itemname;
              int Quantity = ThisItem.quantity;
              decimal Price = ThisItem.unitprice.Value;
            }
            break;
          case "risk-information-notification":
            RiskInformationNotification N2 = (RiskInformationNotification) EncodeHelper.Deserialize(RequestXml, typeof(RiskInformationNotification));
            // This notification tells us that Google has authorized the order and it has passed the fraud check.
            // Use the data below to determine if you want to accept the order, then start processing it.
            SerialNumber = N2.serialnumber;
            string OrderNumber2 = N2.googleordernumber;
            string AVS = N2.riskinformation.avsresponse;
            string CVN = N2.riskinformation.cvnresponse;
            bool SellerProtection = N2.riskinformation.eligibleforprotection;
            break;
          case "order-state-change-notification":
            OrderStateChangeNotification N3 = (OrderStateChangeNotification) EncodeHelper.Deserialize(RequestXml, typeof(OrderStateChangeNotification));
            // The order has changed either financial or fulfillment state in Google's system.
            SerialNumber = N3.serialnumber;
            string OrderNumber3 = N3.googleordernumber;
            string NewFinanceState = N3.newfinancialorderstate.ToString();
            string NewFulfillmentState = N3.newfulfillmentorderstate.ToString();
            string PrevFinanceState = N3.previousfinancialorderstate.ToString();
            string PrevFulfillmentState = N3.previousfulfillmentorderstate.ToString();
            break;
          case "charge-amount-notification":
            ChargeAmountNotification N4 = (ChargeAmountNotification) EncodeHelper.Deserialize(RequestXml, typeof(ChargeAmountNotification));
            // Google has successfully charged the customer's credit card.
            SerialNumber = N4.serialnumber;
            string OrderNumber4 = N4.googleordernumber;
            decimal ChargedAmount = N4.latestchargeamount.Value;
            break;
          case "refund-amount-notification":
            RefundAmountNotification N5 = (RefundAmountNotification) EncodeHelper.Deserialize(RequestXml, typeof(RefundAmountNotification));
            // Google has successfully refunded the customer's credit card.
            SerialNumber = N5.serialnumber;
            string OrderNumber5 = N5.googleordernumber;
            decimal RefundedAmount = N5.latestrefundamount.Value;
            break;
          case "chargeback-amount-notification":
            ChargebackAmountNotification N6 = (ChargebackAmountNotification) EncodeHelper.Deserialize(RequestXml, typeof(ChargebackAmountNotification));
            // A customer initiated a chargeback with his credit card company to get her money back.
            SerialNumber = N6.serialnumber;
            string OrderNumber6 = N6.googleordernumber;
            decimal ChargebackAmount = N6.latestchargebackamount.Value;
            break;
        // Edit: Additional case statement for "authorization-amount-notification"
          case "authorization-amount-notification":
            AuthorizationAmountNotification N7 = (AuthorizationAmountNotification)EncodeHelper.Deserialize(RequestXml, typeof(AuthorizationAmountNotification));
            // Information about a successful reauthorization for an order
            SerialNumber = N7.serialnumber;
            string OrderNumber7 = N7.googleordernumber;
            break;
          default:
            break;
        }
      }
    </script>
    <notification-acknowledgment xmlns="http://checkout.google.com/schema/2" serial-number="<%=SerialNumber %>" />
    

    Once I have got to grips on using Google Checkout I will add another blog post containing my full call-back solution.