Wednesday, January 30, 2008

Some Sharepoint Stuff

In my real job, I do a bit of Sharepoint support, not much development, so I don't really get to work with the dotNet side of things.

I do get to work with the database, which gives quite a bit of insight on how Sharepoint works internally.

One of the things stored in the Sharepoint database is the individual settings for each webpart.

Now, our client has a Sharepoint based site, with some custom dotNet stuff thrown into the defaut.aspx of the template's web Homepage. This Homepage really gives us headaches because some users have the ability to close webparts. This could be easily fixed by getting into the Modify view, but something with the additional code prevents Modify view from working.

What happens is when you place the web in Modify mode, the browser gets stuck and stops responding, and CPU usage goes up. I've debugged it and partially traced it to an infinite loop in the resize functions in Sharepoint's Javascript code.

I'm not too eager just yet to go messing around with the dotNet code, as some loaded controls might be involved in messing up the page's DOM heirarchy or something that could cause an infinite loop.

To restore the missing webpart, we have a backup default.aspx of the vanilla Sharepoint web Hompage which we use to temporarily replace the dotNet-messed-up one.

With the vanilla page in place we can safely call Modify mode and restore the webpart.

Now I was asked how we could prevent users from closing the webpart accidentally, and one of the things that came up was to disable the close button. This can only be done in Modify mode, which requires the vanilla page, which requires that no one is using the site, which can only be done during non-business hours.

With a global user base, and a shift nearly opposite to the business users, the window where we can use the vanilla page to do our stuff is only 2-3 hours. Coupled with the fact that there are hundreds of sites to change, it begins to be impractical.

So with some determination I set out to find where Sharepoint stored the settings for webparts, and the field tp_AllUsersProperties seemed to invite further investigation. It's an image field, used to store an arbitrarily large binary value. Here is what I have so far:

"Header" - Always present: Doesn't seem to change
0105 0000 0002 2A00 4A00 2900 033D 0000 022A 0049 0029 0003 3E00 0001

"Separator" - Seems to separate entities
0F01

"Close Disabled" - Present if "Allow Close" is unchecked.
15 0029 0003 4800

"Zone Change Disabled" - Present if "Allow Zone Change" is unchecked

2B 0029 0003 4800

"Minimise Disabled" - Present if "Allow Minimise" is unchecked.

16 0029 0003 4800

Description - Text
02 0029 0003 FFFF nn

nn is the length of the text in bytes, no null termination

Detail Link - URL
1A 0029 0003 FFFF nn

nn is the length of the text in bytes, no null termination

Help Link - URL
1B 0029 0003 FFFF nn

nn is the length of the text in bytes, no null termination

Icon (Small) - Image URL
1F 0029 0003 FFFF nn

nn is the length of the text in bytes, no null termination

Missing Assembly - Text
27 0029 0003 FFFF nn

nn is the length of the text in bytes, no null termination

Icon (Large) - Image URL
20 0029 0003 FFFF nn

nn is the length of the text in bytes, no null termination


"EOF" - Always appears at the end

0F0F

It only seems to encode the Advanced Settings.

If it is null, default settings are used when in Modify mode.

If no text entities are defined, there must be at least one text entity before the EOF marker. The entity can be any text entity such as Detail but it should be truncated as:

1A 0029 00

each entity is followed by the separator, unless it is the last entity, where is will be followed by the EOF marker.

If entities have an identifier (first byte), a robust parser should be able to read the entities even if they were written in any order, unless it expects an order in which they are written.

nn is only a byte wide so the maximum number of characters in the text entities is 255.

Having incorrect values results in an error with Sharepoint not being able to "serialize" the webpart.

I have no idea what the recurring values "0029 0003 FFFF" mean. Changing them results in the same error as above.

I haven't tried this on another Sharepoint, or across multiple sites.

You should join tp_PagerUrlId to the Docs table in order to find the page that the webpart is on.

tp_WebPartId ias actually a GUID of a hash of the webpart name. See about that here.

As we are looking to eliminate the ability to Modify I've since moved on to more simpler Javascript to hide the webparts Modify buttons.

Anyway, I hope this is useful to somebody.

Wednesday, January 23, 2008

PSP-Dev Woes

Today was by far the most painless install of the psp toolchain I ever did. While this is only the second time, and I hope I won't have to do it again soon, I did learn a few things along the way.

The first thing I did was to jot down exactly how I installed the toolchain and what problems popped up, so I wouldn't have to rely on my now-rusty memory.

It helped bucket loads that I was using Dan Peori's toolchain/library installers. It took a while but when everything was done, most of the source code I had on me was compiling without a glitch.

I wasn't supposed to go back to trying to code for the PSP. I wanted very much to give up on it, since I couldn't think of anything useful to begin to write and start learning that PSPDEV-lore. Everything about programming for the PSP seems so complicated and it's hard to get your hands on some easy-to-understand documentation.

I was also beaten to the Multi-Update folder idea, something that allows you to switch the contents of your update folder, as only one update folder is allowed on your PSP.

A tower defense game has already been made. It would be nice to make one with nice graphics though. At this point it thinking about developing for the PSP brings me back to SDL, as there is a port available for the PSP, it would be so much easier to develop on the PC, work out the main bugs, then port it to the PSP.

Maybe I should go back to square one, write a bouncing ball app, and move on from there.

