mo.notono.us

Thursday, October 11, 2012

Recent Items in Windows 8

I  just got Windows 8 installed on my work desktop a few days back, and am still trying to find my way around the place.  The jury is still out if this is a great OS for non-touch laptop/desktop users; I really appreciate some of the performance features; some of the UX, not so much.

This morning I was looking for a file I had just closed, and I couldn't remember the filename or the path.  Recent Items to the rescue, I thought. So I hit Windows, typed "Recent" - nothing - continued, "Recent Items" - nothing.  Hmm.  Hit Windows + F to do a file search only - still nada.

Google to the rescue, as always:

From elessarGObonzo: the folder is still located in "C:\Users\[yourusername]\AppData\Roaming\Microsoft\Windows" as 'Recent Items'

Unfortunately this folder is a special folder that can't simply be added as a Toolbar - that would have been great.  You can however add it to your Start menu, Desktop, and also to the Taskbar.

To add Recent items to your Start menu, simply right-click and select Pin to Start.  Done. (Tip: Hit Windows to bring up Start and then move the icon to a place you can find it.)

To add Recent Items to the Desktop is also easy, rght-click, select Send To > Desktop (create shortcut).  Done.

To add Recent Items to the Taskbar is more complex - you have to add a shortcut to the Taskbar folder, which like the Recent Items folder itself is hidden.

From Windows 7 Themes: the Taskbar folder is located here: C:\Users\[yourusername]\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

So simply Alt-drag the Recent Items from its folder to the Taskbar folder and you now have a button in the Desktop taskbar.

Not quite the same as Windows 7, but manageable.

Labels: , ,

Monday, August 15, 2011

Stop Word and Live Writer from Replacing "Straight Quotes" with “Smart Quotes”

Whenever I write any coding documentation, Word and Live Writer like to “help out” by auto correcting some stuff that I’d rather it left alone, since it tends to break code samples. Quotes are on top of that list – so here goes:

From the ICan’tBelieveIHaventDoneThisBefore department, here is how to stop Word from replacing "straight quotes" with “smart quotes”.

In Word, hit the Office Button, then Word Options, then the Proofing tab, then the AutoCorrect Options, then the AutoFormat As You Type tab, then uncheck "Straight quotes" with “smart quotes”.

image

