Work and Play

Wednesday, December 28, 2005

Gone In 60 Seconds

Awesome movie, I highly recommend it (the most recent one with Nicolas Cage) :). However, don't get the director's cut. I watched this last night, and it sucks. They replaced a couple of good scenes with mediocre ones, changed some dialog for the worse, and added bits of conversation that served no purpose but to prolong the movie. I didn't catch the end, but I'm hoping they didn't mess that up too.
That's about all that's new in my world :).

Monday, December 26, 2005

Linuxant!

Well, that was fun :). This is my first post from Linux. I was finally able to get my wireless lan card up and running. It will cost me $20, but I suppose that's more worth it than dragging cable up here from two floors below, or continuing to throw money M$'s way. Linuxant is an awesome tool for wireless drivers in Linux. It was able to use my windows driver, no problems. I tried a couple of free/open-source programs first, but they did not work :(. Given more time I probably could have made them work, but for now I'd rather spend my time using Linux. Anything else I might have put the time into, but an internet problem is 10x worse because whenever you run into a roadblock it's reboot into Windows to get online.

Wednesday, December 21, 2005

Windows is dead...

and so is Linux :P. Let's just say you shouldn't look for me online for while unless I hit a stroke of luck. My Linux install died halfway in, and somehow took Windows with it :(. I'm on my parents' computer now, trying to re-download and burn the install CD. Hopefully the corrupt file was due to the CD I used, and not the ISO itself, or this party will get a lot more fun real fast!

Update: Luckily, it was just the CD that was bad. I downloaded and burned another copy and it went in fine. Unfortunately, I'm still posting this off WinXP because I need to find out how to get my wireless lan card to work in Linux :). But at least it's there. Thanks Monti, for the tip - Ubuntu is much easier than Gentoo to start with :-D.

Tuesday, December 20, 2005

More Fun With Dynamic Controls

I thought I was done with this, but apparently not :). I decided (after my earlier post) not to dynamically load user controls on the project I'm working on, simply because it's almost complete and it will take too much time to tear them apart and put them on dynamically. Unfortunately, the only way I was able to correct the callbac lifecycle problem was by creating a flag, and only processing the prerender method on a callback after the callback event had been handled.

Anyhow, here was the situation today: my dynamically stored server controls were not always being loaded correctly at postback. I was doing testing today to make sure all of the components were working when I found this error. In addition, this was on a page which was not using callbacks, just standard ASP.NET 1.1 controls.
After some fun debugging, I found that the dynamic control had good values in it after the load method completed, but it was reverted to bad values again at PreRender. Part of the problem here is that I'm developing a wizard-style app, so on a postback I need to load the old control, populate the values, and then load the new control. Depending on which page is using this user control, the reload can be either the same information or a completely different control.
My first impression was to make sure I load the data first thing on PreRender. However, that is a very easy rule to forget, and difficult to debug later on if/when we reuse this user control. Next idea was just to create an event, so that when the control contains the postback data the event is fired and anyone who needs that data can handle it.
The event is what I went with, but unfortunately it was tricky. The event would have to be created after Load has completed (unfortunately overriding OnLoad or LoadViewState after they have processed events does not work). I had to implement IPostBackDataHandler and use RaisePostBackDataChangedEvent to be able to fire my event at the correct time. To get this to work you need to use Page.RegisterRequiresPostBack(this); in your OnInit. Too bad this project isn't in 2.0 - the extra events supplied by the page would have been very useful in handling this situation.

Friday, December 16, 2005

Goblet of Fire

I got around to seeing the newest Harry Potter movie, finally :). It was awesome and disappointing at the same time. The disappointing part first - it was very rushed and impossible to follow without reading the book. Luckily I have read it, but many people (or at least many I know) have not. I think this spoiled it in a way, as the 4th book really picks up the pace for the series. For those who have read the book though, you could follow it and the visuals were awesome. As usual, they had to modify some things to fit them in, but this seemed to be done very well after the first portion of the movie.
I'm not much of a movie reviewer, so that's all I have to say :). If you've read the book, go see the movie! If not, I don't recommend going to see this until you catch up. (At about 730 pages, you better start reading now if you want to see it in the theaters!)

Dynamic Controls, Lifecycle, and AJAX

