by Victor
28. April 2010 14:09
Billy Sing is a hero. He was an Australian soldier of the World War I, and distinguished sniper during the Gallipoli Campaign. He killed almost 200 Turkish soldiers during that campaign. Turkish called him "The Assassin of Gallipoli". He was also an Anglo-Chinese ancestry. But in the Australia TV mini-series "The Legend of Billy Sing", he was white washed. It does not mention his Chinese heritage at all. After watching the trailer, I found out the only thing Chinese about the Billy in this series is his last name, which is not a name immediately recognisable as being Chinese anyway. In the trailer there is a scene where the whole family are at the table, they are all white, including the father. If a country cannot even face its national is not white, how do you expect it to treat its people equally. Look at the recent comments made by Pauline Hanson, it makes very clear why there are many attacks against minority race groups in Australia these years.
by Victor
23. April 2010 13:41
I upgraded my blog from blogengine.net 1.6.0 to 1.6.1. Really happy to see they finally integrated with Recaptcha. Comment spam is becoming increasingly annoying. I need to delete quite a few of these every day . Hopefully Recaptcha can stop some of them. And this update is straightforward. Good job guys :D.
by Victor
21. April 2010 19:39
3e17fbdd-5d83-469e-a024-816936d1f62c|1|4.0
Tags: Joke
Joke
by Victor
20. April 2010 16:05
How to bulk delete in SharePoint?
The normal way to delete file programmatically in SharePoint is using the SharePoint API. The code looks like:
foreach(SPList myList in myWeb)
{
foreach( SPListItem item in myList )
{
item.Delete();
}
}
This works fine for document libraries contain small amount of data. It will be extremely slow when you have document libraries contain millions of records. In this case, you will need bulk deletion.
In order to use bulk deletion you need to know the CAML and how to use SPWeb.ProcessBatchData() methods.
There is the example.
private static String BuildBatchDeleteCommand( SPList list, SPListItemCollection coll )
{
StringBuilder sbDelete = new StringBuilder();
sbDelete.Append( "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Batch>" );
// We prepare a String.Format with a String.Format, this is why we have a {{0}}
string command = String.Format( "<Method><SetList Scope=\"Request\">{0}</SetList><SetVar Name=\"ID\">{{0}}</SetVar><SetVar Name=\"Cmd\">Delete</SetVar><SetVar Name=\"owsfileref\">{{1}}</SetVar></Method>", list.ID );
foreach ( SPListItem item in coll )
{
sbDelete.Append( string.Format( command, item.ID.ToString(), item.File.ServerRelativeUrl ) );
}
sbDelete.Append( "</Batch>" );
return sbDelete.ToString();
}
// While there's something left
while ( list.ItemCount > 0 )
{
// We get everything but we limit the result to 100 rows
SPQuery q = new SPQuery();
q.RowLimit = 100;
// We get the results
SPListItemCollection coll = list.GetItems( q );
// We process a CAML batch
String batch = BuildBatchDeleteCommand( list, coll );
// We execute it
web.ProcessBatchData( batch );
list.Update();
}
BTW the methods returns a String, if your code doesn’t work, it would return you an error code. If everything is fine, it just return "0x00000000".