| Subcribe via RSS

Running Chrome OS in VMWare Workstation – Step By Step

July 16th, 2010 | No Comments | Posted in Geek

I wanted to have a play with Chrome OS, but didn’t fancy compiling the code etc…

Fortunately, GdGt provide a VMDK that you can download, and be up and running in no time using VMWare workstation (or player for that matter)

Step 1 – Download Chrome OS VMDK

I downloaded a Chrome OS VMDK from GdGt – you can get it here:
http://gdgt.com/google/chrome-os/download/

Step 2 – Create a new VMWare machine

image

Select “I will install the operating system later”

image

As the guest operating system, select Linux, then Ubuntu
Others may work, but this is the one that worked for me.

image

 

image

You can choose whatever size to make the disk, since you will be replacing this anyway!

set whatever you want for this vmdk as we will be deleting it soon

Click finish.

Click finish

Step 3 – Edit the newly created machines settings

One the machine is created, click Edit virtual machine settings (before you power it on)

Click on edit virtual machine settings

 

Select the Hard Disk, and click Remove

Remove existing hard disk

Then, press Add.

Select Hard Disk, and press next.

select Hard Disk 

Select “Use an existing virtual disk”

select use an existing virtual disk

Note:

At this stage, it would be sensible to unzip the downloaded file from gdgt to your ChromeOS VM Directory (in my case C:\VM\Chrome OS (if you haven’t done so already)

Then, click next in the above screen

select chrome-os-0.4.22.8-gdgt.vmdk

Select the chrome-os-0.4.22.8-gdgt.vmdk file, and click Finish.

If it asks you to convert the existing virtual disk to a newer format, just select “Keep Existing Format” and press Ok.

The new hard drive will be added.

Click Ok.

Step 4 – Power on the virtual machine

Power on the Virtual Machine, and after a few seconds, the login screen appears:

chrome os login screen

Enter your Google account username and password, and press enter
(note: you must be connected to the internet for this to work)

Ta Da!

Chrome OS "logged in"

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Tags: ,

Dell E6400 Screen Flicker – Caused by display cable?

June 16th, 2010 | 2 Comments | Posted in Hardware

Last week, I started having trouble with my Dell E6400 Notebook.

There is an intermittent "flashing" on the screen – kind of a “solarising” of the colours, and flickering – it also displayed as “split screen” – split horizontally, displaying the same image top and bottom, but at very low resolution.

See flickering / solarising:
[video]http://www.youtube.com/watch?v=mS7pOjiEgKE[/video]

Sometimes, the screen would turn off, flash black, and then display “Display driver stopped responding and has recovered” – see image below:Display driver stopped responding and has recovered

I can reproduce the problem by holding the laptop by the left hand side, towards the top of the base, and sort of pressing the base cover.

Location of display cable on Dell E6400 Removing the base cover, I traced the problem to be with or around the LED cable (highlighted red in the image to the left)

If i pressed the cable or where it was connecting to the main board, the flickering problem could be reproduced.

I removed the cable, cleaned it, removed all dust from around it and replaced.

This problem is not totally fixed – but it happens far less now than it did before.

I suspect very strongly, I will require a new cable.

I generally (through bad habit) tend to pick the laptop up on that side of the base – so I think the cable may of worn out.

Fingers crossed a new cable is all that is required, not a whole new motherboard!

For reference, the cable I have is pictured below:

Dell E6400 Display Cable - Part Number: DC202000HZ0L

Part Number: DC202000HZ0L

VN:F [1.9.3_1094]
Rating: 2.0/10 (1 vote cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Tags: ,

reCaptcha enabled on comments

May 27th, 2010 | No Comments | Posted in Blogging

I’ve recently noticed a lot of blog comment spam on my blog.

Where  some-one kisses-bum in order to “trick” me into accepting  their comment.
For example:

Howdy there,this is Everett Krajcer,just discovered your web-site on google and i must say this blog is great.may I share some of the Post found in this website to my local friends?i’m not sure and what you think?anyway,Many thanks!

Complete with a nice back link to his crappy website about “low rate loans”

This black hat SEO tactic is become very widespread.

Simply google a few phrases from that comment

google results for "Howdy there,this is Everett Krajcer,just discovered your web-site"

Whilst you will not see any exact matches, they’re all along the same sort of lines, and on blogs…

The software posting these comments alters it very slightly for each blog posting, to fool search engines.  image

To combat this, I’ve installed the reCaptcha plugin onto WordPress

Installation took literally two minutes, and is now up and running. 

Apologies to any genuine comment posters, but the spam was becoming too much!

You can get the plugin here:

http://wordpress.org/extend/plugins/wp-recaptcha

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Tags: , ,

100 new followers on twitter, bought for a Fiverr

May 10th, 2010 | 2 Comments | Posted in Twitter

After signing up to Fiverr, I decided to give it a try.

Someone with a somewhat copyright infringing username of Twitter offers:

Twitter: I will sell you 100 real Twitter Followers for $5
(http://www.fiverr.com/users/Twitter/gigs/sell-you-100-real-twitter-followers)

There were plenty of others offering the same, if not more followers, but they required your username and password, and would just follow hundreds of people, in the hope of a reciprocal follow.image

However, this one seemed different.
Just over £3.30 for 100 new followers? Great feedback? It seemed too good to be true, so I thought I’d lay my $5 on the line, and give it a go.

I placed my order, and around an hour or so later, had confirmation he had begun.

Within a few minutes, I started to get email notifications of new people following me.
It seemed to be working!

25 minutes later, the emails dried up, and I assumed it was completed.
I checked my followers, and, to my amazement, I had 135 new followers!

Some were particularly random, no tweets, following loads of people etc (suspect- FAKE) but there were a few active tweeters in there.

I @ replied some of them, asking how they heard about me / why they started following me, however have not got any response

All in all, did what was said on the tin. I got over 100 followers. Using who.unfollowed.me I saw that about 15 of these unfollowed me within a week.

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Tags: ,

What can you get for a Fiverr? – A quick review on Fiverr Marketplace

May 6th, 2010 | 4 Comments | Posted in Web

New marketplace Fiverr allows you to outsource those small tasks you may have, for a fixed fee of $5 (aprox. £3.30 depending on how the exchange rate is behaving)Fiverr screenshot

Fiverr allows people to list things they would do, for $5.
In return, Fiverr takes $1 from the value of the order, leaving the person providing the service with $4.
This can be withdrawn from the account, once they have accumulated $40 or more.

As you would imagine, there are plenty of weird and wacky offerings, or “Gigs” as they are called by Fiverr.

However, there are hundreds of potentially really useful things available.

For example:

genelors: I will setup a WordPress blog and configure your domain to it for $5

landee: I will be your personal assistant for 1 hour for $5

mzzedithandlucy: I will give you a 1/2 hour Juggling Lesson over Skype for $5

Payment is handled through PayPal, making it nice and easy to use.

When you place an order, you have to pay upfront, and then the order is fulfilled.
Just in case, there is a dispute procedure – but it’s unlikely you’ll ever need to use it!

Fiverr order now button - orders in queue

So you can be sure of a timely delivery, there is a handy “number of orders in queue” displayed below the order button.

You can also contact the seller to clarify things before you part with your $5.

I for one, will be outsourcing some of those niggly little tasks to Fiverr.
Such tasks as resizing photos, installing WordPess etc… are perfectly suited!

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Tags:

Deploying .NET 4 Project – Error 1001 (System.BadImageFormatException)

April 26th, 2010 | 7 Comments | Posted in Geek

After attending the UK Tech Days events last week in London, I was keen to jump on the Visual Studio 2010 and .net 4.0 bandwagon.

I converted some of our projects here at Crocus to the .net 4 framework (which was incredibly easy – nothing broke!)
I even took advantage of some of the quick to implement features in .net 4, and converted some of our massively over-ridden methods to use optional parameters.

One project in particular is a Windows Service, that sends out purchase orders on a schedule.
(I recently wrote about how this broke due to Quartz.net expecting a UTC start time)

This has a Visual Studio deployment project associated with it.

After building the newly upgraded .net 4 version of the project, and deploying the .msi file to our target server, I got the following error:

Error 1001 Exception occurred while initializing the installation. System.BadImageFormatException: Could not load file or assembly or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Now, I had definitely upgraded said server to .net 4 (twice, as a matter of fact – after the first time i received this error!)

After some Googling, some people were saying to change the platform target on my assemblies, which i did, to no avail. 

I eventually discovered the problem.

You need to set the .NET Framework Launch Condition

Here’s how to do it:

Right click on your deployment project in solution explorer

Right click on your deployment project in solution explorer

Under “Version” Choose .NET Framework 4

Under “Version” Choose .NET Framework 4

After rebuilding and deploying my setup file, everything worked fine.


VN:F [1.9.3_1094]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Tags: , ,

C# 4.0 – Optional Parameters

April 14th, 2010 | 1 Comment | Posted in Geek, Visual Studio

I know, I know, VB has had them for ages.

But I don’t care… Now C# has them too!

This will greatly reduce method overloads!
Check this bit of code (sorry it’s not a “real world” example)

public class TestClass
{
    public void DoSomething(string parameterOne, string parameterTwo, string parameterThree)
    {
        DoSomething(parameterOne, parameterTwo, parameterThree, null);
    }

    public void DoSomething(string parameterOne, string parameterTwo, string parameterThree, string parameterFour)
    {
        if (parameterFour != null)
        {
            //doing somthing with the parameters.
        }
    }
}

The DoSomething method has an overload on it that takes a fourth parameter (in this case parameterFour)

When we use the above code, our intellisense looks like this:

 

overload1

…and the second overload

 

overload2

As we can see, the method has 2 overloads. One taking parameterFour, one not.

New in C# 4.0, we can use something called optional parameters.

This allows us to change our method to:

public class TestClass
{
    public void DoSomething(string parameterOne, string parameterTwo, string parameterThree, string parameterFour = null)
    {
        if (parameterFour != null)
        {
            //doing something with the parameters.
        }
    }
}

As you can see, we’ve removed the overloaded method – I’m sure you can appreciate, if we had a method with many overloads, this results in much cleaner code :-)

Now, our intellisense looks like this:

intellisense-with-optional-parameter-method

In my opinion, this looks a bit confusing.

Sure, I’ll get used to it, but in my opinion, the method is still sort of overloaded… just with optional parameters!

VN:F [1.9.3_1094]
Rating: 3.0/10 (3 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Tags:

Quartz.net trigger not firing

April 12th, 2010 | 1 Comment | Posted in Geek

I’ve used Quartz.net for a little while – more specifically, around 6 months. I started working with it around the end of October 2009. Irrelevant, you may think, but the important thing here is the time. During winter months, the UK runs on GMT (or UTC+0)

During these months, (up until 28th March 2010) my application functioned as expected – however, when the clocks went forward for British Summer Time, the trigger stopped firing.

The problem?

I’d specified my triggers start time like this:

trigger.StartTimeUtc = DateTime.Now;

Which was fine, when, before the clocks go forward for summer.

After the clocks go forward (and we start enjoying lighter evenings etc…) the UK is on UTC+01 (British Summer Time)

This means, at the time of writing (circa 14:45pm, April 12th 2010) the values of DateTime.Now and DateTime.UtcNow are as follows:

DateTime.Now

12/04/2010 14:47:39

DateTime.UtcNow

12/04/2010 13:46:58

… a whole hour and a few seconds difference.

By using DateTime.Now to set the start time (which expects the time as UTC) – I was in fact, telling Quartz.net to start the trigger at 14:47 – an hour later than I wanted.

Summary

Always use DateTime.UtcNow to set the Triggers StartTimeUtc :-)

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Tags:

Facebook notification spam – someone ”likes” your photo

February 28th, 2010 | 6 Comments | Posted in Web

Recently, a lot of people have  been “liking” my photos.

Unfortunately, the notifications are sent out by various versions of a new form of Facebook spam application.

image

Clicking on “your photo” – in a hope to see which photo this person liked, takes you to a page where you’re asked to allow an application access to various parts  of your profile:

“Allowing Lika access will let it access your Profile information, photos, your friends’ info and other content that it requires to work”

This is the important part of this application – clicking on “allow” will enable the app to get access to all the information on your profile.
It then sends out notifications to ALL your friends, that you “liked” one of their photos.

Presumably, it is also sending all your information to the developer. This could be anything from your profile – work information, contact info, address, photos – anything.

One way to check if a notification you have received is genuine is to hover over “your photo”

Hover over "your photo" and check the link location

Unless the link is something similar to: http://www.facebook.com/photo.php?pid=12345 then it’s a fake.

The names are usually something like “Like” or “Lika” or something along those lines, to fool you into thinking they are genuine, Facebook features.

VN:F [1.9.3_1094]
Rating: 10.0/10 (4 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Tags:

Implementing DataCash 3D Secure with ASP.net

February 23rd, 2010 | 6 Comments | Posted in Geek

This is an article I’ve been meaning to write for a while now…

Mainly, to help others out, who are struggling with the near non-existent documentation provided by Datacash, when trying to plug 3D Secure into my ASP.net application.

I’m sure you’re already familiar with what 3D Secure is, so I won’t go in to too much detail, nor will I go into much detail with regards to the process.

The purpose of this article is to get you familiar with how to send the details to the DataCash MPI, receive a response, and display and use the 3D Secure window in an iFrame (or framed window for that matter)

Please note:
This code is for tutorial purposes only. It’s dirty, crude, buggy, and not refactored in any way shape or form.
I simplified the code down to bare bones, in order to better explain each element.
Obviously, it comes without warranty… it should work as expected, but has no logging, error trapping or any of that good stuff… and when dealing with online payments, you really should take more care!

Download

zip-icon

I’ve made the entire source code for this tutorial available for download.
You will need to edit the web.config to add your own VTID and Password

 

 

Donate

btn_donate_SMI don’t normally do this, but this article took me literally months to pull together, so any small contribution would be gratefully received!


Payment Page

This is the functionality that processes payment – for example, allows the customer to enter their credit card details etc…

The mark-up is fairly straight forward.

Two things to note are the body, and the form tag:

<body id="myBody" runat="server">

Note that the body tag is runat server

<form id="MainForm" runat="server">

Note that  the name is “MainForm” – we will need this later.

Since in this tutorial, I’m showing how to use an iFrame, I have this bit of code, below the payBtn:

<asp:Panel ID="ACSFramePanel" runat="server" Visible="false">
    Please verify.....<br />
    <br />
    <iframe src="" name="ACSFrame" width="450" height="400" frameborder="0" />
</asp:Panel>

Line 4 of the above is basically where the 3D Secure frame will appear.

I wrapped it in a Panel, so that we can hide it, while the customer enters their card details etc…

Now, let’s look at some of the code-behind:

private Config config;
private Agent agent;

//this would be our order id / reference in production
private string ourReference = Guid.NewGuid().ToString("n").Substring(0, 8);

protected void Page_Load(object sender, EventArgs e)
{
    config = new Config(AppDomain.CurrentDomain.BaseDirectory + "datacash.conf"); // would probably need to come from web.config
    agent = new Agent(config);
}

In the above code, Config and Agent are both DataCash objects.

In the Page_Load event, we basically set these two objects up.

config is set from an xml file (located in the project root) called datacash.conf – this can of course be located anywhere you like (and called anything you like)

agent is then set using the defined config object.

The config file looks like this:

<Configuration>
  <logfile>datacash.log</logfile>
  <logging>5</logging>
  <Obscure>
    <element>Transaction.CardTxn.Card.pan</element>
    <element>Authentication.password</element>
    <element>Transaction.CardTxn.Card.Cv2Avs.cv2</element>
  </Obscure>

  <!--this would be for the live server-->
  <!--<host>https://mars.transaction.datacash.com/Transaction</host>-->

  <host>https://testserver.datacash.com/Transaction</host>
  <port>443</port>
  <timeout>90</timeout>
  <setstrict>true</setstrict>
</Configuration>

Of course, this doesn’t have to be done in Page_Load – in “the real world” this would all be part of a payment helper class. But for demo purposes, it’s fine in the Page_Load – just means we have to repeat ourselves on other pages…

Next, we assume the user fills out the form, and presses the Pay button.

Sending the request to DataCash

protected void payBtn_Click(object sender, EventArgs e)
{
    //so they don't press the button twice.
    payBtn.Enabled = false;

    //get browser info (for 3d secure stuff)
    var browser = Request.Browser.Browser;

    var request = buildAuthDataCashDocument(
        ourReference,
        cardNumber.Text,
        expiryMonth.Text,
        expiryYear.Text,
        startMonth.Text,
        startYear.Text,
        issueNumber.Text,
        secCode.Text,
        billingAddress1.Text,
        billingAddress2.Text,
        billingAddress3.Text,
        billingAddress4.Text,
        billingAddressPostCode.Text,
        browser);

    //send the request document to the agent.
    //todo: could implement some kind of error trapping / retry here
    var authResponse = agent.send(request);

    //get the datacash transaction reference (just in case we need to try authorizing the payment without 3D Secure)
    var datacashRef = authResponse.get("Response.datacash_reference");

    //get the response code
    var responseCode = authResponse.get("Response.status");

This code basically generates a XML document with the payment authorisation request, and submits it to DataCash.

I refactored buildAuthDataCashDocument as it was pretty large, and made the code a bit too dirty, even for this demo!

Couple of bits of note within buildAuthDataCashDocument are:

request.set("Request.Authentication.client", ConfigurationManager.AppSettings["DataCashVtid"]);
request.set("Request.Authentication.password", ConfigurationManager.AppSettings["DataCashPassword"]);

This basically sets the VTID and Password from config (in our case, web.config) which looks like:

<appSettings>
   <add key="DataCashVtid" value="99******"/>
   <add key="DataCashPassword" value="bK*******"/>
</appSettings>

Also, within buildAuthDataCashDocument is:

request.set("Request.Transaction.TxnDetails.ThreeDSecure.verify", "yes");
request.set("Request.Transaction.TxnDetails.ThreeDSecure.merchant_url", "www.crocus.co.uk"); //or whatever brand??
request.set("Request.Transaction.TxnDetails.ThreeDSecure.purchase_desc", "Items from Crocus"); //or some other short sumary
request.set("Request.Transaction.TxnDetails.ThreeDSecure.purchase_datetime", DateTime.Now.ToString("yyyyMMdd HH:mm:ss"));

This is important, for 3D Secure – Fairly self explanatory.

After building our request Document, we need to send it to DataCash, and get another Document back – as a response.

To do that, it’s as simple as:

var authResponse = agent.send(request);

This sets authResponse to the response Document.

We can then use the .get() method on authResponse to retrieve elements from it.

We are most interested in Response.datacash_reference and Response.status

The datacash_reference is unique to each and every transaction processed, so it is useful for later things like refunds, reporting etc…

Response.status is the DataCash status code for this transaction.

It’s from this, that we determine how to proceed.

switch (responseCode)
{
    //handle 3DS error responses....`
    //Basically, if it's one of these, the transaction is screwed, and shouldn't proceed....
    case "151": 		//	3DS Invalid Transaction type
    case "152": 		//	3DS Manual Authorization not supported
    case "153": 		//	3DS verify element missing
    case "154": 		//	3DS Invalid verify value
    case "155": 		//	3DS field missing
    case "156": 		//	3DS Invalid Browser.device_category
    case "157": 		//	3DS Merchant not enabled
    case "159": 		//	3DS No VERes from DS
    case "160": 		//	3DS Invalid VERes from DS
    case "161": 		//	3DS call auth centre

        //log the error here
        break; //- throw them out of transaction process. Should redirec

    case "56": //speed limit - too many transactions on that card number in short space of time
        break;

    //3ds payer verification required....
    case "60":
    case "150":
        show3DSIframe(authResponse);
        Response.Clear();
        break;
}

I won’t go in to too much detail, as the comments kind of speak for themselves…

Basically, if you get a 60 or 150 then the transaction requires you to show the 3D Secure window.

Showing the 3D Secure iFrame

I’ll spend a bit of time on show3DSIframe, as this is the part that caused me the most hassle – How to actually display the ACS in an iFrame, especially in ASP.net

private void show3DSIframe(Document doc)
{
    ACSFramePanel.Visible = true;

    //this is the data cash reference number for this transaction
    var dataCashReference = doc.get("Response.datacash_reference");

    //this is the url of the ACS - the page generated by the bank, that contains the
    //boxes where the customer enters information etc...
    var acsUrl = doc.get("Response.CardTxn.ThreeDSecure.acs_url");

    //this is a long message / code that is generated for the transaction
    var pareq = doc.get("Response.CardTxn.ThreeDSecure.pareq_message");

Ok, so in the markup from Part 1, you may remember I wrapped the iFrame in a Panel, called ACSFRamePanel. Now, we need to set the visibility to true.

These first few lines are self explanatory – we need to get the dataCashReference, acsUrl (the URL of the 3D Secure page – this is usually returned by the customers issuing bank) and the pareq – this is a long string, that’s a bit like a password for the transaction.

These elements are retrieved from the passed in DataCash Document.

We then need to create our Term URL – This is basically a URL that the 3D Secure window POSTs back to:

var termUrlPrefix = Request.ServerVariables["HTTPS"] == "ON" ? "https://" : "http://";

//termUrl is where the ACS page posts back to.
var termUrl = string.Format("{0}{1}",
    termUrlPrefix,
    Request.Url.Authority + "/3DSResponse.aspx");

In our demo case, it’s just on our local host machine – this could however, for example, be something like www.myUrl.com/checkout/3DSresponse.aspx

This next part is the important part.

This set’s the required hidden fields (PaReq and TermUrl) on our form.

We then register another hidden form – “MD” – This is our order number / reference for this transaction – so we can retrieve it from our database, and update the status when we come out the other side of 3D Secure.

The next line generates a little bit of JavaScript that basically causes this form to submit itself to the acs url.

The result of this, is then output to the target (parameter 3 in our string.format) – ACSFrame.

Remember we called our form “MainForm” :-)

Then, myBody.Attributes.Add inserts the resulting JavaScript to the onLoad function of our body tag.

Remember we made runat server earlier

//ClientScript.RegisterHiddenField adds a hidden field to the form...
ClientScript.RegisterHiddenField("PaReq", pareq);
ClientScript.RegisterHiddenField("TermUrl", termUrl);

//this is the data cash reference, and our reference -
//so we can update the order on the other side of the verification (paid, failed etc...)
ClientScript.RegisterHiddenField("MD", dataCashReference + "|" + ourReference);

var js = string.Format("javascript: document.{0}.action='{1}'; document.{2}.target=\"{3}\"; document.{4}.submit();",
    MainForm.ID,
    acsUrl,
    MainForm.ID,
    "ACSFrame",
    MainForm.ID
);

//since the body tag of this page is called myBody, and is runat=server, we can access
//it here, and inject our javascript.
myBody.Attributes.Add("onLoad", js);

And there we have it – the 3D Secure window is displayed in an iFrame

I’ll edit this post with a link to 3DSResponse.aspx when I finish that article…

Hope this helps! Feel free to ;-)

btn_donate_SM

VN:F [1.9.3_1094]
Rating: 8.0/10 (2 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Tags: , , ,