Well, today turned out to be a fun day too :). For some reason, I haven't found the need to dynamically add controls to a page very often - but I certainly did today.
Using web custom controls and server controls built into .NET, this is a lot easier than I had thought it would be. So long as you recreate the control no later than the Page.Load event, it will participate in viewstate and postback events. I had a small hurdle to get around, in that each pageload I needed to get the new value and then replace the control, but no big deal. I originally thought I'd have to manually fetch the data from Request, so this made me happy.
However, dynamically loading User Controls is not quite as fun if you don't know how. Having never done this before at all, I thought I could instantiate the class and be done with it. Oops! I didn't entirely forget that the ascx side of the page is built into a class inheriting from the ascx.cs file, I was just hoping the environment could figure it out. It can, but you need to give some hints - before adding the control, you need to place the <%@ Reference Control = "MyUserControl.ascx" %> directive in the design side, and use the Page.LoadControl("MyUserControl"); method before adding it to a container code-side. I didn't get a chance to play with this too much - the reference I found showed using this method only on the first load, but I'm hoping it needs to be done whenever you want to see the control - I don't want it in the page on every load or I wouldn't be adding it dynamically.
The last bit of fun - and the one I left off on, is AJAX. We have the Teleric r.a.d. controls suite, so I have been making use of their callback controls - having developed callback functionality before, I really appreciate that these work just by drag and drop, no other wiring needed. However, many of my callbacks have begun to misbehave. Some just don't update the appropriate controls anymore, even though I haven't changed those files in a while. Others make the page lifecycle all whacky (I get two PreRender events, then my Click callback trigger event, then another PreRender event). This means that the PreRender wipes out the information I needed to get on callback. This problem is what led to the UserControl bit above - the project I'm working on has many nested UserControls, I'm hoping that if I dynamically load only the needed ones then any conflicts causing the weird callback behavior will be resolved.

Thursday, December 15, 2005

Random Question

Wish they limited the text entry of the random question to 150 characters, I found out after I wrote a book :-P. Nothing earth shattering, but I figured since I already bothered to type it all out I'll be darned if I don't post the full answer.
You're trapped in a well with a goat and a slinky. Describe how you will escape.
Sharpen the end of the slinky on the side of the well. (This better be a metal slinky or I'll be eating goat steaks and shouting myself hoarse for help). Shear off the goat's hair and braid a rope. This rope with miraculously be long enough to escape, strong enough to support me carrying the poor naked creature, and catch on something outside the well so I can climb out.

Jumping on the Bandwagon...

Well, it took me long enough :). Not sure if I'll end up doing this for long, or even if anyone will read it, but hey. Since my personal life is boring, most stuff here will probably be problems I've dealt with at work. Most of those will probably have pretty obvious solutions because my mind was toast :-P. Hopefully some things may actually be helpful to other people though.

Microsoft problem of the day was source control with Visual Studio 2003 :). It suddenly decided to have anmesia about one of my projects, even though the other 6 in the solution were working fine. To fix it, I ended up having to...
  1. Stop IIS
  2. Delete the project folder
  3. Delete WINDOWS\Microsoft.NET\...\Temporary ASP.NET Files
  4. Delete [User Profile Folder]\VSWebCache
  5. Delete the virtual directory in IIS
  6. Start IIS
  7. Start VS and download the project from source control - still gives errors here
  8. Close the solution
  9. Restart IIS
  10. Open the solution, click past about 5 warnings, and it works again
Ick! And why did this happen? Who knows! Just hope it doesn't happen often.

(I know I'm using the term CSS somewhat incorrectly here, but it's easier than saying "non-table layout" throughout.)
Design problem of the day (and week, month, year) is CSS. I've been doing a lot of reading over the last few years about CSS layout, but have always stuck to nested tables for the need to do things quickly. However, CSS Zen Garden has sold me on CSS- especially because we're facing a project where many clients use the same site with different skins. However, it looks like we're still using nested tables, and using .NET 2.0 themes to handle the visuals instead :(. Themes are a very nice addition, I'll admit, but I really like how clean the source of a page looks using CSS.
I would definitely like to use themes with CSS to make the site work very well, but unfortunately I don't have the CSS experience yet to make a valid argument, and we are fighting a deadline. This is actually one of my reasons for starting a blog; I hope to design my own site for it without tables (for layout) to get some general experience.
The other side effect of using nested tables for layout is that it makes it much harder to use CSS layout components. I've had to make a few user controls this week, and I've had to wrap them all in tables because of display issues when I only had a div container. I can't seem to find information on exactly why, but floating divs did not play well with either firefox or IE and I had to float a table instead - which still doesn't display correctly in firefox, but luckily this particular component is only used in house where I know IE will be used.

Lastly, I'm finally venturing again into open-source software territory. Since my computer is not being used for gaming much anymore, I've decided to dual-boot with Linux and WinXP. I still need to keep WinXP for VS.NET and gaming, otherwise I'd ditch it completely (I've gotten a little fed up having had to call to re-activate two computers this week because of minor hardware changes). I have already switched to Firefox, and am using OpenOffice since I refuse to pay a couple hundred for another copy of MS Office (my mom needs my copy). I haven't used it much yet, but Open Office looks very promising, and works with MS Office files.

Let me say now that I doubt I will ever have another post this big :). I've had a lot on my mind that I wanted to jot down, but didn't get around to doing it until tonight.