Blog posts tagged: visual-studio

News and other things I find interesting


RSS Feed


Jun
8
2012

Visual Studio 2012 Express for Desktop applications

Last modified: Friday, June 08, 2012

Two weeks ago I wrote this tweet that generated over 1500 link clicks alone, as well as several retweets with different untracked links.

In this blog post I mentioned that actions speak louder than words and asked Microsoft to show us their commitment to open source.

I'm happy to say that today Microsoft announced that they listened to user feedback and will now be offering a Visual Studio Express for Desktop applications.

Not having a Visual Studio Express for Desktop applications would have had a negative impact on open source. Thanks to everyone who retweeted and voted!

Tags:

Add a new comment





May
26
2012

Visual Studio 11 Express - No support for building desktop applications nor metro style enabled desktop browsers

Last modified: Sunday, May 27, 2012

Microsoft announced last week that Visual Studio 11 Express will not have support for building Desktop applications, by extension this also means that it will not have support for building metro style enabled desktop browsers.

The workaround is to install Visual Studio 2010 and use the Windows 8 SDK. This isn't a good solution, but it's even worse when you consider metro style enabled desktop browsers. This workaround won't work for metro style enabled desktop browsers that need the Visual Studio 11 compiler. The Windows 8 SDK no longer ships with a compiler of its own.

Firefox can be built with a configuration option to disable the metro bits, so you'll still be able to use Visual Studio 2010 Express to develop on Windows 8, but not if you want to work on Metro related things. In that case, you'll need to use a paid version of Visual Studio 11.

As we've seen with Visual Studio 11 though, who itself can't target Windows XP, this will eventually become a problem as Windows versions increase if no change is made by Microsoft.

I hope that Microsoft will come out with an edition of Visual Studio 11 Express for desktop development, because it hurts open source projects that want to develop for Windows 8 and beyond.

If you also think this will hurt open source development in the long run, you can vote to add support for desktop development back into Visual Studio 2010 Express. Vote it, tweet it, blog it, add comments to it.

Microsoft has previously claimed that it loves open source:

"We love open source," says Jean Paoli of Microsoft in a recent interview with Network World. "We have worked with open source for a long time now."

Actions speak louder than words, please show us.

Tags:

Add a new comment | 4 comment(s)

Gravatar image Anonymous on Saturday, May 26, 2012 (06:05:31) says:

Long-term, have you considered migrating Firefox to build with a MinGW toolchain instead?

Gravatar image Brian R. Bondy on Saturday, May 26, 2012 (06:05:28) says:

We do have some contributors building that way but it's not currently the primary way people build. And our Nightly builds and tests all run with builds made with Visual Studio currently. That wouldn't help with the Metro related bits problem also.

Gravatar image Jay on Monday, May 28, 2012 (04:05:33) says:

Microsoft doesn't like open source/free software.

Microsoft doesn't like competition.

Open source is the worst kind of competition for Microsoft.

You've 2 alternatives: don't develop for windows, find an alternative.

Don't beg. Makes you look weak!

Gives credence to those that say that open source is for "hobbyists".

Gravatar image Brian R. Bondy on Friday, June 08, 2012 (06:06:21) says:

Please see here:
http://www.brianbondy.com/blog/id/143/visual-studio-2012-express-for-desktop-applications

Microsoft does like open source, they just made a temporary bad decision which they corrected.

Also there's a big difference between advocating and begging.





Oct
23
2010

Windows Phone 7 development overview in 2 minutes

Last modified: Thursday, April 28, 2011

For fun I decided to look into Windows Phone 7 (WP7) Operating System (OS) development. Microsoft is definitely trying to reinvent its Mobile image with WP7 and they are spending over $400 million on marketing to do so. WP7 is a fresh platform for Microsoft and competes against iOS, Android, and Blackberry OS.

I currently own an Android HTC phone but I'm not so keen on developing for it since the primary development language is Java. Primarily I'm a Native C++ and .NET developer.

At first I didn't want to even look at WP7, but after spending a few hours reading about it I've changed my initial perception completely. I decided to write my equivalent to "Hello World" which is a Pi Memorize program that I made in MFC around 13 years ago. Pi Memorize is a small tool that helps you learn Pi to 10,000 digits.

WP7 is Microsoft's entirely new mobile OS and it is not compatible with the existing Windows Mobile which was based on Windows CE. WP7 is expected to be released in November of 2010 and unlike iOS and Blackberry OS, it is not a closed platform. Providers of the WP7 OS include HTC, Dell, Samsung, LG, and more. Apps made for Windows Mobile cannot be used directly on WP7.

WP7 development is based on Silverlight 3 (with some features from Silverlight 4), XNA Game Studio, and the .NET Compact Framework 4. I was a little disappointed to see that there is no native development with access to lower level things via writing a hypothetical native VC++ app. Windows Mobile had support for writing native apps with VC++ and also Windows Mobile had support for the .NET Compact Framework. Another missing feature that used to exist is multi-tasking, and finally cut, copy, and paste functionality.

Silverlight is the main way to make an app in WP7 and if you don't already know Silverlight is based on XAML and is similar but has a much nicer development stack (in my opinion) to Adobe's Flash. User interfaces in Silverlight are made in a declarative language called Extensible Application Markup Language (XAML). Silverlight is based on WPF and shares its XAML support.

XNA is familiar to game developers for Xbox and it is also based on the .NET Compact Framework.

To publish your application you need to buy a yearly renewable membership for $119 USD. The submission process works by submitting a .xap package which is just a renamed .zip with all of the application files. In order to successfully submit your app there is a known issue where you need to go to http://xbox.com/live and accept the agreement there first. Otherwise the "Submit a Windows Phone 7" button simply redirects you back to App Hub / create.msdn.com.

