This is default featured slide 1 title

You can completely customize the featured slides from the theme theme options page. You can also easily hide the slider from certain part of your site like: categories, tags, archives etc. More »

This is default featured slide 2 title

You can completely customize the featured slides from the theme theme options page. You can also easily hide the slider from certain part of your site like: categories, tags, archives etc. More »

This is default featured slide 3 title

You can completely customize the featured slides from the theme theme options page. You can also easily hide the slider from certain part of your site like: categories, tags, archives etc. More »

This is default featured slide 4 title

You can completely customize the featured slides from the theme theme options page. You can also easily hide the slider from certain part of your site like: categories, tags, archives etc. More »

This is default featured slide 5 title

You can completely customize the featured slides from the theme theme options page. You can also easily hide the slider from certain part of your site like: categories, tags, archives etc. More »

 

Orthodoxy vs. Pragmatism, or How I Became a Better Developer

Few indeed are the practices that can be recommended universally. Wisdom suggests the humility of knowing this and applying it liberally.
Dr. Dobb’s Design Articles

Acquiring Big Data Using Apache Flume

Data analysis is only half the battle; getting the data into a Hadoop cluster is the first step in any Big Data deployment. Apache Flume uses an elegant design to make data loading easy and efficient.
Dr. Dobb’s Database Articles

Detailed Profiling of SQL Activity in MySQL 5.6

MySQL’s latest update to the Performance Schema brings the ability to profile an statement’s activity, low-level wait events, and I/O impact. It is the easiest and most detailed way to identify what statements to tune and how.
Dr. Dobb’s Database Articles

The joy of being a programmer

I am programming since I am 10 and I am now 38. Today I measure how much good programming bring to my life, directly and indirectly. I’d like to give credit to aspects I love in this job. Hopefully some young people will read this and will consider maybe doing one of the most wonderful job on earth.

Getting in the flow: According to wikipediaflow is the mental state of operation in which a person performing an activity is fully immersed in a feeling of energized focus, full involvement, and enjoyment in the process of the activity. In essence, flow is characterized by complete absorption in what one does. Focus, immersion, being concentrated, involvement …  being everyday in the flow by coding hours and hours, contribute a lot to a solid positive state of mind.  These are moments where one can completely forget about minor everyday pesky stuff, but also forget for a while more serious problem in life everyone has to face. Being in the flow is the condition to solve challenging problems and to create beautiful pieces of engineering. Being in the flow can lead to addiction but it is not addiction. This is essential to control when to check-in in the flow and when check-out, making sure to not be disturbed meantime.

Being creative: Being a software engineer is one of the most mainstream way of being paid for being creative. Often, writing software is deemed to be an artistic activity. A programmer has to be humble, because this is a kind of art not understood by the mass. But being humble is a chance to become wiser and increase self-confidence. Also, knowing you are going to be creative for a while, is an excellent motivation to overcome the first step effort to jump in the flow. But the truth is that for every passionate programmer, there is a background thread in the mind in charge of creativity (often running at sleep-time), that makes it so that in the morning the envy to create what you have in mind is too strong.

Becoming an expert: It is common to hear that a programmer must know numerous technologies, that its skill is to learn how to learn new technologies. On this I disagree because what makes me really happy is to master completely a technology and exercise daily my expertise. I used to master all the tricky details of C++ and COM and it was fun. Before that I used to master some assembly level programming and it was fun, I was not even getting paid for that. In 2002/2003 and then  2005 I wrote two editions of a 1.000 pages book on .NET and C# and writing it has been one of the most blessed moment in my career. Since then I capitalize on this knowledge every single hour of coding, letting me focus my thoughts on problems to solve, and not on all the non-trivial things a complex platform like .NET is actually performing under my feet. Of course I am constantly discovering new details about surrounding technologies, like functional programming paradigms through the prism of functional paradigm introduced in .NET languages. But I know what is my core knowledge, both in terms of technologies and in term of program design skills. And as long as I won’t be forced to change my core skills, relying on my expertise to express my creativity and making a living on top of it is a source of personal achievement.

