Wednesday, 5 October 2011

MOSS 2007 - Upload size and HTTP-error 404.13

Today I discovered a strange behaviour of MOSS 2007 in combination with IIS 7. Normally you set the maximum upload size on web application level, inside the central administration. Guess what, that doesn't work at all when you are running MOSS 2007 on a IIS 7. You will raise into a "HTTP-error 404.13 Not Found". Thanks to internet, I found the solution (it worked for me, so give it a try).

Solution 1 - Changes for all web sites:
Next statement will set the maximum file upload size to 100MB. Note: the maxAllowedContentLength is in bytes!

%windir%\system32\inetsrv\appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:104857600
Solution 2 - Changes for a web app:

%windir%\system32\inetsrv\appcmd set config "Default Web Site/" -section:requestFiltering -requestLimits.maxAllowedContentLength:104857600
Just execute the statement in a command prompt.

Read more...

Friday, 2 September 2011

MS Word is starting fast, relatively speaking

Today, I downloaded the Process Monitor to get a bit more insight in what kind of registry key's are read when a program starts up.
Just as a kind of trial, I started MS Word 2010. Always a bit slow in starting. Well, I have to change my opinion a bit. It seems that Word needs up to more than 69.000!! registry events to start up. Well, from that point of view, it is not starting up slow... ;)


Read more...

Monday, 15 August 2011

Logo Windows Phone Mango revealed

Well, Microsoft must have thought: fruit is good for your health, so we call our new phone 'Mango'. Does the new logo looks like this?

(c) Rob van Meeuwen ;)

Read more...

Monday, 27 June 2011

Raise (custom) event after closing jQuery popBox

