Important notice

Please note that this blog is discontinued here. All the posts are also coppied to my new blog at http://boris.gomiunik.net.
Important: Due to large amount of comment spam further commenting has been disabled here. If you wish to send me a comment, plase look up the same post on my new blog and leave comment there. Thanks!

12/01/2007

How to open an Office document in the document library without asking for username and password?

Even if you have the website open for anonymous access and anonymous users can access your documents in a document library, opening an office document will always require entering username and password. You can open the document, if you cancel the request for username and password three times. Still this can be annoying.

Untill now I was avoiding this by publishing PDF documents and making links to them. But you can change this. Let's say we're in a subsite /sub1 and have a Word document called mydocument.doc in a document library called Docs.

Linking to /sub1/Docs/mydocument.doc will request username and password from anyone opening the document. To avoid this, correct the hyperlink in your refference to:
/_layouts/download.aspx?SourceUrl=/sub1/Docs/mydocument.doc
is going to result in a simple download.

Now I can publish also Office documents for public.

UPDATE: Seems I was making the mistake of testing this authenticated. The _layouts/download.aspx requires authentication, so we're still stuck with the same problem. But it doesn't ask for username when opening word :)

11/30/2007

Add Content Editor Web Parts a bit faster

Here's a quick tip: If you want to add more Content Editor Web Parts faster to a homepage or a webpart page (to move and edit them afterwards)

1. Switch to edit mode
2. Add a Content Editor Web Part
3. When the page reloads with a CEWP added, hit Refresh (F5) and click "Retry" when Internet Explorer asks you if to resubmit information.

I use this technique to add multiple CEWPs to the page, when I need to add some explanations above some webparts. When I have enough of them, I drag them to different zones and positions and edit the titles and contents.

11/18/2007

Using Cookies with SharePoint's Data View

In my previous post I've explained how to pass parameters from URL to use in a Data View. There is another very useful way: - using Cookies. The process is very similar, using SharePoint Designer:

1. To read the cookie value and use it as a parameter:

Open the properties pane of the XSLT Data View and select Parameters

Add a parameter, name it as you wish, and in the Parameter Source select Cookie. In the next field enter the name of the cookie which to read and again you can enter a default value.

And you can use the parameter value as you wish - for filtering, conditional formatting, as content in the dataview, etc.

2. But how to set or manipulate Cookies?

The easiest way to set a cookie value is with functions I've found on QuirksMode. I've contacted the author but got no reply so I'll dare to publish the JavaScripts here. I repeat again: these are the property of QuirksMode. I use the functions below to set, change value or delete cookies 


Set or change value of a Cookie:

function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else
    var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

Delete cookie:

function eraseCookie(name) {
    createCookie(name,"",-1);
}

To put the above example into practice. In a DataView I'd be reading a cookie named ShoeSize and use it as parameter $Size in a data view. To set the value of a cookie for example to M I'd use a function:

<script type="text/javascript">createCookie('ShoeSize','M')</script>

If the third parameter is not supplied the cookie is active only as long as the browser is open. To change a cookie value to S and to be valid for 3 days, I'd use

<script type="text/javascript">createCookie('ShoeSize','S',3)</script>

When I don't need the cookie anymore, I just use <script type="text/javascript">eraseCookie('ShoeSize')</script>.

Using cookies to pass parameters between pages has its benefits, like - you don't complicate with codepages, long URLs, you can pass the parameter between more pages than one, etc. But you can't pass the parameter with cookie between sites. For this I'd recomend QueryString.

Using parameters from URL as variables in XSLT Data View

This is a reply to PsychedEric in my post about QueryString. To use params from URL in an XSLT data view is quite simple. Once you have the data view inserted, display the options of the Data View and click on Parameters.

Next click the button "New Parameter" and enter a name for it. Then in a Parameter Source dropdown, select Query String.

 

Under the dropdown enter the variable name - which parameter in URL to read. For example if it will be reading parameter "p" in url webborg.blogspot.com?p=1234 just enter letter p. You can also set a default value if there is no p parameter in the URL.Next click OK.

And that's it. Now you can use this parameter for filtering, or in the Data View Web part as you desire. If you want to use the parameter in the DataView just enter its name with a $ (dollar) sign before it. SharePoint Designer's Intellisense will recognize it.

10/22/2007

New Free Download Manager - Download videos from YouTube, Google Video, ...

I've already posted about the Free Download Manager. Recently I've checked and they have a new version, which enables you to download videos from YouTube, Google Video, Blennus, DailyMotion, LiveDigital and MySpaces. Probably the list of supported sites will keep expanding.

It enables you to automatically convert the downloaded Flash video (.flv) to some of the popular video formats - .avi, .mpg, .mp4, .wmv, etc.

It comes also with a built-in (as an option) torrent downloader.

