Showing posts with label technology. Show all posts
Showing posts with label technology. Show all posts

Thursday, August 28, 2008

Creating tabs in SharePoint using Javascript and CSS

I couldn’t find an example of this, but I was determined to make it work. Here is the result.

I wanted a set of tabs where clicking on a tab would change the category but stay on the same page. Also, I must be able to pass in that category through the URL.

For example, I might have a web page http://...describe.aspx. I want to display information from several SharePoint lists. However, if I use the
URL http://...describe.aspx?animal=cat, then I only want the information about cats, and if I use http://...describe.aspx?animal=dog, then I only want the information about dogs.

Data views in SharePoint Designer will be used to display the desired information, using the animal variable. The method for that is not described here.

So I need to somehow read the variable from the URL using JavaScript. Then I need to highlight the tab corresponding to the variable. I found the code for that here: http://www.dynamicdrive.com/forums/archive/index.php/t-11883.html

It doesn’t look that great in the screenshots, but when you put the code into a SharePoint web part, it looks better. Here is the code:


<style type="text/css">



span.class1

{

float: left;

padding: 4px 0px;

font-size: 1em;

font-family: Tahoma, sans-serif;

border-right: 1px solid rgb(123,166,225);

}



.class1 A:link

{

background-color: #ffffff;

padding: 4px 10px;

background-image="url(/sites/_layouts/images/topnavunselected.gif)";

background-repeat:repeat-x;

}

.class1 A:visited

{

background-color: #ffffff;

padding: 4px 10px;

background-image="url(/sites/_layouts/images/topnavunselected.gif)";

background-repeat:repeat-x;

}

.class1 A:hover

{

text-decoration: none;

background-color: #FCE293;

padding: 4px 10px;

background-image="url(/sites/_layouts/images/PortalTabSelected.gif)";

background-repeat:repeat-x;

}

.class1 A:active

{

background-color: #ffffff;

padding: 4px 10px;

background-image="url(/sites/_layouts/images/topnavunselected.gif)";

background-repeat:repeat-x;

}









</style>





<script type="text/JavaScript">



// set the color of the chosen tab

// the tab is chosen by appending ?page=cat to the URL



function change(page)

{

document.getElementById(page).style.backgroundColor = "#7BA6E1";

document.getElementById(page).style.backgroundImage="url(/sites/_layouts/images/topnavselected.gif)";

document.getElementById(page).style.backgroundRepeat= "repeat-x";

document.getElementById(page).style.fontWeight= "bold";



}



// runs a function at page load time



function addLoadEvent(func) {



  var oldonload = window.onload;

  if (typeof window.onload != 'function') {

    window.onload = func;

  } else {

    window.onload = function() {

      if (oldonload) {

        oldonload();

      }

      func();

    }

  }

}



// run this function at page load time



addLoadEvent(function $_GET(key_str) {

if(window.location.search) {

var query = window.location.search.substr(1);

var pairs = query.split(/&|;/);

for(var i = 0; i < pairs.length; i++) {

var pair = pairs[i].split("=");

if(unescape(pair[0]) == key_str)

return unescape(pair[1]);

}

}

change(pair[1]);

}

);



</script>



<span class=class1>

<a href="default.aspx?page=cat" id=cat>cat</a>

</span>



<span class=class1>

<a href="default.aspx?page=dog" id=dog>dog</a>

</span>



<span class=class1>

<a href="default.aspx?page=horse" id=horse>horse</a>

</span>





- schneid

Tuesday, March 18, 2008

The downfall of grammar