(thanks to Herb Tyson who posted this here: http://help.lockergnome.com/office/prevent-Word-Outlook-Replaceing-Apostrophes--ftopict987047.html)

In Live Writer, it's a bit more straight-forward, simply select the (tiny) Live Writer button, then Options, then Editing, then uncheck Replace "straight quotes" with “smart quotes”

image

There – "that's better".

Labels: , , , ,

Thursday, March 24, 2011

IE9 the new king of the Underscore performance tests

See http://documentcloud.github.com/underscore/test/test.html and past tests: http://mo.notono.us/search?q=underscore

Labels: , , , ,

Tuesday, January 11, 2011

"Microsoft has completely lost the web development community."

Last year Mark Pilgrim released a free e-book/site called “Dive Into Html5” (http://diveintohtml5.org/).  The site/book has served as a valuable resource on a recent Html5 project we’re working on here at AIS, and I have frequently gone back for details on topics such as local storage and canvas.  It is an excellent book for any bleeding edge web developer.  It is so choice. If you have the means, I highly recommend picking one up.

This week, Mark posted his observations on how publishing a free e-book (which is also purchasable in print format) works well for him, and that it gives great insight into what parts of the book are being read, and by whom. He then makes the following observation:

6% of visitors used some version of Internet Explorer. That is not a typo. The site works fine in Internet Explorer — the site practices what it preaches, and the live examples use a variety of fallbacks for legacy browsers — so this is entirely due to the subject matter. Microsoft has completely lost the web development community. (emphasis mine)

I forwarded this internally within AIS, and a nice debate ensued.  One common complaint was the hyperbole of the statement, and I agree; a more accurate line would likely be "Microsoft as a browser vendor has lost significant mindshare in the bleeding edge web development community."

Personally one of the things I love about Html5 (using the term the way the hypers would – to mean modern web development with client-driven UI interactions using JavaScript, CSS(3) and some HTML5 semantics) is that it has in some ways unified the web development community:  The debate a few years ago was about JSP vs .NET vs PHP vs Python vs Rails vs someotherservertechnology.  Folks from different camps seldom interacted and learned from each other.  With Html5, the backend processes are completely irrelevant, as long as they don’t muck with the Html (ASP.NET webforms is still a major sinner here, unfortunately) and developers using all sorts of backend software and operating systems are now adding to the collective knowledge, mostly working towards the common goal of getting as much functionality as possible, pushed to end users through mostly standards compliant browsers. 

For instance, our Html5 app is backed by ASP.NET MVC 2 and SQL server.  We do all our development on Windows, in Visual Studio – we’re looking to deploy to Azure.  Clearly we’re MS developers.  But we could just as well have done the app in Php against MySql running on linux and apache, and we’re taking cues from folks using python, java, Rails, Node.js, php and God knows what on the backend.

At the same time I haven’t used IE by choice for about 5 years, maybe more…

I was asked what I thought MS could do to gain back some developer mindshare – so here goes:

  • My thoughts are that if Html5 and the set of bleeding edge technologists that go with it are any kind of priority for MS,  they need to do some or all of the following:
  • Find a way to upgrade the legions of IE 6, 7  and 8 users to IE9.  This will obviously not be easy,  but they could do something similar to what Google did with Chrome frame (i.e. make IE9 a plugin for the older browsers),  or they could do something like the makers of the “IE Tab” Chrome and Firefox extensions do,  allow IE to be hosted inside Chrome,  and only activate it for certain sites.  Or let users install IE9 side by side with the older versions.   All of these would have as goal to encourage end users to use the latest possible browser for the task they need it for,  and to make them install IE9 instead of Chrome or Firefox.
  • Make IE9 the paragon of standards compliance.   (They are actually getting close to this...)
  • Bring IE9 to WP7 and whatever tablet software they're coming out with.
  • Reduce the focus of Silverlight as a browser plugin,  and make it more about web-deployed desktop apps.
  • Drastically improve the support for css and javascript in Visual Studio, including debugging and unit testing.   And give this toolset away in the form of VS Express.
  • Evolve the Dev tools in IE9 to become better than Chrome's inspector and the Firebug plugin.
  • Separate the IE development from Windows to allow quicker iterations
  • Do more things like the jQuery deal. The world of CSS is a mess (we desperately need mixins and code forks like those provided by media queries), MS could take the lead here…

The point is, whether Mark’s browser percentages are statistically valid as an indication of web developer’s preferences, or to what degree Microsoft is lagging/losing developer mindshare; these are not the pertinent questions.  The fact is that Microsoft is now not a leader in emerging web development areas – maybe they never were – but should they want to be, they need to take action. IE9 is shaping up to be a great browser, and they need to push it aggressively.

Labels: , , , , , , , , , , , , , , , , , , ,

Wednesday, September 15, 2010

IE9 Beta test scores against Underscore.js

Another new browser launch, and another obligatory proves-absolutely-nothing-definite/just-a-single-use-case performance test against the Underscore.js utility framework.

Previous tests showed that IE was gaining on the lead (Chrome), and that is still the case: As seen in the charts below, IE is sometimes faster, but still generally slower than Chrome (longer bars are better):

Again, this test proves very little, other than that IE9’s new Chakra JS engine is still slower than V8 for doing array iterations, and faster for mapping, getting property values, and creating list ranges.  IE9 has a number of features Chrome doesn’t have (yet) such as hardware acceleration (the IE Speed reader demo runs 790% faster in IE than in Chrome!) and ES property getter/setter standard compliance, just to mention two random ones…

IE9 beta is a HUGE step forward for IE.  Not sure if it will become my default browser, but this is at great day for the web.  Now if the EU and other governing bodies can just look the other way while MS quietly replaces all prior IE instances with IE9… ;-)

Labels: , , , ,

Tuesday, August 10, 2010

XElement, XAttribute and Explicit Conversion Operators

When we (my team at AIS) some xml parsing for the Rolling Stone project, we had to convert element and attribute values to ints and dates, etc. We ran into the problem that sometimes these elements and attributes didn’t exist – so using myXElement.Attribute(myAttribute).Value in a TryParse() would fail with a NullReferenceException, since Value couldn’t be called on a non-existent attribute.

Classic case for an Extension method – which is what I created:

public static T GetAttributeValueOrDefault(this XElement element, XName attributeName, T defaultValue) where T : struct
{
	//First check that the attribute is present
	XAttribute attribute = element.Attribute(attributeName);
	if (attribute == null || attribute.Value == null || attribute.Value == "null")
	{
		return defaultValue;
	}
	//...else attempt conversion
	return attribute.Value.ConvertOrDefault(defaultValue);
}

…except that we were all WRONG: http://www.hanselman.com/blog/ImprovingLINQCodeSmellWithExplicitAndImplicitConversionOperators.aspx

It turns out XAttribute has a series of explicit conversion operators, as does XElement:

Reflector reveals the following for XAttribute (XElement also has the same operators)

public class XAttribute : XObject
{
…

    // Methods
…
    [CLSCompliant(false)]
    public static explicit operator DateTime?(XAttribute attribute);
    [CLSCompliant(false)]
    public static explicit operator bool(XAttribute attribute);
    [CLSCompliant(false)]
    public static explicit operator Guid(XAttribute attribute);
    [CLSCompliant(false)]
    public static explicit operator bool?(XAttribute attribute);
    [CLSCompliant(false)]
    public static explicit operator int(XAttribute attribute);
    [CLSCompliant(false)]
    public static explicit operator Guid?(XAttribute attribute);
    [CLSCompliant(false)]
    public static explicit operator int?(XAttribute attribute);
…
    //etc, etc, etc – umpteen more
…

The implementation of the int? version looks like this;

[CLSCompliant(false)]
public static explicit operator int?(XAttribute attribute)
{
    if (attribute == null)
    {
        return null;
    }
    return new int?(XmlConvert.ToInt32(attribute.value));
}

So to get the value of an XElement/XAttribute, simply cast it to the type you want – make it the nullable variety if you aren’t sure that the attribute/element is present, the explicit conversion operator will check and convert the value for you, then check for null in your code…

Live and learn.

PS!  How are you expected to discover this, without reading the source-code (or Scott’s blog)?

 

  

Labels: , , ,

Monday, August 09, 2010

Dear Microsoft: Embrace JavaScript Already

It’s 2010:JavaScript is 14 years old, and you’ve officially supported “JScript” for the past 13 years.  Yet today, I have to open my JavaScript file in the FREE, OPENSOURCE, NotePad++ to find a missing closing } deep in my JavaScript file, because your latest premium Visual Studio IDE still can’t properly parse the language.

I appreciate the efforts you’ve gone to with improved intellisense in VS2010, but that is far from enough.  Why do we still need macros or plugins for elementary functionality such as function outlining, a document hierarchy tree, bracket matching and other validation?

As long as there is an internet driven by HTML, there will be JavaScript right beside it.  Embrace it already.

Labels: , , , ,

Thursday, August 05, 2010

Seadragon.com is now Zoom.it

Microsoft Live Labs recently rebranded their SeaDragon public Deep Zoom service ‘Zoom It’ and put it at http://zoom.it

They now have an API for Silverlight, .NET and JavaScript, allowing you to submit the url of your image to deep zoom, returning the url for your Deep Zoom Image (DZI). Or, for the non-programmatic approach, you can simply submit your url through the browser at http://zoom.it (the same way you could previoously through seadragon.com).

Completed DZIs are given a very short, incremental url, e.g. http://zoom.it/10ms, and you also get the embed code to put the image on your own site, like so:

The embed code for the above is exceedingly simple:

<script src="http://zoom.it/l6BK.js?width=auto&height=400px"></script>

Labels: , , , ,

Monday, July 12, 2010

Yet another pre-stolen idea: the electric supercharger

In my not-too-consistent series of “pre-stolen ideas”, here’s another from the automotive front: the electric supercharger, as part of EcoMotors’ new engine design.

Based on my unused mechanical engineering degree, AFAIK, some of the drawbacks of a supercharger are the additional engine friction it provides, and the fact that the boost provided is directly related to engine speed. Since you only really need the additional boost some of the time, my thought was - why not control boost with a near-zero lag electric motor whose output is completely independent from that of the main engine?  Which is of course what EcoMotors is now doing.

Volkswagen is using a twincharger design in their latest creation – a 1.4 liter engine that produces as much power as V6 engines twice the size did a decade or so ago.  EcoMotors seem to have done VW one better, enough for Bill Gates to invest in the company.

Labels: , , ,

Friday, July 02, 2010

Bing Bar Begone

I rarely use Firefox anymore, because it takes forever and a half to launch (I should figure out why that is…).  Anyhow, I started it today, just to find the frickin’ Bing bar taking up new real estate.  Where did that come from?

image

Mozilla support has the answer: https://support.mozilla.com/en-US/kb/Removing+the+Search+Helper+Extension+and+Bing+Bar

This is the kind of crap that Old Microsoft would do.  With all the recent goodness coming out of Redmond, I really didn’t expect this.  Bad Microsoft, bad.

Uninstalled.

Labels: , , , ,

Saturday, June 26, 2010

Undersore.js Performance Tests Revisited (this time with pretty charts)

Out of sheer vanity, I added my own blog feed to my Google Reader, as I was curious if anyone ever Liked my posts.
Answer: Nope. :-(

Anyhow, I came across my post on Underscore.js, and since MS just dropped Platform Preview 3 of IE 9, I thought I’d redo the comparison in Chrome6, IE8 and IE9 (though I know this is hardly any complete benchmark test, it’s still telling).  The results are below: 

As I said in my last post, I can’t wait for IE9 to replace every previous IE version…  I haven’t been this excited about an IE product since IE4, which was more than 10 years ago.

IE 8 – still a dog.

IE8 results

IE 9 PP3 – Starting to look good!  Faster than Chrome in some tests!

IE9 results

Chrome 6 – still the winner in most categories, though the lead is shrinking

Chrome 6 results

Bottom line, though – if you’re doing a lot of looping/mapping, you should use Underscore rather than jQuery.

Labels: , , , , ,

Sunday, June 13, 2010

IE 9 HTML5 Testing: “Works on My Machine”

One of my esteemed colleagues on an internal forum posted about how great IE 9’s HTML5 support was, based on the result of Microsoft’s test pages.  MS’s tests are sadly self-selective however: meaning they only seem to test for elements that IE9 supports: http://samples.msdn.microsoft.com/ietestcenter/

“Cross-browser Test Results Summary:
W3C Web Standards Number of Submitted Tests Internet Explorer 9
Platform Preview
Mozilla Firefox 3.6.3 Opera 10.52 Apple Safari 4.05 Google Chrome 4.1
HTML5 40 78% 63% 48% 43% 43%
...”

Compare that to my own results running html5test.com on the 6(!) browsers I have installed:

html5test

Html5 is the first time in a decade that the browser vendors have had a new major standard to fight over; I’m just grateful that this time around we’ll have an army of frameworks such as jQuery that can level the development playing field for us.

Labels: , , , , , , , , ,

Friday, June 11, 2010

How to Always Run Visual Studio As Administrator

To jum straight to the solution, click here

“Certain tasks, including debugging and creating local IIS applications, require that you start Visual Studio as a user with Administrative privileges. On Windows Vista, and Windows Server 2008 when not running as the built-in Administrator account, this requires right-clicking the Visual Studio 2008 icon in the Start Menu and choosing Run as administrator.

“To make this process easier, you can create a shortcut and check the Run this program as an administrator check box on the Compatibility tab of the shortcut properties.”
from Using Visual Studio 2008 with IIS 7 @ learn.iis.net

On the last few projects I’ve worked on, we’ve used IIS sites for our development (for a number of reasons I won’t detail here), and the need to open VS in admin mode has been a constant annoyance.  It’s like constantly getting bitten by a mosquito. Today I finally got annoyed enough to spend 5 minutes researching a solution.  (I know.  I procrastinate.)

The solution, or what seems to be working for me so far at least was found at sevenforums.com: How to Run a Program as an Administrator in Windows 7.  Some of these options I knew about, the one I hadn’t tried and which worked for me was this:

1. Right click on the program shortcut or program .exe file, then click on Properties, and on the Compatibility tab. (See screenshots below)
NOTE: If you are doing this while logged on as a standard user instead of an administrator, then you will need to also click on the Change settings for all users button and type in the administrator's password.

Run as Administrator-compatibility_mode1.jpgRun as Administrator-compatibility_mode2.jpg

2. To Always Run this Program as an Administrator -

A) Check the Run this program as an administrator box, and click on OK. (See screenshots above)

The key is to change the compatibility setting of the Visual Studio EXECUTABLE, not the shortcut to it.  I.e., on my laptop, I went to C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ and right-clicked devenv.exe and then proceeded as above.

I then had to add one more step – when I now clicked on a .sln file, nothing would happen.  It appears the default Open action couldn’t run, I assume, due to inadequate privileges.  To fix this, I right-clicked the .sln file, selected Open With –> Choose Default Program, and then selected Visual Studio, making sure Always use… was checked.

Presto – my .sln files now open asking to be run as admin, as do my jump list projects.

Itch scratched.

Labels: , , , , , , , ,

Thursday, June 03, 2010

Diva Girl in Mommy’s sunglasses

I rather like the new personalized background picture for Google – even if it is a blatant rip off of Bing.  Once again, competition improves the field.  Here’s my current background – from our trip to Philly last weekend:

image

Labels: , , , , ,

Thursday, May 27, 2010

Enabling Support for HTML 5 Schema Validation in Visual Studio 2010

Out of the box, HTML 5 schema validation is not supported in Visual Studio 2008 and 2010.  The folks on the Visual Web Developer Team rectified this for VS 2008 and Visual Web Developer, but they did not provide any update for VS 2010 (that I know of).  No matter, you can use the 2008 version – here’s how.

1. Download the schema update for VS 2008/VWD

2. Open the downloaded zip file and follow the instructions in the ReadMe.txt file except:

2.a) Where it says to add the schema to C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Packages\schemas\html, replace the 9.0 with 10.0 – the path for VS 2010 (in 64 bit Windows) is:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Packages\schemas\html

