Next generation's garbage RSS 2.0
# Tuesday, May 04, 2010
It's true. I was pretty excited when I heard about a chance to ride along with Carl Franklin and Richard Campbell of DotNetRocks. It was a promotion put on by Telerik where one lucky victim from each city would get to ride in the RV with them to the next city and watch that show.

Timeline:
  • Several weeks before - heard about the RoadTrip on a DotNetRocks episode. Went to the site mentioned, but there wasn't a sign-up form yet. Set an alarm on my phone to remind me to check the site daily.
  • A couple of weeks before - The form was there. I filled it in. I then told my wife about it and said that there was a insignificant chance that I might win that. I then realized that this was going to conflict with SqlSaturday in Huntington Beach.
  • Monday 4/19 - canceled plans to go to SqlSaturday.
  • Tuesday 4/20 - Beta 2 of a certain smart phone OS broke camera support. Boo. Did take a pocket camera with, but didn't take many shots with it.
  • Friday 4/23 - went to the DotNetRocks RoadTrip event in Phoenix. Got there right at 6 PM. Chatted with Richard and mentioned how cool I thought the RoadTrip ride-along was. He said, "You should go." - They were going to pick me up on Saturday. I texted my wife. I found it rather hard to concentrate during the event.
  • Saturday 4/24 - Carl and Richard drove the RV to my house, around 11 am - crazy - got onboard and away we went. Bound for Houston, some 1100 miles away. They opted for driving straight through. Chatted their ears off probably. We jury-rigged the PA speaker to a MP3 player so we could listen to old episodes of Mondays on the drive.

  • Sunday 4/25 - Pulled in to Houston around 9 am. Around 20 hours with the time difference. Got a little sleep in the RV and a little more at the hotel after going for a walk. Later Richard, Tom (driver) and I met up with Zain Naboulsi (MS Dev Evangelist) for dinner and had some spirited discussions over a great dinner. Then just hung out with Richard for a couple of hours chatting about techie nerdy stuff.
  • Monday 4/26 - Met up with Dustin Campbell and had really great sushi with everyone. Totally geeked out with Dustin about languages and Visual Studio. Then we went to the MS office, setup and they did the show. It was kinda neat to see them do a second show. Did a video interview with Todd of Telerik about the experience and we discussed some of the cool stuff in SiteFinity 4.0 CTP. Then we went back to the hotel. Sadly, the experience was over. Got about 2 hours of sleep then took a cab to IAH airport and got on my early flight back to PHX.


Really a great time.
Thanks Carl and Richard and Thanks Telerik!

Tuesday, May 04, 2010 11:04:02 AM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
.NET
# Thursday, April 29, 2010
While the pundits (no, not me, the other pundits) argue about whether Apple is trying to protect their delicate users from the chainsaw gangs of Flash apps or if Adobe is now being beaten like an LAPD cop killer because of some ancient grudge, I'm thinking that their may be a whole 'nother reason: It is step one on the road to killing the Mac.

Why kill the Mac? Easy. Jobs can only make money on hardware and a little bit on their own software, but he wants the 30% on everything like he's getting on the iPhoneOS side. Can't lock down the Mac and setup an app store on it now, so it must die.

In order to kill the Mac, you'd need to be able to do everything you can do on a Mac on a iPad (well, except for development -- screw you developers!)

Replace my Mac? Yep. Get iWork on the iPad and a bluetooth keyboard. Oh, you want a bigger screen and everything. Ok, what about a 15" iPad Pro that folds up like a laptop with a built-in keyboard and multitouch trackpad/display. MacBook Air-like dimensions with a full day's battery life. Oh yeah, and you can sync it directly to your iPhone.



What more do you need pointy-haired boss? Pointy-haired boss wants a corporate dashboard application on his iPad with notifications... pronto!

The one kind of development Apple does want is iPhoneOS development. What if there was an app available for free in the app store that let you design your UI, kinda like you do in Interface Builder now, and let you write code. When you're ready to test, you click build, the code goes up to Apple, is compiled, packaged, signed and comes back to your iPad ready for you to test and debug. When you are satisfied with the results, click Publish and your app is in the App Store, ready to be enjoyed by all fartapp-aficionados.

Ah, but how can that work if you are doing stuff like Corona, MonoTouch or CS5. And so 3.3.1 had to be changed.

So, specifically, my predictions are:
* iPad Pro - Ives will twist his hands and say that they completely rethought the portable computer and voila, iPad Pro w/ laptop style and a second touch-display that acts like a trackpad - the whole package suitable for authoring applications - at the same time, Steve will declare that they listened to you and now you can own and use an iPad and iPad Pro without iTunes and you can sync your iPhone to your iPad Pro.
* iPad XCode - Integrated Development Environment on the iPad Pro for authoring apps for the appstore. Maybe free, maybe $49. But it won't include a compiler or code-signer. Your source will go to Apple to be compiled, signed, versioned, scrutinized and approved.
* Mac languish - only minor hardware improvements - Snow Leopard is the last Mac OS - security problems go unfixed and just become justification for the glorious iPad Pro. Every move they make will be to reduce the need for people to buy Macs.

