Category Archives: Computing

Looking back on 2016, and looking forward to 2017

I keep hearing about how awful 2016 was and how 2017 should hopefully be better. There were a lot of celebrity deaths in 2016, and I was devastated by the presidential election. More personally, I was laid off from Toshiba in a huge reduction-in-force, and my roommate had to put our two dogs to sleep. Yeah, there were negatives. And yet I’ll be lucky if 2017 lives up to 2016.

I traveled to Europe and saw eight countries with three of my closest friends, gem, Antonio, and Anela, and visited two great friends, Jessica and Andrew, who had recently moved to Paris. I saw Denmark, the UK (including England and Northern Ireland), the Republic of Ireland, the Netherlands, Belgium, France, Italy, and Sweden. It was amazing, and I swear I’ll get to sorting photos and blogging eventually.

I saw Disneyland Paris and our hometown Disneyland’s Season of the Force. I attended Devin and Lorena’s 30th wedding anniversary party that included a face-painted bar crawl and a 1920s speakeasy party. I saw Kristine’s first exhibit that she curated in LA – Firsts, Seconds and Thirds: African American Leaders in Los Angeles During the 1960s & 70s.

I watched Anela dance a few times, including Shimmy Shakedown featuring her and Melissa. I saw the Wet Silk art exhibit, met Jon Klassen at the LA Times Festival of Books, and watched an LA KISS Arena football game.

The Holi Festival was a colorful blast of fun. Here I am with gem, Tory, Sean, and Nicole. I also went to the Huntington Beach Cherry Blossom Festival!

I went to a number of photoshoots with Anela, including this Fourth of July shoot that I really enjoyed, a fairy photoshoot, cherry blossoms, and the Walt Disney Concert Hall and train tracks in LA where I also got to shoot gem!

I took a bunch of friends to the Alpaca Hacienda for Anela’s birthday, and we got to see feed and pet alpacas and a llama!

I watched Sherlock Holmes and the Time Portal as well as Sweeney Todd, and gem surprised me with tickets to see Patton Oswalt. I’d been wanting to see his stand-up for a long time, and he didn’t disappoint. I had the three most amazing meals of my life – two at Frame in Paris and one for Edward’s birthday at Alexander’s Steakhouse in Pasadena.

I participated in a high-altitude sleep and cognitive ability sleep study at Barcroft Station, White Mountain Research Center where I witnessed some of the most beautiful views of nature I’ve ever seen. I saw the B-52s and Flight of the Conchords live as well as a number of local ska bands that I see regularly. I went to Allison’s awesome gaybut party and finally made it to one of Bryan’s parties where I participated in some of the most stimulating conversation I’ve had in a while.

I cosplayed Luke while gem cosplayed Professor Layton at San Diego Comic-Con. I also cosplayed Fix-It Felix Jr., and a Pokemon Go trainer. I got to dress as a zombie later in the year as well! I attended the Sonic the Hedgehog 25th anniversary party and saw some improv such as Spectacles, ImprovCity, and more.

Two great friends, Gracie and Jon, got married, and I got to watch.

I worked for three months doing server and other hardware installation for California DMVs. While I was traveling across the state, I got to visit my friends Matt, Katie, and Marc. I also had the chance to have lunch with Chuck Sommerville, a game designer whom I’ve admired for a very long time. He’s incredibly fascinating and has done many interesting things, and he was every bit as nice as I could have hoped.

And I even got to meet Alex and Darnell’s beautiful new daughter, Meredith.

Now I’m sure I’m missing many awesome things about 2016, but that just proves my point. If 2017 is half as good to me as 2016 was, I’ll be very grateful. Happy New Year.

DMV server installation job and Nor Cal trip

I recently finished a temporary, contract job as a field technician for Form 10 installing computer hardware in California DMVs. Each day, two technicians would arrive at a DMV at 2:30 PM. We’d install new a new uninterruptible power supply and rack server, remove the old UPS and server, remove the old camera workstation, install and configure a new one, install new fingerprint readers at every window, and remove the old fingerprint readers. We’d leave whenever we were finished (usually between 7 and 10 PM), and then one of us would come the next morning to watch from 7:30 AM until 10:00 AM. And then we’d drive to the next DMV. As the team lead, I also had a bit of paperwork.