2.b) Edit the VS registry file matching your Windows environment, and again change the 9.0 to 10.0 – e.g. for my Windows 7 64 bit machine the correct registry file is:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Packages\{1B437D20-F8FE-11D2-A6AE-00104BCC7269}\Schemas\Schema 23]
"File"="html\\html_5.xsd"
"Friendly Name"="HTML 5"
"URI"="http://schemas.microsoft.com/intellisense/html-5"

3. Back up your registry

4. Run the registry file (as always, take caution)

Labels: , , ,

Monday, May 24, 2010

Comparative Performance of Underscore.js in Chrome and IE

I came across the very handy-looking Undersore.js today, and clicked on the test & benchmark link. I first ran the test in Chrome.  The results below show number of operations per second.  Looks like each, map, keys, values, and range are pretty inexpensive operations, whereas uniq and intersect should be used sparingly.  All makes sense. 

Then out of curiosity, I ran the same tests in IE and Firefox.  The exact numbers are not significant as the results vary by 10-20% between subsequent runs in the same browser, but the range is pretty illustrative.  And yes, I know IE9 is harder, better, faster, stronger, so this is not a fair fight.  I can’t wait for IE9 to replace every previous IE version…

  Ops/sec

(higher is

better)
Test Chrome 6 IE 8 Firefox 3.6

