Archive for the ‘Software’ Category

WSS/SharePoint Extension 1.2 for Visual Studio 2008

Friday, June 20th, 2008

Finally it’s out, get it while it’s hot.

Now you SharePoint developers no longer need to hesitate to upgrade to Visual Studio 2008 if you haven’t.

This will greatly help development of SharePoint-based solutions when you’re using Visual Studio 2008 by providing the following features:

Visual Studio 2008 Project Templates

  • Web Part
  • Team Site Definition
  • Blank Site Definition
  • List Definition
  • Empty SharePoint Project

Visual Studio 2008 Item Templates (items that can be added into an existing project)

  • Web Part
  • Custom Field
  • List Definition (with optional Event Receiver)
  • Content Type (with optional Event Receiver
  • Module
  • List Instance
  • List Event Handler
  • Template

SharePoint Solution Generator

  • This stand-alone program generates a Site Definition project from an existing SharePoint site. The program enables developers to use the browser and Microsoft Office SharePoint Designer to customize the content of their sites before creating code by using Visual Studio.

Installing the WSS/SharePoint extension on Windows XP/Vista

If you are using Windows XP/Vista and try to install the extension, it will display the following error:

The product can only be installed if Windows SharePoint Services 3.0 has been installed first.

Instead of replacing your OS with Windows 2003, launching a Virtual PC image preloaded with SharePoint, or trying to install SharePoint on Vista, you can simply create a registry entry to fool the extension installer as if you have installed WSS on your XP/Vista machine. Before following these simple steps, as with any registry modification, do so with caution at your own risk. You can create a registry backup if necessary.

Basically — under the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12 registry key — you need to add the following string value: Sharepoint="Installed".

Here is the step-by-step instruction:

  1. Run regedit from command prompt or Start > Run.
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.
  3. If you cannot find the “12″ folder, right click on the Web Server Extensions, select New > Key from the popup menu, and enter 12 as the new key name.
  4. Right click the “12″ key/folder, select New > String Value from the popup menu, and enter Sharepoint as the name.
  5. Double click the newly created Sharepoint entry, and enter Installed as the value data.
  6. Now you can try to install the Sharepoint extension for VS 2008.

An easier way to do the above steps is to download the SharePointOnXP.reg file, extract, double click on the file. Then you can try to install the extension.

By the way, if you haven’t done so, you might also want to add SharePoint’s dlls to the GAC. Hence, Visual Studio won’t find troubles when compiling your SharePoint-based projects.

SharePoint Bending: Forefront Forbids Programmatically File Uploads

Monday, June 2nd, 2008

I had a custom page that needed to be deployed inside a MOSS 2007 site’s document library. The problem was, there were more than 100 sites in the site collection. Manually uploading the file was so time-consuming, so I decided to write a simple console application to upload the file to each site’s document library.

The application simply made use of the Microsoft.SharePoint.SPFileCollection.Add() method to upload the file programmatically to the desired document library. In my development environment, it worked flawlessly. So happily I went to the client and ran the application in the production server. Almost immediately, the application exited without any message. It’s strange because I made it to output the upload status as well as the exception message.

Then I tried to add a more verbose exception handling, by printing out the exception stack as well as the exception type, and I got this following output:

Exception class: Microsoft.SharePoint.SPException
Exception message:
Stack Trace:
at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Byte[] file, Boolean overwrite, String checkInComment, Boolean checkRequiredFields)
at Microsoft.SharePoint.SPFileCollection.Add(String urlOfFile, Byte[] file, Boolean overwrite)

See? No exception message. How the heck would I know what happened then? Well, at least I got the idea that the failure was at the Microsoft.SharePoint.SPFileCollection.Add() method execution. I ran the code under the administrator account, the same account used as the site’s administrator, so it shouldn’t be the account problem. I fired up the browser, tried to upload the file manually to the document library using the same administrator account, and it also worked. So definitely this was not a problem related to the permission.

After messing around with the site’s settings and permissions, rewrote my application’s code many times, as well as googled for solutions, I finally found out the real problem. It’s not the code or the permission problem. But it seemed that the production server had Microsoft Forefront Server Security installed. It was configured to scan for viruses on every file uploads and downloads.

So what I did to fix the issue is:

  • Open SharePoint Central Administration
  • Open the Operations tab
  • Click on the Antivirus link under the Security Configuration section
  • Turn off the Scan documents on upload setting

