VS 2010 Database projects - treat your database as code

by Vlad 29. July 2010 21:09

Before

Working on a project that includes a database implies dealing with the schema changes and versions. The problem is that the tools that can help you are pretty expensive and (from my experience) not 100% reliable. It was so bad that my team and I developed our own database versioning mechanism and even started working on a tool to automate it.

What I want

I want to be able to deal with the database schema objects the same way i deal with the code files - specifically, I want to be able to see a svn history for them.

I want to be able to deploy a new version of the database to test and production servers AUTOMATICALLY, without worrying about data loss.

I want to be able to restore an old backup (like one with specific test data) of the database and update it to the latest version.

I want to keep the developer, test and production databases in sync (that is, the schema is the same for the same version).

I want the configuration data (read-only data like states and cities) to be included in the versioning system. More...

Categories: Databator | SQL

Agile vs Plan Driven

by Vlad 29. July 2010 18:51

If you ever had to convince a client or a boss why Agile works, you know that it's not an easy task. Agile goes against many ideas that are considered axioms in the business world - like planning first and then keeping to that plan: "plan your work, then work your plan". If that is the case, these points from a talk by Martin Fowler and Neal Ford (ThoughtWorks) might help you.

In the Plan Driven approach, a project is successful if it goes according to plan, so in software development it depends on requirements stability, on having clear and fixed requirements. As you probably know, that is a luxury most software projects don't have, and a first approach would be to apply techniques like Change Management or Sign In Blood to contain the changes. Unfortunately that leads to unhappy clients and unusable software.

The Agile approach is to break the dependency on requirements stability and come up with a process that takes into account changes. It does that by using Adaptive Planning and Evolutionary Design.

Adaptive planning implies going through the project cycle many times, re-planning and re-adapting often.

Evolutionary design can be achieved with the help of practices like Self Testing Code, Continuous Integration, Refactoring and Simple Design.

If this made you curious, I highly recommend that you view the complete talk here:

 

Pourquoi, pas comment
Pourquoi, pas comment

USI 2010 : conférence incontournable du l'IT en France
Rendez-vous annuel des Geeks et des Boss souhaitant une informatique qui transforme nos sociétés, USI est une conférence de 2 jours sur les sujets IT : Architecture de SI, Cloud Computing, iPhone, Agile, Lean management, Java, .net... USI 2010 a rassemblé 500 personnes autour d’un programme en 4 thèmes : Innovant, Durable, Ouvert et Valeur.
Plus d'informations sur www.universite-du-si.com

 

VS 2010: Web.Config Transforms extra spaces problem

by Vlad 21. July 2010 20:38

