Cool Sidebar Gadget For Your Custom Experts Exchange Badge

AID: 4167
  • Status: Published

2350 points

  • Bypatsmitty
  • TypeTips/Tricks
  • Posted on2010-11-29 at 12:29:01
Awards
  • Community Pick
scrn1.gif
  • 60 KB
  • Screenshot of desktop with gadget
Screenshot of desktop with gadget

This article will show you how I created a Sidebar Gadget to display my medium-sized Custom Experts Exchange Badge. I'm not a fan of having things on my desktop, but this is a neat little deal to place on your desktop to showcase your EE profile.

A gadget is simply a folder, a HTML file, and a XML file. That's it! Only 3 simple items to create a Windows Sidebar Gadget. (take note that I have only developed this in Windows 7 - I can't vouch for Vista, however I assume this simple example will work on Vista also...)

1. Create a folder on your desktop (we'll move it later) and name it something like "eeBadge.Gadget".

2. Create a XML file inside the folder you created and name it exactly "gadget.xml".

3. Create a HTML file inside the folder you created and name it something like "eeBadge.html".

Okay, now were ready to see what goes inside these 2 files. Let's start with the XML file as that will be the simplest one and once it's setup you won't have to go back to it. The XML file basically puts a 'Name' to your gadget and points to the HTML file that you created. Although not necessary, you can attach an icon to your gadget if you want. Just place the image in the folder you created and reference to it in the XML file. I put the Experts Exchange Logo in there and called it "logo.png".
<?xml version="1.0" encoding="utf-8" ?> 
<gadget> 
  <name>Experts Exchange Gadget</name> <!-- the name of your gadget --> 
  <version>1.0</version> 
  <description>Displays Your EE Badge In a Simple Gadget</description> <!-- the description of your gadget --> 
 
  <copyright>&#169; Patsmitty.com</copyright> 
  <icons> 
    <icon height="48" width="48" src="logo.png" /> <!-- the reference to your icon if applicable--> 
  </icons> 
  <hosts> 
    <host name="sidebar"> 
      <base type="HTML" apiVersion="1.0.0" src="eeBadge.html" /> <!-- the reference to your HTML file --> 
      <permissions>Full</permissions> 
      <platform minPlatformVersion="1.0" /> 
      <defaultImage src="logo.png" /> 
    </host> 
  </hosts> 
</gadget>
                                    
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:

Select allOpen in new window


A couple of important things to note regarding the XML file:
1. the file is named exactly "gadget.xml"
2. the <base> tag references your html file

Now that we have the XML file complete, you can close it and open the HTML file that you created. The shell of your html file should look like this:

<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=Unicode" /> 
        <title></title> 
        <link type="text/css" rel="stylesheet" href="http://www.experts-exchange.com/shared/expertBadgesCss.jsp" /> 
    </head> 
    <body style="height: 270px; width: 220px;"> <!-- this is the size for the Medium Custom Badge. If you want to show another size of your badge (i.e. small or large) you'll have to modify these dimensions. Small Badge = 350 x 170 (h x w) :: Large Badge = 245 x 320 (h x w) --> 
        <script type="text/javascript">setInterval(addScript, 1800000); // updates the data every 30 minutes</script> 
         
    </body> 
</html>
                                    
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:

Select allOpen in new window



It's time to go to get your badge from experts-exchange.com and copy and paste the code into the body of your HTML file right after the </script> tag. Here is how to get the code for your badge:

1

Go to www.experts-exchange.com and login.



2

Click on 'My Account' towards the top-right of the page


A small drop-down box will appear. Select the "Edit" link to the right of "Profile"


3

Select the 'For Experts' tab




4

Follow the 5 Steps on the page to create your Badge and retrieve your code


After you have selected your type, size, options, and zones; Click the "Create Certified Expert Badge" button to generate your code.


5

Copy and Paste your code


Copy and Paste your generated code into the body of your HTML file just after the </script> tag.


And that's just about it! Save your HTML file and close it. Now all that needs to be done is to move the folder into the right directory. Go to C:->Program Files->Windows Sidebar->Gadgets and place the folder there inside the Gadgets folder.

Go to your desktop and right-click, select 'Gadgets' located near the bottom, and you should see your new gadget in the list! Drag it onto your desktop.

scr2.png
  • 487 KB
  • Screenshot of gadget window with new gadget
Screenshot of gadget window with new gadget
    Asked On
    2010-11-29 at 12:29:01ID4167
    Tags

    Badge

    ,

    EE Badge

    ,

    Experts Exchange Badge

    ,

    Windows 7

    ,

    Windows

    ,

    Sidebar

    ,

    Gadget

    ,

    Sidebar Gadget

    Topic

    Windows 7

    Views
    1220

    Comments

    Author Comment

    by: patsmitty on 2010-12-04 at 13:05:03ID: 21848

    Alan, I removed the code snippet at the bottom of the article 3x now and it keeps coming back! Can you try and remove this for me?

    Other than that, the article has been modified to your standards and is ready to go. It's just that the last code snippet keeps showing up...

    Thank you!

    Expert Comment

    by: alanhardisty on 2010-12-04 at 16:13:48ID: 21859

    Nice article. I like having the gadget on my desktop so I can keep an eye on my status.

    Yes vote from me.

    Expert Comment

    by: cdebel on 2011-01-18 at 13:53:41ID: 22942

    The setInterval on this script doesn't seems to work for me.  I've placed a timer of 900000 to get it refreshed every 15 minutes).  Few hours elapsed, still no update.  But if i check at the copy the link found in addScript in a browser windows, i see some informations showing correctly (112 questions answered, while the badge in the gadget still show 111).

    Anyone got an idea why it doesn't work for me?

    I got Windows 7 Home Premium 64 bits, (french version).

    i'll try to keep my browser opened, and answer few questions, just to see if it will update or not in the browser...

    Author Comment

    by: patsmitty on 2011-01-18 at 16:47:44ID: 22945

    @cdebel: you can alter your avatar-like image (eeple icon) to force changes to your badge so you don't have to wait for questions to be answered. Try moving the script around the document a bit to see if anything changes. I'll look into it further. Thanks for the feedback.

    Expert Comment

    by: cdebel on 2011-01-18 at 18:57:10ID: 22950

    FYI: I've kept my Internet Explorer window opened with the eeBadge.html opened, and it didn't changed there too.  

    I've googled a bit about this function (i'm no expert of javascript).  In every sample i've seen, they always add "()" at the end of the function name.  Like this:

    setInterval(addScript(), 900000);

    Is it the problem?  I've modified it to see if it make a difference...

    Author Comment

    by: patsmitty on 2011-01-18 at 21:18:02ID: 22959

    The function will be called either way. Can you copy and paste the code here so I can see it exactly?

    Expert Comment

    by: cdebel on 2011-01-19 at 06:45:59ID: 22971

    Ok, here's the code... in this version i've dropped the refresh rate to every 1 minute.
    <html xmlns="http://www.w3.org/1999/xhtml"> 
        <head> 
            <meta http-equiv="Content-Type" content="text/html; charset=Unicode" /> 
            <title></title> 
            <link type="text/css" rel="stylesheet" href="http://www.experts-exchange.com/shared/expertBadgesCss.jsp" /> 
        </head> 
        <body style="height: 222px; width: 300px; padding:0 0 0 0; margin:0 0 0 0"> 
            <!-- this is the size for the Medium Custom Badge. If you want to show another size of your badge (i.e. small or large) you'll have to modify these dimensions. Small Badge = 350 x 170 (h x w) :: Large Badge = 245 x 320 (h x w) --> 
            <script type="text/javascript">setInterval(addScript(), 60000); // updates the data every 1 minutes</script> 
    
    
    
    .... HERE, I PLACED THE CODE FROM THE E-E WEB SITE
    
        </body> 
    </html>
                                            
    1:
    2:
    3:
    4:
    5:
    6:
    7:
    8:
    9:
    10:
    11:
    12:
    13:
    14:
    15:
    16:
    

    Select allOpen in new window

    Expert Comment

    by: DanRollins on 2011-01-19 at 15:37:01ID: 22987

    Using the above steps, I get a "addScript is undefined" error.  
    I believe that the problem can be fixed by repositioning part of the HTML.  I removed line 8 and added this below the EE-generated script:
    <script type="text/javascript">
    setInterval(addScript, 10000); // updates the data every 10 seconds
    </script>  
                                            
    1:
    2:
    3:
    

    Select allOpen in new window


    (right above the </body> tag)  Change the interval back to 180000 later.

    It appears that the EE code expects to manipulate a particular script block, based on its ordinal position within the HTML.

    Note: I'm also seeing an odd white border around the gadget rather than the expected gradient fill.  It might be related to my OS and IE version (Win7, IE 8)
    -- Dan

    Add your Comment

    Please Sign up or Log in to comment on this article.

    Join Experts Exchange Today

    Gain Access to all our Tech Resources

    Get personalized answers

    Ask unlimited questions

    Access Proven Solutions

    Search 3.2 million solutions

    Read In-Depth How-To Guides

    1000+ articles, demos, & tips

    Watch Step by Step Tutorials

    Learn direct from top tech pros

    And Much More!

    Your complete tech resource

    See Plans and Pricing

    30-day free trial. Register in 60 seconds.

    Loading Advertisement...

    Top Windows 7 Experts

    1. Run5k

      533,641

      Sage

      5,632 points yesterday

      Profile
      Rank: Genius
    2. ve3ofa

      212,070

      Guru

      0 points yesterday

      Profile
      Rank: Genius
    3. ded9

      172,851

      Guru

      0 points yesterday

      Profile
      Rank: Genius
    4. thinkpads_user

      170,266

      Guru

      664 points yesterday

      Profile
      Rank: Genius
    5. nobus

      164,276

      Guru

      668 points yesterday

      Profile
      Rank: Savant
    6. jcimarron

      108,163

      Master

      2,000 points yesterday

      Profile
      Rank: Genius
    7. Merete

      83,469

      Master

      0 points yesterday

      Profile
      Rank: Genius
    8. l33tf0b

      69,723

      Master

      500 points yesterday

      Profile
      Rank: Wizard
    9. motnahp00

      68,969

      Master

      4,000 points yesterday

      Profile
      Rank: Sage
    10. Darr247

      62,370

      Master

      0 points yesterday

      Profile
      Rank: Genius
    11. Callandor

      62,085

      Master

      2,000 points yesterday

      Profile
      Rank: Genius
    12. cwstad2

      60,285

      Master

      0 points yesterday

      Profile
      Rank: Guru
    13. LeeTutor

      59,598

      Master

      10 points yesterday

      Profile
      Rank: Genius
    14. Anuroopsundd

      50,017

      Master

      0 points yesterday

      Profile
      Rank: Sage
    15. garycase

      49,932

      0 points yesterday

      Profile
      Rank: Genius
    16. hanccocka

      49,616

      0 points yesterday

      Profile
      Rank: Genius
    17. McKnife

      48,823

      0 points yesterday

      Profile
      Rank: Genius
    18. CSI-Windows_com

      45,378

      0 points yesterday

      Profile
    19. rindi

      41,667

      3,000 points yesterday

      Profile
      Rank: Savant
    20. leew

      39,803

      10 points yesterday

      Profile
      Rank: Savant
    21. apache09

      37,716

      0 points yesterday

      Profile
      Rank: Genius
    22. dariusg

      35,164

      500 points yesterday

      Profile
      Rank: Genius
    23. RobSampson

      33,450

      0 points yesterday

      Profile
      Rank: Genius
    24. DavisMcCarn

      31,060

      0 points yesterday

      Profile
      Rank: Genius
    25. IanTh

      29,417

      10 points yesterday

      Profile
      Rank: Genius

    Hall Of Fame