Meet inspiring people sharing the same passion: I imagine meeting peers is a source of happiness for every expert in something. This is also why investing in a solid programming particular set of skills is a positive thing. Not only respect from others programmers arise, but it lets have great exchange with smart people as passionate as you. The importance of flow, underlined above, also comes with the disadvantage of being often alone with your thoughts. Most programmers enjoy working alone anyway, but for those who need a bit of more social activity, having an expertise in something is also a great way to become partly a teacher (in professional or academic spheres), partly an architect and contribute to important decisions, partly a team-leader and be responsible for project progressing, partly a consultant, and be able to share your knowledge in a pleasant social environment. I put the word partly in italic because if your social activity make it so that you are not writing code meant to be run in production anymore, you shouldn’t consider you as a programmer anymore and you’ll loose a great deal of the points I am mentioning here. If you need social interactions all day long, programming is not for you.

Being involved in something that make sense: Here also my position might be a bit different of what is widely accepted. I agree that for juniors, it is important to multiply the opportunities to work in several different teams and companies, to get an idea of what they like and what they don’t, to be influenced by several inspiring mentors. But once you become seniors, working on the same application in the long term, where you feel well programming in,  polishing it days after days, seeing its evolution across years, maintaining it in a clean state by adopting modern paradigms like automatic tests, DbC or relentless refactoring, having your word to say about strategic decisions, personally I found this being a great source of daily happiness and a great motive to involve myself! In addition, working hard to achieving important milestones regularly, is an excellent way to give a sense to your professional career, which is (much) more the exception than the rule.

Work wherever, whenever you like: A 2KG laptop with the proper tools set installed, a few hours of electricity every 24 hours, this is all what a programmer needs to do his job well. A descent internet connection is often appreciated, and there are today only few points on earth where internet is not available at all somehow. Programming might be probably the less demanding working activity in terms of time and space requirement. Getting in a flow in a 12 hours plane flying across the planet, scheduling half a year to live and work in a paradise tropical island, avoiding traffic jam by staying at home for work (in your pijama), delaying programming in the night or early morning to take care of the kids and their education, all this is not only possible but pretty common actually. Most serious software companies let some of their skilled engineers work wherever they prefer. Did you know that many of the great minds behind Visual Studio didn’t actually moved with their family to Seattle, but still live in their country, sometime far away from the US?

Make a decent living doing something you like: Last but not least, everywhere, skilled programmers get paid above the average salary in their countries, and if we take the example of a developing country like India, good programmers get a much much higher income than the average. On top of that, a skilled programmer have pretty close to zero chances to remain unemployed for a long time. This also means that if you don’t like your current position, it is easy to find a new better suited one. This situation is made possible because less than two decades ago, the modern civilization realized that IT is the condition for its development. It is a fact that many of the richest persons in the world were originally programmers and every motivated programmers has the potential to create its own ISV business and become a millionaire. A programmer can also decide to make more money by coding for the financial industry, or even bet on a startup and potential makes millions in a few years.

All the next big things will consume even more IT, this includes human genome analysis for the mass, the entire medicine that will be deeply impacted by that, more prevalent portable devices, more sophisticated entertainments, augmented reality, robots and automated machines to do surgery, to assist the increasing growing number of old people, artificial intelligence in the long term, and certainly everything nobody hasn’t imagined yet. After all 20 years ago, nobody anticipated the impact of Google. 10 years ago nobody anticipated the impact of Facebook and smart phones.

Ok enough getting in the flow of writing my passion for programming, I have some code to write before the weekend :)


CodeBetter.Com Posts

Hadoop Tutorial Series

Dr. Dobb’s Database Articles

Xamarin Evolve 2013 Talk Video – How C# Saved My Marriage

My Talk at Xamarin Evolve

In case you haven’t heard, Xamarin is a fabulous company was amazing products and their Evolve 2013 conference was absolutely smashing.

The Visual Studio Solution Explorer now has Android, iOS, and Windows all in the same place!I was fortunate enough to speak at Xamarin Evolve 2013 in Austin last month, just after lunch one day. I wanted everyone to understand how excited I am about what they’re doing, how Azure and Visual Studio appreciates them and how great it is to be a C# developer right now. So, I did a fun little talk called “How C# Saved my Marriage, Enhanced my Career and Made Me an Inch Taller.