It was nice experience installation the rack servers. The hardest part was the physical act of getting it racked. It was also interesting seeing the DMV from the other side. DMVs have a reputation for being slow and boring, but in reality they’re staffed by normal people who are for the most part trying to help customers. And some of those customers are pretty bad.

The real difficulty of the job was the hours. Every other day I didn’t work until 2:30, which sounds good. However, when you consider that I’m in a different hotel each night, waking up, eating breakfast, working out, checking out by 11, and then driving to the next DMV by 2:30, there wasn’t much time for anything. There were tiny pockets of time. Maybe I could work out quickly enough, check out early, drive to the next DMV as soon as possible, and get there by 12:30 or 1. That gave me maybe two hours, but those free hours were in an unfamiliar place without any physical space for me to use. It was tough, especially being in Northern California or the Central Valley for a few weeks without being home.

Surprisingly I ran into three emergencies. First, one of the security staff members at one of the DMVs was taken away on a gurney. I don’t know what happened to her, but she was able to walk to the gurney herself. At another DMV, I heard a bit of a commotion between the staff and found out that an ambulance came for a woman who fell in the parking lot. It was raining hard that day, and I heard she fell unconscious. I don’t know if she slipped in the rain, hit her head, and was knocked unconscious or if she suddenly lost consciousness, causing her to fall. What I do know is that I saw security coning off a part of the walkway the had a puddle of blood. Apparently she broke her nose. Lastly, my partner and I witnessed a woman pulling away from a man, yelling things like, “get away from me” and “don’t touch me!” I got security, and my partner brought her inside while the man followed. It seemed to be a domestic dispute. Maybe she was overreacting and he wasn’t doing anything wrong. Maybe he was doing something wrong. I don’t know. But I do know that at the end of the day, she was okay, and that’s what matters. The police came and talked to both me and my partner, and they reviewed the security footage right next to me as I installed the server. It was an interesting day.

There was some chance for fun as well. I had some down time one day and decided to visit the local university, Stanislaus State.

I had never even heard of it, but I enjoy universities, and this one was certainly beautiful.

I also saw some cool wildlife. Yes, this photo is terrible. But there are wild turkey in the center!

And here’s a terrible photograph a baby deer! It’s right under the bush in the center at the top.

While in Sacramento, I had the chance to visit the Capitol Building.

I had to take a photograph with the bear! Former-governor Schwarzenegger bought this and left it in the Capitol Building.

I met an interesting woman with whom I went out twice while in Sacramento too. She teaches fifth graders, including many who have hearing impairments. She uses ASL in the classroom. I found it particularly interesting to realize she has to watch for children signing during tests as a way of cheating. She also plays roller derby in Sacramento, which is pretty sweet!

Chuck Sommerville, creator of Chip’s Challenge, lives near Sacramento. I asked him if he’d like to join a fan for lunch, and he agreed. It was awesome. Chip’s Challenge is one of my favorite games; I have an autographed copy of the original Lynx version. The lunch was a pretty amazing experience. He’s a bit of a personal hero of mine and has done a lot of cool things. He always has fascinating projects and shares progress on Facebook. Over lunch he told me a lot about the development of Chip’s Challenge, Chip’s Challenge 2, and Chuck’s Challenge 3D. I also heard about some more of my Lynx favorites like Klax, Todd’s Adventures in Slime World, Gates of Zendocon, and California Games (Chuck designed the skateboarding game). He also told me about John Romero (designer of Doom) and how they were both huge fans of each other’s work.

Chuck now works with LEDs. One installation of which he was particularly proud was the “Sensing YOU” installation in San Jose, which I had a chance to check out. It interacts with the phone game, Ingress, and responds to the motion of pedestrians passing under it. He actually got me playing Ingress now too. It’s a location-based game made by Niantic, the same developer who later made Pokemon Go. Ingress and Pokemon Go use the same underlying data.

Here’s a video of the installation that I took! I was with Matt and Katie, who I stayed with one weekend. They were very gracious to let me stay in their home and are truly terrific people. I had a wonderful time with them!

