Next generation's garbage RSS 2.0
# Monday, November 12, 2007

Trying to weed out blogs that I shouldn't bother with. If you wanna survive my brutal weeding process, make your blog titles clever but meaningful. That is, make it so I can sucessfully predict what your blarticle will be about but keep it so I want to read it from just the title.

Monday, November 12, 2007 12:13:52 AM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -

# Sunday, November 11, 2007

Well, it's been a week with the iPhone. It really is pretty nice. I ended up with it primarily because for a smart phone it was the cheapest to run. AT&T would have charged my wife an I almost $200/mo to run a pair of Tilts or other WM6 based phones, but a pair of iPhones is just over $100/mo.

The iPhone is a first class phone. Way more than I can say for anything I've seen built on Windows Mobile. No WM phone I've seen passes the pocket test. The iPhone is surprisingly thin and small. It is very pocket compatible. The WiFi and EDGE web browsing/emailing is super addictive. I almost look forward to standing in line somewhere so I can catch up on stuff. I crave riding the bus so I can surf. I had started to neglect my email -- just never time to catch up, but I'm now jumping when my iPhone chimes. Maybe this will all wear off, but I don't think so. I find myself choosing to surf from my iPhone even when my laptop is right there next to it.

The big things that suck are:

  • no copy/paste -- this really sucks.
  • tethering (PC data connect through iPhone) costs extra -- I wish that I could EDGE connect via Bluetooth even at a throttled speed or limited amount. You can get a plan that includes this but it's pretty expensive.