Monday, January 14, 2008

A Sense of Accomplishment

I've been missing a sense of accomplishment that comes with the things I used to do. Things I rarely get to do now, because of work and the fact that I dont own all my time (i.e. have a girlfriend).

Sometimes I really miss doing things what others might consider wasting time, things like sketching landscapes and mecha and anime girls (usually in skimpy outfits), playing a musical instrument like a guitar or a piano, finishing an RPG, putting together electronic gadgets out of spare parts, writing semi-useless programs that have no real use beyond the esoteric, writing stories from imagination, reading countless books all day.

When it comes down to it, these things don't really mean anything to anyone in the long run and in the context of the real world can be dropped in favor of something more productive, like coding for profit, watching the news, or heck, catching up on sleep.

I guess I had a lot of time to do those things and I got used to doing them, and now I'm out of my comfort zone I'm just having to adjust all my priorities.

And sometimes I find I've replaced those things with something similar, but not exactly the same, like blogging, and reading articles and blogs.

Maybe it's all part of growing up, and sacrificing time for yourself for time for others.

Maybe I have a lot to look forward to, when I'm sixty, then my own family can let me have my own time in my "lab" with all those gutted electronic parts and half-assembled computers and books and magazines.

For now though, it's an accomplshment enough to get work done and come back home.

Tuesday, January 8, 2008

Igor, it's ALIVE!

As you know, I've been having problems reading my old backup DVDs with my Samsung DVD-writer (model SH-S182M)

This morning I tried a firmware update, first, using the same fimware version as it currently had (SB04). When that didn't work, I tried the latest version SB05.

After flashing the utility rebooted my computer, and I popped in a backup DVD expecting nothing, as usual, when all of a sudden XP's autoplay feature kicked in and scanned the DVD.

I must admit I am a bit skeptical, only time and a few reboots will tell.

Meanwhile, I greedily grab all my porn backups just in case it stops working soon...

Friday, January 4, 2008

New-Computer Woes

I've had my new PC for almost a month now, and for the most part, it's not had any problems. I say for the most part, because there were some issues I had with it.

The motherboard, an ASUS P5B-MX WiFI Solo AP sports 4 SATA ports and 1 IDE port. As I was upgrading everything besides the drives, this proved to be an almost fatal mistake. I had a 80GB, a 160GB and a DVD-ROM that were all IDE. One of these drives would be left out.

My first thought was to go USB and buy an enclosure, but I didn't really think that the transfer speeds would be up to par, and another plug on my power strip and wires running to my PC wasn't going to make that corner of my room any prettier.

Instead of buying a new SATA drive and saving myself a headache I stubbornly decided to try the roundabout, unorthodox, alternative way, using a SATA-to-IDE converter.






I knew my chances of finding one were slim as these devices weren't exactly regularly-used items, but I was loath to buy a new hard disk.

After asking around several computer stores in the Megamall area with no luck, I asked my uncle who happened to know someone who sold the very device I was looking for. Hindsight, I should have taken his advice and sold him the 160GB so my losses in buying a new SATA drive would be minimized but I still thought I could save more money with the converter.

The first unit I recieved was a dud. It failed to detect any of the drives. I had it replaced and the new one finally worked.

It wasn't without fault, it failed to detect either the 160GB or the DVD-ROM. There were no instructions with the device. It only detected my 80GB (single partition, jumpers set to Master) which was fine with me, as I could now use all my drives at the same time. My 80GB hosted my OS, but it posed no problem as the BIOS allowed booting from any drive.

Just to satiate my curiosity, I ran Nero's Disc Speed test to see if the SATA-IDE converter made things worse. Although I didn't have a proper control for the results, it was just as fast as the 160GB on the IDE.

With the IDE connected to the 160GB and the DVD-ROM, and my PC booting from the SATA-IDE connection, I mopped my brow of sweat and thought - problem solved!

No such luck.

This time, the problem came from the DVD-ROM. Up until I got the SATA-IDE converter, I was forced to switch between the DVD-ROM and the hard disk manually, shutting down every time I needed a file from one or the other media.

I recall having used the DVD-ROM to install most of the software on my PC with no problems. Now it was acting up and refusing to read most of my backup DVDs! CDs seemed to work fine, as did pirated DVDs such as containing the entire fourth season of the series 24.

Just my backup DVDs that contained my PC installers, PSP games and girl-on-girl porn collection was unreadable! I kept getting an error: "incorrect function" when trying to read my backups. I managed to get it working sometimes, but only if I did the following:

  1. Remove the hard disk from the IDE. DVD is the only device on it.

  2. Boot into Windows. Run Doug Knox's XP CD fix. This removes filters that CD-burning software may have installed and left when uninstalled.

  3. Reboot. Make sure desired DVD-R is already inside the DVD-ROM.

Windows then detects the DVD-R and can read it in explorer. However, opening and closing the tray caused the problem to re-appear.

I tried a System Restore and a new install of Windows XP but neither was able to get my drive working the way it used to.

Strangely enough, when I boot into DOS via UBCD, it can read the DVD backups just fine. The only problem is the DVD is flaky when it comes to booting. So booting into UBCD is a hit-and-miss affair. It has been this way since I got it, so maybe the DVD hardware really does have a problem.

Maybe I should just get a new SATA DVD-ROM save myself a headache.