I’d never put up Christmas lights and enjoyed the opportunity to help them.

They looked great!

Matt has an arcade cabinet at home that his brother gave him as a gift. Here’s Matt and Katie playing Bomberman together. This photo makes me really happy honestly! They’re wonderful together, and I might have a soft spot for arcade cabinets too.

Visiting them was really fun. I got to see my friend Marc a couple nights that weekend as well. It’s practically unbelievable to me that I originally met these great friends through World of Warcraft!

That’s my trip! I got to add rack server installations to my resume, see all sorts of the more rural parts of California in which I had never stopped, visit Sacramento, and even meet Chuck Sommerville. It was a pretty good gig!

Dynamic CSS based on weather

Raymond Camden wrote a great tutorial on loading style sheets dynamically based on the user’s current weather. He poked fun at himself and the idea a bit at the beginning of his post, but I think it’s honestly a terrifically fun idea. As it’s beginning to get a bit colder as we enter the holiday season, it would be very… cozy… to have a site recognize the weather and respond with some cool blues and whites!

Will I get around to implementing something like this? Probably not. But I find it pretty interesting anyways!

Windows 8

Windows 8 Partner Box

Happy Windows 8 launch day! It’s nice that it’s finally here, but I suspect that we’ll have a lot of customer questions despite our preparations. The Windows 8 launch was one of a few causes of stress this week. Hopefully next week will be calmer.

For lunch today we went to P.F. Chang’s before heading over to the Microsoft Store. We wanted to play with Surface ourselves. The first thing I noticed was how nice the Microsoft Store itself was. It was bright, colorful, and very welcoming.

The Surface was fun to use, and the keyboard was interesting. There are two type of keyboards. The first is the Touch Cover. It’s a cover with a touch sensitive keyboard and touchpad. The keys don’t actually depress, but you can feel individual keys. It felt a little odd but worked well. The second keyboard is the Type Cover. It’s similar to the Touch Cover but has keys that actually depress. It’s like a laptop keyboard.

The Surface itself felt solidly built. Even the integrated kickstand felt secure and useful. I just wish the Surface Pro (with Windows 8 Pro rather than Windows RT) was available now rather than in three months. There hasn’t even been an announcement of the price!

There were no surprises relating to software. Windows 8 is, no surprise, the same Windows 8 that we’ve been using for a while now. There’s also no Windows 8 family pack or bundle, which is unfortunate. Most people probably have more than one computer. I have at least three that need to be upgraded. Of course, Windows 8 Pro is only $39.99, so I can’t really complain.

I’m pretty excited about Windows 8. It’s hard to predict how receptive the general population will be, but I suspect that after the initial fear of the unknown calms down, people will be fine with Windows 8. While I don’t use the “new interface” at all really, I’m frustrated using Windows 7 computers. I’m anxious to see what other Windows 8 devices are released, especially by Toshiba. We’ve already announced an ultra-book with a slide-out screen, converting between a tablet and laptop. It uses full Windows 8, not Windows RT. Microsoft is almost entirely pretending that the Surface Pro exists, which might be a strategy to keep its OEM partners happy. After unexpectedly entering the tablet market, by only providing a Windows RT tablet, they’re allowing OEMs (whether intentionally or not) to fill the hole with Windows 8 devices.

By the way, Microsoft gave everyone in Toshiba’s Digital Product Division a box like the one in the photograph. It contained a Windows 8 t-shirt, a stress cube, some stickers, a bag, and a pen! Sadly it didn’t contain any hardware or even a copy of Windows 8!

The Verge Reports on Toshiba’s Windows 8 Devices

Toshiba shows off first Windows 8 prototypes: convertibles, sliders, and tablets | The Verge
The Verge offers a nice little article on Toshiba’s new Windows 8 devices. These include a tablet that connects to a keyboard similar to the Asus Transformer as well as a tablet that slides open to reveal a keyboard. It can also slide up to look like a standard laptop.
I hope I get to beta test these.

History of Hard Drives

Timeline: 50 Years of Hard Drives | PCWorld

Over the past five decades, hard drives have come a long way. Travel through time with us as we chronicle 50 milestones in hard-drive development–from product firsts to new technologies, and everything in between.

