|
|
Thursday, April 26, 2007 |
Two Point Oh
Posted: 4:18:00 PM
|
I've been working on a particular music website lately, rewriting it in a different language. The goal is to bring musicians back to a quality, feature-rich site.
No, I'm not working on Trax in Space 2.0, despite the rumors I'm sure are surfacing.
It is OSMusic.Net I am tuning up, moving it into ASP.Net. I haven't had a whole lot of success making a real website with ASP.Net yet, but I've got plenty of experience from working on .Net at work that makes me feel far more comfortable than I did about 6 months ago.
So what's the new OSMusic.Net going to feature? Lots of AJAX, if you can believe that. While I'm still dead set against the security that AJAX offers, I still believe that it can be useful for presentation, and I plan to put a lot into the presentation aspect of OSM. Microsoft has come out with a fairly polished set of AJAX controls for ASP.Net that are really easy to use, keeping ugly JavaScript out of my code. Granted, I'm still going to use it for things like localizing a user's time and removing dead links from a page, but that's nicely tucked away into its own file, and won't be changing from the ASP version to the ASP.Net version.
What else will be new? Well, I have some plans for some new features that will make the user experience more personable, including friends lists, favorite songs, and more. Also, the collaboration features I've been wanting to work on for so long will be added to this version. There will also be a new look, along with the possibility to easily change that look, should someone come with a design that looks better than designs I come up with.
Other projects... well, I'm just not up for coding much else lately. I put a lot of thought into Cent, but never go back to the code, partly because of the time it would take to set up a CrystalSpace environment on my main computer, and partly because of the fact it's in C++, which is a language that just doesn't excite me. Hopefully some day I'll get that drive back that I had going good for a while last year.Labels: Coding, OSMusic.Net
|
Broken Things
Posted: 4:11:00 PM
|
I have been quite annoyed over the past couple months with things that aren't working the way they should.
First is Kathy's computer. Mind you, the specs on her computer and mine are exactly the same. However, she's having serious issues. Firstly, her network card sometimes doesn't fire up with the computer, leaving her networkless until she shuts down and reboots. Second, she's got a KVM that doesn't seem to want to work with her new computer, causing the keyboard and mouse to not work, forcing a physical reboot of the machine. I could attribute these problems to Windows Vista, except my computer works just fine. The KVM could be the KVM itself, but Kathy's been unwilling to test it out. She lives with it, but if it were me, it would drive me straight up a wall.
Second is her monitor. I got her an LCD for her birthday in December. Now the red channel's gone. Apparently I'm going to have to send it in for a trade.
Lastly is my UPS. Yes, the big $1,000+ one that cost me $60 just to get it from the leasing office and into the apartment, the one that took me hours to install into the rack. Well, it doesn't work. That's right, I got a big, thousand dollar paper weight in the bottom of my rack. I haven't gone through all the troubleshooting I should with it, so I'm hoping that it's still salvagable. However, I'm not liking the idea that there is a strong possibility that I will need to return this UPS. It costs hundreds of dollars to ship, which is about how much it weighs, too. I'm not happy.
The rack is mostly done, but I just haven't had the energy to disassemble and reassemble the two Linux boxes and put them into the rack. That said, the rest of the rack is fine, and I'm quite happy with where the setup is going. There are still too many cables to worry about, but that comes with the territory of so many servers.Labels: Monitor, Servers, UPS
|
Monday, April 09, 2007 |
Extending ASP.Net Controls with Child Controls
Posted: 3:07:00 PM
|
If you've ever tried to extend an ASP.Net control that has child controls in a custom control sitting in your App_Code directory, then you know the frustration of the lack of Intellisense for those child controls. When you try to enter the correct control that should go inside your child control, you get an error saying "Element 'TableRow' is not a known element. This can occur if there is a compilation error in the Web site.
Of course, when you compile and view the page in your browser, everything is okay. What is making Visual Studio find these seemingly phantom errors?
The reason is because you are using different assemblies. When ASP.Net compiles your custom control in the App_Code directory, it puts it in its own assembly. This assembly, of course, is different from the assembly the child controls are in. Since you have not defined any child controls in your custom control, Intellisense has no idea that something can go inside that tag, and likewise the dynamic compiler will throw up errors.
You don't want to reinvent the wheel, however, by recreating those child elements. The solution? Inheritence.
Let's take an ASP Table control for example, since that's the one I've been working on for the past few days. What I wanted to do was to create a sort of wrapper around the table so that all my tables would have the same graphics without having to put the same code over and over in my .aspx files. I also added a title property, and thought about future development where I might want to create various themes for the site. This all can be done easily in a custom control.
Now, the basic child elements of the Table control are the TableRow and TableCell elements. In order to be able to use them, I must extend them in the same assembly as my Table control. Here's what I've done.
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Microsoft.VisualBasic
Namespace MyControls
Public Class MyTable
Inherits Table
Private strTitle As String
Public Property Title() As String
Get
Return strTitle
End Get
Set(ByVal value As String)
strTitle = value
End Set
End Property
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
'Do your custom writing here!
writer.Write(strTitle)
'Do your custom writing here!
MyBase.Render(writer)
'Do your custom writing here!
End Sub
End Class
Public Class MyTableRow
Inherits TableRow
End Class
Public Class MyTableCell
Inherits TableCell
End Class
End Namespace
Note that the classes for the child elements are otherwise empty. They simply inherit from the parent and that's it. Since the Table control is looking to have a TableRow inside of it, and MyTableRow inherits from TableRow, you can now use MyTableRow and Intellisense will pick it up. Same for MyTableCell. What's the .aspx look like? Load up a quick page, and put this after the Master, Page, or Control directive:
<%@ Register Namespace="MyControls" TagPrefix="mc" %>
After that, throw this anywhere in the body:
<mc:MyTable ID="tblTest" runat="server" Title="Testing MyTable" Width="100%">
<mc:MyTableRow BackColor="Yellow">
<mc:MyTableCell HorizontalAlign="Center">
This table is working!
</mc:MyTableCell>
</mc:MyTableRow>
</mc:MyTable>
You will notice that not only do you get Intellisense for the child elements and their attributes, you also get no more errors!Labels: ASP.Net, Child Controls, Coding, VB.NET
|
|