Recently I started to use the jQuery plugin popBox (http://plugins.jquery.com/project/popBox). This plugin provides a simple to use popup textarea extension for textboxes. The nice thing is that it works on hidden textboxes as well.

For my hour registration form I have some hidden textboxes to keep the form a bit clean. The form supplies textboxes for each day (see figure).

So for each day you can add hours, comment en log-info. The last two fields are hidden. To edit the comment and/or log-info you just press on the corresponding image.
Because these fields are invisible, you want to have some kind of indication if some text has been entered already or not. So I want to change the 'button'image if some text has been entered.
Raising an event seems to be a hard job, because you don't really access the (hidden) textbox, so their events are not raised. After some search and trial and error I found a solution.
First of all, let me show you how I attached the jQuery popBox plugin to my hidden comment and log-textboxes (see instructions at http://plugins.jquery.com/project/popBox). The hidden textboxes where called like txtNewMonComment, txtNewMonLog, txtNewTueComment etc.

1. I applied the popBox to all textboxes with class set to 'txtDailyComment':
$(document).ready(function () {
 //attach popBox jQuery plugin to all textboxes with class=txtDailyComment.
 $('.txtDailyComment').popBox();
});
2. The images that simulates a button are configured like this:
<img alt="Comment" src="/hrt/_layouts/images/DNM.WP.HourRegistrationGeneralForm/message_add.png"  onclick='SetTextboxFocus($(this));' id="btnNewMonComment" />
3. I wrote the SetTextboxFocus function to show the content of the corresponding hidden textbox:
function SetTextboxFocus(button) {
 var day = button.attr("id").substring(6, 9);
 var type = button.attr("alt");
 var control = "txtNew" + day + type;
 $("input[name=" + control + "]").focus();
}
So far is just like the instructions on the popBox plugin page.
4. The customization starts here and is quit simple. I wrote a function that I want to fire after closing the popBox. You can do whatever you want in this function. For demo reason I just show an alert:
function AfterTextboxUpdate() {
 alert('popBox is closed');
}
5. The popBox plugin supports option parameters. So I just add one of myself. I changed the popBox attach as written in step 1 as follows:
$(document).ready(function () {
 //attach popBox jQuery plugin to all textboxes with class=txtDailyComment.
 $('.txtDailyComment').popBox({ onclose: function () { AfterTextboxUpdate(); } });
});
6. The last step is to edit the popBox1.3.0.js file. Find the part where blur function is fired and add "options.onclose();" inside the if-section:
popBoxContainer.children().blur(function () {

 if (change) {

  $(this).parent().hide();
  $(this).parent().prev().hide();
  $(this).parent().prev().prev().val($(this).val().replace(/\n/g, options.newlineString));
  options.onclose();
 }
});
That's it. When you close the popBox, the AfterTextboxUpdate function will be fired.


Hope this helps you to get even more about this great jQuery plugin.

Read more...

Monday, 2 May 2011

iMac 27" internal speakers stopped working

Since two weeks, I have an iMac 27" (i5, 2,8GHz) at home. A really nice and beautifull machine for my photography and video hobby.
However, last weekend the internal speakers stopped working. Sometimes it worked after a reboot for about 5 minutes max, mostly less.
I searched around on the internet, but all kind of suggested tricks didn't work (like reset PRAM, plug and unplug a headphone, starting GarageBand and so on.
Today I contacted the apple support and they gave me the following trick to try. I share it with you, because this one I didn't found on the internet.

  1. Shutdown the computer
  2. Unplug the powercable
  3. Keep the powerbutton pressed for 30 seconds. This will reset the SMC. This will in no way affect your data/installation. See also (http://support.apple.com/kb/HT3964)
  4. Plug in the powercable
  5. Start your iMac and here you are, all things are fine again (till now at least :) )
So, all credits to the Apple Helpdesk!
Edit: I just found this solution somewhere on the apple site. However, I didn't find it relating to my problem (I didn't search that well I suppose).

Read more...

Tuesday, 22 March 2011

The query uses unsupported elements

I am using SPMetal for creating partial classes for accessing my SharePoint lists by code.
Today I was trying to run a Linq query in LinqPad on a SharePoint list (see here how to use LinqPad on SharePoint data). See query:

var q = from w in WorkItems
  where w.ShortUserID == "rob"
  where (((DateTime)(w.WorkDate)) >= firstDay 
     && ((DateTime)(w.WorkDate)) <= firstDay.AddDays(6))
  select new {w.Title, w.WorkDate, w.Hours, sprint = w.SprintItem.Title};
q.Dump();
Well, it's just an ordinary Linq query, but as always with SharePoint related programming, nothing goes well the first time. I got the following error message:
The query uses unsupported elements, such as references to more than one list, or the projection of a complete entity by using EntityRef/EntitySet
It has something to do with the 'sprint' information I needed. The 'SprintItem' is a property (Type of SprintItem object) of the WorkItem class. Somehow this will fail.
An explanation given by Paul Beck (see his blog):
ToList() method forces immediate query evaluation and returns the generic that contains the query result. As described in the MSDN article LINQ can't convert the LINQ to SharePoint into a CAML query so by using the ToList() method, the query is broken into 2 stages. This will apply to queries that use JOINS, UNIONS, and various other LINQ operators as described in the MSDN Unsupported LINQ queries article.
In his article he relates this problem with 'join'. However, I didn't use this keyword. Nevertheless his solution worked, I needed to put 'ToList()' right behind 'WorkItems' and the problem is solved. So the code will now looks like:
var q = from w in WorkItems.ToList()
  where w.ShortUserID == "rob"
  where (((DateTime)(w.WorkDate)) >= firstDay 
      && ((DateTime)(w.WorkDate)) <= firstDay.AddDays(6))
  select new {w.Title, w.WorkDate, w.Hours, sprint = w.SprintItem.Title};
q.Dump();

Read more...

Thursday, 10 March 2011

LinqPad on SharePoint data

Linq to SharePoint is great! The SPMetal.exe is really easy to use (see here how to use it).
But I was struggling a bit to get the right Linq queries. So I thought, well let's use LinqPad. I ran into the following error message:

PropertyOrFieldNotInitializedException: The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
I searched for a solution, but I didn't find one. Today I figured out how to use LinqPad to query on SharePoint data, without facing these security-IIS-related issues.
On CodePlex you can find the LinqPad Data Context Driver for SharePoint created by a guy named 'theiwaz'. Creating a new connection in LinqPad, using this driver did the trick. Read the documentation how to install and setup the configuration (very easy!).

In my situation, I ran into a small problem. The documentation shows a screenshot with a sample code, using "C# Expression" a the language.
When I tried that, it failed. I got the following message:
String was not recognized as a valid Boolean
 Changing the language to "C# Statement(s)" did the trick for me. I only need to rewrite the code a little bit. But that's actually a great advantage, because it now looks like the code as I will use inside my VS2010 project.
var q = from prod in Products
    where prod.Customer.Title == "DNM"
    select  prod.Title;

q.Dump(1);

Read more...

  © Blogger templates Psi by Ourblogtemplates.com 2008

Back to TOP