Firefox undermined by Redmond sneak-ware

Posted in Uncategorized on June 6, 2009 by Si

As reported in various places, including El Reg (http://www.theregister.co.uk/2009/06/01/ms_firefox_extension_row/), the .NET Framework 3.5 Service Pack 1 update installed a Firefox extension without asking the user’s permission. The ClickOnce extension gives websites the ability to easily install software on the client, a major security hole and one that many users chose Firefox for to avoid. The extension is installed for all Firefox users so can’t be uninstalled through the GUI (maybe that needs to be addressed in a future release of FF!).

Anyway, the solution for those eager to remove this sneak-ware from is available from Annoyances.org (http://annoyances.org/exec/show/article08-600), but the steps are reiterated below:

  1. Open Registry Editor (type regedit in the Start menu Search box in Vista/Windows 7, or in XP’s Run window).
  2. Expand the branches to the following key:
    • On 32-bit systems: HKEY_LOCAL_MACHINE \ SOFTWARE \ Mozilla \ Firefox \ Extensions
    • On x64 systems: HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Mozilla \ Firefox \ Extensions
  3. Delete the value named {20a82645-c095-46ed-80e3-08825760534b} from the right pane.
  4. Close the Registry Editor when you’re done.
  5. Open a new Firefox window, and in the address bar, type about:config and press Enter.
  6. Type microsoftdotnet in the Filter field to quickly find the general.useragent.extra.microsoftdotnet setting.
  7. Right-click general.useragent.extra.microsoftdotnet and select Reset.
  8. Restart Firefox.
  9. Open Windows Explorer, and navigate to %SYSTEMDRIVE%\Windows\Microsoft.NET\Framework\v3.5\Windows Presentation Foundation.
  10. Delete the DotNetAssistantExtension folder entirely.
  11. Open the Add-ons window in Firefox to confirm that the Microsoft .NET Framework Assistant extension has been removed.

Grrrrrr….

This backwards nation

Posted in Uncategorized on May 16, 2009 by Si

So I was sitting in the departure lounge at Heathrow airport trying to log on to the internet to check my email and the like, and what with LHR being a major international airport with millions of travellers passing through each day, one might expect some free wifi.

But no. This money grabbing backwards nation can’t even get that organised. £1 for 10 minutes!?!?!? You are having a giraffe my friend!

So now I’m at Hong Kong, waiting in the departure lounge to catch my next flight on to Auckland, and thankfully they have managed to grasp the concept of free wifi. Granted, its unsecured and the connection rate doesn’t seem to be brilliant, but it is free and is enough for me to write this and check my mail quickly. I’ll see what there is in Auckland in due course.

So the question is, how much does it really cost a big telco (for example BT) to provide free wifi? There’s probably a lot of hardware to install and run, but it shouldn’t need a massive team of engineers to support it, and given there is already an extensive payphone network in the terminals connectivity to the main trunk networks shouldn’t be a problem either. One day……. I can but hope :)

Rant over.

Si

Flickr`n ‘eck!

Posted in Uncategorized with tags on May 3, 2009 by Si

Lights On A Stick now on Flickr!!

Just a handful of my favourites on there at the moment, more to come as I get round to uploading them!

Si

Frog in a….

Posted in Graphics / Animation with tags , , on September 10, 2008 by Si

….blender. Its the punchline to a bad joke, and certainly not something I would counsel. However, this post is about a different type of blender altogether.

Blender is a free open-source 3D design and animation package, offering similar power and functionality of professional products such as 3ds Max and Maya (these packages are used in the film and tv industries – think of any Pixar film!). I have used the cut-down versions of both these packages (Gmax and Maya Personal Learning Edition respectively), more just playing around than with any real project in mind, and so I look forward to having a play with Blender. It is supposed to be more user friendly, however I guess you still need some artistic skill!!

Blender has had exposure on the BBC Click programme and support/awareness for it is growing. By the looks of it there are some impressive movies out there already. Also in the Blender community, Super3Boy has done a load of excellent tutorial videos which are available on YouTube – http://www.youtube.com/user/super3boy – so no excuses really!

Hop-fully I’ll be able to squeeze the last drops of performance out of my wheezing computer to run Blender, and if so I’ll report back later, possibly with a picture of a (still intact) frog…. So if you really wanted to see Monsters Inc 2, or the return of The Incredibles, then now you can have a go at making your own version – just don’t confuse your NURBS with your Beziér splines and check those knot vectors offer full continuity over the parametric surfaces……. :)

Si

It’s all gone radio rental

Posted in ASP / ASP.Net with tags , , , on July 19, 2008 by Si

Feel free to leave now if you’ve had enough of radio buttons….

So having dealt with radio buttons on my filter (read my other post, Missing / (in)action for background), I had the next challenge of getting radio buttons in a gridview. “Template Columns” I hear you shouting at me, and you’d be right. While there is a built-in column type for checkboxes, the same thing doesn’t exist for radio buttons. So a quick bit of markup like:

<asp:TemplateColumn><ItemTemplate><asp:RadioButton ..... /></ItemTemplate></asp:TemplateColumn>

you’d think would work nicely. But it doesn’t. Try it, and you’ll find that you can select the radio button in each data row, at the same time. The idea is, of course, that only one would be selected at a time. Something is going slightly wrong here.

Have a butcher’s at the air force (butcher’s hook = look, air force = source) and you’ll see that each rendered <input> element has a different name attribute. The browser uses this attribute to group radio buttons together, so as far as the browser is concerned each radio button is in its own group and so can be selected at the same time.

The two and six (=fix) for this is to use a Literal control in the item template,

<asp:Literal ID="RadioButtonMarkup" runat="server"><asp:Literal>

then override the gridview’s RowCreated event with something like:

Protected void GridView1_RowCreated(Object sender, GridViewRowEventArgs e)

{

If (e.Row.RowType == DataControlRowType.DataRow}

{

' Grab a reference to the Literal control

Literal outputRow = (Literal)e.Row.FindControl("RadioButtonMarkup");

' Output the markup except for the "checked" attribute

outputRow.Text = String.Format( "<input type="radio" name="radioButtonGroup" " & _ "id="RowSelector{0}" value="{0}" />", e.Row.RowIndex);

}

}

Job done. You get a radio button in each row, and you can only select one at a time. This also has the advantage that you can modify the code should you need to (e.g. I am changing this so depending on a parameter this will display radio buttons or check boxes).

There is still the issue of remembering the selected item after postback. This can be done, I suggest reading the rest of the article from which I half-inched (=pinched) the above: Microsoft ASP.net – Adding a GridView Column of Radio Buttons. Essentially it involves adding a private property to store an ID of the selected item, then checking for that in the RowCreated handler above.

Si.

btw: radio rental = mental

Missing / (in)action

Posted in AJAX, ASP / ASP.Net on July 19, 2008 by Si

Despite my recent lack of postings I am still alive!! :)

And that’s not the only reason for the title of this post. I have a monster in the making. Not a good monster mind, a real ugly monster. This monster is an ASP.NET user control. What started out as a simple task to develop a control that would allow users to specify some filters/parameters before generating a report seemed on paper, quite simple and feasible. However, adding in some nested user controls, several of my own hand-crafted javascript calendars (the built-in .NET calendar is really slow and I think painful to use), and some optional radio-buttons as a template column on a datagrid has given this a life of its own. A whole screen full of viewstate is really not the way forward!!!

Anyway, the other reason for this post is to spread/share the knowledge about radio buttons, AJAX and postback. In my monster control, I have a few radio buttons that let the user switch between filters, but obviously when the page loads I want a default filter to be shown. Correspondingly I want one of the radio buttons to be checked. “Easy!” you say, and, well, yes it is, and it might look something like:

<asp:RadioButton ID="RadioButton1" runat="server" GroupName="group1" Text="Option 1" Checked="true" OnCheckedChange="RadioButton1_CheckedChanged"/>

But is it quite that simple? When a radio button is selected, I want to do some stuff server-side and show a different filter through the magik of AJAX. The code above might work for buttons 2 and 3, but there is a distinct lack of action when button 1 is re-selected (after selecting 2 or 3). “Huh?” you say? The reason for this is the Checked="true" bit. When the page is rendered, this radio button doesn’t get the postback javascript associated with it’s onclick event, and so never triggers a postback. Solution? Wrap the radio buttons in an update panel so they get updated when AJAX does its thing.

Read this article for more info (it helped me win this particular battle with the monster): http://smarx.com/posts/the-case-of-the-radiobuttonlist-half-trigger.aspx.

I fight on….

Si

While I’m here…….

Posted in InfoPath, SharePoint, Snippets with tags , , , , , , , on April 25, 2008 by Si

I remembered a couple of other little SharePoint snippets that I have found useful.

  1. Want to use that lovely green spinning icon that SharePoint uses when its doing something? Try the SPLongOperation class – good example here.
  2. Need to set the audience for a webpart through code? This is what I used!.
  3. Get the current user in InfoPath (not strictly SharePoint, but uses the SharePoint web services). Read this.
  4. Convert the XML that SharePoint returns into a dataset (I find myself using this all the time, probably because I don’t know better!):


public DataSet NSXmlToDataSet(string xmlString)
{
DataSet ds = new DataSet();
XmlDocument xd = new XmlDocument();

xd.LoadXml(xmlString);

XmlNamespaceManager nsMgr = new
XmlNamespaceManager(xd.NameTable);
nsMgr.AddNamespace("rs",
xd.DocumentElement.GetNamespaceOfPrefix("rs"));

XmlNode xn = xd.SelectSingleNode("//rs:data", nsMgr);

XmlNodeReader reader = new XmlNodeReader(xn);
ds.ReadXml(reader);

return ds;
}

Si

People in the field

Posted in SharePoint, Snippets with tags , , on April 25, 2008 by Si

SharePoint again folks! When dealing with users and groups (for example with list columns), SharePoint likes to store the underlying value in it’s own special format, usually ID;#Value (e.g “1;#neboddy”). That’s all well and good, but when you need to retrieve that value and display it in a friendly format (e.g. “Mr N E Boddy”) then there’s some work to do.

Fortunately SharePoint gives you a quick and easy way of getting at all the user properties for Mr Boddy (or anyone else for that matter!): SPFieldUserValue. Tada! Create a new object of that type, give it the value you’ve read from the list field, and then point an SPUser object at it, hey presto, you’ve got everything you could want. This saves having to write your own parser, and if Microsoft change the format down the line, they should update this class in the process.

Here is some lovely (delete if appropriate) code to demonstrate. This code was written to return either login names or email addresses for a multi-user field, hence the foreach() loop:


public string GetUserListFromField(SPWeb web,
                 string fieldValue,
                 bool returnEmail)
{
    string returnValue = "";

    //get collection of users from passed-in value
    SPFieldUserValueCollection allUsers = new
      SPFieldUserValueCollection(web, fieldValue);

    foreach(SPFieldUserValue fieldUser
               in allUsers)
    {
        //convert value to user
        SPUser user = fieldUser.User;

        if (returnEmail)
        {
            //return email address if requested
            returnValue += user.Email + ";";
        }
        else
        {
            //return login names
            returnValue += user.LoginName + ";";
        }
    }

    //trim the trailing semicolon
    int i = returnValue.LastIndexOf(";");
    returnValue = returnValue.Substring(0, i);

    //tidy up
    web.Dispose();

    return returnValue;
}

Now you see it, now you don’t

Posted in SharePoint with tags , , on April 23, 2008 by Si

A lovely thing is a SharePoint document library. Well it is until users are added in to the equation. At which point, either you don’t want them using the toolbar, or they don’t want to see it (or bits of it). Fair enough, just go into the web part properties and hide the blasted toolbar. Job done! Well, no, because if I wanted to template that site and use it again (which I often do), the toolbar settings don’t get saved so I have to go back in and turn them off. Boring!!

So I set about creating a feature that would enable me to quickly set up a site and configure all the different bits, and all was going well until I tried to get at this toolbar setting. You see, its not directly available through the SharePoint object model, and is hard to get at using System.Reflection (I tried lots of code posted on other sites, none seemed to work for me – says a lot about me then!). I was going to skip over it and then I found this cool little web part – Toolbar Manager . Problem solved!

This neat web part sits on the page like any other, and has a simple set of properties which basically hide any or all of the toolbar buttons (and associated menu items) on a list view web part. It is SO easy to use, and the source code is available to so you can customise it if needed. I have added an extra bit to hide the view selector as well. So now the users can have whatever they want to see on the toolbar, and us developers can stop them doing anything but change the view! My next tweak will be trying to get it to add custom buttons as well. It can’t get much better!! Thanks Scot!! (BTW you can download the source code and/or solution packages from CodePlex)

Si

All odd numbers are prime…..

Posted in Uncategorized on March 20, 2008 by Si

Mathematician: 3 is a prime, 5 is a prime, 7 is a prime, and by induction – every odd integer higher than 2 is a prime.
Physicist: 3 is a prime, 5 is a prime, 7 is a prime, 9 is an experimental error, 11 is a prime,…
Engineer: 3 is a prime, 5 is a prime, 7 is a prime, 9 is a prime, 11 is a prime,…
Programmer: 3 is a prime, 5 is a prime, 7 is a prime, 7 is a prime, 7 is a prime,…
Salesperson: 3 is a prime, 5 is a prime, 7 is a prime, 9 — we’ll do for you the best we can,…
Computer Software Salesperson: 3 is prime, 5 is prime, 7 is prime, 9 will be prime in the next release,…
Biologist: 3 is a prime, 5 is a prime, 7 is a prime, 9 — results have not arrived yet,…
Advertiser: 3 is a prime, 5 is a prime, 7 is a prime, 11 is a prime,…
Lawyer: 3 is a prime, 5 is a prime, 7 is a prime, 9 — there is not enough evidence to prove that it is not a prime,…
Accountant: 3 is prime, 5 is prime, 7 is prime, 9 is prime, deducting 10% tax and 5% other obligations.
Statistician: Let’s try several randomly chosen numbers: 17 is a prime, 23 is a prime, 11 is a prime…
Professor: 3 is prime, 5 is prime, 7 is prime, and the rest are left as an exercise for the student.
Computational linguist: 3 is an odd prime, 5 is an odd prime, 7 is an odd prime, 9 is a very odd prime,…
Psychologist: 3 is a prime, 5 is a prime, 7 is a prime, 9 is a prime but tries to suppress it,…
Psychiatrist: 3 is a prime, 5 is a prime, 7 is a prime, 9 would be a prime if it wasn’t for his relationship with 3.
Project Manager: Firstly, what’s a prime, and how long will it take to make 9 one of those?

(plagiarised from somewhere….)

Follow

Get every new post delivered to your Inbox.