Wednesday, November 19, 2014

Mono for Unreal Engine




Earlier this year, both Epic Games and CryTech made their Unreal Engine and CryEngine available under an affordable subscription model. These are both very sophisticated game engines that power some high end and popular games.

We had previously helped Unity bring Mono as the scripting language used in their engine and we now had a chance to do this over again.

Today I am happy to introduce Mono for Unreal Engine.

This is a project that allows Unreal Engine users to build their game code in C# or F#.

Sunday, November 16, 2014

Migrating from Silverlight to AngularJS




Introduction
What attracted many developers to Silverlight starting back in 2007, was that it allowed us to write maintainable web applications quickly and easily. This was largely due to MVVM, a pattern that separates logic from presentation. The ViewModel portion of the app, written in C# or VB, contains all of the logic, which makes it easy to test and maintain. The View portion of the app is written in XAML, using a rich library of supporting classes and controls.

When Microsoft decided to stop investing in Silverlight, many developers were faced with a tough decision. How could they migrate to modern web platforms and not throw away all the benefits of MVVM and the knowledge they gained by using Silverlight?

At ComponentOne, a division of GrapeCity, we faced this challenge ourselves. We studied the alternatives and concluded that HTML5 and application frameworks such as AngularJS seemed like the best option going forward. AngularJS provides the key ingredients: a solid framework for single-page applications, a templating mechanism, and basic support for MVVM. All it was missing were the controls and a few essential classes required to create traditional MVVM apps.

Well, we know how to write controls. So we decided to add what was missing.

The result is Wijmo 5, our latest control library for HTML5 and JavaScript development. Wijmo 5 is a true HTML5 solution, based on JavaScript and CSS. It includes all of the controls commonly used in LOB (line of business) applications, as well as JavaScript implementations of the ICollectionView interface and a concrete CollectionView class.

Together with AngularJS, Wijmo 5 provides a great platform for porting existing Silverlight applications and also for creating brand new web applications faster than you ever thought possible.

Read more: Codeproject

Visual Studio 2015 Preview Features – Part 1

 




Visual Studio 2015 Preview has been released with support for cross platform device development in C++ in addition to an Android emulator, updated tooling for Apache Cordova, the open source .NET compiler platform, support for ASP.NET 5. The preview also includes many new updates and improvements.

Visual Studio 2015 adds support for cross-platform mobile development using C++ leveraging the open source Clang and LLVM toolchain. It enables developers to share, reuse, build, deploy and debug libraries for other operating systems in Visual Studio.

With the help of Visual Studio 2015 Preview, you will be able to create projects from templates for Android Native Activity apps or for shared code libraries that you can use on multiple platforms and in Xamarin hybrid apps. It is also possible to set breakpoints, watch variables, view the stack and step through code in the Visual Studio debugger.

In addition to the currently available emulator for Windows Phone, Visual Studio 2015 includes a powerful emulator for Android. This means that you will be able to test Android apps from within Visual Studio.

Read more: DZone

Microsoft Open Sources .NET and Mono

Today, Scott Guthrie announced that Microsoft is open sourcing .NET. This is a momentous occasion, and one that I have advocated for many years.

.NET is being open sourced under the MIT license. Not only is the code being released under this very permissive license, but Microsoft is providing a patent promise to ensure that .NET will get the adoption it deserves.

The code is being hosted at the .NET Foundation's github repository.

This patent promise addresses the historical concerns that the open source, Unix and free software communities have raised over the years.

.NET Components

There are three components being open sourced: the .NET Framework Libraries, .NET Core Framework Libraries and the RyuJit VM. More details below.

.NET Framework Class Libraries
These are the class libraries that power the .NET framework as it ships on windows. The ones that Mono has historically implemented in an open source fashion.

The code is available today from http://github.com/Microsoft/referencesource. Mono will be able to use as much a it wants from this project.

We have a project underway that already does this. We are replacing chunks of Mono code that was either incomplete, buggy, or not as fully featured as it should be with Microsoft's code.

Tuesday, November 11, 2014

XAML Organization




We've worked on countless WPF and Silverlight projects over the past several years and throughout that time, we've refined both our process and the organization of our solutions.  We pass off front-end code to our client developers.  So clean, understandable organization is extremely important for an effective transfer of knowledge.

Most of the development teams that we work with are well versed with c# code, programming methodologies, and best practices.  But typically we find that XAML is not something that they care much about.  Due to this lack of interest folks tend to not put much up-front thought into how their Resource Dictionaries are organized, nor is there much in the way of guidance from Microsoft.  So then 3 months into their development cycle the application looks great from a code perspective, especially if the Model View ViewModel (MVVM) paradigm is followed, but digging into the various styles, templates, brush resources, etc… reveal a lot of problems.
...
...

Rule#1: One Style per Resource Dictionary