In Visual Studio 2010 you can use xdt transforms to fill the web.config files with the appropriate values for deployment to test or production environments.And it is pretty simple to use:

  • - add Config Transforms to the web.config (like web.Debug.config)
  • - duplicate the sections with the values you want to customize
  • - set the xdt:Locator attribute for the nodes that need to be identified by an attribute (like xdt:Locator="Match(name)")
  • - set the xdt:Transform to control how the values are changed (common uses - xdt:Transform="SetAttributes" to update some attribute values, or xdt:Transform="Replace" to replace the whole node
  • - you get the transformed web.config when publishing or creating a deployment package (or you can create it from command line).

More details on how to use the Web.Config Transformation here.

 

However, there is a nasty bug that you won't probably notice before publishing for the first time.

Let's say that you want to replace a value that is not an attribute, but the inner text of a node.

 <value>Default value here</value>

You can write the transform like this:

 <value xdt:Transform="Replace">Production value</value>

The problem is that in the generated web.config file the value will appear like this:

 <value>Production value
 </value>

The extra spaces (and newline) will be passed to the value and can generate problems if the setting represents a file path for example.

According to Microsoft, this is a known bug and will be fixed in the next Service Pack for Visual Studio.

 

The workaround is to trim the value before using it in code, but that won't help you if the setting belongs to a 3rd party component that you can't modify.

 

Categories: Gotcha | WTF

Links - 2010-07-06

by Vlad 6. July 2010 15:39

Benoit Mandelbrot: Fractals and the art of roughness

At TED2010, mathematics legend Benoit Mandelbrot develops a theme he first discussed at TED in 1984 -- the extreme complexity of roughness, and the way that fractal math can find order within patterns that seem unknowably complicated.

 

Silverlight for Symbian

Silverlight includes a runtime that is optimized to display content on memory-constrained devices. Silverlight support for Nokia S60 5th Edition devices includes:

  • The ability to view Silverlight applications in the mobile browser.
  • Tools to build Silverlight applications that target devices

Tips and Tricks for INotifyPropertyChanged

As a WPF or Silverlight developer, you know that your models must implement INotifyPropertyChanged and it can be a pain. To do it safely, you really need to check to see if there are any registered handlers, then raise the event. To add insult to injury, the event arguments take a string, so if you mistype the property name you're out of luck. Some clever individuals have created nice code snippets to generate the needed plumbing, but it doesn't help with refactoring.

One common solution is to create a base class that provides the plumbing for a raise property notification.

Import Art from Photoshop and Make into Silverlight Controls

In this tutorial, we’ll take graphics created in Adobe Photoshop and Illustrator, import them into Expression Blend and then quickly turn the visual assets into interactive Silverlight controls.

Create a Custom Control - Inheriting from TextBox

When a control almost does what you want it to – if only it had another button or behaved slightly differently – you may be able to extend it by writing a custom control. Custom controls let you change an existing control or write a completely new control.

Categories: News | Silverlight

Monterrey geeks - Extreme Tuesday May 18th

by Vlad 17. May 2010 11:49

For Monterrey geeks: I'm organizing an "Extreme Tuesday" meeting (which I hope can turn into a regular event).

The idea is to get together and talk about geek stuff - agile, TDD, software development, mobile technologies, Silverlight, .NET or whatever IT-related theme you can think of.

Place, date and time: Sierra Madre Galerias (Av. Insurgentes), Tuesday May 18th 2010 staring at 7 PM.

If you are interested, please confirm your attendance here - Nerd Dinner or leave a comment below.

Also, comments suggesting a specific theme or topic for this first meeting are welcome.

 

Para los geeks de Monterrey: estoy organizando un encuentro de "Martes Extremo" "Martesextremo" (a sugerencia de Heriberto - there is sex in the middle Laughing).

La idea es de juntarnos y platicar acerca de cosas geek - agile, TDD, desarrollo software, tecnologias moviles, Silverlight, .NET o cualquier tema relacionada con TI que se les ocurre.

Lugar, fecha y hora: Sierra Madre Galerias (Av. Insurgentes), Martes 18 de Mayo de 2010 empezando a las 7 PM.

Si estas interesado, por favor confirma tu asistencia aqui - Nerd Dinner o deja un comentario abajo.

Comentarios que proponen un tema especifico para este primer encuentro son bienvenidos.

 

 

Categories:

DesignData support for Silverlight in Visual Studio 2010 and Blend 4

by Vlad 14. May 2010 12:52

In order to take advantage of the design-time binding support in Blend (and now VS .NET 2010), especially when using MVVM, you had these options:

1. Set the DataContext in XAML to a StaticResource (like a ViewModel) created for design only, and change it to the real thing at runtime.

Good: use the existing class structure, XAML intellisense and autocompletion.

Bad: the design-time object will get created at runtime too, cannot access private set or readonly properties, must have a parameterless constructor.

2. Create sample data in Blend (XML).

Good: can be created by designers, can use private set or readonly properties, no runtime penalty.

Bad: must be kept in sync with the actual ViewModel, no compile-time checking, no intellisense support.

DesignData

The DesignData combines the advantages of the two options - you can create a XAML with your design values, based on the existing class model.

You can take advantage of intellisense and autocompletion and you're able to set readonly properties, instantiate classes with no parameterless contructors.

The objects will be created only at design time, so there is no runtime penalty. You also get compile-time checking - you get an error if you try to set an invalid value to a int property, for example.

This functionality has been available since Blend 3, but it was (and still is) kind of hidden - in Blend 3 / VS 2008 you had to manually edit the project file to get it to work.

Fortunately in VS 2010 you don't need to edit the project file, but there still is no Item Template for DesignData files.

More...

Categories: MVVM | Silverlight | DesignData

Syntax Highlighting TextBox in Silverlight using MVVM

by Vlad 5. May 2010 19:53

This is a demo about leveraging the databinding and templating support in Silverlight and the MVVM pattern to create a simple syntax highlighting textbox control.

The idea is to have an invisible TextBox (handling the editing) overlapping a ItemsControl that uses TextBlocks to highlight the keywords in the text. The ItemsSource property of the ItemsControl is bound to a collection property on the ViewModel, so we only need to update this collection in order to maintain the controls in sync.

In the end we'll get something like this:

More...

Monterrey geeks - get together for an Extreme Tuesday

by Vlad 5. May 2010 12:11

For Monterrey geeks: I'm organizing an "Extreme Tuesday" meeting (which I hope can turn into a regular event).

The idea is to get together and talk about geek stuff - agile, TDD, software development, mobile technologies, Silverlight, .NET or whatever IT-related theme you can think of. For Heriberto: no, sports are not IT related :)