_.each()

20213

510

3249

_(list).each()

13570

493

3161

jQuery.each()

3637

209

910

_.map()

18581

303

5488

jQuery.map()

7084

686

8519

_.pluck()

10852

282

4785

_.uniq()

127

1

33

_.uniq() (sorted)

308

210

84

_.sortBy()

1641

45

359

_.isEqual()

4962

869

1826

_.keys()

22675

1142

4295

_.values()

24551

321

5435

_.intersect()

83

1

20

_.range()

33345

1223

5262

Again, why I use Chrome as my default browser.

Labels: , , , , ,

Wednesday, March 17, 2010

Odd MINOR Outlook 2007 Bug

First message: sent 12:34, from EST timezoneSent1234

Second message: sent 12:59, also from EST timezone – note the discrepancy between list and preview.

sent1259

Labels: , ,

Friday, February 12, 2010

Things I’m digging today

FreeMind – free mind mapping tool.  Love the simplicity, and that I can copy a branch and paste in an email as a well-formatted nested list.

Fiddler2 – back in the day (v1.x) I remember it as complex to use – now it’s dead simple.  Maybe I got smarter, but I fear the reality is that the tool just got better.

Buzz – I, for one, welcome our new insect overlords

(Ok, I admit it – I just wanted to see how my blog posts appeared on Buzz, and I had nothing better to write.)