Fascinating read about hard drive advances from 1956 to 2006. It was brought to my attention by a forum member who worked for them back at the beginning!


Dear Internet,
Last night there was a power outage. When I started my computer today, my HDD was making bad clicking noises. I wanted to confirm that it was the HDD and not the DVD burner, so I hit eject on my drive. The DVD that was in there was covered in some kind of goop. It looked like honey but smelled like nothing. The computer itself doesn’t have anything on it. Still, it seems like something must have dripped into the drive, but I’m not sure how it made it into the drive without me noticing anything on the outside of the drive or on my case itself. Anyways, I removed my DVD drive for now, and then started the computer again.
Yep, the HDD is still making bad sounds.
Your friend,

Why I Hate Computers

(Last updated at on 10/5/09 at 10:51 PM. Jump to latest update.)
I just noticed that the “computing” category on WebPageless is just computer errors. This probably isn’t that interesting to anyone else, but I found that keeping track of PC errors and how I go about fixing them is helpful to me. Maybe someone Googling will find it useful too, or even better, maybe someone I know will be able to help me.
In a previous post I detailed how my computer was unable to play World of Warcraft. It would freeze while logging in after picking a character. Sadly, I never updated how I fixed it, and the problem is happening again.
More specifically, the problem never went away. Yeah, World of Warcraft would work, but when ever I rebooted, WoW would have the same problem. I could fix it by using System Restore to restore to a previous restore point. Not most recent restore point would not necessarily fix the problem. I would just keep restoring older and older restore points until the game worked. Unfortunately, none of the restore points I have fixed the problem after this last time.

Of course, this doesn’t really address the problem at all. What’s causing it? I don’t know. I do know, however, that a while ago I saw newer video drivers in Windows Update, but applying the update would cause this exact problem. How did I fix that? I used System Restore and never applied Windows Updates again. The strange thing is, despite disabling Automatic Windows Updates, I still see Windows Updates restore points in System Restore. Apparently, Windows Update is still running. I think what’s happening is that those video drivers, for what ever reason, are breaking World of Warcraft, and somehow they’re being applied every so often. Rebooting my computer allows them to finish installation. At least, this is my current theory.
Where do I stand now? I don’t really know. To be complete, let me talk about my computer here:

  • Windows Vista Business 64-bit, Service Pack 1, completely legal and verified
  • Intel Core 2 Duo E7200 @ 2.5 GHz
  • MSI P45 Neo-F mainboard
  • 4.00 GB of RAM
  • nVidia GeForce 8800 GT, drivers version 180.48 (7.15.0011.8048)
  • Rosewill 802.11b/g PCI

I bolded the most likely problem. After using the automatic scanning tool on nVidia’s site, they say my latest driver should be GeForce/ION Release 191, Version 191.07, from October 5, 2009. Hey, that’s today! I wonder if nVidia has got things together enough to make one that works now. I found an interesting article on engadget from March, 2008 saying that nearly 30% of Vista crashes were caused by nVidia in 2007, which makes it the most common cause. That is a rather old article as far as software is concerned, but assuming it’s accurate, does show that there have been problems with Vista and nVidia.
Update at 10/5/09, 2:48 PM
I played Team Fortress 2 for about 5 minutes, and there were no problems. I just made a restore point, so now I’ll update my nVidia drivers and see what happens.
Update at 10/5/09, 3:11 PM
I updated the nVidia drivers to 191.07. We’ll see how this goes!
Update at 10/5/09, 3:24 PM
World of Warcraft is working again! It looks like nVidia got some working drivers up finally!
Update at 10/5/09, 9:07 PM
After I found that World of Warcraft was working, I played for about an hour and then set a restore point in case anything went wrong in the future. A few hours later I rebooted, and now WoW has the same problem. I restored to that point that I had just made (that should have been working), and that didn’t fix it. I tried reinstalling the 191.07 drivers because it worked right after I installed those last time. Didn’t help. Now I’m going to restore the restore point I made this afternoon right before updating the drivers for the first time.
Update at 10/5/09, 10:51 PM
I restored that restore point, and WoW still crashed. I then installed the 191.07 drivers, and WoW still crashed. Now I’m going to try doing all the updates in Windows Update.
Last Update
Those updates fixed it! I’m still not rebooting after getting it working, because who knows how that’ll leave my computer. I’m glad Windows Update is finally fixing problems rather than causing problems.