The general story of my talk is that, like VISA, C# is everywhere I want to be. I can create apps now on iOS (iPad, iPhone), Android (Phones and Tablets), Mac desktop apps, Windows Phone, Windows (all flavors), and Windows 8 Store apps. You can use Xamarin Studio, of course, but even better, Xamarin integrates with Visual Studio wonderfully. You can literally write iPhone apps in C# from within Visual Studio and compile them using a networked Mac as a build server. It’s amazing.

I teamed up with Greg Shackles and we ported the Pan Tilt Zoom client (I already have Web and Windows Desktop versions) to iOS and Android!

Then Dominique Louis from MonoGame helped me port Daniel Plastaid’s “Disentanglment” application to Android and iOS. Now it runs on Windows 8, iOs and Android.

disentanglement

We announced better NuGet support for Mono, took a SignalR pull request for iOS support and more. It was great fun.

Here’s a screenshot I took in the middle of the talk. I used Lync and the Xamarin-powered iPhone version of our Pan-Tilt-Zoom app using SignalR to call back to the Seattle Office. Then I turned the camera around so I could see myself watching myself watching me watching the keynote.

Lyncing back to the SignalR team

It’s a great time to be developing with C# and .NET. I hope you also join me at the MonkeySpace conference (formerly Monospace) in Chicago in July. I’ll be presenting, teaming up with a friend who is launching an amazing soon-to-not-be-so-secret .NET related product that will take C# to even more places!


Big thanks to our Sponsor this week. It’s Redgate! Check out Deployment Manager – app deployment without the stress. Deploy .NET code & SQL Server databases in one simple process from a web-based UI. Works with local, remote and cloud servers. Try it free.




© 2013 Scott Hanselman. All rights reserved.

     

Scott Hanselman’s Blog

Scripting ease with Script Packs

Script Packs are a really cool extensibility point we added into scriptcs. A pack delivers a bundle of functionality that makes frameworks more palatable to consume from script. They are available as nuget packages making them very easy to consume.

For example, if you look at our Web API sample, you’ll see there’s a bunch of fiction if you just try to get web api working from scratch.

  • You need to add using statements for each namespace you want to use. This is a lot more painful than one might thing when you don’t have intellisense.
  • You need to configure web API, this involves creating a host, defining default routes etc. Adding lots of object creation and such starts to make the script pretty hairy. Not impossible, but painful when there’s no template.
  • You need to teach Web Api how to resolve controllers in script by implementing a custom controller resolver.

Now pull in the Web Api script pack (scriptcs –install scriptcs-webapi) using the Require<WebApi>() and your boiler plate code evaporates to this:

id: file:

The script pack does all of the following to make the experience better

Removes the need for using statements for common namespaces. The script pack provides those which is why you don’t have to add the web api namespaces in your example above.

Adds dll and nuget package references that bring the dependencies the framework needs.

Removes general boilerplate code. In the previous sample you need to create a host, define routes etc as I mentioned. In this case the script pack creates the host for you and configure with the default routes. You can customize if you need to.

Provide APIs to fill gaps that prevent the framework from working well in script / supporting dynamically emitted assemblies. The Web Api script pack brings in and configures a custom controller resolver for you.

We’re just getting started with the work we’ve done with script packs, but they are a really nice extensibility point and really take advantage of nuget as a delivery mechanism. The community has been rising to the occasion and building out quite the gallery as well.

There’s some great posts about script packs covering topics like how to build them or even use them from the REPL that you should really check out.

Have fun exploring the new world of scripting in C# with scriptcs!


CodeBetter.Com Posts

Working with TypeScript in Visual Studio 2012

Using Visual Studio makes working with TypeScript easy and helps reveal subtleties of the language implementation and code generation.
Dr. Dobb’s .NET Articles

@model and beyond

In my previous post I had been fiddling with the html helper used in Razor views. Since then our custom html-extensions have been doing great things for our project. To mention some:

  1. Standardizing the look and feel. It is far more consistent and maintainable to set attributes (including a css class) and event handlers in one centralized place.
  2. Simplify the script. Often a part of the logic the script will follow is already known server side. Instead of writing everything out in javascript rendering the intended statements leads to a leaner client. There is an example in my previous post on building post-data.
  3. Decoupling the libraries used. At the moment we are using the Telerik MVC suite. In my previous post I described how our html helpers build standardized Telerik components for our views. In the not to far future we want to switch to the Telerik Kendo suite. Having wrapped up the library dependency in our Html helper will make this switch a lot easier to implement.

