Ramblings of a NNW mind
Only the 65 most recent posts are available here. If you want to see more, head on over to the main LiveJournal feed.
August 29th 2010
23:10
50 First Lines
Music: VNV Nation - Saviour (Vox)
July 13th 2010
12:08
I Write Like...
Win.
Music: My Dying Bride - To Remain Tombless
February 25th 2010
16:17
Things I miss...
You know, I think what I miss about working with C is that you can do things like:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
unsigned int my_int = 0x8080;
unsigned char* my_byte1 = (unsigned char*)&my_int;
unsigned char* my_byte2 = (unsigned char*)&my_int + 1;
printf("&my_int = %p\n", &my_int);
printf("&my_byte1 = %p\n", my_byte1);
printf("&my_byte2 = %p\n", my_byte2);
printf("my_int = %d\n", my_int); // 32796
printf("my_byte1 = %d\n", *my_byte1); // 128
printf("my_byte2 = %d\n", *my_byte2); // 128
unsigned int result = *my_byte1 + *my_byte2;
printf("result = %d\n", result); // 256
exit(EXIT_SUCCESS);
}
I miss C's somewhat flexible approach to types.
Music: Bertrand De Billy, Birgid Steinberger, Heidi Brunner, Jeffrey Francis, Kwangchul Youn, Maurizio Mura
November 8th 2009
08:15
Games For Windows Live Subscription Annoyance
So, I'm trying to get my X-Box Live subscription renewed (well, it's actually Games For Windows Live, but you know), however I have a slight issue:
- It won't let me redeem a code to renew my subscription because I have a payment method in decline.
- The payment method is in decline because the card it's trying to use no longer exists.
- It won't let me remove the card because it's configured to use it to auto-renew.
- It won't let me change auto-renew to redeem a code because the payment method is in decline...
Oh and I can't e-mail them to bitch about this because it would be an account query and I have to phone them. People who know me will know how well I get along with phoning people.
Microsoft, you excel at fucking up.
Music: Me First and the Gimme Gimmes - My Boyfriend's Back
September 24th 2009
14:37
Abstract and generic base forms in Visual Studio.
OK, the inability of Visual Studio's form designer to deal with abstract base forms is a known thing and there is a work around involving TypeDescriptionProvider. However what I currently want to do is have an abstract base form that is also generic; there doesn't seem to be a work around for this.
This is highly annoying because it makes designing child forms really awkward and right now would involve more effort than I can actually be bothered to make. I mean I could make the problem go away by doing it wrong and using "object", instead of using generics to make it all lovely and verifiable at compile/development time, but damn it, using generics is the right way to do it.
The main reason this fucking annoys me so much is Microsoft actually know about the damn problem. It's been there since at least Visual Studio 2003 .NET (in the abstract form, the generic problem is obviously not in 2003), as far as I know and it's still there in Visual Studio 2010. The bug is, if you report it, just closed as "won't fix" with fluff about concentrating on security related bugs. Well fuck that, I want the designer to work properly with perfectly valid fucking code.
The code produced, if you do go to the trouble of manually writing the code to populate the derived form with your controls, works fine. It's just the form designer can't handle it because of the way it uses reflection to create an instance of the base class and then calls the InitializeComponent() method to actually fill it. That, I suspect, is why Microsoft won't fix it. It would involve a complete change in the way that the form designer functions. At least that's my supposition.
Music: Wendy Carlos - Brandenburg Concerto #4 in G Major: I-Allegro
August 12th 2009
13:53
.NET Annoyances
From the MSDN docs on the "DefaultValuesNeeded" event in DataGridView:
In data bound mode [...] When the user enters the row for new records, a new row is created in the data source before the DefaultValuesNeeded event occurs. When you populate the DataGridViewRowEventArgs.Row property in your event handler, the values are added directly to the data source.
If you're me this means you assume that DataGridViewRowEventArgs.Row.DataBoundIt
June 10th 2009
08:54
Idle updates
Working from home today and Thursday, instead of Thursday and Friday, because of the industrial action on the tube. Part of me wishes they could make it a 72 hour strike, just so my Friday routine isn't getting screwed up.
Or I would be if I could actually VPN in to the office; the DSL line the VPN is forwarded on seems to be foobar again. Although I can use GoToMyPC to get in to my workstation, it can't open any connections outbound. Don't seem to be able to get in to the router's web interface either, which isn't helpful. I need a body in the office to reset it.
Music: Placebo - Johnny and Mary
June 9th 2009
13:02
Reflection Voodoo
I wrote this method to get round having to do app.Run(scriptName, Type.Empty, Type.Empty, Type.Empty, Type.Empty, Type.Empty, Type.Empty, Type.Empty...) with "Type.Empty" in upto 30 times.
( Reflection Voodoo )And I have since fixed some of the edge case issues (like what happens if you pass more than 30 optional parameters).
June 5th 2009
14:43
Maldon Election Results
| Candidate | Political Party | Votes Received | % | Elected? | Majority |
|---|---|---|---|---|---|
| Channer, Penny | Conservative | 2359 | 41.63 | Yes | 1179 |
| Mead, Brian Harold | Independent | 1180 | 20.83 | No | N/A |
| Crowther, Christopher John | Liberal Democrat | 621 | 10.96 | No | N/A |
| Carden, Janet Marilyn | Green Party | 600 | 10.59 | No | N/A |
| Bentley, Michael John Charles | Labour | 515 | 9.09 | No | N/A |
| Blain, Len | British National Party | 391 | 6.9 | No | N/A |
I'm quite happy with that result. And for those of you who don't know, that's me in third place.
Music: Harry Christophers, The Sixteen & The Symphony of Harmony and Invention - The Complete Funeral Music
June 4th 2009
12:11
Unhelpful Exceptions...
Method 'get_DbConnection' in type 'RHD.Database.DatabaseObjects.PackageBou nd.Course'
from assembly 'RHD.Database.DatabaseObjects, Version=2.0.1.1, Culture=neutral, PublicKeyToken=null'
does not have an implementation.
The main reason this exception is unhelpful is because there is an implementation for get_DbConnection (as you might have guessed from the name, it's actually the magic property method for the getter) in the ActiveRecord class, but for some reason it can't see this.
I suspect this might be something to do with Course being derived from BaseCourse, which is an abstract class derived from ActiveRecord, itself an abstract. BaseCourse also implements ICourse.
ActiveRecord is doing a partial implementation of IActiveRecord; it's implementing the dirty flag and db connection properties. The commit and delete methods are implemented as abstract and left for child classes to implement.
Solved: OK, apparently it was to do with platforms. For some reason my soltuion had reverted to building for "Any CPU" rather than "x86" (I'm on a 64-bit system, so often building for "Any CPU" won't work, becuase of assembly foobar).
Design & Original Content © Copyright 2005 - 2007 Chris Crowther. All Rights Reserved.

