Webmaster

Rozrywka

Zwierz?ta

Motoryzacja

Transport, ci???arowe

O ci???ar??wkach i transporcie

Sport

Koszyk??wka

Basketball - newsy

Fotografia

Komputery

O serwisie

Serwis ten jest agregatorem RSS, który magazynuje zebrane informacje tak, aby można było do nich swobodnie później wrócić. Wszystkie treści pochodzą z kanałów RSS i są własnością twórców serwisów, które je udostępniają.
Tytuł każdego artykułu jest odnośnikiem do strony, z której dana treść pochodzi.
Baza zawiera 191361 akrtykułów.

Polecamy

Bronie
Konta osobiste
Kredyty mieszkaniowe porównanie
Foto Pl
Sklep z kolorami
Ebooki OnePress Torrent
Opisy do komunikatorów
Tapety Boże Narodzenie
Sztandary - Bydgoszcz

In the first part of this article I'll talk about how you can enable the jQuery JavaScript library in SharePoint 2007 sites and pages. The second part of this article will focus on using jQuery in SharePoint 2007 sites and pages.

When I was at PDC’08, I attended a session about the jQuery JavaScript library (watch online). A few weeks before that Scott Guthrie announced that Microsoft would support, and even ship jQuery together with Visual Studio, along with Microsoft’s own AJAX implementation: ASP.NET AJAX. If you’ve never heard about jQuery, I defenitly recommend you to to check it out, there are some great tutorials available. The defenition of jQuery reads: "jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript." In my opinion jQuery is great because it simplifies a lot the JavaScript that you have to write if you’d like to do fancy AJAX stuff, selecting HTML elements for example is a breeze. Secondly jQuery has a big community that develops plugins for various scenarios. I already wrote and talked quite a bit about integrating ASP.NET AJAX with SharePoint 2007, so let’s check out how you can integrate jQuery as well!

First things first: you need to get the jQuery library from the official website. It comes in three varieties: uncompressed (with debug information, use it while you develop), packed (smaller, use it for production) and minified (needs to be uncompressed at the client, so slower but even smaller). The jQuery library is just a JavaScript (JS) file, so it can be loaded from any web page (html, aspx, etc). If you’d like to have IntelliSense when writing code in Visual Studio 2008 for jQuery (highly recommended of course), you need to download a Visual Studio hotfix. Now you’re good to go to make use of jQuery in your development environment.

Before I show you some things you can accomplish with jQuery in your SharePoint sites, let’s think about how we can make the jQuery library available on the ASPX pages of our SharePoint sites. There are two things that need to be done: first the JS file (the library itself) should be deployed to a location which can be accessed by SharePoint pages, secondly the library should be loaded by the SharePoint pages.

Deploying the jQuery JS file is quite easy: I recommend deploying it to the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS folder on every Front End Web Server of your SharePoint Server Farm. By doing so, the file can be loaded by making use of the URL http://yoursite/_layouts/ jquery-1.2.6.min.js or http://yoursite/subsite/_layouts/ jquery-1.2.6.min.js, since the _layouts part of the URL always points to the LAYOUTS folder in the 12-hive.

Making sure that SharePoint pages will load the library can be accomplished in a couple of ways:

1) Load the library in the page you want to use it
This can be done very easily by adding for example a Content Editor Web Part to the page (or modifying the page with an editor), containing the following HTML:

<script type="text/javascript" src="http://weblogs.asp.net/_layouts/jquery-1.2.6.min.js"></script>

2) Add the script to the master page
You can add the same script tag to the master page that is used by your SharePoint sites as well, typically in the HEAD tag:

<HEAD runat="server">
    . . .
    <script type="text/javascript" src="http://weblogs.asp.net/_layouts/jquery-1.2.6.min.js"></script>
    . . .
</HEAD>

This may look very easy, but remember modifying out-of-the-box files in the 12 hive is typically not supported. So if your sites use the default master page, this is a no-go. Additionally it could be that you’ve to multiple master pages (e.g. system and site master pages) which complicate the situation.

3) Use the AdditionalPageHead Delegate Control (my favorite!)
By providing the contents for the AdditionalPageHead Delegate Control that is used by all the out-of-the-box master pages, you can make sure the the jQuery library is loaded by all the SharePoint pages. The AdditionalPageHead Delegate Control allows multiple controls to provide contents, so it’s a great extensibility scenario. To accomplish this you need to build a web user control (ASCX file), that contains the script tag to load the jQuery library:

<%@ Control Language="VB" ClassName="jQueryControl" %>
<script type="text/javascript" src="http://weblogs.asp.net/_layouts//jquery-1.2.6.min.js"></script>

There is no code-behind file required. This control needs to be deployed to the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES folder on the hard drive of every SharePoint Front End Web Server. Additionally you need to have a feature that will add the control to the AdditionalPageHead Delegate Control, the feature’s manifest will look like this (assuming the control is named jQueryControl.ascx):

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control
   
    ControlSrc="~/_controltemplates/jQueryControl ascx />
</Elements>

The feature can be scoped to any level, when it’s activated on a certain level, all the pages will automatically have the script tag in their HEAD tags. Pretty cool, isn’t it?

You can do all of this manually, but it’s of course much nicer to package the jQuery library JS file, the user control and the corresponding feature into a SharePoint Solution (WSP). I’ve created a sample Solution file, that contains a feature scoped to the Web level so the jQuery library can easily be deployed and enabled or disabled per SharePoint site. There is also an installer available that guides you through the installation process by making use of a nice wizard. You can find the solution, installer and sources as a part of the SmartTools project on CodePlex (direct link to the releases).

Ok, now we are ready to make use of jQuery in our SharePoint sites, in the second part of this article I'll show you some cool stuff you can do by integrating jQuery with SharePoint 2007.

Technorati Tags: sharepoint,wss,moss,jquery,smarttools,ajax,aspnetajax

[191329]

Once upon a time, in the chilly windowless basement of a Fortune 100 company, a young programmer joined our small development team. He brought with him a programmers editor called Brief. Within weeks every developer in the entire company was using this powerful editor. The three compelling features were the ability to select copy and paste columns of text, multiple windows with cut and paste between them and…drum roll please…macros. With macros, enormously tedious tasks can be performed easily in seconds.

Sadly, the Brief editor went the way of the Dodo, but happily, the macro feature lived on. In the Visual Studio Editor this feature is called Anonymous Macros.

It would be clumsy to describe how Anonymous Macros work with written words so I made a video that shows the power. The video is here: MacroDemo

After seeing the video, you may want to put these keystrokes on a 'sticky' to tape to your monitor:

Ctrl-Shift-R     Start/Stop Recording

Ctrl-Shift-P    Playback

I've always wanted to try doing a video and this was a good excuse. I hope you find it helpful.

Steve Wellens

[191328]

I was doing some load testing the other year and noticed one of the counters was going off the charts - ASP.Net exceptions.  I couldn't understand why my application, which was behaving fine in every other way, was throwing exceptions.

It turned out that I have been doing a Response.Redirect from the OnInit of a Page that was inheriting from a custom Page class which had a try/catch. The exception was a ThreadAbortException.  I quickly added a catch clause to grab the ThreadAbortException and ignore it, but what could I have done to avoid throwing an exception at all?

One of the most common calls in the whole of ASP.Net is Response.Redirect - which sends an HTTP 302 response back to the browser and does one of the most common things that all multi-threaded system do - throws a ThreadAbortException to exit the current Thread.

It turns out that there is another way to do this, assuming you can handle the conditional logic to ensure the current Response doesn't get mashed up before you send it to the browser.  It involves the little-known CompleteRequest() method, which essentially tells ASP.Net to skip any more events in the Pipeline, Handler or Module and just send the Request straight back to the client.

Here's my example of redirection method that doesn't throw an Exception.