The net effect is Steve gets his 30% on everything.
Thursday, April 29, 2010 5:15:38 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
Apple | Security | tinfoilhat
# Thursday, March 25, 2010

Wanted a generic way to pass a DataTable as a parameter to SqlCommand as a TVP (Table Value Parameter). It automatically creates the, IMHO, superfluous User-Defined Table Types. Here's what I have so far:

<Runtime.CompilerServices.Extension()> _
    Sub AddTableParameter(ByVal cmd As SqlCommand, ByVal n As String, ByVal dt As DataTable)
        Static typeXlat As Dictionary(Of System.Type, SqlDbType)
        If typeXlat Is Nothing Then
            typeXlat = New Dictionary(Of System.Type, SqlDbType)
            typeXlat.Add(GetType(Int64), SqlDbType.BigInt)
            typeXlat.Add(GetType(Int32), SqlDbType.Int)
            typeXlat.Add(GetType(Int16), SqlDbType.SmallInt)
            typeXlat.Add(GetType(Byte), SqlDbType.TinyInt)
            typeXlat.Add(GetType(SByte), SqlDbType.TinyInt)
            typeXlat.Add(GetType(Boolean), SqlDbType.Bit)
            typeXlat.Add(GetType(String), SqlDbType.VarChar)
            typeXlat.Add(GetType(Byte()), SqlDbType.VarBinary)
            typeXlat.Add(GetType(DateTime), SqlDbType.DateTime)
            typeXlat.Add(GetType(DateTimeOffset), SqlDbType.DateTimeOffset)
            typeXlat.Add(GetType(Char), SqlDbType.Char)
            typeXlat.Add(GetType(Single), SqlDbType.Real)
            typeXlat.Add(GetType(Double), SqlDbType.Float)
            typeXlat.Add(GetType(Decimal), SqlDbType.Decimal)
            typeXlat.Add(GetType(Guid), SqlDbType.UniqueIdentifier)
            typeXlat.Add(GetType(Xml.XmlDocument), SqlDbType.Xml)
        End If

        'assembly the typename and spec
        Dim tabletypedef As New List(Of String)
        Dim parm As New SqlParameter(n, SqlDbType.Structured)
        parm.Value = dt

        For Each c As DataColumn In dt.Columns
            Dim s As SqlDbType = SqlDbType.Variant
            If typeXlat.ContainsKey(c.DataType) Then s = typeXlat(c.DataType)
            tabletypedef.Add(c.ColumnName + " " + s.ToString)
        Next
        Dim tabledef = String.Join(",", tabletypedef.ToArray)
        Dim typename = "autotype_" + tabledef
        parm.TypeName = "[" + typename + "]"

        'create the type if needed
        Using cmd2 = New SqlCommand("select count(*) from sys.types where is_table_type=1 and name='" + typename + "'", cmd.Connection)
            If cmd2.ExecuteScalar() = 0 Then
                cmd2.CommandText = "create type [" + typename + "] as table(" + tabledef + ")"
                cmd2.ExecuteNonQuery()
            End If
        End Using

        'add the parm referencing the typename
        cmd.Parameters.Add(parm)
    End Sub

Thursday, March 25, 2010 7:54:18 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
.NET | SQL
# Monday, March 22, 2010
Please, take a moment and read this article about plagiarism. If you have a blog or twitter account, please link to the article, not to me. Thanks.
Monday, March 22, 2010 11:11:38 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -

# Monday, January 18, 2010
We have a client that has a WSS3 install with a single site, but wants to start creating sites for each functional group inside their organization. The bummer was WSS3's search was limited to a single site. Well, we could just replace it with Search Server 2008 Express, but that runs over SQL Server 2005 Express and is limited to 4GB on the databases so it would be a hassle to manage when it gets big.

The answer is to use both.