Since more communication is in written form now, you might think that grammar and spelling would improve. I think it's worse. The proliferation of text messaging is partly to blame, since it is dependent on using shortened (incorrectly spelled) words. People don't put any thought into their written words. My biggest pet peeves include "would of," as in "I would of been there" (I would've been there) and using apostrophes for plurals, as in "I have 3 dog's." It's (or its) an endless list but I'll quit there (or their or they're). (I have to admit that I normally violate the "punctuation within quotations rule," and would usually place the comma outside of the quotes in this sentence.)

Email should be a clear form of communication. You have the opportunity to put together some coherent thoughts in your own time. The recipient can then answer at his convenience, also putting time into his responses. This is much better than a phone call, where the caller might blather on endlessly before actually stating the question. Unfortunately, email has degraded into a "type how I speak" form in which the sender simply types exactly the words they would say on the phone. Any semblance of decorum is lost.

Of course, the level of formality depends on the relationship of the two parties. If you are chatting with your buddy, go crazy. If it's a work email or you are trying to prove a logical point, poor grammar really blows your cover.

My son is learning grammar in second grade. I don't recall learning that until junior high school. I am amazed that he can correct a poorly formed sentence. Hopefully, the net generation (whoops, I meant to type "next" but that seems appropriate) will do better.

- schneid

Monday, February 25, 2008

Bad web design

I am so tired of bad web design. My biggest pet peeve is when a web site has a workflow diagram with a little word under each picture describing the item – but you can’t click on the picture, only on the word!
It’s even worse when the word is small. A similar problem is when you are supposed to click on some teeny tiny icon to open a link. You can barely get your cursor on that icon. Here is a table of information and you click on an item to get more information. But instead of having a link from the description, you must click on the small number!
Another common web design problem is the difficulty of finding relevant information. Most visitors to certain types of web sites are often in search of 2-3 pieces of information. For example, most visitors to a school web site are probably looking for the school calendar (or lunch calendar), the attendance line (to call when your child is sick) or office phone number, or school closings. All this information should appear on the school’s main web page and you should be able to see it without scrolling. There shouldn’t just be a link to that stuff, the information should appear on that page.

Sometimes web sites have icons instead of words for common links. I think icons are ok when you use the web site a lot, like your blog. A little pencil icon means edit. OK, I get it. But if someone only visits a web site occasionally, what does a little book icon mean? Address book? Read a book? Who knows. Web sites with infrequent visitors should abandon icons or at least combine them with text.

Even worse are bad fonts. I’ve seen some pretty unreadable fonts. Here’s an example:

If you like the look of a fancy font, then use it for your header. But a paragraph needs to have a readable font. You also shouldn't assume that every browser supports the fonts that you have. At least take it into consideration when you use a fancy font.

I've seen pages that have no headers or categories - the links are embedded into paragraphs. This style was abandoned about 15 years ago for good reason. It's cute when it's your personal web site but not when it's an information web site. I don't have time to read a paragraph, just list out the relevant links!

Better searches! This is a category in itself, and really applies to big corporate sites as opposed to mom and pop web sites, since they presumably don't have the programming capability to do it right. It's unbelievable that I can go to a hotel web site, type in Madison, and what comes up is a list of damn near every Madison in the US...except Wisconsin...because that is on the SECOND page of results! Come on! Or when there is only one result to your search - but instead of displaying the information, the web site displays a link! Now you must click again to get the information. Argh!

Here's one of my favorites. I'm trying to book a flight. I enter Chicago and Albany. And here's what I get:

This site may be using a soundex search, in case people type a word the way it sounds and misspell it. But that's idiotic when they have spelled the word correctly and there is only one exact match.

Try to display the information in the same page whenever possible. I've been thinking about this lately, and I'm sure that other people have too. I'm tired of opening page after page of subcategories to get information when the site has very little information in the first place.

If you have a personal site, or your site isn’t informational, do whatever you like. But if you have an informational web site, please don’t do these:
  • Bad fonts
  • Hard to find important information
  • Can't click on images or links are not obvious
  • Non-descriptive categories
  • Bad searches
  • Too many clicks to get to relevant information
  • No headers, categories, or list of links
My wife is getting tired of hearing me say "This is the WORST web site EVER!"

- schneid

Thursday, October 25, 2007

New computer!

I finally bought a new computer. The old one is 7 years old with a 600 MHz Pentium 3 processor. I was due! I just found a great deal on an HP Pavilion Media Center with Intel Core 2 Quad processor Q6600 2.4GHz. Ohhhhh yeahhh. I found a deal for $400 off. It has 1 GB of RAM because I can buy RAM really cheap for it. I bought 2 GB extra from Crucial for only $60. I'll probably use some Christmas money to buy an additional monitor to have a dual monitor setup. And I'll need a decent video card and an external hard drive. I can't wait to get my hands on it.

I need to buy a print server so that I can print from our laptop. But most of them sound pretty unreliable or expensive. If anyone has experience with a print server, I'd like to hear about it.

- schneid

Wednesday, October 24, 2007

How to report a problem

In general, people are really bad at including a useful description when reporting a problem. People in technical fields should be good at this, especially people who are involved in software or product development, since bug tracking is a critical part of development.

I'm responsible for supporting some tools. It's amazing how often someone will report a problem, but not give any useful information. And they do it by phone! I hate receiving phone calls. I mean, sometimes it's appropriate, but I like email because it forces the person to write down a coherent thought. When they call you, they can just blather on endlessly without getting to the point.

A recent example was a phone message like this (almost verbatim): "Someone was having a problem accessing XYZ in the web pages." There is almost no useful information in there. Who is the someone? What web pages? What's the URL? I actually knew what the problem was immediately (that person didn't have permission), but couldn't actually solve the problem since I didn't know the URL and who it was. So I had to call back and get the correct information to fix the problem.