Crappy Computer: Take 3

Latest update: 12/23/08, 9:39 PM
A couple months ago after finally realizing that it was a BIOS issue that kept me from booting, I installed Windows XP 64-bit because my nice, legal copy of Vista Business 64-bit wouldn’t work. A month later, I had to reformat. I put the same OS on again. That was about a month ago. This weekend, I reformatted again and put Vista Business 64-bit on my PC thanks to Antonio lending me a DVD. It installed without a hitch! Then, I tried to figure out Steam. I ended up just shoving my entire Steam folder in a new directory other than Program Files (x86). I realize that applications can’t save in Program Files now. However, I tried installing Steam in Vista and then observing where it puts stuff before copying my old Steam files into the correct location, but I couldn’t figure it out. Anyways, leaving it in some other folder seemed good enough.
However, World of Warcraft randomly crashes. I haven’t really tried any other games for more than a minute or two. Here’s what’s going on: If I launch Wrath off of my internal HDD, it crashes either right after getting in game or during the loading screen after choosing my character. If I run it off of my external, I can usually play for a few minutes, but it’ll still crash. When it crashes, everything freezes, including my speakers playing the last quarter-second or so of audio repeatedly. I’m using the latest graphic card drviers, 180.48. Vista is completely up to date. I download the latest drivers for my wireless card and motherboard also.
This is my system:

  • MSI P45 Neo-F motherboard with up to date drivers
  • Intel Core 2 Duo Wolfdale 2.53 GHz
  • 4 GB of OCZ Platinum DDR2 1066 RAM
  • PNY GeForce 8800 GT PCI Express 2.0 x16 with 180.48 drivers (latest)
  • Rosewill 802.11b/g PCI card with up to date drivers
  • Vista Business 64-bit,up to date
  • DirectX 10

I found this thread talking about WoW crashing in Vista. I followed the advice of changing my graphics card’s 3D settings from maximum quality to maximum performance. I then ran it from my internal disk, and it crashed while loading my character. I’m reinstalling my graphics drivers now. I’m going to continue to update this post as a personal log so I can keep track of what’s happening.
Update: Reinstalling video card drivers didn’t work. I have a couple options. I can try installing older video card drivers or trying to go to DirectX 9. Using DirectX 9 would kind of annoy me though. DirectX 10 is one of the few things Vista has going for it.
Update at 5:52 PM: Installed the latest nVidia beta drivers, 181.00. Same problem when running World of Warcraft from the internal.
Update at 5:57 PM: Disabling all add-ons does not help!
Update at 6:23 PM: I wanted to try DirectX 9c, but Microsoft’s site won’t let you choose old versions. I found it easily on another site. I downloaded AVG Free because I wanted to scan it first. AVG stopping during install to tell me that my copy of Vista wasn’t up to date. I was missing the KB929547 patch. I checked Windows Update again, but it said I was completely up to date. I clicked check again, and my PC froze. This is the first time it’s frozen outside of a game. Here’s the description of the patch according to Microsoft: “Install this update to resolve an issue where after installing the Windows Filtering Platform (WFP) driver, applications and services appear to stop responding for approximately 15 seconds.” That doesn’t really sound like my problem because my computer stays frozen. I’ll try getting it anyways.
Update at 10:44 PM: I went back to Windows Update, but it still said I had everything completely up to date. I told to check again, and after it checked a couple times, it found more updates. Weird. I updated a whole bunch. Same problem.
Update at 11:52 PM: I found out that DirectX 9 won’t work in Vista, so there’s no need for me to worry about trying that. I tried running WoW as an administrator, but it still crashed. My account is an administrator already, but I think in Vista you have to run applications as administrator to use those privileges. I’m not positive though. I also tried running it in XP SP 2 compatibility mode. That didn’t work either. I still need to try both together, but I doubt that’ll yield better results. Also, I need to turn UAC off to see if that helps. Another thing to consider is that I changed the compatibility of and tried running as administrator Launcher.exe, which launches wow.exe. I don’t know if the compatibility option or “run as administrator” settings carry over to an .exe launched by the original .exe. I guess I need to look into that too! At least I have this log to keep my thoughts coherent.
Update at 12/23/08, 9:39 PM: I realized that I hadn’t tried any games other than World of Warcraft yet. I didn’t really think that mattered since I froze outside of WoW while checking for updates with Windows Update. I ran Left 4 Dead and played a full level with everything on high settings. It ran really well! Then I tried WoW again. I ran the copy stored on my internal drive, and for the first time ever, I got into the game! I noticed that my add-ons were all off and wondered if that’s what was causing the problems before. However, I was pretty sure they were off because the last thing I tried last night was turning them off. Anyways, I logged out, turned my add-ons back on, and tried to log in again. It froze! I found the problem, right? Wrong! I rebooted, turned them all off, and it froze again trying to login. I’m not really sure what’s wrong! It makes me want to play more Xbox!

