May 2005 Entries
Check out this article on Wired. It invovles a government raid on a file sharing organisation in the US. Now I don't want to get into a debate about whether or not file sharing is right. I know the arguments on both sides. The music/film industry say that file sharing is starving the business of much needed revenue which would be ploughed back into new talent. The file sharers say that whilst the industry employ profitering techniques, (like region encoding, meaning that to stay legal if you moved from the US to Europe you'd have to re-purshase your film collection), then the market will "correct" itself in this way. They also point out that it's hypocracy for the film industry to complain about copyright breaches when they well know that the reason that the industry is based on the west coast is that they moved out there so they could rip off early patents of cameras etc and be beyond the reach of the east coast law enforcers.
No, what interested me about the article was the few telling sentences and phrases that it contained, phrases like Acting on detailed information provided by the motion picture industry... let you know exactly who's pulling the government strings. But the most interesting phrase is ICE, the largest investigative arm of the Department of Homeland Security... Excuse me! Homeland Security? You're kidding right? Good to know all the tax dollars spent in the name of anti-terrorism and some of the draconian anti-terror laws are being put to good effect isn't it?
Contrary to what many believe, Longhorn won't be built on top of the .Net Framework, we hear. But that might not be a bad thing.
[Via Microsoft Watch from Mary Jo Foley]
Sounds like Microsoft has run into a brick wall, in terms of getting applications written to the .Net Framework 1.1 to work with .Net Framework 2.0, the forthcoming release of Microsoft's programming infrastructure.
[Via Microsoft Watch from Mary Jo Foley]
Here, in the Comments to a Dave Buck posting Darren Oakley sings the praises of statically typed languages such as C#. I wont waste time rebutting his assertion that ... that protection makes programming EASIER because your program works. First time and every time. You don't have to spend weeks debugging. because that's nonsense and anyone who's done any programming at all knows it's nonsense. But I will rebut his assertion that statically typed languages make life easier. If I want to print a set of invoices in Smalltalk I can write the following code...
#(Invoice1, Invoice2, Invoice3)
do: [ :invoive | invoice print]
To do the same thing in C# I have to write...
foreach(Invoice i in MyArrayListOfInvoices)
{
Invoice inv = i as Invoice;
Invoice.Print();
}
In the C# example I have to add the cast, an extra step which has no baring on the logical solution, it's just there to satisfy the compiler. How is that easier? It's not just when handling dynamic collections either, one of my all time favourite wastes of time, is having to cast the return from sql output parameters, (as in the code below), as the values are always of type object!
//...
try
{
cmd.Connection.Open();
cmd.ExecuteNonQuery();
_Id = (int)cmd.Parameters[0].Value;
_OLToken = (byte[])cmd.Parameters[1].Value;
}
The SQL Server timestamp data type is great for optimistic locking. A column with a data type of timstamp is automatically updated by SQL Server every time a row is added or updated, and the timestamp will be unique in the database. So, on an update all you need do is compare the timestamp in the object with that of the timestamp in the db row and if they're the same you can do the update and if not you can throw an optimistic locking error.
So far so good. When I use a data reader to fill my model object pool I can set the timestamp field in the object no problem using the the following code...
dm.OLToken = (Byte[])dr.GetSqlBinary(5);
But when I update the object I use an output parameter in the stored procedure to return the new timestamp value and assign it to the object, using the following code...
_OLToken = (byte[])cmd.Parameters[0].Value;
But the value of _OLToken is always zero after the assignment, and it's not the cast to byte[] that's doing it either as in the debugger cmd.Parameters[0].Value has a value of zero before the cast. Grrrr! So until I fix this problem, it looks like the users will be able to create an object and edit it once after that they will get optimistic locking errors as 0 != the timestamp value on the db. Jeez, do you think that will be a problem? :)
Update: It turns out that if I use an output parameter it always returns zero, but if I mark the parameter I use to send the original optimistic locking token to the update sp as being InputOutput, the exact same code works fine. So now I have my fix, though I'd be a lot happier if I understood why the output parameter doesn't work, so if anyone knows, put me out of my misery will you?
I took the family to see Star Wars Episode III last night and as I was watching the film I realised that my son is the same age watching the last, (to be made), film as I was when I saw the first one 28 years ago.
I'm using 2005 beta 2 for some live projects at work at the moment and I'm loving it. I especially love generic lists. It's great to have dynamic, type safe lists. Now if I want a list of Customer objects I can do the following...
List<Customer> CustomerList = new List<Customer>();
Customer c = new Customer(435, "John Brown Ltd.", "admin@johnbrown.com");
CustomerList.Add(c);
foreach(Customer c in CustomerList)
{
string emailAddressString = c.EmailAddress;
//... Do stuff with email address
}
Previously I would've had to have cast each of the objects as I popped them from the ArrayList or have written a special accessor to return a Customer[].
Finding Customers in the list is a lot easier now with anonymous methods. To find Customer by Id I just have to write...
public Customer GetCustomerById(string CustIdString)
{
return Customers.Find(delegate(Customer c)
{
return c.Id == CustIdString;
});
}
Let's say you want to lazily instantiate a list of Customers in your model. If you check for the list count being = 0, how do you know if this is the first time through the code, (i.e. requiring a trip to the database), or if you've already made a trip to the database, but there where no Customers available?
Well you can do it by making the List field = null and only setting it to be an instance of List when you've been through the code once. Like so...
private List<customer> _Customers = null;
public List<customer> Customers
{
get
{
if (null == _Customers)
{
_Customers = new List<customer>();
FillCustomerList();
}
return _Customers;
}
}
The current issue of the Times Educational Supplement is running an article in which they cite a report by the British Educational Communications and Technology Association telling primary and secondary schools in the UK to dump Microsoft Operating systems and products in order to save millions. In a report to be published next week, obtained by The TES, Becta will highlight schools which have turned to free software instead of the market leader's products. Becta does not name Microsoft in its analysis. But almost all schools use some of the company's products. Their conclusion? Schools running OSS are saving 24% on average per pc versus those running proprietary systems.
[Via Slashdot: ]
"With the recent success of movies incorporating mathematics, Dr. Jonathan Farley, a professor of mathematics at the State University of New York at Buffalo who is currently doing research at Harvard, tapped into his professional knowledge and headed west to Hollywood, where he and Dr. Elizabeth Burns, founded Hollywood Math and Science Consulting to help television and movie producers portray accurate mathematics on screen. Their first client: the CBS drama Numb3rs. 'In many cases, they want me to elaborate on some of the math already in the script,' said Farley. 'I help add dialogue and fine tune the math already in the script. It's not just about fixing mathematical mistakes . . . It's also about helping them get the culture right.'"
[Via Slashdot: ]
Microsoft unveiled on Wednesday a new business unit that it's calling IP Ventures. Its mission: To license to venture capitalists and start-up businesses various pieces of Microsoft-Research-developed technology.
[Via Microsoft Watch from Mary Jo Foley]
I'm surprised at Robert Scoble. In his blog today he talks about seeing two guys heading back to Iraq and the effect seeing their goodbyes had on him. What surprised me though was that a guy like Robert, that is so good at cutting through corporate BS and getting to the knub of the matter - seems to have totally swallowed the BS coming out of the US government.
Towards the end of the post he says I'll never forget the sacrifice that these guys are making on my behalf. My question to Robert is this, what do you mean by on your behalf? What exactly is it you think would happen to you if US troops were not in Iraq? What is it that these guys, and other guys like him, are saving you from? Surely someone as shrewd as Scoble can't still believe there's a connection between Iraq and 9/11.
Don't get me wrong here, I have relatives in the forces and they've seen service in Iraq and I have the deepest respect for what they are doing, but I'm under no illusions that they are there to protect me. I know - and they know - they are there, sacrificing themselves to further American imperialism nothing less. Surely you see that Robert?
|