For all but the smallest, apps, you will want to follow this rule.  It is much easier to find a style within a directory than if it is buried deep inside of a gigantic "catch-all" Resource Dictionary.  It is very similar to the c# rule of one class per file.  Now there are exceptions to rule #1,  we do occasionally package up more than one style in a Resource Dictionary, but only if there is a tight pairing between styles such as a small supporting style that the main style needs.  A good example of this is the button style that a scrollBar uses for "Line up"/"Line Down" buttons.  We would package these styles together.

Rule #2: Resource Dictionary named to match contained style

Simple enough, if you have a named style called "HelpButtonStyle", name the Resource Directory "HelpButtonStyle.xaml".  If you have a nameless style that acts as the default for a control, name the Resource Dictionary the same as the TargetType, for example "ComboBoxStyle.xaml"

Rule #3: No resources directly in App.xaml (only ResourceDirectory merging)


Read more: Projekt202


Monday, November 10, 2014

ILSpy, the Visual Studio Extension




Today's Visual Studio Extension is one that can and will come in handy and is a must tool belt have...

Sometimes you've got an assembly, but no PDB or Source, and you just need to peek at how it works. Years ago, we highlighted the open source decompiler ILSpy, I spy with my little eye... ILSpy.

Today we're highlighting a Visual Studio Extension that makes ILSpy that much easier to use, almost too easy (insert "With great power, comes..." here)

Read more: Channel9

Thursday, November 06, 2014

Differences between nanomsg and ZeroMQ

Differences between nanomsg and ZeroMQ

Licensing

nanomsg library is MIT-licensed. What it means is that, unlike with ZeroMQ, you can modify the source code and re-release it under a different license, as a proprietary product, etc. More reasoning about the licensing can be found here.

POSIX Compliance

ZeroMQ API, while modeled on BSD socket API, doesn't match the API fully. nanomsg aims for full POSIX compliance.
  • Sockets are represented as ints, not void pointers.
  • Contexts, as known in ZeroMQ, don't exist in nanomsg. This means simpler API (sockets can be created in a single step) as well as the possibility of using the library for communication between different modules in a single process (think of plugins implemented in different languages speaking each to another). More discussion can be found here.
  • Sending and receiving functions (nn_send, nn_sendmsg, nn_recv and nn_recvmsg) fully match POSIX syntax and semantics.
Implementation Language

The library is implemented in C instead of C++.
  • From user's point of view it means that there's no dependency on C++ runtime (libstdc++ or similar) which may be handy in constrained and embedded environments.
  • From nanomsg developer's point of view it makes life easier.
  • Number of memory allocations is drastically reduced as intrusive containers are used instead of C++ STL containers.
  • The above also means less memory fragmentation, less cache misses, etc.
  • More discussion on the C vs. C++ topic can be found here and here.
Pluggable Transports and Protocols

In ZeroMQ there was no formal API for plugging in new transports (think WebSockets, DCCP, SCTP) and new protocols (counterparts to REQ/REP, PUB/SUB, etc.) As a consequence there were no new transports added since 2008. No new protocols were implemented either. The formal internal transport API (see transport.h and protocol.h) are meant to mitigate the problem and serve as a base for creating and experimenting with new transports and protocols.

Please, be aware that the two APIs are still new and may experience some tweaking in the future to make them usable in wide variety of scenarios.
  • nanomsg implements a new SURVEY protocol. The idea is to send a message ("survey") to multiple peers and wait for responses from all of them. For more details check the article here. Also look here.
  • In financial services it is quite common to use "deliver messages from anyone to everyone else" kind of messaging. To address this use case, there's a new BUS protocol implemented in nanomsg. Check the details here.
Threading Model

One of the big architectural blunders I've done in ZeroMQ is its threading model. Each individual object is managed exclusively by a single thread. That works well for async objects handled by worker threads, however, it becomes a trouble for objects managed by user threads. The thread may be used to do unrelated work for arbitrary time span, e.g. an hour, and during that time the object being managed by it is completely stuck. Some unfortunate consequences are: inability to implement request resending in REQ/REP protocol, PUB/SUB subscriptions not being applied while application is doing other work, and similar. In nanomsg the objects are not tightly bound to particular threads and thus these problems don't exist.

  • REQ socket in ZeroMQ cannot be really used in real-world environments, as they get stuck if message is lost due to service failure or similar. Users have to use XREQ instead and implement the request re-trying themselves. With nanomsg, the re-try functionality is built into REQ socket.
  • In nanomsg, both REQ and REP support cancelling the ongoing processing. Simply send a new request without waiting for a reply (in the case of REQ socket) or grab a new request without replying to the previous one (in the case of REP socket).
  • In ZeroMQ, due to its threading model, bind-first-then-connect-second scenario doesn't work for inproc transport. It is fixed in nanomsg.
  • For similar reasons auto-reconnect doesn't work for inproc transport in ZeroMQ. This problem is fixed in nanomsg as well.
  • Finally, nanomsg attempts to make nanomsg sockets thread-safe. While using a single socket from multiple threads in parallel is still discouraged, the way in which ZeroMQ sockets failed randomly in such circumstances proved to be painful and hard to debug.