Place, date and time: Sierra Madre Galerias (Av. Insurgentes), Tuesday May 11th 2010 staring at 7 PM.

If you are interested, please confirm your attendance here - Nerd Dinner or leave a comment below.

Also, comments suggesting a specific theme or topic for this first meeting are welcome.

 

Para los geeks de Monterrey: estoy organizando un encuentro de "Martes Extremo" (que espero que se va a convertir en un evento periodico).

La idea es de juntarnos y platicar acerca de cosas geek - agile, TDD, desarrollo software, tecnologias moviles, Silverlight, .NET o cualquier tema relacionada con TI que se les ocurre. Para Heriberto: no, los deportes no son relacionados con TI :)

Lugar, fecha y hora: Sierra Madre Galerias (Av. Insurgentes), Martes 11 de Mayo de 2010 empezando a las 7 PM.

Si estas interesado, por favor confirma tu asistencia aqui - Nerd Dinner o deja un comentario abajo.

Comentarios que proponen un tema especifico para este primer encuentro son bienvenidos.

 

 

Categories: Extreme Tuesday

Filter candidates early by interviewing them online

by Vlad 9. April 2010 14:59

This happened to me lots of times:

The candidate arrives for the interview. We spend a few minutes for the introductions and small talk. Then, the first question: "What is a class and what is an object?"... <crickets>...

At this moment I normally try a few other questions, just to be polite, but my mind is made up: I just wasted my time!

It can be even worse - I get an answer that is sufficiently vague and uses some buzzwords to be considered correct. So I spend let's say 30 minutes trying to determine if the candidate knows stuff and has a problem expressing himself or he's just taking long shots with his answers.