What has evolved is the way we work with the model. In MVC the implementation of the controller and the view is clear. When it comes to the implementation of the model there are almost as many different styles of implementation as there are programmers. In general the model can bring any data to the view you can imagine. Not only the source of the data varies, from plain sql to a C# property, also the use of the model’s data varies. It can be a customers name from the database. Or it can be the string representation of some html attribute needed for a fancy picker. Here data and presentation start to get mixed up. Our extensions needed information for the Html-Id. The original Html helper had a custom constructor to get that specific data from the model into the helper. Which required to create our own htmlhelper when starting the view and use that one instead of the standard @html. As seen in the eposHtml in the previous story. It would be cleaner if our extension methods could be satisfied with the default html helper. It would also be cleaner to keep a better separation between ‘real’ data and presentation.

The model is available in every HtmlHelper extension method.

public static PostDataBuilder<TModel> PostData<TModel>(this HtmlHelper<TModel> htmlHelper)

{

    return new PostDataBuilder<TModel>(Id(htmlHelper.ViewData.Model));

}

 

It’s a property of the ViewData.

In our case we needed something to give the control an unique Id. The Id method builds that Id. Previously we passed the Id-base in the constructor, which lead to the custom helper. A far more elegant solution is using a very basic IOC-DI pattern. As implemented By the Id method

private static string Id(object model)

{

    var complex = model as IProvideCompositeId;

    if (complex != null)

        return complex.CompositeId;

    var simple = model as IProvideId;

    return simple == null ? “” :  simple.Id < 0  ? String.Format(“N{0}”, Math.Abs(simple.Id)) : simple.Id.ToString();

}

 

The method queries the model first for the IProvideCompositeId interface, in case the model does not implement that it is queried for the IprovideId interface. Resulting in a string which can be safely used in an HtmlId. (A negative number would lead to a ‘–’ in the string, which is not accepted in an Html Id).

These interfaces are very straightforward

public interface IProvideCompositeId

{

    string CompositeId { get; }

}

 

public interface IProvideId

{

    int Id { get; }

}

 

In case the model is going to be used in a view requiring unique Id’s the model has to implement one of these interfaces.

public class FactuurDefinitie : IProvideCompositeId

{

    public readonly int IdTraject;

    public readonly int UZOVI;

    public readonly bool Verzekerd;

 

    public FactuurDefinitie(int idTraject, int uzovi, bool verzekerd)

    {

        // The usual stuff

    }

 

    public string CompositeId

    {

        get { return String.Format(“{0}{1}{2}”, IdTraject, UZOVI, Verzekerd); }

    }

}

 

Working this way:

  • We can use our custom html extensions in the default html helper
  • Specific data from the model is available inside our extensions
  • The model and the view do not get entangled

The code is no big deal. I know. But the model is something whose horizons are still not in sight.


CodeBetter.Com Posts

Chasing Wi-Fi as a Remote Worker: AT&T Unite LTE Mobile Hotspot Review

AT&T Unite HotspotI’ve blogged about how being a remote worker sucks. Sometimes I just need to get out of the home office and wander around town just to be near people. There’s all this unspoken etiquette when you’re a “homeless” remote worker and you’re squatting in a café. How much do coffee does one buy in order to justified downloading an 8gig ISO over a coffee shop’s bandwidth? Will a croissant cover it? You mean you don’t like me showing up at 9am, taking a seat and leaving at 5pm?

Finding a spot is one thing, but finding good reliable internet is the biggest issue when you’re a remote working nomad. I used to collect coffee shops and rank them by bandwidth, but often they are too unreliable. I want to be able to use Skype/Lync in HD, have a clear conversation, share my screen, remote into machines, and download and upload large files without sipping through their bandwidth straw.

I’ve even stopped using hotel wireless when travelling. It’s just useless. For the last four years I’ve been carrying a Clear Hotspot around. It runs on the Sprint Network and works in all major US cities. I’ve been generally very happy with it. It doesn’t work well inside buildings, but at a hotel if I put it in the window sill I can easily watch Netflix. It’s $ 50 a month for unlimited internet and it’s faster than tethering my iPhone 4S (with its fake 4G). Why pay so much? Because Clear is effectively unlimited, unlike my capped 5 gig iPhone plan, even though Clear isn’t super fast.

The local AT&T fellow loaned me an AT&T Unite Hotspot for a few months.

The Device

The hotspot is made by Sierra Wireless. It has LTE, a lovely 2.4″ color touch screen and a large battery. It’s a comfortable size with a decent heft, most of which is battery. The battery for this hotspot is 2500 mAh, in fact and lasts a long time. I’ve accidentally left it in my bag and found it still on hours later. It’s rated for up to 10 hours of continuous use and I never had it stop on me even when using it a whole work day.

You can have up to 10 devices connected to the Unite over Wi-Fi. This is great on trips with a few laptops, phones and tablets. Multiply this by a few people and you’ll be happy you can fit 10.

It even has two external antenna spots, which could be useful when using in a building or the home as backup internet for the whole house.

The AT&T Unite LTE Hotspot sitting on a Clear Hotspot. The Unite is much larger

The touch screen is very nice, responsive and totally obvious to use.

photo 1

I love that this Unite hotspot shows not only the amount of data you’ve used but the numbers of days left until your data plan resets. This is a killer feature I miss on other hotspots.

photo 2

The Pros – Speed

Here’s the bandwidth at my local McDonald’s, whose Wi-Fi is ironically provided by AT&T Wireless (but clearly capped). Wi-Fi like this is is best for email and small videos, and clearly won’t work for anyone who tried to push it (Skype, RDP, etc). Looks like 1.76Mbps.

image

Here’s my Clear 4G Hotspot. Now, this is holding it against a window and sitting smack in the middle of 4G territory. The Clear is one of those “works great until it totally doesn’t work” things. I love it and take it everywhere, but there’s no middle ground. It either has an awesome connection, or you might as well use your 3G phone. The Clear gets 8.94Mbps

image

Here’s my iPhone 4S with Tethering (that I pay for) over Wi-Fi. This is with 5 bars on “4G” in the same location as the other devices. It’s 3G+ as far as a I’m concerned as iPhone 4S 4G is a lie. I got lucky here with 3.43Mbps, but it’s usually more like 1Mbps.

image

Here’s the AT&T Unite Hotspot, pumping not only 14.5Mbps down but nearly 6.5Mbps up. This was with just 3 bars of LTE!

image

My conclusion after using this for a few months? LTE is no joke. I’ve seen it even faster but the net result is that this Hotspot is as fast as average folks’ home internet. This extra upload headroom was totally noticeable for me when using Lync or Skype whilst sharing my screen. If you’re pushing HD video as well as sharing your screen things start getting choppy with just a megabit.

The Cons

A small device with a large battery pushing 15Mbs nearly anywhere in the US? What’s not to like? For me, the data plan.

It’s US$ 50 for 5GB and $ 10 for each additional Gig. I really like the Clear device being unlimited, and while I used the Unite HARD for two billing cycles I bumped up against the 5GB twice and ended up around 6 to 7GB. Not enough to break the bank, but enough to wish for a 10GB or 20GB plan. If I went to 10GB it would be $ 100. That said, I’m not the typical user.

Alternatively you can add the Unite onto an existing Mobile Share Plan for $ 20 a month then add buckets of data to the plan to be shared across all devices.

Conclusion

If you’ve already got an LTE phone with tethering it’s questionable if you would need an Unite, but the battery life is the kicker. My phone can only tether for a few hours when it’s being worked hard. It’s nice to have a separate device that’s just a hotspot. Also, considering my phone isn’t LTE and I have a Clear spot I’m paying for now, the Unite is an attractive alternative with almost double the speed and easily double the battery over Clear.

The Unite also has a bandwidth meter and shows the date your plan resets. This is such a nice touch. If you’re in the market for a hotspot I can recommend the AT&T Unite. Even easier if you are already an AT&T customer and just want to add the line. The Unite hardware is really impressive. I’m sad to send this device back. The perfect price point for me would be 10GB for $ 75. At that point I’d switch off Clear in a second as a portable 15Mbps a second for 10 hours is almost too fabulous to resist.


Big thanks to our Sponsor this week. It’s Redgate! Check out Deployment Manager – app deployment without the stress. Deploy .NET code & SQL Server databases in one simple process from a web-based UI. Works with local, remote and cloud servers. Try it free.


© 2013 Scott Hanselman. All rights reserved.

     

Scott Hanselman’s Blog