(+more)

Read more: nanomsg.org


Monday, November 03, 2014

dot42 - C# for Android





In a nutshell

Write Android apps in C# without any runtime requirements such as Mono, resulting in small packages. 
Run, deploy and debug right from Visual Studio or SharpDevelop. 
By design, all Android devices are supported.

Read more: dot42

Wednesday, October 22, 2014

#1,185 – ItemsControl Customization Summary

You can can customize an ItemsControl, or any of the controls that derive from it (ComboBox, DataGrid, ListBox, TabControl, TreeView et al), in a number of ways.  The various customization mechanisms are summarized below.
  • Set Style to apply a set of property values for the main control
  • Set Template to change the control template of the control.
    • This changing the highest level of the control (e.g. for a ListBox, a Border wrapping a ScrollViewer, in turn wrapping an ItemsPresenter)
  • Set ItemsPanel to change the panel used to lay out the individual items
    • E.g. User horizontally oriented StackPanel to lay out ListBox items horizontally, rather than vertically
  • Set ItemContainerStyle to set properties that apply to the container for each item
    • E.g. Properties that apply to each ListBoxItem within a ListBox
  • Set ItemTemplate to change the data template used to render each item in the list
    • E.g. Create a custom layout for each item in a ListBox

Visual Studio 2013 Update 4 RC now Available

Visual Studio 2013 Update 4 RC is now available to download. This release has lots of small features and fixes for ASP.NET and web platform, Team Foundation Server, Visual C++, JavaScript Editor, Testing Tools, and some other areas. Specifically for updates to the web development tools checkout this new features announcement on .NET web development and tools blog.

The release notes have the complete list of features and fixes included in this release.

Read more: MS Download

Tuesday, October 21, 2014

Батники против эксплойтов

Я понимаю, что для всех батники выглядят как нечто очень простое и со времен AUTOEXEC.BAT уже практически забытое, в то же время эксплойты, если вы конечно не профессиональный исследователь уязвимостей, выглядят очень сложно и практически неправдоподобно, особенно для некоторых разработчиков. Но! В данном посте я постараюсь перевернуть эти представления и рассказать, что всё как будто наоборот. Батники чуть легче и сильнее по функционалу brainfuck'а, а эксплойты не страшнее сортировки пузырьком на basic'е. 

Как я до этого дошел?

Мне тут на глаза попалась коробка с Windows 7 x64 c минимальными системными требованиями в 2 ГБ оперативной памяти! И я тут подумал, неужели во всех этих гигабайтах не найдётся пары килобайт кода, которые могли бы защитить пользователей от такой напасти, как эксплойты и Drive-by? Это бич всех ОС от MS уже лет пять! Должны быть там средства для хоть какой-то защиты? Но как их заюзать, да еще и стандартными средствами? С помощью батников. А как? Чтобы это понять, нужно прочитать эту простыню до конца. 8) 

Теория

В упрощенной теории срабатывания эксплойтов всё выглядит так: «что-то где-то посмотрели, что-то где-то послали, что-то где-то запустилось». В реальной жизни это часто выглядит так: пользователь, гуляя по интернетам, попадает на честно взломанный сайт, где ему вместе с полезной информацией отдают или JavaScript или редирект на JavaScript, который, анализируя USER-AGENT, информацию о плагинах и т.д. выдаёт пользователю эксплойт, который точно у пользователя сработает. После этого на машину пользователя сгружается троянец, запускается, прописывается в системе и начинает делать свои грязные дела. 

Read more: Habrahabr.ru

Thursday, June 05, 2014

Visual Studio "14" CTP




  Today, we are making available a first community technology preview of the next version of Visual Studio, codenamed Visual Studio "14".  This early build is focused on enabling feedback and testing from the Visual Studio community.  Visual Studio "14" will most likely be available sometime in 2015, with a more complete preview release and final naming available later this year.  Given that this is a very early build, please install in a test environment with no earlier versions of Visual Studio installed.

You can read about the new features and known issues in this first Visual Studio "14" CTP, and also download today.

Over the last 3 months, we've announced many exciting technologies that will be important parts of Visual Studio "14" - including the "Roslyn" .NET compiler platform, ASP.NET vNext and Apache Cordova tooling.  The Visual Studio "14" CTP 1 includes a few of these tools, as well as many additional improvements across Visual Studio, including an early look at some new C++ 11 support that will be part of Visual Studio "14".

C# and VB with the .NET Compiler Platform ("Roslyn")