As you can see - the only "customized" piece of logic is where we set the StatusCode of the Response to 302 (the 300 series of response codes are all different kinds of redirects, but 302 seems to do the trick for whatever you need).  The rest of the method just sets properties of the Response object (like RedirectLocation).

The net effect?  The same as Response.Redirect - except no exception. :)

Rock on - joel.

[191327]

David has an excellent post about a pretty cool ASP.NET feature that you almost certainly don’t know about. I had no idea for sure. Check it out.

http://blogs.msdn.com/davidebb/archive/2008/11/19/a-hidden-gem-for-control-builder-writers.aspx

[191151]

I was trying to include my ASP.NET MVC project in a TFS team build today but the build failed so I've investigated this issue and thought it will be helpful to share it with the community.

To get the MVC project build successfully with the team build make sure of the following:

- Your build server has the WebApplication targets file located in <Program Files> \MSBuild\Microsoft\Visual Studio\v9.0\WebApplications , if not . copy this file from your development machine to the same path in the build server.

- You have installed ASP.NET MVC framework in the Build server, this is the most important step otherwise you application will not build successfully in the team build you may faces some errors like :

error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

or

Controllers\RuleController.cs(31,10): error CS0246: The type or namespace name 'AcceptVerbs' could not be found (are you missing a using directive or an assembly reference?)

 

** Update

This will work with Beta version of ASP.NET MVC since the installation register the MVC assembly in GAC.

For preview versions , you can reference the DLL from your build project

<AdditionalReferencePath Include="C:\Program Files\Microsoft ASP.NET\ASP.NET MVC CodePlex Preview 4\Assemblies" />

 

Thanks !

[191150]

In the previous post we saw how to implement Copy and Paste clipboard operations, completely in Silverlight with cross browser support. In this post, we will extend the functionality to support multiple rows and introduce some Excel like enhancements. We will finish with a reusable DataGridCopyPasteService that can be used to provide any DataGrid with cross browser clipboard (copy/paste) functionality.

ClipboardHelperWe will start with the solution from last post that shows the basic one row copy paste functionality in DataGrid with Excel support. If you recall, we coded three different techniques to implement clipboard functionality. We will extend each one in turn to provide multi row support.

Excel Clipboard FormatICopyPasteObject

When copied from Excel, each cell is separated by a tab(\t) and reach row is separated by newline characters(\r\n). You can test this out by copying rows from Excel and pasting into notepad. So all we need to do to provide multi row support is to format copy data where rows are separated by newline. Similarly when parsing paste data, we first need to split using newline and then tab.

ICopyPasteObject

So far we have used code external to item in order to build data for copy and to paste data back into item. It would be more advantageous to move that functionality into item itself. This will allow item to do its own validation and also accommodate future changes to item itself. ICopyPasteObject interface provides methods to get data to copy from item and to set paste data back into item.

Add a new interface ICopyPasteObject as shown:

public interface ICopyPasteObject { string[] CopyData(); void PasteData(string[] dataFields); }

Next modify Person class to implement above interface as shown

public enum Fields { FirstName, LastName, Age, City } public string[] CopyData() { return new string[] { FirstName, LastName, Age.ToString(), City }; } public void PasteData(string[] dataFields) { BeginEdit(); FirstName = dataFields[(int)Fields.FirstName]; LastName = dataFields[(int)Fields.LastName]; Age = int.Parse(dataFields[(int)Fields.Age]); City = dataFields[(int)Fields.City]; EndEdit(); }

Private Copy Paste Functionality

In order to provide DataGrid scoped Copy and Paste functionality, we subscribe to KeyDown event and look for appropriate Key combinations. Replace existing code (in Tab1.xaml.cs) with following code

