Patrick’s Bytes

Techie for the past 30 years…

Using FCKEditor to embed Flash content; does not appear in IE

This is because FCKEditor only create a <embed> element to display Flash content which does not work for IE. IE requires the <object> element to embed Flash in a webpage where else <embed> only works for Firefox based browsers. This links shows the way to embed Flash object in HTML.

Changing the JavaScript code in FCKEditor is a bit troublesome (my JavaScript skill is not good enough) So if you are using .NET you can refer to this method I created to wrap the <embed> element with <object> element. This is more of a quick hack so I make no guarantee it will work in your environment. I am using LINQ to XML for this so you will need Visual Studio 2008 + .NET 3.5.

Public Function UpdateEmbedTag(ByVal content As String) As String

    Const embedTag As String = "<embed "
    Const objectTag As String = _
    "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'" + _
    "codebase='http://download.macromedia.com/pub/shockwave/cabs/" + _
    "flash/swflash.cab#version=6,0,40,0' id='myMovieName'><embed "
    Const embedCloseTag As String = "</embed>"
    Const objectCloseTag As String = "</embed></object>"

    '<embed type="application/x-shockwave-flash" 
    '  pluginspage="http://www.macromedia.com/go/getflashplayer" 
    '  src="http://localhost:49427/userfiles/Video/test/flash.swf" 
    '  play="true" loop="true" menu="true"></embed>
    '
    'TO
    '
    '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
        '  codebase="http://download.macromedia.com/pub/shockwave/cabs/
        ' flash/swflash.cab#version=6,0,40,0" id="myMovieName">
    '  <param name="movie" value=""/>
    '</object>

    Dim _newContent = "<div>" + content.Replace("&nbsp;", " ") + "</div>"
    _newContent = _newContent.Replace(embedTag, objectTag)
    _newContent = _newContent.Replace(embedCloseTag, objectCloseTag)

    Dim root = XElement.Parse(_newContent)

    Dim embedElementList = root.Descendants("embed")
    Dim flashLocation As String
    Dim height As String
    Dim width As String

    If embedElementList.Count > 0 Then

      For Each embedElement As XElement In embedElementList

         If ((embedElement.Attribute("pluginspage") = _
              "http://www.macromedia.com/go/getflashplayer") _
           Or embedElement.Attribute("type").ToString.Contains("flash")) Then

             flashLocation = embedElement.Attribute("src")
             height = embedElement.Attribute("height")
             width = embedElement.Attribute("width")

             If Not String.IsNullOrEmpty(width) Then _
               embedElement.Parent.Add(New XAttribute("width", width))
             If Not String.IsNullOrEmpty(height) Then _
               embedElement.Parent.Add(New XAttribute("height", height))

             Dim movie = New XElement("param")

             movie.Add(New XAttribute("name", "movie"))
             movie.Add(New XAttribute("value", flashLocation))
             embedElement.Parent.Add(movie)
         End If
      Next

      Return root.ToString

    Else
      Return content
    End If

  End Function

Visual Studio 2008 Trial VPC image updated for holidays season.

Since the existing VPC trial image of Visual Studio 2008 will expires in end of this year, Microsoft has updated the image and posted it online. On top of that, the good folks of Redmond also created images for those wanting to run VS2008 in their Hyper-V environment.

  • VSTS “all-up” Virtual PC/Virtual Server image (6 GB download, expands to 15 GB)
  • TFS “only” Virtual PC/Virtual Server image (3 GB download, expands to 8 GB)
  • VSTS “all-up” Hyper-V image (6 GB download, expands to 15 GB)
  • TFS “only” Hyper-V image (3 GB download, expands to 8 GB)

    Something good to play with if you got nothing to do while clearing your year end leaves. :)

  • Adopting a ALM strategy using VSTS 2008

    Did 2 talks in our annual application lifecycle management event yesterday with the topics on Role of Architects and Improving Application Code Performance.

    Managed to snap some nice photos during Hoong Fai’s session.

    004

    001003

    002  

    Download my slides and materials here!!

    http://cid-732d1d42507315a3.skydrive.live.com/browse.aspx/Public/ALM%7C_20081118

    SharePoint innovations in Visual Studio 2010

    Today there is no build in support for SharePoint found inside Visual Studio 2008 except the SharePoint workflow project. If you want to create studd like Site Definition etc. you need to download the Windows SharePoint Services 3.0 Tools for Visual Studio. It is available for VS2005 as well as VS2008. So in TechEd EMEA 2008, Microsoft announced that Visual Studio 2010 tools for SharePoint will be build in for VS2010.

    Channel 9 did an interview with Reza Chrisaz on what are the new features in VS2010 for SharePoint developers. You can download the video here.  I list down some of Reza’s Key callouts

    image 
    SharePoint project templates build-in for VS2010

    image 
    At last!! Visual designer for SharePoint webparts!!

    image
    Exploring SharePoint artifacts inside Server Explorer

     

    image
    Package Explorer – sort of like the one we have with VseWSS today

    image 
    One of my favourite feature – the feature explorer

     

    image

    Adding Solution to TFS source control with Team Build and nightly build support

    Devtalk event – Visual Basic 9

    Devtalk is basically a rebrand  of Microsoft Malaysia’s D3 event which normally runs on Friday morning. based on popular demand, the topic chosen for this week is VB9 and I was given the opportunity to present what I learnt from Lisa in her TechEd 2008 SEA VB sessions.

    Turn out was very good where 20 person registered but end up we got 21 participants. And best of all they stay on until end of the session which over run for 30 minutes. So what I had presented as new features in Visual Basic 9 and VIsual Studio 2008 such as

    1. New IDE features esp. Intellisense
    2. New language features i.e. LINQ to SQL and LINQ to XML
    3. Refactor! for VB tools by DevExpress

    For audience who want to download my demo and slides you can go to my Live folder here.

    Older Posts »