In Visual Studio "14", the C# and VB compilers and IDE support are fully built on the .NET Compiler Platform ("Roslyn").  This open-source compiler as a service now sits behind dozens of developer experiences in Visual Studio "14", powering build, IntelliSense, refactoring, CodeLens, debugging and many more features developers use every day.  In most places the experiences are unchanged, but there have also been many small improvements across the entire development experience as part of the new compiler platform.

Read more: Somasegar's blog
Read more: Visual Studio

Monday, May 19, 2014

#466 – Using a GridSplitter in Conjunction with a SharedSizeGroup



A GridSplitter allows a user to change the size of a row or column by dragging a visual splitter.  A SharedSizeGroup allows two rows or columns to automatically have the same size.  You can combine these concepts, allowing a user to change the size of one column and have another column automatically have the same size.
In the example below, the user can drag either splitter, but when dragging, the width of both left and right columns changes at the same time.

<Grid Grid.IsSharedSizeScope="True">
    <Grid.ColumnDefinitions>
        <ColumnDefinition SharedSizeGroup="A" Width="Auto"/>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition/>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition SharedSizeGroup="A" Width="Auto"/>
    </Grid.ColumnDefinitions>
 
    <Label Content="Left" Background="Azure" Grid.Column="0"/>
    <Label Content="Middle" Background="Lavender" Grid.Column="2"/>
    <Label Content="Right" Background="Moccasin" Grid.Column="4"/>
 
    <GridSplitter Grid.Column="1" Width="8" Background="DarkSlateBlue"
                    HorizontalAlignment="Center" VerticalAlignment="Stretch"/>
    <GridSplitter Grid.Column="3" Width="8" Background="DarkSlateBlue"
                    HorizontalAlignment="Center" VerticalAlignment="Stretch"/>
</Grid>

Tuesday, May 13, 2014

#575 – PropertyMetadata vs. FrameworkPropertyMetadata

     When you implement a custom dependency property and you register the property by calling DependencyProperty.Register, you specify some metadata for the property by passing it an instance of PropertyMetadata.  This can be an instance of the PropertyMetadata class or an instance of one of its subclasses.  The differences are shown below.

PropertyMetadata – Basic metadata relating to dependency properties
  • CoerceValueCallback – coerce the value when being set
  • DefaultValue – a default value for the property
  • PropertyChangedCallback – respond to new effective value for the property

UIPropertyMetadata – derives from PropertyMetadata and adds:
  • IsAnimationProhibited – disable animations for this property?

FrameworkPropertyMetadata – derives from UIPropertyMetadata and adds:
  • AffectsArrange, AffectsMeasure, AffectsParentArrange, AffectsParentMeasure, AffectsRender – Should layout calculations be re-run after property value changes?
  • BindsTwoWayByDefault, DefaultUpdateSourceTrigger, IsDataBindingAllowed, IsNotDataBindable – Dictates how property participates in data binding
  • Inherits, OverridesInheritanceBehavior – Does inheritance work for this property?
  • Journal – Store this value when journaling?
  • SubPropertiesDoNotAffectRender – Check properties of this object when layout changes?

Monday, May 12, 2014

How to build Mono 3.4.0 / 3.4.1 on Windows

Introduction

This article builds on and updates a number of existing articles which attempt to describe the build process for Mono on Windows.

If you are just looking for Mono 3.4.0 binaries to use, I have provided the resulting binaries from this walk-through here.

The baseline instructions from the Mono project can be found here.

In theory these should be enough to get Mono compiled but, as ever in the real world, things are slightly more complex. As a result others have written pieces on how to build Mono, and I have found "Building Mono on Windows: The Final Battle" particularly useful.

That said, these articles are now a few years old and I ran into various issues building Mono which I have attempted to address with the walk-through below,

We are going to look both at building from the current, at the time of writing, Mono release tarball (3.4.0) and then at building the "latest and greatest" directory out of the git repository

The sequence of events is as follows,

Install pre-compiled Mono
Install & configure Cygwin
Retrieve and extract tarball Mono Sources
Build and Mono
Modify Cygwin/Mono to address any build failures
Install Mono and modify installation
Fix-ups/workarounds for Xamarin Studio
Retrieve and build git Mono Sources
This walk-through has been tested on an x64 machine running Windows 8.1.
Install pre-compiled Mono binaries

A stable, pre-compiled build of Mono 3.2.3 can be downloaded here. Download and install this.

Check that it runs by opening a Mono command prompt from the start bar and typing

mono --version 

You should see Mono come up and the 3.2.3 version shown

C:\Program Files (x86)\Mono-3.2.3>mono --version
Mono JIT compiler version 2.10.9 (tarball)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-pro
        TLS:           normal
        SIGSEGV:       normal
        Notification:  Thread + polling
        Architecture:  x86
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)
C:\Program Files (x86)\Mono-3.2.3> 

Read more: Codeproject