Peter F. Hamilton answers questions from fans
Did I mention I love how this guy writes?
Did I mention I love how this guy writes?
As you may have noticed, I am now working on a new interface for communicating with my blog reader. It features the old Plugoo chat, a whiteboard like interface and a public chat along with administrative news. In the future I will probably also Google Wave.
When you want to enumerate through the items in a Resource class, you find that its ResourceManager class doesn't have a method for it, only GetString or GetObject for when you know the key. The solution to get all of the items in a Resource class comes with the GetResourceSet method of the ResourceManager, which returns an IEnumerable class, but not a collection. The enumerator can be of different types, but by default it is a HashTable, therefore the items the enumerator returns are of the type of DictionaryEntry.var resourceSet = ResourceClass.ResourceManager.GetResourceSet(CultureInfo.CurrentCulture, false, true);
foreach (DictionaryEntry resource in resourceSet)
{
DoSomethingWith(resource.Key, resource.Value);
}
I had this situation where in Internet Explorer, in quirks mode, I would open a dropdown calendar (so showing an absolutely positioned element that was until then hidden) and the scrollHeight of the entire page would increase by a magical 19px. if (!elem.parent().is('body')) $('body').prepend(elem); Notice my use of prepend instead of append. 
It has been a while since I've posted an entry about TED. In case you don't know what it is, go to ted.com and marvel of the interesting things one can find there. Well, in this post I am going to post two talks about the Internet. One talks about how concepts that would never have worked in real life have caught on in cyberspace (see Wikipedia, where people add information voluntarily, without any remuneration) and the second is about how the Internet can be used by totalitarian(?) states to oppress, rather than being a magic tool that spwens democracy. My comments are at the end of the post.
I have to say that Jonathan Zittrain's talk made me immediately think of Fidonet. Long before there was the ubiquitous Internet, amateurs would host Bulletin Board Systems where people could connect and send/read mail, download files and engage in social activities. Actually, one could think even further back, to pirate radio stations, that people would run on their own money (and seldom their own risk) without any chance of a profit.
So yes, given a method of reducing the cost of help significantly, I think a vast majority of people would help others without considering it a bother. However, to adapt the theory that any altruistic person is helping others because of personal reasons, therefore it is a form of egotism, I think a better way of putting it is: given a method of reducing the cost of coagulating in a group, people will enlarge their concept of clan and start doing stuff they would do for themselves for a lot more people.
That brings me to the second talk, Evgeni Morozov's,that would have been a lot more powerful if the guy would have stopped a few times to take a breath, right? :) He talks about the ease of using the Internet to determine the network structure of groups of people (clans again) and then striking where it is most effective with minimal cost to the establishment. There are mathematical algorithms that can do this automatically, just give them a graph of people and they will determine the leaders of opinion, the hubs of information. Then you can either persuade or remove them, giving you the power to control their entire "flock", just like pruning a bonsai tree to make it look like you want it to. And I think this system is a lot more used in democracies, rather than in totalitarian regimes, for the simple reason that despots have other options.
Both ideas seem to have a point in common, in my view, that in any strongly connected group of people leaders will naturally emerge , without any other reason than that they feel good about it, and stear a lot of passive people, whether in opinion or action. In an ideal situation, where all connections between people would be transparent (and I imagine Google is not far from having this kind of information), the entire humanity could be reduced to an active minority and an inertial mass of people.
This is interesting as a case study, because I am talking of an elite group of people, and not one that is organized, but one that is emerging naturally from chaotic personal behaviour. Something like Asimov's psychohistory could use that, with the axioms slightly modified to talk about "active population" as opposed to total population.
I was using these GIF images stored as embedded resources and suddenly I got an Out of memory exception from a component that I had no control over. All images were icon size, 16x16 or a little more, so a lot of the explanations for the error based on "you don't have enough memory!" (duh!) were not helpful. The images did have transparent pixels, and my gut feeling is that it all came from there.image = image.GetThumbnailImage(image.Width, image.Height, null, IntPtr.Zero);I know it's not something very intuitive, but it solved the problem.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
My world view is limited by the data that comes to me. I have my tiny slice of reality, a few friends, my work, then there are movies, news, documentaries, the Internet and so on. You will notice that I placed them in a certain order, it is the order that to me seems to go from more bullshit and less information to more information. I never believed the expression "Truth is stranger than fiction", so lets set the slice of reality aside. And, being first on my list... full of bullshit :)
It started with a simple request for a custom control to perform some validation. Seems easy enough, but it is not. Sure, there is an easy solution and that is to create a composite control, containing the original control and a normal validator, but that means you don't inherit from either control and you have to copy all the properties and methods you are interested in. If, as I did, you do not like this solution, you will soon find out that there are a lots of obstacles to be conquered if you want all the features of a validator, the first of which being that a control cannot easily change the Controls collection of its parent. It would be bad design. Therefore simply adding a Validator from inside the control does not work.Notice anything? There is no mention of IValidator, instead only BaseValidators are sought and the reason the IValidator approach works at all is the line before last where a validator is added to the list if the validationGroup parameter is empty. That is, it will work with IValidators but only on Buttons or other postback controls that have an empty ValidationGroup.
public ValidatorCollection GetValidators(string validationGroup)
{
if (validationGroup == null)
{
validationGroup = string.Empty;
}
ValidatorCollection validators = new ValidatorCollection();
if (this._validators != null)
{
for (int i = 0; i < this.Validators.Count; i++)
{
BaseValidator validator = this.Validators[i] as BaseValidator;
if (validator != null)
{
if (string.Compare(validator.ValidationGroup,
validationGroup, StringComparison.Ordinal) == 0)
{
validators.Add(validator);
}
}
else if (validationGroup.Length == 0)
{
validators.Add(this.Validators[i]);
}
}
}
return validators;
}
Ugh! The fifth book of the Revelation Space series , The Prefect, is the worst so far. Not only is it standalone, but it is also a prequel, something that happends pre-plague. All the characters seem to have been lobotomized some time in the past (possibly in an operation that also mixed their brains around so that they all sound and act the same), including the bad guys, and the story is completely boring. Nothing in this novel makes any sense, nor does it make you feel anything special, quite the contrary, the scenes that were supposed to bring out feelings for the reader felt really forced and had the opposite effect.
It is weird that this doesn't happen with all types of Visual Studio projects, but only with Web apps. You have all those annoying .MySCMServerInfo files that pop-up in your check-in window and then cause errors because SCM knows they should not be checked in.
I didn't know about this, however, through a weird series of events, I have read about this in a book, then heard about it from a friend, then wiki'ed it and got really disgusted, then found it in the news, as the UK government finally issued an apology to one of the great men of computing.
Here is the government apology link and (apparently, the apology was too much for the Brits to leave on their web site for too long. Instead, you have to read the text from the historical archives of the government site here) another link from a blog I am reading which says just about what I was going to say.
I have to say that governments scare the shit out of me. The things they can do are so horrendous that most people refuse to think about it. And as the sleep of reason produces monsters, they usually become monstrous. After all, what are they than a big clump of responsability that every citizen sheds in order to feel good about doing nothing?
So, sorry, Alan Turing, for being part of the species that did this to you! I truly feel ashamed.
Update 24 December 2013: The UK government issued a pardon for Alan Turing. Posthumous, a gesture that would be rather pointless if it weren't for the chronic inability of authority to admit to their mistakes (not to mention actually pay for them).
We all know that dogs are smart. They understand verbal commands and can make complex decisions in new situations. However, they can't speak. Well, there are some weird rare cases of dogs sort of snarling "mama", but it's not real speach.
Today I've updated my computer with the latest patches from Microsoft and then, starting a project, I noticed that it didn't look right in Internet Explorer 8. For example a table with an empty td of width 1px looked as if having 4px. Setting it to 2px or above made it look of having 2px or whatever value I had chosen. I have solved the situation by adding content to the td in question (a simple ), but before today I have not had this problem.
You may get an error of the form Cannot add content of type 'System.Windows.Style' to an object of type 'System.Windows.ResourceDictionary' when working with WPF and your first reaction would be "What?! Why not!?". Well, the issue is very simple, only it stems from another source entirely: you've just tried to add a Style with the same key as another previously entered style.
First time I've ever heard of cymatics and I am intrigued. basically you use some (physical) devices to visualize soundwaves. Here is a small TED presentation about it: