2 months Ago
U.S. Olympic Hockey
Patrick Kane never showed up—he missed again and again and took horrible penalties. His face after his second penalty sums things up nicely for the U.S. (see left).
And the US didn’t even both covering the greatest Olympic goal-scorer ever, warming the hearts of 40+ year-old guys everywhere by letting Teemu score not once, but twice.
I noticed the following during one of the boarder-cross races: almost everyone stood in the gate at the top with hands on the posts, ready to jump at the sound of the bell (picture at left). The French guy, though, was just leaning back, arm akimbo and relaxed (picture at right). All that was missing was a cigarette and a shot of espresso.
Do you see the difference? I think he won the qualifier race as well, but who really cares? He’d already won our hearts on style.
When you grew up in the countryside, you tend to have to prove the extreme rurality of your origin to others who share a similarly bucolic provenance. Should I become embroiled in future such contests of micturial prowess and find myself in trouble, struggling to triumph against a backwoods foe prodigiously well-equipped with a backwoods background that threatens to overshadow my own, I will rest assured that I can break the glass in case of such an emergency to retrieve the following link to end the discussion.
Oh, you guys used to tip cows when you got drunk?
Wow, that’s crazy.
So the farmer filmed them filming themselves “hav[ing] sexual contact with several cows”? Will Ilion police be pressing charges against the farmer for producing bestiality porn as well?
I’ve been using CSS since pretty much its inception. It’s powerful but quite low-level and lacks support for DRY. So, I switched to generating CSS with LESS a while back. This has gone quite well and I’ve been pretty happy with it.
Recently, I was converting some older, theme stylesheets for earthli. A theme stylesheet provides no structural CSS, mostly setting text, background and border colors to let users choose the basic color set. This is a perfect candidate for LESS.
So I constructed a common stylesheet that referenced LESS variables that I would define in the theme stylesheet. Very basically, it looks like this:
This is just about the most basic use of LESS that even an amateur user could possibly imagine. I’m keeping it simple because I’d like to illustrate a subtlety to variables in LESS that tripped me up at first—but for which I’m very thankful. I’ll give you a hint: LESS treats variables as a stylesheet would, whereas SASS treats them as one would expect in a programming language.
Let’s expand the
Let’s see an example before we continue.
You’ll notice that I avoided setting a value for
I want to be able to set some values and just use defaults for everything that I don’t want to override. There is a construct in SASS called
The clue is further down in one of the answers:
It was at this point that the lightbulb went on for me. I was thinking like a programmer where a file is processed top-down and variable values can vary depending on location in the source text. That the output of the following C# code is
In fact, we would totally expect our IDE to indicate that the value in the final assignment is never used and can be removed. Using LESS variable semantics, though, where variables are global in scope and assignment are treated as they are in CSS, we would get
This is exactly as the developer from LESS said: stop fighting it and just let LESS do what it does best. Do you want default values? Define the defaults first, then define your override values. The overridden value will be used even when used for setting the value of another default value that you didn’t even override.
Now let’s go fix our stylesheet to use these terse semantics of LESS. Here’s a first cut at a setup that feels pretty right. I put the files in the order that you would read them so that you can see the overridden values and everything makes sense again.
You can see in the example above that the required variables are all declared, then overridden and then used. From what we learned above, we know that the value of
We can do better though. The example above hasn’t quite embraced the power of LESS fully. Let’s try again.
Boom! That’s all you have to do. Set up everything in your base stylesheet file. Define all variables and define them in terms of each other in as convoluted a manner as you like. The final value of each value is determined before any CSS is generated.
This final version also has the added advantage that a syntax-checking IDE like JetBrains WebStorm or PHPStorm will be able to provide perfect assistance and validity checking. That wasn’t true at all for any of the previous versions, where variable declarations were in different files.
Although I was seriously considering moving away from LESS and over to SASS—because at least they didn’t leave out such a basic feature, as I had thought crossly to myself—I’m quite happy to have learned this lesson and am more happy with LESS than ever.
 For those of you who already know how to fix this, stop smirking. I’m writing this post because it wasn’t intuitive for me—although now I see the utter elegance of it.↩
 I’d also seen the same concept in NAnt
 There are exceptions, but “variables are global in LESS is a good rule of thumb”. One example is that if a parameter for a mixin has the same name as a globally assigned variable, the value within that mixin is taken from the parameter rather than the global.↩
 Seriously, LESS experts, stop smirking. I’m taking a long time to get there because a programmer’s intuitive understanding of how variables work is a hard habit to break. Almost there.↩