List<Person> _copyFromPersons; void peopleDataGrid_KeyDown(object sender, KeyEventArgs e) { if (peopleDataGrid != e.OriginalSource) { return; } // Copy uisng Ctrl-C if (e.Key == Key.C && ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control || (Keyboard.Modifiers & ModifierKeys.Apple) == ModifierKeys.Apple) ) { _copyFromPersons = new List<Person>(); foreach (Person person in peopleDataGrid.SelectedItems) { _copyFromPersons.Add(person.Clone()); } } // Paste using Ctrl-V else if (e.Key == Key.V && ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control || (Keyboard.Modifiers & ModifierKeys.Apple) == ModifierKeys.Apple) ) { if (null == _copyFromPersons ) { Dispatcher.BeginInvoke(() => MessageBox.Show("Please select one or more Persons to copy from")); return; } //Paste int personToCopy = 0; foreach (Person pasteToPerson in peopleDataGrid.SelectedItems) { pasteToPerson.BeginEdit(); pasteToPerson.FirstName = _copyFromPersons[personToCopy].FirstName; pasteToPerson.LastName = _copyFromPersons[personToCopy].LastName; pasteToPerson.Age = _copyFromPersons[personToCopy].Age; pasteToPerson.City = _copyFromPersons[personToCopy].City; pasteToPerson.EndEdit(); if (++personToCopy >= _copyFromPersons.Count) { break; } } // optionally ask user if to auto insert bool autoInsert = false; if (_copyFromPersons.Count > peopleDataGrid.SelectedItems.Count) { autoInsert = true; } if (autoInsert) { // && _copyFromPersons.Count > peopleDataGrid.SelectedItems.Count) { Person pasteToPerson = null; // assumes Person does internal validation and maintains data state (state management) for (int i = personToCopy; i < _copyFromPersons.Count; i++) { // insert new person pasteToPerson = _data.GetPersonForPaste(); pasteToPerson.BeginEdit(); pasteToPerson.FirstName = _copyFromPersons[i].FirstName; pasteToPerson.LastName = _copyFromPersons[i].LastName; pasteToPerson.Age = _copyFromPersons[i].Age; pasteToPerson.City = _copyFromPersons[i].City; pasteToPerson.EndEdit(); } } } // Clear clipboard (similar to Excel) else if (e.Key == Key.Escape) { _copyFromPersons = null; }   }

When user executes copy command (ctrl-c), we save a snapshot of one or more selected items to a private List. Note that we take a snapshot (deep clone of data) instead of saving just a reference so that we have a fixed copy even if user subsequently changes data. When user executes paste command (ctrl-v), we copy data from the snapshot list and copy over to (one or more) selected rows.

Excel like Auto Insert

In Excel if you try to paste rows that are more than selected rows, Excels prompts you if you will like to insert new rows. We can provide similar feature by auto inserting rows when data to paste is more than user selected rows. (One behavior change is that we have no control over where data is inserted). In above code, we first check to see if we have any rows left over (to paste) after pasting over selected items. If that is the case, then we create new Person(s) and then copy data over.

Internet Explorer Only Copy Paste Functionality using Clipboard object

Internet Explorer provides access to ClipboardData object for clipboard operations and we can access it using Silverlight Html Bridge functionality.

Modify KeyDown in Tab2.xaml.cs as shown:

void peopleDataGrid_KeyDown(object sender, KeyEventArgs e) { if (peopleDataGrid != e.OriginalSource) { return; } // Copy uisng Ctrl-C if (e.Key == Key.C && ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control || (Keyboard.Modifiers & ModifierKeys.Apple) == ModifierKeys.Apple) ) { //Build data for clipboard StringBuilder textData = new StringBuilder(); foreach (Person person in peopleDataGrid.SelectedItems) { if (_data.IsEmptyPerson(person)) { continue; } textData.Append(string.Join("\t", person.CopyData())); textData.Append(Environment.NewLine); } //Copy data to clipboard ScriptObject clipboardData = (ScriptObject)HtmlPage.Window.GetProperty("clipboardData"); if (clipboardData != null) { bool success = (bool)clipboardData.Invoke("setData", "text", textData.ToString()); } else { Dispatcher.BeginInvoke(() => MessageBox.Show("Sorry, this functionality is only avaliable in Internet Explorer.")); return; } } // Paste using Ctrl-V else if (e.Key == Key.V && ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control || (Keyboard.Modifiers & ModifierKeys.Apple) == ModifierKeys.Apple) ) { //Get Data from Clipboard ScriptObject clipboardData = (ScriptObject)HtmlPage.Window.GetProperty("clipboardData"); string textData = null; if (clipboardData != null) { textData = (string)clipboardData.Invoke("getData", "text"); } else { Dispatcher.BeginInvoke(() => MessageBox.Show("Sorry, this functionality is only avaliable in Internet Explorer.")); return; } //Parse data and build persons string[] rows = textData.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); if (null == rows || 0 == rows.Length) { Dispatcher.BeginInvoke(() => MessageBox.Show("Please select one or more Persons to copy from")); return; } //Paste int personToCopy = 0; foreach (Person pasteToPerson in peopleDataGrid.SelectedItems) { pasteToPerson.PasteData(rows[personToCopy++].Split(new string[] { "\t" }, StringSplitOptions.None)); if (personToCopy >= rows.Length) { break; } } // optionally ask user if to auto insert bool autoInsert = false; if (rows.Length > peopleDataGrid.SelectedItems.Count) { autoInsert = true; } if (autoInsert) { Person pasteToPerson = null; // assumes Person does internal validation and maintains data state (state management) for (int i = personToCopy; i < rows.Length; i++) { // insert new person pasteToPerson = _data.GetPersonForPaste(); pasteToPerson.PasteData(rows[i].Split(new string[] { "\t" }, StringSplitOptions.None)); } } } [191121]
Speaking at SOAWorld 2008 Otwórz w mowym oknie
In a few hours I will be speaking at SOAWorld about REST and WS-* in the enterprise. The session provide a pragmatic view of the best practices customers are following in order to adopt the REST model in the enterprise and its coexistence with WS-* services. If you are attending to SOAWorld and you are interested in Service Orientation make sure to swing by and say hi ;)....(read more)[191120]
So what have we been up to lately at Speak With Me? Otwórz w mowym oknie

I noticed that this week I got five emails from friends asking "So what's been going on?" or something to that effect! I figured this would be the easiest way to tell everyone!

Our economy has been a mess...

We're still raising and have been able to raise money.

We're on track for a really awesome product ready towards the tail end of next year. I hope it doesn't slip!

If you know me or attended the United Cerbral Palsy Foundation Charity event in Philadelphia, you might have an inkling of what the first product might be.

If you don't know me then know that the first product is something for your car.

But Americans aren't buying more cars. That's okay, they still have their current cars, they can put this into them!

The current system has been in my car for 3.5 years and 60,000 miles. Tested in the rain in Seattle while going through a tunnel, tested on the highways of California, Nevada, Oregon, and Washington.

I did distraction testing during an aggressive driving course with some friends & some of our investors. Prior to this, the usability tests showed a <1% difference in lap times between using the system while driving and not.

We demonstrated for real, that using Speak With Me's system while driving causes next to no distraction. How? Because the car behind me had trouble keeping up with me. Imagine his surprise when discovering I always had the music I wanted playing, and that my car did not have two turbos. (It does have a clutch-type 100% locking LSD which really helped my corner exit speeds, and the suspension is aligned and corner balanced).

 What about those swanky iPhones, the new Android phones, the new Blackberry Bold & Storm, and the Windows Mobile smartphones? And Google came out with it's voice app this week? Isn't that a competitor?

The speech apps that are out there for mobile phones are using speech recognizers with complex language models. They work - kinda sorta - well they think about working. Are they competitors? Kinda, sorta, but not entirely.

As you can see from this review of Google's voice search added to their mobile app by John Markoff, the NY Times reporter and author of the fabulous book, What The Dormouse Said,

speech recognizers on their own, still aren't up to the task.

Speak With Me is different. We help the recognizer understand context. Think of it as a debriefing session from your assistant before you go on stage. That's how we're more accurate.

 But gosh darn it, why haven't you shipped anything yet so we can try it out?

Because half baked cookies are kinda mushy.  We could get a phone app out faster, but it would sacrifice the time to market of our other key product which is in the GPS market. The two products share some similarities, but have some differences too. One has the data on the device, one has the data in a cloud. So we made a tough decision this week, to stay on track with the GPS product, and hold off on the smartphone related products till we're a bit further along with the GPS product. Back in 2005 when you first read about us from Robert Scoble's Blog or Techcrunch, there were very few devices capable of running our software in the mobile and embedded space. Today there are tons, and everyone - not just Speak With Me, is scrambling to make the best use of the computing power we have today to give everyone fabulous software for their mobile devices. The phone today is like the PC world in the early eighties, I agree with Steve Ballmer on that point.

It is interesting how the internet has really led to much faster demand creation. What if the New York Times had an article about Xerox PARC in the seventies - would we have all had the GUI before the early eighties? I'm curious and I think I'll ask John Markoff and Doug Englebart that question directly in a couple weeks. SRI's doing a 40th anniversary event of the mother of all demos - on December 9th. Doug as you may or may not know, was the inventor of the mouse. Just think, he demoed in 1968 - what we as the public didn't get to use until 1982. Wow.

 So how do you make a good cookie?

By using the highest quality ingredients, like Ghiradelli Chocolate Chips, Organic Cane Sugar, organic eggs, pure vanilla extract and not imitation. Then bake them for the right amount of time. You'll end up with something spectacular, just ask anyone who's eaten my cookies :) When they're ready, you'll know...

 You didn't expect me to tell you the ingredients within Speak With Me, now did you ;)