Other annoyances include:

  • should be able to sync via Bluetooth (I couldn't get this to work)
  • more support for other video formats both synced and online
  • I wish I could speed control playback
  • The camera is pretty bad -- it doesn't have video either
  • The clock & weather apps should have been combined.
  • There needs to be a better todo list thingy than 'notes'.

I don't really care that there is no IM support - It just seems like a rude technology.

Overall, I recommend it highly.

Sunday, November 11, 2007 1:14:50 AM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -

# Saturday, November 10, 2007

Everyone knows exception handling is relatively expensive, but it is important to keep in mind where the cost lies. It is primarily in the throw action. The price of a try is nearly zero when no exceptions occur.

In the IL instruction stream the only difference between a wrapped block of code and plain is a LEAVE instruction that jumps around the catch block. The method has an exception table that marks the region of code protected. What happens when we actually time the difference? The result is extremely small -- and strangely enough, try/catch in the loop is slightly faster for C#! Because the numbers we are dealing with are so small, however, I would suggest that this is coincidental noise due to instruction alignment or something like that. I would guess that the cost of try is essentially crushed out by the JIT compiler optimizer.

The real expensive operation is throwing exceptions. How expensive? My tests show it's about 36 microseconds each. Slow by comparison, but maybe not as slow as you thought. As expected VB's exception handling was a little bit slower (~1%), due no doubt to SetProjectError calls that are inserted before throws/rethrows.

I always had an assumption that THROW (rethrow) was cheaper than THROW ex or THROW NEW. I reasoned that the stackframe would not have to be gathered during rethrow. Timing it shows rethrow is slightly slower.

I learned you have to be pretty careful about timing code. For example, a significant amount of time is burned JITing when a function is hit the first time, and that first exceptions are really expensive. Firsts should be burned off before timing begins.

Try out the code attached and post your results and please give environment.

Here's my numbers on a Dell Latitude D830 1.7GHz 64-bit laptop w/ 4GB RAM.

>CSharp.exe 10000000000 100000
trycount=10,000,000,000, throwcount=100,000
Loop without try/catch: 31132 milliseconds
Loop with try/catch: 21251 milliseconds
difference: -9881 milliseconds
throw new with 5 throw ex: 21448 milliseconds
throw new with 5 rethrows: 21370 milliseconds
difference: 78 milliseconds

>VB.exe 10000000000 100000
trycount=10,000,000,000, throwcount=100,000
Loop without try/catch: 23361 milliseconds
Loop with try/catch: 30739 milliseconds
difference: 7378 milliseconds
throw new with 5 throw ex: 21617 milliseconds
throw new with 5 rethrows: 21845 milliseconds
difference: -228 milliseconds

Attached: TestExceptionHandlingInLoop.rar (12.5 KB)
Saturday, November 10, 2007 1:59:25 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
.NET Internals
# Sunday, November 04, 2007

blogging from my iPhone

Sunday, November 04, 2007 11:15:53 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [1] -

# Friday, November 02, 2007

Scenario: You just made a nice DVWP and you exported it and mounted it on another page and kaboom -- FAIL.

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.

Whoops. Different site. Even though the DVWP references the list by GUID, it doesn't work cross-site. Here's how to fix that.

Leave the broken DVWP where it is. Add another DVWP on the same page, in the Data Source Library, click "Connect to another library..." and point it at the site where the data came from. You should now be able to expand the lists/libraries and insert that. Now, just grab the stuff inside <SharePointWebControls:SPDataSource> and copy that over the broken one's data source. Throw away the temporary web part and you should be good to go.

Friday, November 02, 2007 11:03:22 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
SharePoint

I thought I saw Heather Solomon blog about how to do this, but I couldn't find it to reference here. Anyway, I wasn't really excited about the way she described, so I tried something else.

The problem is that SPD doesn't want you to customize a publishing page. You can detach it from the page layout, but that's kinda lame.

Try this instead:

  1. Make a copy of the page where you want a custom DVWP added.
  2. Detach the copy from the page layout
  3. Edit that page in SPD.
  4. Add and customize a DVWP.
  5. You might have to add DVWP to the webpart gallery - go to root admin, web parts, add.
  6. Now, export that DVWP which you can do from the browser.
  7. Upload it to the webpart gallery
  8. Mount it on the page you started with; the one that is still attached to the page layout.

Edit: You can short cut that a bit - after export, just go to the advanced toolpane, and import from there.

Friday, November 02, 2007 4:39:05 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
SharePoint

Yes, yes, I hear you anti-table zealots, but this is cool. (I'll have to blog my thoughts about this someday, along with the other religious argument about nothing but stored procedures accessible to code.)

Scenario: You have a table that will have n columns, where n is determined at run time and you want the columns to have equal width, for example, a table that is 100px wide with 4 columns should render 25px wide columns, 5 wide, 20px.

Why is this useful? SharePoint or ASP.NET SitePath menus.

Here's how:

table tr td { width:5%; }

When the table renders and sums up the 5%s and gets only 20 or 25% total, it scales that up to be 100% and the cell width percentage scales up with it.

see it at http://hafthor.com/equalwidthtables.html

I haven't tested this non-quirks mode, but it does work in FireFox and IE7.

[Edit 2007-11-04] I have tested this in xhtml strict mode (IE7 and FireFox) - it still works.

see it at http://hafthor.com/tricks.html

[Edit 2007-11-05] Dang. FireFox doesn't render this the way I wanted when in xhtml strict mode. The issue wasn't apparent until the overall width wasn't really wide. But, I tried those pages on iPhone Safari and they looked okay.

Friday, November 02, 2007 2:30:28 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
HTML | SharePoint
# Wednesday, October 31, 2007

I had a goal to get MCPD by the end of this month. I knew it was going to be tough given I had a 40hr/wk job to go to, but since my wife+baby where going to be out of town for a couple of weeks, I thought that this would be the ideal time block to get this done.

Two weeks ago I booked an exam time for today and bought the MCPD Training Kit from Borders and started reading. I was studying for the 70-551 which is the upgrade from MCAD to MCPD WebDev exam, but the kit is for the three individual exams that actually make up the 70-551.

It was a stretch, but I managed to read all three books cover to cover; well, sort of. I skipped the reviews and exercises. I also installed the training programs and went through the entire lesson review quiz type dealie. Last night I was going to go through that again and I thought to try the 'certification mode' on the training program. I didn't bother before because I thought it was the same stuff, just timed and only 45 random questions, and I thought it better to be thorough. Well, no, the questions were completely different. Some seemed to ask about stuff I never heard of. Panic. I stayed up nearly all night to race through the random certification mode a couple of times and find what they were talking about a study for it. Had I seen this the day before, I would have rescheduled the test for sure. I found out today that you can customize certmode to show everything like lesson review mode. (I thought selecting the customize tab was taking me back to the lesson review content.)

Anyway, I managed to get pretty comfy with the MCTS content, but just didn't have much time spent with the MPCD part. It was also the case that I rushed the MCPD content during the main study, as it was the last book and I basically read it Sunday afternoon to evening.

Result? FAIL! 4 hours gone.

Yep, I failed, but just barely. Apparently, the 70-551 is independently scored in three sections. You're given over an hour for each section and they are timed independently, but fail any section and you fail the whole thing. In trying to read the sheet with bars on it for the individual sections, it looks like I got 3 wrong out of 30 on the 70-528 part, 3 out of 28 wrong on the 70-536 but I must have gotten 10 wrong out of 30 on the 70-547 part since my score was 670. Ouch. Dang. Had I just gotten one more right, I would have squeaked by. Glad I registered for the free "second shot". What's odd is that in flipping through the 70-547 book, little in it looked familiar, as in, I don't remember that stuff on the test. There was several completely novel bits on the test, like how to use SetAccessRuleProtection. Stuff I searched the book for but didn't find. I might stumble upon it if I run the certmode a few more times. Another oddity is that the bar for the 70-547 looks more like 730 - yes, I measured it.

For those of you thinking about taking any of these tests, I would still say don't wuss out and shape test your way through it, but make sure you try the custom 'certification mode' before you take your test!

This is not the same experience that I had with the older MCAD related ones. They matched up pretty good with the topics discussed in the MCSD/MCAD training kit.

By the way, the comment period, where you can give feedback about questions, is 15 minutes total for all three sections -- and it takes about three minutes to advance to the next section. It said it would pause the timer between sections, but I'm not so sure. I didn't get a chance to comment any of the last section. Twice during the 70-547 part, advancing to the next question took a minute; literally 60 seconds. I should get a freebie question for that. :)

Anyway, I will spend my free retake soon.

Wednesday, October 31, 2007 8:08:41 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
Certification
# Saturday, October 20, 2007

Wow. Take a look at PhotoSynth [http://labs.live.com/photosynth] – Imagine if this was taken worldwide. I'm imagining an image-based positioning – your pictures could get automatically geo-tagged and if they were in a public collection you could find other images of that location. Virtual Earth integration… I wonder how related to the VE local image system this is. Based on shadows/star placement, it could even derive the time of day/night. Of course, most digital cameras know what time it is. What if they could stitch in the time dimension to it, so I could take a series of pictures outside and tween the series and play a movie of grass growing. This could also be useful for someone trying to edit an element out of a photo, by finding another photo shot from a transformable location without the element. Imagine a cloud of little unstable flying drones that swarm an area, take pictures and PS builds a world that you could walk through in virtual reality. Perhaps image enhancement based on several images of roughly the same thing. What about doing this to video? Stitch together a 3-D movie of an event from a hundred spectators' camcorders. Yeah, wow.

Saturday, October 20, 2007 4:09:46 AM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
From the labs
Archive
<November 2007>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678
All Content © 2013, Hafthor Stefansson - Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way. - Sign In