And then, the practical part: get him or her to write some simple code -  a class with a property and a method (C#). As a programmer you probably write dozens of those each day. And that's when I have my confirmation: the candidate doesn't even know the syntax for a property or a method. He's looking for the door, thinking if it would be less shameful if he just got up and ran. And I just wasted even more of my time!

Now, on top of that, imagine that the company had to arrange transportation and accommodation for the candidate, because he/she was from another city. Or, the company has a recruiting process that requires the candidate to pass an interview with HR or to take some personality tests first. What a waste!

And it is a global problem - Coding Horror, The Non-Programming Programmer.

The solution? Interview candidates by phone or online first. Coder Proof is a free interview tool that allows you to see the candidate's skills at programming in real time. You can see how he writes code before dedicating more time and resources to bring him to the office for a face-to-face interview.

And the candidate can run at any time - there is no shame in "I just lost my internet connection". Wink

Are you satisfied with your career?

by Vlad 29. March 2010 16:32

Note: this article is about software development jobs, but most of the points made apply to any kind of job out there.

Are you annoyed that, despite your many years in the company, you still didn't get a promotion? Or even a raise?
Even worse, the company is hiring people to cover upper level openings instead of promoting you?
Do you have a boss that is 5 or more years younger than you?
Or have you been interviewed by someone that is 5 or more years younger than you?
Are you afraid that you'll have a hard time finding another job, should something happen and "separate" you from the current one?

Think about it, and don't fool yourself... If most of the above applies to you, it's ALL YOUR FAULT!

So if you think about complaining that the company you work for doesn't appreciate your true value, or that there are no jobs because of the crisis, you ARE fooling yourself.

Still not convinced? Let me ask you this:
How many books did you read last year? And I'm not asking if you read the latest Harry Potter, I'm talking about programming books, software development books. Oh, and the "red Microsoft books for certification" don't count either. Most "Microsoft Certified Application Developers" I’ve seen couldn't figure out the syntax for a property.
What new technologies have you learned in the last year? (i.e. Can you really take advantage of .NET Framework 3.5 or are you still stuck in 2.0?)
Have you learned any methodologies or programming techniques? Agile and TDD have been trendy for some time now... do you REALLY know what they are about?
How much of what you learned this year can you really take with you to the next job? It's nice that you are now an expert in using Excel as a database because that's what your current job was about, but that won't help you much in getting a job working with MS SQL 2008.
Try this Programmer Competency Matrix. Find out where you’re lagging behind.

You can stop reading now if you (still) think your career is on a good path.

Still here? Good :)
So, what do you need to do? Increase your VALUE, of course.
You could see your VALUE as what the market is prepared to pay for your knowledge and skills.

Knowledge

General - languages, methodologies, patterns & practices, software architecture, etc.
The advantage of learning a new language, for example, is that you'll be able to use that knowledge for another job, in another company. You should try to direct yourself towards really valuable knowledge - learning Visual Basic 6 will probably help you less than learning Visual Basic .NET or C#.
Domain specific - accounting, vector graphics, banking, specialized programming languages, etc.
Getting this type of knowledge can imply a greater effort and will increase your value only when dealing with companies from that specific field. So think twice before spending 6 months learning about tombs and tombstone designs.

Skills

Ex: coaching, communication, team work, leadership.

Don't expect to be put in a management position to learn about leadership. You have to show yourself as the natural choice for the job before getting it - don't expect the company to just "give you a chance" and see how it turns out. Leadership does not equal official authority. Being able to work well with the team and help get the best out of your team mates will make you more valuable than being able to code alone like crazy for hours.

Now, your VALUE is what you sell when you go to an interview or when you ask for a pay raise. If it hasn't increased, you won't have any leverage in the negotiations.

The faster you raise you value, the better. Why? Because your time is limited!
There comes a point when your age starts to work against you. Are you 35 and you only have experience in VB6? Why should someone pay you more than a 23 years old with basic knowledge of C#? It's even worse: the 23 years old might have a thirst for learning new things, but you've certainly proved that you don't.
Basically, if you increase you value slowly, there could come a time when your pay will freeze, or start to decrease, or, even worse, you won't be able to find a job.
If you raise it fast, you can get to a point where you are in upper management or you have your own business - not so many worries for the years to come. And whatever happens, you'll have your value to "sell" to the highest bidder.

Is my value rising? How fast? Is my income rising? How fast?

Ask yourself these questions. Is your value stagnant? Work on it! Your value is up and your income didn't catch up? Get a raise, or get a better paying job!
You might be able to get a better income once or twice by using your negotiating skills, even though your value is not (yet) worth it. Don’t count on it though – in the long run, the sure way to do it is to raise your value.

So keep raising it, unless you want to end up with someone young enough to be your son to humiliate you in an interview!