[191119]
Open Source alternatives in .NET for building RESTful services Otwórz w mowym oknie

Usually all my posts about REST are about WCF or mention this technology in some parts. Today, I decided to take a different approach and discuss some of the projects available today for building REST services,  Resourceful and Dream framework (Both available for mono as well).
It is worth mentioning however that the WCF team has made an excellent work introducing the new Web Model in .NET 3.5, it has definitively helped a lot to adopt this kind of service in the .NET platform. In my opinion, there are still some aspects in WCF that could be improved,

  1. WCF services are hard to unit test. It is possible but requires some extra work. I already mentioned some techniques  based on integration tests and mocks in this post "Unit tests for WCF"
  2. Poor support for defining multiple resource representations/formats within a single operation definition.
  3. Any aspect you would like to add here ?

Ok, I will try now to summarize some of available features or implementation details in these two projects.

Resourceful

LocalApplicationDescription app = new LocalApplicationDescription();

// get-user

LocalApplicationMethod getUser = app.NewMethod("getUser", HttpMethod.Get, _usersController.GetUser);

getUser.NewResponseRepresentation(MediaType.ApplicationXml);

getUser.NewResponseRepresentation(MediaType.ApplicationExWwwFormUrlencoded);

 

ApplicationResource userResource = app.NewResource("users/{username}", new TemplateParameter("username", "xsd:string"));

app.Bind(userResource, getUser);

The developer has to perform two things, first define the operation itself specifying a friendly name along with the supported Http methods and resource representations and afterwards, create a resource mapping ("users/{username}" in this case). {username} is a URI template hole, equivalent to the Uri Templates in WCF.

The method signature for the NewMethod is the following,

NewMethod(string id, string name,Action<IRepresentationContext> handler)

As you can see, the last argument is a delegate that points to the operation implementation. IRepresentationContext is equivalent to the WebOperationContext class in WCF, it contains all the runtime context settings that a service can use. This actually better than WCF because IRepresentationContext can be mocked for unit tests.

In the example above, _usersController is a simple class with the service implementation (This separation of concerns definitively helps a lot for unit testing). Some code for the GetUser operation implementation looks as follow,

public void GetUser(IRepresentationContext context)

{

    string username = context.TemplateParameters["username"