I love when someone includes all the relevant information. It does happen occasionally.

- schneid

Sunday, October 14, 2007

Impossible to get tech support

Finding technical help on the internet is getting more and more frustrating. The companies that own the web sites are smart to create FAQs, support forums, and have lots of answers available. But ultimately you should be able to contact a person or send a problem report. And it shouldn't be so hard to find out how to do that. If you look at Google, you really have to jump through hoops to finally find a support email address just to report a bug. Same for contacting Amazon technical support.

I just found a bug in a software tool that I use at work. I have a license for this tool, but my company has no maintenance agreement. When I go to the tool's web site, the only choices for getting technical support are for customers with maintenance agreements. Don't they want me to report a bug?! I don't want any follow up, I just want them to know about it. OK, I want them to care, but if they don't, that's not my problem. It's their product.

Even if you report a bug, don't expect for it to be fixed. I reported a bug on dictionary.com many months ago, but they haven't fixed it. Their American Heritage dictionary pronunciation key has a bug, and in fact it's in the very first entry - it shows the symbol for long a (remember, long vowels say their name), but then the example word is pat. It would take them 2 seconds to fix that, if they cared. Obviously they don't.

- schneid

Monday, September 24, 2007

Why I love the internet

I wear extra-wide shoes. Basketball shoes are narrow, probably because men that play basketball are tall and thin and have narrow feet. I, on the other hand, have short (size 10) wide feet. I bought some new shoes about 6 months ago, played basketball twice, and my feet hurt so bad I could barely walk for a week, and felt like I had bruises on the balls of my feet for a month. Needless to say, I stopped playing basketball then.

You can't get wide-width basketball shoes at the store. You have to order them. I went to Sports Authority to try on shoes, and figure out what my proper size would be by trying on New Balance running shoes. Sports Authority has those in wide widths, and you can order wide-width basketball shoes from New Balance. So I determined that I needed a 10 4E New Balance shoe. Then I went online to find some and they retail for about $80.

Then Google found an ad in craiglist. In New Hampshire, no less. A guy was selling two pairs of exactly the shoes I wanted in exactly my size - 10 4E. One pair was worn once, and cost $25. The other pair was brand new for $30. I called the guy, paid by PayPal, and he shipped them within 4 hours...these shoes were on my feet in 4 days. I bought the cheaper pair and they fit great, so now I'm buying the other pair.

And that's why I love the internet!

- schneid

Thursday, August 09, 2007

Google Reader and other good tools

There's a reason why Google is awesome. Every time I think of a feature that one of their tools needs, shazam, there it is just a few weeks later.

I really like Google Reader. I was reading about 20 blogs regularly, and it was hard to keep up. I can't believe I wanted so long to use a reader/aggregator. I just wish more sites would feed their entire post. Some only feed summaries or even just headlines. But still, it's a great tool for reading many blogs. It's even better when people include a few photos in their blog. Those are like a nice little surprise in the blog reader!

Google Mail (Gmail) is a great mailer. It's free, there's a ton of disk space (more than 2 GB, the spam filters are great, forwarding, etc. etc.

I'm experimenting with Google Groups for our cub scouts. I think it's going to work nicely. I've also starting using Google Calendar - you can share your calendar with others, so my wife and I can post appointments and view each other's calendars.

Don't even get me started on Google Maps. This (mapping on the internet) is clearly one of the most useful tools of the internet age. One of the features that I wanted has been implemented - you can actually change the route between two points. Google Maps determines the route for the two points that you enter, but suppose I want to avoid a certain road. Now you can just drag the route to another road, and you can add multiple destinations.

I'm also using Google documents to share spreadsheets and docs. Works fine although it hasn't been that useful so far.

- schneid