The following article was originally published on the Encodo blogs and is cross-published here.
Encodo is a member of the Microsoft Partner Program with a Silver Competency. We maintain this competency through a combination of the following:
This involves no small amount of work and means that the competency isn’t that easy to get. You can also use Microsoft competencies (e.g. MCSE) but we don’t have any of those (yet).
We’ve had this membership for a while in order to get partner benefits, which basically translates to having licenses for Microsoft software at our disposal in order to develop and test .NET software. This includes 10 licenses for all premium versions of Visual Studio, up to and including the latest and greatest.
The partner web site
In previous versions, we were able to go to the partner web site and, after a lot of effort, get license keys for our 10 licenses and distribute them among our developers.
I mention the effort only because the partner site(s) and page(s) and application(s) are so notoriously hard to navigate. Every year, Microsoft improves something on the site, generally to the style but not the usability. I pluralized the components above because it’s hard to tell how many different teams, applications and technologies are actually behind the site.
It’s basically always been a mess and still is a mess and our suspicion is that Microsoft deliberately makes it hard to redeem your licenses so that you’ll either (A) just purchase more licenses via a channel that actually delivers them or (B) call their for-fee hotline and spend a bunch of money waiting on hold before you get forwarded from one person to another until finally ending up with someone who can answer your question.
 You can confirm our impressions just by looking at the screenshots attached below.↩
The convoluted path to licenses
That question being, in case we’ve forgotten, “how can I please get your software to recognize the licenses that I purchased instead of threatening me that it will go dark in 90 days?”
The magical answer to that question is below.
First, what are we actually trying to accomplish? We have a multi-pack license and we want some way of letting our users/developers register products. In most cases, this still works as it always has: get a license key and enter it/register it with the local installation of the product (e.g. Office, Windows, etc.)
With Visual Studio 2013 (VS2013), things are slightly different. There are no multi-pack license keys anymore. Instead, users log in to their Visual Studio with a particular user. VS2013 checks that account for a license on the MSDN server and enables its functionality accordingly. If you have no license registered, then you get a 90-day trial license.
If the license is a multi-pack and the user accounts are individual…how does that work? Easy: just associate individual users with the partner account and assign them licenses. However, this all works via MSDN, so it’s not enough to just have a Windows Live account. That user must also be registered as an MSDN subscriber.
So, for each user, you’re going to have to do the following:
The solution (with screenshots)
Sounds easy, right?. Once you know what to do, it’s not so bad. But we had a lot of trouble discovering this process on our own. So here are the exact steps you need to take, with screenshots and hints to help you along.
Logging in has other benefits: you can store your VS2013 settings on the Live server and use them wherever you work with VS2013 and have logged in.
I shelled out CHF8.– for Zattoo for this month so that I can watch the Olympics on my own schedule. It’s pretty sweet, especially for hockey games.
Zattoo keeps a 7-day buffer for over 100 channels. You can actually watch for free, but you don’t get HD and you have to watch extra, Zattoo-specific commercials. The Olympics coverage is remarkably commercial-free, at least on the Swiss (Swiss-German, German, French and Italian) and Austrian channels. The German channels have more advertisements but mostly between events. They tend to prefer live coverage. BBC2 I’ve hardly watched at all because they show more interviews and adverts than sports.
What did I think of the hockey games? Latvia played with tremendous heart, proving once again that teamwork can be (almost) equal to loading up on raw NHL talent. Canada played hard but seemed to be thinking about the next match already.
In the US-Czech game, the US showed off a lot of talent but also benefited from more than its share of lucky bounces. They are to be credited with going at the net, but the 5 goals they got (on 25 shots) included a few ugly ones. The right team definitely moved on, though.
The Russians would have loved to have had half the luck of the Americans in their game against Finland. With 38 shots and only 1 goal, it was kind of a sad loss because they, perhaps even more than the US, play an absolutely lovely, balletic passing-style hockey with lots of speed and chances. They dominated the offensive zone for long minutes at a time—even at 5 on 5—but they just couldn’t score.
The story of the Olympics, at least over here in good ol’ Switzerland, is the Swiss women’s hockey team, who showed a tremendous will to deliver what I think is the only rally-win of this Olympics. That almost never happens to Swiss teams—rallying isn’t our thing. It was an exciting game with some decent (non-checking) hockey.