10/11/2007

Stability and performance update for Windows Vista

Yesterday evening my laptop with Vista already got too slow for normal work that I started to think about reinstalling. But instead I decided to use the performance tools in control panel and I made serious maintenance plus I turned off some features like visual styles.

An improvment in performance was immediate. And then suddenly a baloon pops up from my system tray explaining that there are solutions to my Vista problems (format? :-)). Desiring the better performance I follow the link and download the update. For all here's the link to KB article from which you can download the update for 32-bit or 64-bit Windows Vista.

http://support.microsoft.com/default.aspx/kb/941649

After installing the patch and restart - the difference is obvious. Performance is better.

The best performance improvement I notice is that my SharePoint Designer crashes immediately instead of freezing for 2 minutes first :-)

Technorati Tags: , ,

10/07/2007

Great tools for web developers pt. 3

The third in the series of tools for web developers is for the ones that don't want or don't have the option to install any software or addons and just need a quick access to a tool for inspecting DOM

1. Mouseover DOM inspector v. 2 - MODIv2

This thing is pure JavaScript, DHTML and CSS so you really don't need anything else for inspecting a DOM of a certain page. All you need is to bookmark a link on the help homepage:

Tools For Web Designers Pt. 3 - 01

And then go to the page you want to inspect the DOM, and next just call the script from your favourites.

Tools For Web Designers Pt. 3 - 02

And you're already exploring the DOM.

Tools For Web Designers Pt. 3 - 03

It doesn't contain as many tools as the previously described toolbars, but it's a very good solution for quick start and instant DOM inspection.

Great tools for web developers pt. 2

In my previous post I've presented a tool that I find very useful when debugging display, creating javascript related to HTML DOM, etc. The tool is intended for Internet Explorer. The FireFox users aren't deprived of such tools either. There are two tools available:

 

1. Web developer toolbar for Mozilla Firefox

 

It offers quite a wide array of tools for web developers, such as ruler, css validation, DOM explorer, etc.

Tools For Web Designers Pt.2 - 02

It has a nice feature when exploring DOM - it displays all the parrent elements - so you can see how any element is nested.

Tools For Web Designers Pt.2 - 03

A neat add-on to that feature would be to be able to pause the selection and view the nested DOM, since there are a lot of times too many nested elements and the text goes out of the screen.

2. Firebug

A good combination of both - ie and firefox dev toolbar, it has very good tools for debugging HTML, CSS and JavaScript. What I like about it is that you can select the elements and it automatically also selects the HTML. And to manipulate the HTML, JavaScript and CSS in real time is very easy.

What I like about it is that it is easy to use, it has ability to monitor, debug and execute JavaScript, it helps with visualising some of CSS properties, and its toolset is nicely organized and easy to use. On the image below you can see how easy is to manipulate HTML in real time.

Tools For Web Designers Pt. 2 - 04

The problem of displaying too many nested elements is solvet neatly with a simple solution: the elements are ordered in opposite sense - it displays nested elements from right to left - instead of html > body > ... div it displays div < ... < body < html.

Tools For Web Designers Pt. 2 - 05

These are some neat tools that may make your life easier. I recomend using them all together because you know what headaches the IE/FireFox display compatibility can cause :)

10/04/2007

Great tools for web developers pt.1

Many times to refference or change the the element's properties in a DOM of a web page, I was just going crazy. Especially in SharePoint this can be difficult, because some elements are nested DEEP within other elements (table > div > div > div > ... > input).

You can help yourself a bit with javascript:alert() or by viewing code, but there are tools to make your life as a web developer much easier:

1. Internet Explorer developer toolbar

This tool is a super add-on to Internet Explorer, with which you can easily explore the dom elements and their properties simply by mouse over and click.

Some screen shots

Tools For Web Designers 01 Tools For Web Designers 02

It has lots of other neat features like visual display of class and id info, outlining certain elements, disabling styles, images, clearing temporary files, etc. I especially like the color picker and the ruler, enabling you to select colors or to measure width or height of anything directly on the screen!

Color picker
Tools For Web Designers 04
Ruler
Tools For Web Designers 05

9/06/2007

Preloader image for ajax and similar web applications

I started to create my first ajax-like web application and I was looking a good site, where to find animated gifs.

After a while I've found a great site, which not only offers animates gifs, but actually you can generate the loader alone, selecting the foreground, background and style of the preloader.

Click here to get (generate) your preloader image.

8/17/2007

Resolving the "Unable to display this Web Part" problem after SharePoint Designer restore

If you've restored the SharePoint site using commands Site --> Administration --> Restore site and this site had special XSLT data views you may be in for a big surprise!

You can receive the following message:

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.

Or in Slovene language

