Archive for the ‘technology’ Category

Providing Internet Access to Hyper-V machines through a WiFi Adapter

Thursday, May 27th, 2010

So running around from Hyper-V environment to Hyper-V environment, there are always two things I need to do.

1. Network my host to the VPC through a loopback adapter so that I can remote desktop into it and
2. Get internet connectivity

Now when you want to get internet connectivity you can do it through your Wireless connection or if you have a data card, through dial-up.

This method talks about the former option, it is so easy if you just follow these steps:

  • Open Hyper-V manager
  • Click on the Virtual Network Manager and create an Internal Virtual Network by selecting Internal and clicking Add.
  • Give a meaningful Name
  • Apply and OK
  • Now a Virtual Network has been created which can be associated with 1 or more virtual machines.
  • On the host machine, in the Network and Sharing Center click on Change Adapter Settings
  • Select your WiFi Adapter and the Internal Virtual Network you created.
  • Right click and select Bridge Network and the bridge is created.
  • In the Hyper-V Manager, right click the virtual machine and select settings
  • Add a Network Adapter and select the Internal Virtual Network you created initially from the drop down.
  • Click apply and ok.

Here is a good post if you need to do it from your broadband card (e.g. Vodaphone Mobile Connect) for when you are out of the office. http://sstjean.blogspot.com/2008/09/hyper-v-give-your-virtual-machines.html.

I hope this helps someone one day!!

Apply CSS to IE7 only

Sunday, August 3rd, 2008

This is always such a boggy thing for web developers, so I had to duplicate this as it is the first decent post I found out there on the topic. Found it from quite a cool blog site called www.aetherworld.org.

CSS hacks for browsers typically either exploit a flawed implementation or the complete lack of an implementation of a certain feature in the rendering engine. Most webdesigners know about the relatively poor level of web standards support in Internet Explorer and have tried for years to find workarounds for the most grievous bugs. However, exploiting software bugs to create a hack is quite dangerous because software gets updated and old flaws are fixed.

When Microsoft introduced conditional comments with Internet Explorer 5, a lot of problems were fixed. One could use constructs such as

<!--[if IE]>
     <style type=”text/css” media=”screen”>
          #myID {
               background-color: red;
          
}
     </style>
<![endif]–>

to tailor CSS styles to Internet Explorer only. No other browser would parse anything in those conditional comments.

Conditional comments have a lot of drawbacks, though. Most problematically, they require changes to the actual HTML source since there is no equivalent to conditional comments in CSS. They also don’t work well with XSL as Dave Shea has pointed out. This is why most web developers turned to the less reliable technique – the exploitation of browser bugs – to target specific browsers in their stylesheets.

The * html Hack

One of the best known hacks for Internet Explorer is the * html hack which takes advantage of the flawed implementation of the DOM in Internet Explorer.

All web pages have a root element, <html>, containing two children, <head> and <body>. Those two contain other children in turn. Internet Explorer (both for Windows and Mac) disagrees, however. In its DOM there is another root element, which contains <html>.

If you write a CSS selector like

* html #myID {
      *background-color: red;
}

only Internet Explorer (version 6 and lower) will apply the rule. The * selector, also called the “universal” selector, selects any element. The rule above will apply to the element with the ID myID which is a child of <html> which in turn is the child of any other element. Since only in Internet Explorer, <html> is contained by another element, the rule will be ignored by all other browsers.

While this has worked fine until now, Chris Wilson, Group Program Manager for IE Platform and Security at Microsoft has announced, even before the launch of Internet Explorer 7, that universal selector-related hacks will fail in IE7’s strict mode. Put simply, the * html hack no longer works in Microsofts most recent webbrowser.

Applying CSS to IE7 only

Do not despair, gentle reader, there are several solutions to this problem.

Although Internet Explorer 7 fixed a bug which occured when a property name was prefixed with an underscore or a hyphen, other prefixes are treated as they were in IE6. While this disabled the fairly well known underscore hack, new opportunities grew. If you add any other (non-alphanumeric, of course) character in front of a CSS property, it will be ignored by all browsers except Internet Explorer. Unfortunately Microsoft excluded the hyphen and underscore from being used in this hack (both are reserved in the CSS specification), so we have to rely on characters not in the CSS specification, for example an asterisk (*). This also means, the hack won’t validate.

html>body #myID {
     *background-color: red;
}

The above example only applies background-color: red only on Internet Explorer 7. The html>body selector makes sure, IE6 and below won’t understand the style.

Another possibility would be leaving out a selector on either side of the CSS child combinator. IE7 replaces the empty selector with a *. For example, >body is translated to *>body by Internet Explorer 7, which is actually a valid selector, since body is indeed the child of an arbitrary element, namely <html>.

>body #myID {
     background-color: red;
}

Internet Explorer versions below 7 don’t understand the child combinator and ignore the rule completely, as do all other browsers, since >body should generate a parsing error as it’s not valid CSS. So, once again, only IE7 applies the rule.

Unfortunately, above solutions don’t validate. If you don’t care about one small error in your stylesheets, you can use them of course. If, like me, you care about valid CSS, there is a third hack that you can use.

*:first-child+html {
     background-color: red;
}

Now you have three different hacks which allow you to target Internet Explorer 7 specifically so you can fix all those nasty rendering bugs.

Very impressed

Sunday, August 3rd, 2008

So I have been extremely bored today and this evening decided to write a new blog post. In the process I decided to upgrade WordPress to version 2.6 and I am very impressed. It is basically everything you could expect from website content management software. That fact that it is free is incredible. I am sure a higher and higher percentage of websites are going to be running off WordPress. I see they have even come out with a book WordPress for Dummies, now you know they are big :) Anyway, I do admire these guys as the amount of effort to produce such a good piece of software is unbelievable.

On another note has been a busy last two months and have done some great things, including:

  • Watched “The Dark Knight” - longest movie ever known
  • Had a week long holiday in Holland with Willa and family - had some great days on the beach
  • Celebrated the Durban July 2008 at a mates house - congrats Snaith Racing
  • Went clay pigeon shooting - shot 10/10 in my last round
  • Saw the Queen - Royal Ascot races
  • Lastly, bought a house with Willa and am moving in this month, so should be quite busy from now on.
Franche Court Road

Franche Court Road

Learn The Basics Of LINQ

Sunday, February 24th, 2008

LINQ (Language INtegrated Query) is a powerful but misunderstood new language feature brought to us in the .NET framework version 3.5 (C# 3.0 and VB 9). Even though this is a new feature, it already has some huge misconceptions (such as thinking LINQ is a replacement to SQL). This article will teach you how to use LINQ (the language itself), where LINQ can save you a lot of time and will cover some basic concepts of Extension Methods and Lambda expressions. Courtesy of http://www.singingeels.com

(more…)