New Computer

I bought a new computer. The parts came in Monday, but it’s not working yet. Whenever I install the video drivers and reboot, Windows hangs while loading. I have to use Last Known Good Configuration to get it to boot again. I’ve tried a bunch of different drivers, and none works. I think the video card could be bad. Sometimes when I boot, I don’t get any video output. I have to unplug the power from the video card and reseat it. Nine times out of ten that doesn’t fix it though. At this point I can’t tell if it really does fix it the other time or if it’s just me trying repeatedly. I get beep codes on boot too but haven’t looked into them too much.
I was also wondering if it was an issue with everything being 64-bit. Despite everything supposedly being compatible, I know 64-bit is relatively new. On top of that, Vista 64-bit is more supported than XP 64-bit. The drivers are for XP x64, but I thought I’d try XP 32-bit or Vista 64-bit.
My only XP CD was old and bad so I asked Collin to burn my legitimate XP Pro with SP2. He said it asked him if he wanted to correct the size of the burn because the disc size was unequal to the image size. He apparently said no to this. The disc didn’t work. It couldn’t find a file on the disc. I burned the same image on gem’s computer and got the same error when I attempted to use it, but the burn also failed verification. Some people on forums had the same error because their discs or drives were dirty, but my drive is brand new and seems to work otherwise (it installed XP x64) and the discs look good.
Next I downloaded Vista Business 64-bit and burned it. It didn’t pass verification either and won’t work at all. No computer can even recognize it.
Eventually, I’ll get another OS on there with which to test the card. If it works, then I know it’s a software issue. If it doesn’t work, it’s most likely a hardware issue and I’ll try the card in another computer. My hardware is after the break.
MSI P45 Neo-F motherboard for LGA 775 Quad-core / Core 2 Extreme / Core 2 Duo / Pentium CPUs. FSB 1600/1333 MHz. Intel P45 north bridge and Intel ICH10 south bridge. 4x240pin DDR2 1066 slots (max 16 GB). 1 PCI Express 2.0×16 slot, 2 PCI Express x1 slots, 3 PCI slots. 6 3 Gb/s SATA connections. 8 channel Realtek ALC888 audio. Gigabit LAN. 2 PS/2, 1 COM, 1 LPT, 4 USB 2 rear ports. 4 onboard USB.
Intel Core 2 Duo E7200 Wolfdale CPU Dual-Core at 2.53 GHz and 1066 MHz FSM. 3 MB L2 cache, 64 bit support.
4 GB (2x2GB sticks) OCZ Platinum 240pin DDR2 1066 memory. 5-5-5-18 timing.
PNY GeForce 8800 GT at 600 MHz. PCI Express 2.0×16. 512 MB of video memory at 1800 MHz. DirectX 10 compatible. 2 DVI ports and s-video out. Max res 2560×1600.
750 GB Samsung SATA 3.0 GB/s HDD (7200 rpm)
550 watt Antec power supply
Rosewill 802.11b/g wifi card.
Windows XP Professional x64 installed.

C# Attributes, Using statement, and Properties