Labels: , , , , ,

Friday, December 04, 2009

Getting the ContentType from an ItemAdding Event Handler

Inside an event handler for an ItemAdded event, getting the List Item’s ContentType is as easy as

var contentType = properties.ListItem.ContentType;

However, for ItemAdding, properties.ListItem is null.

Luckily, the ContentType name and Id are part of the properties.AfterProperties collection – the following will work:

SPList list = properties.List; 
string contentTypeName = properties.AfterProperties["ContentType"].ToString(); 
SPContentType contentType = list.ContentTypes[contentTypeName]; 
SPFieldCollection fields = contentType.Fields;

Between the AfterProperties field values and the content type field collection, you typically have all that you need... Just remember to not depend on properties.ListItem.

Labels: , , , , ,

Tuesday, November 17, 2009

How to Upgrade a WSPBuilder Project to SharePoint 2010

<UPDATE date=”2009.12.02”>: WSPBuilder Extensions 2010 Beta 1.3 (or newer) makes the below mostly obsolete – though I was still not able to deploy using the VS add-in – I got a message stating my SPTimer Service was not running.</update>

Based on advice from Bjørn Furuknap (@furuknap, http://furuknap.blogspot.com/2009/11/using-wspbuilder-for-sharepoint-2010.html) I was able to deploy to SP 2010 a rather complex WSPBuilder-based SharePoint solution that I first recompiled in VS 2010.

Steps were:

  1. Download the command line version, with the x64 cablib dll
  2. Upgrade your VS 2008/2005 solution to VS 2010
  3. Replace your 12 references with their 14 equivalents - most will be found in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI
  4. Compile your VS solution - this SHOULD work
  5. Use the wspbuilder command line tool to create, but not deploy your wsp (use wspbuilder -help for instructions)
  6. Use stsadm -o addsolution -filename <yourwsp> to deploy the solution

Labels: , , , , ,