Here's the steps to make a test environment for this from scratch:
  1. Make a virt using Windows 2003 R2 w/ SP2
  2. Add web server role
  3. Windows Update
  4. Install WSS3 w/ SP2 which gets me the Window Internal Database (not limited to 4GB) for SharePoint content.
  5. Let the Configuration Wizard do its magic.
  6. Install Search Server 2008 Express
  7. Let the Configuration Wizard do its magic again but don't let it replace your WSS3 site - tell it to make a new search site on a random port.
  8. Turn on the "Office SharePoint Server Search Web Parts" site collection feature on the WSS3 site
  9. Install SharePoint Designer 2007
  10. Open the Search Server site's /results.aspx page
  11. Save as to WSS3 site as /results.aspx (with Don't save for the images/css junk)
  12. Add a Search Box webpart to the /default.aspx page of your wss3 site setting the "Target search results page URL" to /result.aspx
To test, I created a subsite and uploaded a sample document to a doc lib there (/inetpub/wwwroot/iisstart.htm) - let a crawl happen then searched from the root site for the word "Construction".

Now to tune this a little better, you might want to set the memory limits on the two instances of SQL running on this box now (MICROSOFT##SSEE and OFFICESERVERS). My understanding is that SQL server is super memory greedy, but the express and WID versions are less so but they still will probably push at each others memory causing them to drop cache buffers and page out IIS, ASP.NET and SP core stuff, so better to limit them.

I did this by creating the following text file (sqlconfig.txt):
EXEC sys.sp_configure N'show advanced options', N'1'  RECONFIGURE WITH OVERRIDE
GO
EXEC sys.sp_configure N'max server memory (MB)', N'256' -- <== mod this value to around 1/4 of installed memory - 1024 max
GO
RECONFIGURE WITH OVERRIDE
GO
EXEC sys.sp_configure N'show advanced options', N'0'  RECONFIGURE WITH OVERRIDE
GO
Then I ran this from the command line:
sqlcmd -S localhost\MICROSOFT##SSEE -E -i sqlconfig.txt
sqlcmd -S localhost\OFFICESERVERS -E -i sqlconfig.txt



Monday, January 18, 2010 11:18:53 AM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
SharePoint
# Friday, November 13, 2009
There appears to be a bug in how Visual Studio does "Add Service Reference" proxy generation for VB.NET projects.

I ran into this issue when trying to add a service reference to Bing Maps and I believe it is not limited to that. I think it stems from it misunderstanding that enum instance variables cannot be tested for equality using .Equals in VB... not sure why.

I think the solution is to simply replace the offending line:
If Me.enumfield.Equals(value) <> true Then
with
If Not Object.Equals(Me.enumfield ,Value) Then

BTW: DO NOT compare boolean results to True or False as they have done!

Use
If boolean_results Then
or
If Not boolean_results Then
[EDIT 2010-07-07]
Specifically, this block of code is wrong:
<System.Runtime.Serialization.DataMemberAttribute()>  _
Public Property CompareOperator() As SearchService.CompareOperator
Get
Return Me.CompareOperatorField
End Get
Set
If (Me.CompareOperatorField.Equals(value) <> true) Then
Me.CompareOperatorField = value
Me.RaisePropertyChanged("CompareOperator")
End If
End Set
End Property
and should be replaced with this:
<System.Runtime.Serialization.DataMemberAttribute()>  _
Public Property CompareOperator() As SearchService.CompareOperator
Get
Return Me.CompareOperatorField
End Get
Set
If Not Object.Equals(Me.CompareOperatorField,value) Then
Me.CompareOperatorField = value
Me.RaisePropertyChanged("CompareOperator")
End If
End Set
End Property
Made this edit so search engines would pick it up... so I can find my own fix next time I run into it. :) [/EDIT]

Friday, November 13, 2009 4:41:25 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
.NET Internals | Bing Maps | Visual Studio
# Monday, October 19, 2009
I'm actually going to encourage you to consider using GC methods. Well, now hang on cowboys... this is for pretty limited circumstances.

You see, the GC class can do more than compact memory. It can also run finalizers on unreferenced objects. If you are writing a class that included a finalizer (which you would only need if your class is the lowest-level class to deal with an unmanaged resource or are managing a pool of scarce resources) then you might consider using GC. Even though you might (read should) implement IDisposable, if a user of your library fails to Dispose your object, that unmanaged resource will leak until, at some non-deterministic (read random) point, the garbage collector runs and that object's finalizer might (read random) be queued and run. If it leaks often enough, your attempt to create additional objects with the unmanaged resource could fail because you have exhausted the available supply.

Rather than fail, you could attempt:

 GC.Collect(0);
 GC.WaitForPendingFinalizers();

and try again. If it works on the retry, you might want to log that for the developer's information. One might argue that this is just encouraging and forgiving sloppiness, but I look at it as a step towards robustness and can actually help the developer diagnose a real problem whereas not doing this would just lead to more random run-time only-on-heavy-load failures.

If you wanted to be really awesome, once you detect that you could recover, flip a bit on to start recording a stacktrace on each create, then in your finalizer, put that stacktrace in a application-wide queue that then gets logged by the next create. Now you've told the dev exactly where to go find the spot where they got your object but didn't dispose it.

Another place is when you are calling something that has an unmanaged resource behind it along with other code that isn't behaving. For example, you are writing a web part in SharePoint that is calling new SPSite and OpenWeb... perhaps you are being a good SPRequest citizen, but another web part on the site that you didn't write isn't being so nice.

You could make auto-recovery wrappers for the stuff you use. Your newSPSite method would attempt to return new SPSite but if that should fail, Collect + WFPF and try again. Ugh, what a pain. But sometimes it beats trying to explain to someone why it is another webpart's fault that your webpart explodes.

Monday, October 19, 2009 9:40:14 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
.NET Internals
# Saturday, October 17, 2009
Disclaimer: I'm a Ruby-n00b and just trying merb.

Did you get this after trying to
gem install merb
?

...
Successfully installed merb-1.0.12
44 gems installed
Installing ri documentation for diff-lcs-1.1.2...
Installing ri documentation for rspec-1.2.9...
Installing ri documentation for addressable-2.0.2...
Installing ri documentation for data_objects-0.9.12...
Installing ri documentation for dm-core-0.9.11...
Installing ri documentation for dm-migrations-0.9.11...
Installing ri documentation for json_pure-1.1.9...
Installing ri documentation for mime-types-1.16...
Installing ri documentation for thor-0.11.7...
Installing ri documentation for merb-core-1.0.12...
Installing ri documentation for merb_datamapper-1.0.12...
Installing ri documentation for ZenTest-4.1.4...
Installing ri documentation for RubyInline-3.8.3...
Installing ri documentation for ParseTree-3.0.4...
Installing ri documentation for merb-action-args-1.0.12...
Installing ri documentation for merb-assets-1.0.12...
Installing ri documentation for merb-slices-1.0.12...
ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument - ./</cdesc-<.yaml

Not sure why that is, but it won't stop merb from working. I went ahead a made a for loop to install the other gems again so they'd get their ri documentation.

for %x in (merb-auth-more merb-auth-slice-password merb-auth merb-cache merb-exceptions highline templater merb-gen haml merb-haml merb-helpers mailfactory merb-mailer merb-param-protection merb-more do_sqlite3 dm-timestamps dm-types dm-aggregates dm-validations randexp dm-sweatshop dm-serializer) do gem install %x

Here's what comes from gem install merb-slices -V --debug

ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument - ./</cdesc-<.yaml
        C:/ruby/lib/ruby/gems/1.8/gems/rdoc-2.4.3/lib/rdoc/ri/writer.rb:41:in `initialize'
        C:/ruby/lib/ruby/gems/1.8/gems/rdoc-2.4.3/lib/rdoc/ri/writer.rb:41:in `open'
        C:/ruby/lib/ruby/gems/1.8/gems/rdoc-2.4.3/lib/rdoc/ri/writer.rb:41:in `add_class'
        C:/ruby/lib/ruby/gems/1.8/gems/rdoc-2.4.3/lib/rdoc/generator/ri.rb:226:in `update_or_replace'
        C:/ruby/lib/ruby/gems/1.8/gems/rdoc-2.4.3/lib/rdoc/generator/ri.rb:89:in `generate_class_info'
        C:/ruby/lib/ruby/gems/1.8/gems/rdoc-2.4.3/lib/rdoc/generator/ri.rb:44:in `process_class'
        C:/ruby/lib/ruby/gems/1.8/gems/rdoc-2.4.3/lib/rdoc/generator/ri.rb:39:in `generate'
        C:/ruby/lib/ruby/gems/1.8/gems/rdoc-2.4.3/lib/rdoc/generator/ri.rb:38:in `each'
        C:/ruby/lib/ruby/gems/1.8/gems/rdoc-2.4.3/lib/rdoc/generator/ri.rb:38:in `generate'
        C:/ruby/lib/ruby/gems/1.8/gems/rdoc-2.4.3/lib/rdoc/rdoc.rb:324:in `document'
        C:/ruby/lib/ruby/site_ruby/1.8/rubygems/doc_manager.rb:177:in `run_rdoc'
        C:/ruby/lib/ruby/site_ruby/1.8/rubygems/doc_manager.rb:149:in `install_ri'
        C:/ruby/lib/ruby/site_ruby/1.8/rubygems/doc_manager.rb:109:in `generate_ri'
        C:/ruby/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:144:in `execute'
        C:/ruby/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:143:in `each'
        C:/ruby/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:143:in `execute'
        C:/ruby/lib/ruby/site_ruby/1.8/rubygems/command.rb:257:in `invoke'
        C:/ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:132:in `process_args'
        C:/ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:102:in `run'
        C:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:58:in `run'
        C:/Ruby/bin/gem:21

Saturday, October 17, 2009 11:35:46 AM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
merb | ruby
Archive
<May 2010>
SunMonTueWedThuFriSat
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345
All Content © 2010, 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