Then I could successfully executed my application to upload the file to every sites.

This is a mere workaround to resolve this problem temporarily. I still need to find a more proper solution so my application can work with Forefront.

Should LINQ End SubSonic (and Other DAL Tools)?

Tuesday, August 7th, 2007

SubSonicFirst, I’d like to say that SubSonic is really really awesome. I just know SubSonic for three or four months, but I already created some new projects and converted some old ones with SubSonic. And they were commercial projects.

Compared to SubSonic, all other DAL tools look “awful”. I’ve been using plain old ADO.NET, NetTiers, NHibernate, and even created my own DAL tool. But once I use SubSonic, I suddenly have more time to date, play games, watch movies, and do other fun things.

Regarding LINQ, this stuff is simply great. It is not just yet another DAL tool. It even extends the language with querying capabilities, not just to DB but almost everything. I just had the chance to play with it yesterday—although I have read about it for a long time—, and I was very impressed. If only Microsoft had created it earlier.

Yes, LINQ currently only supports SQL Server, but this is really just a matter of time. Soon more providers will emerge surely.

Having the advantages of being provided out of the box with .NET Framework 3.5, the cool query keywords built-in the languages, as well as the capability to query beyond database, I think it will be extremely hard not to pick LINQ over other DAL tools.

So, for pure DAL tools out there, I guess this is the end. But for SubSonic, I don’t consider SubSonic is merely a DAL tool, but a great time saver.

The “convention over configuration” mantra that it brought from the sacred realm of Ruby on Rails simplifies many things. For example, SubSonic will know whether my tables have some auditing fields (i.e., CreatedOn, CreatedBy, ModifiedOn, ModifiedBy) and populate them automatically for me. It knows when to use soft or hard delete by checking if there is a Deleted or IsDeleted field in a table. Did I mention SubSonic has auto scaffolding and the useful utility classes (a.k.a. SubSonic Sugar)? All of them is really a great time saver.

SubSonic spoils me so much I hate to not being able to use it in my projects. I really hope that SubSonic can work hand in hand with LINQ to ease developer’s life much further. The combined strength of language level queries provided by LINQ and the “convention over configuration” mantra and utilities provided by SubSonic will certainly grant developers with a great power to finish projects better and faster.

Web Development Resources

Friday, April 13th, 2007

Since I have been in Web Development for like forever, I’d like to put some resources I found useful and interesting for my future references. If this can also help you, that’s cool.

Clearing Floats Elegantly

The tutorial will introduce and guide you to clear floating elements. It also deals with browsers’ specific problems.

Chatcreator

This allows you to easily embed a chat box anywhere in your Web page. You only need to enter a few properties, such as chat title, font, box size, and color. Then they will provide you with a JavaScript code to put somewhere in your Web page.

CSS for Bar Graphs

A good tutorial to show you how to create bar graphs only with CSS.

CSS for Bar Graphs

Custom Radio (Option) Buttons and Checkboxes

You can customize your radio buttons and checkboxes using this tool.

Custom Radio (Option) Buttons and Checkboxes

Fancy Menu with JavaScript and CSS

A tutorial on creating a very cool menu with JavaScript effect and CSS.

Forms Without Tables

Want to create forms without tables? Take a look at this tutorial.

Forms Without Tables

Light Weight CSS Tabs

Using CSS to create light weight tabs for Web navigation.

Light Weight CSS Tabs

Star Rating

A tutorial on how to create interactive star rating using CSS.

CSS Star Rating

Transparent PNG in Internet Explorer 6 and Older

Prior to Internet Explorer 7 — i.e., IE 6 —, IE cannot render transparent PNG images correctly. Fortunately we can resolve the problem pretty easily using JavaScript. Find the JavaScript code and tutorial on how to use it in the above link.

Change Your Fonts, Change Your Mood

Wednesday, October 18th, 2006

You must already know Arial and Times New Roman pretty well. If you are a programmer, you must also know Courier inside-out. They are the main line of Microsoft’s fonts pack. Microsoft Word defaults to Times New Roman. Excel’s default font is Arial. Notepad has Courier New (or Lucida Console in later Windows versions). Have you been tired of them after seeing them for 1, 3, or 10+ years? I do. If you are like me, then please continue reading.

Change Your Printing Fonts

You have a wide choices for printing fonts. If you have a fine quality printer, chances are all fonts will look crisp and great on papers, even the good old Times New Roman. But sometimes you will need variation to fresh up your eyes.