More adventures in C#!
There are a few new concepts I learned recently while working. As the title of this entry suggests, they are attributes, the using statement, and properties. While all three were new to me, they’re very logical (as one would expect with anything dealing with programming).
Attributes allow you to assign metadata to your code. An attribute goes directly before the data it describes. It’s encased in square brackets and is of the form Key(Value). For instance, if I want to describe who wrote a particular class and when, I could put // Peter Anargirou, 7/9/2008. However, that isn’t very structured. Instead I could put [Author(“Peter Anargirou”),Date(“7/9/2008”)] directly preceding the class declarations. Attributes can be programmatically referenced by the program in which they exist, making them very useful for code reflection.
The using statement is also very interesting. It’s of the format using ( object declarations here ) { …code…}. Anything declared in the using declaration is deallocated at the end of the using block. For example, you can open a file in the using declaration and not have to worry about closing it. When execution leaves the using block, the file is closed automatically. It’s similar to a try/catch/finally.
Lastly, properties are something new I recently discovered. They’re similar to accessor methods in other languages. Normally, if I have an int that I want to be able to access from outside the class it’s in, MyClass, I make it public. If I do that, then I might accidentally overwrite it when I that’s not what I intend to do. Also, there’s no way to check what I’m doing with it. For instance, I might not want it to store a value of 0, but with a public int, I have no way of enforcing that. Instead, I could make a private int and have accessor methods. I might have private int count, public int getCount(), and public void updateCount(int newCount). This is definitely the preferred way of doing things, but now when I want to retrieve the count from outside, I always have to say MyClass myClass = new MyClass(); int x = myClass.getCount();. To update the count, I have to use myClass.updateCount(42);. With properties, you can create accessor methods that invoke automatically while you treat the property like a public variable. For example, I now write

private int myCount;
public int count
get { return myCount; }
set { if ( value != 0) myCount = value; }

Now from outside I can simply write x = myClass.count to retrieve the value and myClass.count = 42 to update the value. Of course, it’s also checking that I’m not updating with 0. If I try to update with 0, it won’t actually update myCount. It’s clean and simple yet still provides the more complex checking that can be done with accessor methods. Very handy!

HTML Form Combo Box

I found an interesting article on how to create a Combo Box in DHTML. Form controls are definitely in need of the combo box, but I’m not so sure this does the job all that well.
A combo box is a drop down select list that can also allow the user to input his or her own strings. The author of the article builds one in DHTML by first placing a select list on the page and then placing a textbox on top of it using CSS. He then causes the dropdown list to make a Javascript function call, causing the textbox to update with the value of the list’s selection. It’s interesting in concept, but you can tell something strange is happening. Looking at the page, you can tell there’s a rendering error (in this case not an error) and that there are controls stacked on top of each other.

Getting Vertical Scroll Position in a Div to Persist Across Postbacks

I’ve been working on this for a little bit now, and it was surprisingly easy. I just didn’t know all of the syntax.
First, any element in a webpage that scrolls has a scrollTop attribute that’s equal to the number of pixels it has been scrolled. When it’s scrolled all the way to the top, scrollTop is zero.
To cause this to persist, you can store it in a hidden input.
<input type=”hidden” name=”whatever” id=”whatever” value=”default” runat=”server”>
Name and id should be equal, and making sure runat=”server” is present is important. Now this should persist automatically. The only other thing that’s needed is to store and restore the value. You can use an onscroll=”nameOfJavascriptFunctionThatStoresThePosition()” attribute in the div in question to call a function whenever the div is scrolled. Then in your Javascript section, set window.onload equal to whatever function is going to restore it. Parentheses aren’t needed at the end because you’re mapping onload to a function.
The last thing to remember is that in your storing and restoring functions, you can’t simply refer to the id of the hidden input because your codebehind might, and most likely will, change it. You’d have to use <%=idOfInput.ClientID%>. You can use document.getElementById(‘ blah ‘).value, where blah is that previous tag. To restore the value that value should be set into the div’s scrollTop (again, you can use document.getElementById(), but you won’t need to do ClientID stuff because the div’s not runat=”server”. To store the value, you just set the scrollTop into that hidden input using that same method. Pretty simple!
Of course, if you’re not concerned with a div but rather the whole document, you can do a similar thing using body’s scrollTop or just enable SmartNavigation if the page is being designed for InternetExplorer.