Jane's Technical Stuff

Tuesday, July 26, 2005

C# Homework - Brighton Bloggers list - Part 1


This evening I've been experimenting with some C# stuff at home. The project I've set myself is to read an xml file into a grid, handle updates and write out both an xml file and a html sample which can then be fed into the Brighton Bloggers list page (at the moment it is updated by hand in HTML whenever there is a change). I could have done the development in my usual home time tool choice of PHP and mySQL, but this seems to be a better way of furthering my C#/.NET knowledge.

Thus far I've created a sample XML file, and have got that being read into a datagrid (with help from MSDN) and can make changes to the data and get it to be written (again with help from MSDN). I've also sorted the datagrid into alphabetical order (based on blog name).

Tasks remaining:
1) Write out an alphabetically ordered HTML list (using appropriate Brighton Bloggers styles) for all the active blogs in the list
2) Add a check to go off and verify all the blogs in the list, and ensure that a response is found

Labels: ,

// posted by Jane @ 7:58 PM   save to del.icio.us

Comments:

Monday, July 25, 2005

C# and handling a COM event


Another new thing to work out - how to handle events raised by COM DLLs. This page at msdn contained the start of the answer (or at least the code samples), but it took quite a bit of experimentation to make it work with my COM DLL (written in Delphi - not sure if that confuses matters at all).

To make it work I had to:
a) create a class level version of the COM component i.e. EventTest1.clsMainClass evt = new EventTest1.clsMainClass();
[Note: example is a VB test event that I've created just to check the logic]
b) set up the event handlers, I found that if I started off with typing the object name, i.e. evt, then on typing . the intellisense would offer me the events as well, and if I selected one of those and type += then the rest of the information was available through intellisense (got to live intellisense)
i.e.
evt.OnComplete += new EventTest1.__clsMain_OnCompleteEventHandler(OnComplete);
evt.OnStart += new EventTest1.__clsMain_OnStartEventHandler(OnStart);

c) create the event handler
i.e.
void OnStart(ref string text)
{
MessageBox.Show (text);
}

void OnComplete(ref string text)
{
MessageBox.Show (text);
}

And that is it, simple really...

Labels: ,

// posted by Jane @ 10:27 AM   save to del.icio.us

Comments:

Friday, July 22, 2005

C# - Using Objects in ListBoxes/ComboBoxes


As I become more "object oriented" in my development approach (I've done VB for too long) I was struggling to get ComboBoxes and ListBoxes to accept and display an object appropriately rather than just populating the list with a string, and then using an index or string lookup to find the appropriate item.

The other day I had a sniff around the internet and thought that the Format event might help, and today I managed to get it to work.

If I have a combobox called myList, and I've assigned a Person object to it as
myList.Items.Add(person). I then need to register the event Format as:

private void myList_Format(object sender, ListControlConvertEventArgs e)
{
e.value = ((Person)e.ListItem).Surname;
}

myList will then be populate with the Surname of the Person, but the myList.SelectedItem will hold the object currently selected.

Labels: ,

// posted by Jane @ 1:56 PM   save to del.icio.us

Comments:

Thursday, July 21, 2005

Free Apress ebooks


I've just been told that Apress have started offering some of their books in pdf format, and that for a limited time they can be downloaded free of charge.

The items on offer are:
Writing Perl Modules for CPAN,
Programming VB.NET: A Guide for Experienced Programmers,
Programmers Introduction To PHP4,
Dissecting a C# Application,
COM and .NET Interoperability

Note: Source code etc can be downloaded from Apress

Labels:

// posted by Jane @ 11:44 AM   save to del.icio.us

Comments:

Wednesday, July 20, 2005

User Interface experiments


Cayne mentioned dontclick.it a week or two ago, and I've just had the opportunity to take a look at it, and interact with it. I quite like it as an alternative interface (maybe it has potential for rsi sufferers) but I'm so used to clicking now that it would take me a while to get used to it in more than a demo. I find it quite elegant, and some of the site design concepts are lovely - choose Communicate, The Links and use the circular menu navigation.

Another interesting interface is Fold n Drop which Richard pointed me at.

A couple of interesting interface design concepts.

Labels:

// posted by Jane @ 7:57 PM   save to del.icio.us

Comments:

NDoc with Beta 2


I've been struggling to get NDoc to work properly with Beta 2 code this afternoon. I followed the instructions on the NDoc wiki to get it to be able to open the .exe, but then couldn't seem to get much further for a while. After a few failed attempts I've set my Beta 2 project to publish XML documentation, rebuilt my solution and configured NDoc to look at that XML file through the SlashDoc setting. All is now working happily, and the output produced is very smart indeed.

Labels:

// posted by Jane @ 2:03 PM   save to del.icio.us

Comments:

.Net, C# and form inheritance


I've recently had my first opportunity to dabble with c# and .Net 2005 beta 2 and have had my first occasion to inherit from a form. I had a base form which requests certain information from the user. I needed a similar form, with an additional prompt.

The obvious choice was to inherit from the base form. I tried doing this only to discover that all the controls were locked and I couldn't rearrange the form to add my new parameter in a more obvious location. This seemed like a ridiculous limitation and it took a bit of googling, but eventually we found the answer, set the controls in the base form to have a Modifier value of protected or public. This does the trick!

Labels: ,

// posted by Jane @ 12:16 PM   save to del.icio.us

Comments:

Thursday, July 14, 2005

SQL Server Log truncation


One of our customers has been having disk spaces issues, this has not been helped by the fact that they have a large SQL Server 2000 log file for one of our databases. I couldn't work out why it was so large, as our automated backup should truncate the log files on a daily basis. What I didn't know was that once a log file has disk space allocated to it, it doesn't give it back - instead you must run DBCC SHRINKFILE(databasename_log, 2). The customer had run without backups working for several weeks, and so consequently the log file had grown quite large, and a larger than necessary amount of disk space had been allocated.

Labels: ,

// posted by Jane @ 12:44 PM   save to del.icio.us

Comments:

Monday, July 11, 2005

Good Software Writing


Some new books arrived at the house today, one of them The Best Software Writing I makes really easy reading, and reaffirms just how important good writing/communication skills are.

Labels:

// posted by Jane @ 10:32 PM   save to del.icio.us

Comments:

Brighton Bloggers   This page is powered by Blogger. Isn't yours?   rss Sussex Digital - focusing on the Sussex digital community