Spletnega gradnika ni mogoče prikazati. Če želite odpraviti težavo, odprite spletno stran v urejevalniku HTML, združljivim s storitvami Windows SharePoint Services, kot je program Microsoft Office SharePoint Designer. Če težave ne morete odpraviti, se obrnite na skrbnika spletnega strežnika.

The problem is that while restoring the site, SharePoint designer doesn't correct the GUIDs of lists being used. For example: You're having an XSLT data view of a list called Contacts. When restoring SharePoint designer creates the list with a new GUID, but it uses the old GUID (from where the backup was made) of the list. The solution is simple: Fix the GUIDs of lists used in dataviews:

1. Open the Manage content administration page of your site (http://server/site/_layouts/mcontent.aspx)

2. Copy the shortcut of the list being used in XSLT to clipboard

3. In the URL you'll find the new GUID of a list between brackets ( in http://server/site/_layouts/ListEdit.aspx?List={89D731E5-0538-4999-B4AF-D7A5D9EA781F} the GUID is 89D731E5-0538-4999-B4AF-D7A5D9EA781F

4. With SharePoint Designer open the page with XSLT data view and search for term ListID in the code.

5. Select the value of the ListID parameter. It should be the GUID of the list (either in ListID="....." or in the same tag, look for GUID-like numbers.

6. Prest CTRL+H for Search and Replace with the value still selected. It will automatically populate the "Find what" field with it. Now paste the copied URL with GUID in the "Replace with" field and remove all but the GUID. Make sure you have the "Find in Source Code" option checked.

7. Now just press the "Replace all" button and your XSLT data view will magically come to life :).

I hope that this bug will be fixed with next version of SharePoint Designer, or maybe can develop some kind of plugin for that procedure to speed up the process for all the pages. I know that with FrontPage this wasn't happening.

8/14/2007

Access server different server with certain host name - build a new site while current still exists

The upgrade from Windows SharePoint Services 2.0 to 3.0 gave us in the company the opportunity to reconstruct some of the sites. The issue was that while the new site in WSS3 was in development, the site in the current server would stay active.

With version 2 this wouldn't be a problem. While having the existing www.site.com we'd create a new SharePoint site with the same host header and add a host header like new.site.com and work on it using new.site.com, while the DNS server is still pointing to the old site with www.site.com. At the end you just need to change dns for www.site.com.

The challenge comes with the version 3.0, because it's bound to host headers. Therefore it's best to work with the original host header from beginning. So how to build a website on a new server with a host header www.site.com while the other one still exists?

One alternative is already described in one of my previous posts.

The second alternative is to set up a DNS server to point to the new IP with the existing domain and use it like primary dns server on the development computer. Not practical - just to sacrifice the whole DNS server for one site.

My friend Miha - who in my oppinion should have a blog for all the great stuff that he advised me untill now - showed me even a better alternative. The third - best - alternative is that you trick your Windows XP or Windows Vista that www.site.com is on a certain IP - therefore server. Let's say for example that the existing site www.b4business.si is on IP 123.123.123.123. And the new server where we want to develop the site is on IP 123.123.123.321.

All we need to do is to edit the hosts file, which is located in c:\windows\system32\drivers\etc folder. At the end add the hostname (domain) and desired IP. - like in the picture below:

In Vista you have to have administrative rights to edit that file. After you've updated the hosts file, flush the DNS resolver cache (Start --> Run --> ipconfig /flushdns) and the the hosts file overrides any dns. Now you can edit the www.b4business.si on a new server.

When the site is ready, change the DNS to point to the new site and don't forget to remove the entry in hosts file.

Update: I've had the path to the file wrong. Now it's ok.

8/13/2007

Rearranged my blog homepage a bit...

It was a while from when I was checking what interesting gadgets blogger had to offer. Ofcourse checking them I was pleasantly surprised. So not so long ago using some new gadgets, I've rearranged my homepage a bit:

  • removed "About me" part
  • added "Read about" section with all my tags so you can filter
  • using a new feature in Blogger - added a small poll - which content you find most useful - you're invited to answer it so can get a feedback about what to write more. :) 
  • shuffled the right hand column a bit.

8/10/2007

fromURL - translate characters from URL

As mentioned in my previous post, you can pass parameters throught URL between pages. The problem can arise if you have special characters in parameters, like č, ž, š, spaces, etc. If you have the url

http://www.mysite.com/default.aspx?test=12 3

it will change to http://www.mysite.com/default.aspx?test=12%203 - so spacebar is converted to %20. And the function queryString would also get the value of parameter test to be 12%203. To complement the querystring you can use the fromUrl function that I've prepared, to translate these kind of characters:

 

function fromUrl(rezultat) { 
    rezultat = rezultat.replace(/%C4%8D/g,'č')
    rezultat = rezultat.replace(/%C4%8C/g,'Č')
    rezultat = rezultat.replace(/%C5%A1/g,'š')
    rezultat = rezultat.replace(/%C5%A0/g,'Š')
    rezultat = rezultat.replace(/%C5%BE/g,'ž')
    rezultat = rezultat.replace(/%C5%BD/g,'Ž')
    rezultat = rezultat.replace(/%22/g,'"')
    rezultat = rezultat.replace(/%20/g,' ')
    rezultat = rezultat.replace(/%23/g,'#')
    rezultat = rezultat.replace(/%25/g,'%')
 return rezultat
}

In the function above I've used the most common characters that need translation in slovene plus double quotation mark, spacebar, hash and percent sign. You can add more characters, I've prepared a table of characters and codes below. So now using a combination of these two functions

fromUrl(queryString('test')) would return the value 12 3.

Table of codes for URL encoding

Code Character   Code Character
%20 (space)   %C4%B8  ĸ 
%21 !   %C4%B9  Ĺ 
%22 "   %C4%BA  ĺ 
%23 #   %C4%BB  Ļ 
%24 $   %C4%BC  ļ 
%25 %   %C4%BD  Ľ 
%26 &   %C4%BE  ľ 
%27 '   %C4%BF  Ŀ 
%28 (   %C5%80  ŀ 
%29 )   %C5%81  Ł 
%2A *   %C5%82  ł 
%2B +   %C5%83  Ń 
%2C ,   %C5%84  ń 
%2D -   %C5%85  Ņ 
%2E .   %C5%86  ņ 
%2F /   %C5%87  Ň 
%C4%80  Ā    %C5%88  ň 
%C4%81  ā    %C5%89  ʼn 
%C4%82  Ă    %C5%8A  Ŋ 
%C4%83  ă    %C5%8B  ŋ 
%C4%84  Ą    %C5%8C  Ō 
%C4%85  ą    %C5%8D  ō 
%C4%86  Ć    %C5%8E  Ŏ 
%C4%87  ć    %C5%8F  ŏ 
%C4%88  Ĉ    %C5%90  Ő 
%C4%89  ĉ    %C5%91  ő 
%C4%8A  Ċ    %C5%92  Œ 
%C4%8B  ċ    %C5%93  œ 
%C4%8C  Č    %C5%94  Ŕ 
%C4%8D  č    %C5%95  ŕ 
%C4%8E  Ď    %C5%96  Ŗ 
%C4%8F  ď    %C5%97  ŗ 
%C4%90  Đ    %C5%98  Ř 
%C4%91  đ    %C5%99  ř 
%C4%92  Ē    %C5%9A  Ś 
%C4%93  ē    %C5%9B  ś 
%C4%94  Ĕ    %C5%9C  Ŝ 
%C4%95  ĕ    %C5%9D  ŝ 
%C4%96  Ė    %C5%9E  Ş 
%C4%97  ė    %C5%9F  ş 
%C4%98  Ę    %C5%A0  Š 
%C4%99  ę    %C5%A1  š 
%C4%9A  Ě    %C5%A2  Ţ 
%C4%9B  ě    %C5%A3  ţ 
%C4%9C  Ĝ    %C5%A4  Ť 
%C4%9D  ĝ    %C5%A5  ť 
%C4%9E  Ğ    %C5%A6  Ŧ 
%C4%9F  ğ    %C5%A7  ŧ 
%C4%A0  Ġ    %C5%A8  Ũ 
%C4%A1  ġ    %C5%A9  ũ 
%C4%A2  Ģ    %C5%AA  Ū 
%C4%A3  ģ    %C5%AB  ū 
%C4%A4  Ĥ    %C5%AC  Ŭ 
%C4%A5  ĥ    %C5%AD  ŭ 
%C4%A6  Ħ    %C5%AE  Ů 
%C4%A7  ħ    %C5%AF  ů 
%C4%A8  Ĩ    %C5%B0  Ű 
%C4%A9  ĩ    %C5%B1  ű 
%C4%AA  Ī    %C5%B2  Ų 
%C4%AB  ī    %C5%B3  ų 
%C4%AC  Ĭ    %C5%B4  Ŵ 
%C4%AD  ĭ    %C5%B5  ŵ 
%C4%AE  Į    %C5%B6  Ŷ 
%C4%AF  į    %C5%B7  ŷ 
%C4%B0  İ    %C5%B8  Ÿ 
%C4%B1  ı    %C5%B9  Ź 
%C4%B2  IJ    %C5%BA  ź 
%C4%B3  ij    %C5%BB  Ż 
%C4%B4  Ĵ    %C5%BC  ż 
%C4%B5  ĵ    %C5%BD  Ž 
%C4%B6  Ķ    %C5%BE  ž 
%C4%B7  ķ    %C5%BF  ſ 

Technorati tags: , ,