To get started in development you can download the WP7 development toolkit which includes an emulator, Visual Studio 2010 Express, XNA Game Studio, and the needed WP7 development tools. If you already have Visual Studio 2010 installed it will install the additional tools needed without installing Visual Studio 2010. From the Visual Studio New Project Window, you will notice you have additional tab pages for "XNA Game Studio 4.0 and "Silverlight for Windows Phone".

I developed only a small application, but from start to finish it only took me 5 hours, including downloading and installation, and I've never used Silverlight before; however, I have developed some apps with WPF.

Surprisingly the hardest part of the whole development was simply figuring out how to restrict a user to only be able to type numbers. To do this you can simply use a Textbox.InputScope element:

<TextBox Name="digitsText" TextWrapping="Wrap" Height="340" HorizontalAlignment="Left" Margin="-5,31,0,0" Text="" VerticalAlignment="Top" Width="460" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" DataContext="{Binding}" KeyDown="digitsKeyDown">
  <TextBox.InputScope>  
    <InputScope>
      <InputScopeName NameValue="TelephoneNumber"/>
    </InputScope>
  </TextBox.InputScope>
</TextBox>

This makes it so the textbox input consists of only the characters which are available to you when entering a phone number.

To restrict the keys in that input scope such as #, *, . and space I had to write some code behind via handling the KeyDown event:

private void digitsKeyDown(object sender, KeyEventArgs e)
{
    bool isValid = e.Key >= Key.NumPad0 
                        && e.Key <= Key.NumPad9;

    //Don't allow input if we have # or * or ...
    e.Handled = !isValid;
    //...
}

To embed the actual digits of Pi I simply added an embedded resource to the project called PiDigits.txt which contained Pi to 10,000 digits. I loaded that resource at runtime with the following code into a string variable called correctPiDigits.

Assembly asm = this.GetType().Assembly;  
Stream stream = asm.GetManifestResourceStream("PiMemorize.PiDigits.txt"); 
StreamReader reader = new StreamReader(stream);
correctPiDigits = reader.ReadToEnd();
//...

Here are some screenshots of the WP7 app that I made:

Tags:

Add a new comment





Jul
28
2009

Slow compilation time in C/C++

Last modified: Friday, April 22, 2011

Compilation in C/C++ is a very big operation due to C/C++'s complex grammar. Source files typically residing in .cpp are always only compiled one time; however, header files typically residing in .h files are compiled once per compiler execution. Each header file needs to be recompiled because there could be different effects made from the preprocessor.

Since an individual header file is often compiled many times, header compilation as a whole can make up a large part of your total C/C++ compilation time.

Two of ways you can do to reduce this portion of compilation time is:

  1. Forward declarations
  2. Precompiled headers

Forward declarations

Extensively using forward declarations at all times will give you the biggest performance in compilation time.

Forward declaration means to declare something without defining it in a header file. Include the header file instead in the source file where it will be compiled and parsed only once.

c.h:

class C
{
public:
  C()
  {
  }
};

d.h:

class C; //<--- This is a forward declaration

class D
{
public:
  D()
  {
  }

  C c;
};

Notice that d.h does not include c.h even know it uses a class declared in c.h

main.cpp:

#include "c.h"
#include "d.h"

int main(int argc, char **argv)
{
  D d;
  return 0;
}

In main.cpp it is important that you include c.h before d.h; otherwise, the compiler will complain about C being an undefined type.

Note you can also perform forward declarations with template types:

template <typename T>
class CMyClass;

Precompiled headers

Precompiled headers allow you to speed up compile time when compiling C++ source code. You typically put anything in a precompiled header that doesn't change often or ever such as the standard library includes or boost includes.

Precompiled headers are available for most C++ compilers including GCC and Visual C++. Both of those implementations are similar.

Only 1 precompiled header can be included per compilation, so therefore at a minimum per file. But in a single project you can have several different precompiled headers.

In Visual C++ the compiled headers have an extension of .pch and in GCC they have an extension of .gch.

In GCC you compile headers just like any other file but you put the output inside a file with a suffix of .gch.

So for example if you precompile stdafx.h you will have a precompiled header that will be automatically searched for called stdafx.h.gch anytime you include stdafx.h

stdafx.h:

#include <string>
#include <stdio.h>

a.cpp:

#include "stdafx.h"

int main(int argc, char**argv)
{
  std::string s = "Hi";
  return 0;
}

Then compile as:

> g++ -c stdafx.h -o stdafx.h.gch
> g++ a.cpp
> ./a.out

Your compilation will work even if you remove stdafx.h after step 1.

Tags:

Add a new comment | 2 comment(s)

Gravatar image Jack on Wednesday, July 28, 2010 (04:07:30) says:

Brian,

Unfortunately your forward declaration example does not seem to be demonstrating anything. main.cpp will compile just fine without the forward declaration in d.h.

Perhaps there is something missing from the example? I am interested because I have a rather large C++ project that I would love to speed the compile time up for.

Jack

Gravatar image Brian R. Bondy on Monday, August 02, 2010 (09:08:47) says:

Ya the example was just to show what a forward declaration is. You can see the benefit in a large header file that has a lot of things in it. When header files include other header files you then have a lot of parsing that you don't need to do.





Sep
9
2006

Visual studio C++ suggestion

Last modified: Friday, April 22, 2011

When adding a header file include that is not from a directory in your include directories, it should ask you: "Would you like to add [path] to your include directories?"

Tags:

Add a new comment





Next page