Basically, you can use either serif or sans-serif fonts as your printing fonts. If you don’t understand the difference, serif fonts have structural details on the end of strokes that make up letters and symbols (definition quoted from Wikipedia). If you still don’t get it, observe the picture below (also captured from Wikipedia).

Serif and Sans-Serif

There are some pretty good alternatives to Times New Roman. I personaly like Palatino Linotype and sometimes Georgia. Bitstream Vera Serif looks pretty good too.

Change Your Screen Fonts

Screen fonts are used to render the text you see on your computer monitor. It can be anything from GUI elements such as menus or labels, to the text displayed on your Web browser. Windows XP mainly combines Tahoma and Trebuchet MS to render GUI elements which are pretty much okay for me. Internet Explorer uses Arial and Times New Roman as its default fonts (that is the fonts which are used when the Website you visit doesn’t specify a certain font), and this looks rather ugly for me.

Unlike printing fonts, you usually have fewer choices for screen fonts. Not all fonts will look good on screen since monitors have much lower resolution than average printers. Usually, serif fonts won’t look good on screen since the serifs parts may be rendered poorly. So you better stay with sans-serif fonts here.

Microsoft has several fonts which are designed specifically for screen fonts: Tahoma, Trebuchet MS, and Verdana. They are made so they look crisp on monitors and easy on the eyes. Generally, we won’t get tired quickly when reading text on-screen using the mentioned fonts.

I used to like Verdana so much, but now I use Bitstream Vera Sans as my default font in my Firefox browser. The Bitstream Vera Sans font is also optimized so the rendering quality is great on low-resolution devices such as monitors. The following are the pictures of my Website rendered with Bitstream Vera Sans (upper) and Arial (lower).

Bitstream Vera Sans and Arial

Do you like it too? I will show you later how to install and use the Bitstream Vera fonts.

Change Your Code Fonts

Are you a programmer? Do you mainly develop on Windows platform? If the answers to the both questions are “yes”, then you must be very familiar with the Courier or Courier New fonts. The Courier family font has been used widely in Windows development environment. There are some popular alternatives for this code fonts, mainly the Lucida Console font.

You cannot pick any fonts as code fonts since programmers will need monospace (aka fixed-space) capability to ease indenting in coding. If you are bored with Windows’ standard fonts, you can try Bitstream Vera Sans Mono. It is designed for programmer to optimize the clearness of codes. Take a look at the following picture comparing Bitstream Vera Sans Mono (upper) and Courier New (lower).

Bitstream Vera Sans Mono and Courier New

About the Bitstream Vera Fonts

You read them several times. I use the Bitstream Vera fonts. They look good, but you can’t find them in your font selector dialog box. Why? Because they don’t come with Windows. Bitstream Vera fonts are released under an open source license and published by the GNOME Foundation. Since they are open source, everyone can use and modify them freely (as in free speech). There is a TTF (True Type Font) version for use with Microsoft Windows which can be downloaded here.

Installing and Using the Bitstream Vera Fonts in Windows XP

Here is a guide for those who are unfamiliar with basic fonts operation. This guide is for Windows XP, but should work under different Windows version with some adjustments as well.

  1. Download the TTF package. They are packed in several formats: zip, tar.gz, and tar.bz2. Choose the zip package if you are unsure.
  2. Double click to open the zip (or whatever) package. You will see some files beginning with “Vera”, copy them to any folder you want.
  3. Open Control Panel, switch to Classic View, then double click on Fonts.
  4. Choose menu File > Install New Font…
  5. Navigate to the folder where you copied the Vera fonts earlier in step 2.
  6. Select them all in the “List of fonts” box and click the OK button.
  7. They are installed and ready to use.

Here is another guide to change your default browser font. I use Mozilla Firefox 2.0, but you can do this also in Internet Explorer.

  1. Launch Firefox.
  2. Choose menu Tools > Options…
  3. Click on the Content tab.
  4. Under the Fonts & Colors group, click on the Advanced button.
  5. Set Bitstream Vera Serif, Bitstream Vera Sans, and Bistream Vera Sans Mono to the Serif, Sans-serif, and Monospace combo boxes respectively.
  6. Click OK several times to close the Options dialog box.

Many applications allow you to change the fonts, just explore, change some fonts to brighten up your mood. Have fun.