This is a mirror of official site: http://jasper-net.blogspot.com/

Grab 50GB of Box Online Storage Free for Life

| Thursday, February 14, 2013
Inline image 2

Need more cloud storage space? Box (formerly Box.net) is back with a new 50GB promotion, so you can store and share your files online—and now easily sync them across your devices.
Box works on mobile devices and syncs with Mac and PC. The business-friendly cloud service also handily integrates with several applications, such as Microsoft Office and Google Docs. You'll find finer sharing and security controls on Box than on many competitive services, including Dropbox.

There is a major downside, however: File upload size is limited to 250MB, so if you have large files to store, you'll need to use a different service for those.

Still, 50GB is a good deal of space to play with (and a big upgrade from the standard 5GB). This offer is valid for new customers only (or you can use the multiple Gmail alias trick by adding a period in your username). 

Read more: Lifehacker
QR: Inline image 1

Posted via email from Jasper-net

Simple golden rules for async / await

|
The async / await features in C# are incredibly easy to use but there’s a number of pitfalls than can be trap the unwary. The following are my golden rules when building any app (usually Windows 8 but now also Windows Phone 8) using the async / await features.

Always await your async operations, sometimes it’s easy to not await an async operation if you don’t need the result. By not awaiting the operation it becomes “fire and forget”, however this also means that any exceptions in the operation are swallowed and the operation could fail silently. I make sure all async operations are properly awaited so I can keep track of any errors in the system. If you need to make the operation “fire and forget” there are patterns you can use (I’ll go into these in a later post) to combine operations so you’re not holding other activity up.

Be careful around async void, there’s already advice on the internet to avoid async void methods as much as possible, but they have a habit of creeping in almost everywhere. In Windows 8 an exception that leaves an async void method will crash the process while also avoiding the Unhandled Exception handler (this does appear different in Windows Phone 8). Unfortunately you can’t easily get away from then, given that a lot of your async activity is driven from event handlers which will be async void. My golden rule is to have a strategy in error handling to make sure all errors are handled in every async void. I discuss one possible strategy in my Tech Ed talk on Windows 8 app development.

Be very careful around async lambdas, it can be very easy to use the async / await keywords inside lambdas, what is not easily apparent is the signature of the lambda. The same async lambda can be either an Action or a Func depending where you pass it, if it’s Action then you’re suddenly writing yourself an async void and the above advice applies, it also can’t be awaited with random effects. Phil Haack easily demonstrates what can happen if you get it wrong.

QR: Inline image 1

Posted via email from Jasper-net

You Want To Build Web Software with C#?

|
If you like choices, you've come at the right time. You might think the decision making process starts by choosing between ASP.NET Web Forms and ASP.NET MVC, but if you widen your perspective a bit you'll find there are even more options outside the confines of the File –> New Project dialog in Visual Studio. And, these choices have steadily increased and matured over the last few years.

Here are just a few of the other options for writing a web app today:

- Nancy (lightweight and low ceremony)

- FubuMVC (convention-based and highly compositional)

- OpenRasta (a resource oriented framework for web sites and APIs)

- Service Stack (a web services framework)

- Oak (highly dynamic, frictionless)

Even when you restrict yourself to frameworks from Microsoft, there are still a bewildering number of decisions to make. Web Pages, Web Forms, Web API, or MVC?

Making A Decision
Ultimately your job is to ship working software, and be happy about shipping the software. It's hard to build an application when you loathe working with the underlying technology. If you are brand new to all of this, I believe one of the first steps is to sit down by yourself and with your team, and figure out what you like and dislike about the available frameworks. If you are brand new to all of them, it would be worthwhile to spend a couple hours with each. Read about their design goals. Read the code examples as they will demonstrate the code you'll be living with.

Some of the questions to ask at this period include:

- What are my business requirements? Do I need to optimize for both mobile and desktop? Do I need to be highly scalable? What sort of authentication mechanisms do I need for my customers? Am I building a site, a service, or a combination of both?

- Do the abstractions make sense to me? Do the abstractions relate well with my mental modal of how things work on the web?

- What do I value the most? Testability? Flexibility? Simplicity? Past experience with an existing framework?

Read more: The ode to code
QR: Inline image 1

Posted via email from Jasper-net

How do I check if my computer has a TPM chip?

|
Inline image 2

People who have Windows 7 Ultimate and Enterprise might be interested in knowing if they have a TPM chip so they can use Bitlocker and Bitlocker To Go. Bitlocker is a drive encryption feature on Windows 7 Ultimate and Enterprise editions. It allows a person to encrypt an entire system volume in order to protect their data. Bitlocker uses the TPM chip to process and store a cryptographic key for authentication. There are a few ways you can check to see if you have a TPM chip installed on your PC. The first way, and probably the quickest and most reliable is to open up your device manager and look for something that says Trusted Platform Module. This is usually found under the Security Devices category.

Read more: Webbed Eye
QR: Inline image 1

Posted via email from Jasper-net

The Reality of Developer's Life

|
In this post I am going to try to illustrate in a funny way the reality of developer's life. This post is a translation of another post written in Spanish.

When you upload something to production environment:

Inline image 2

When my boss reported me that the module I have been working will never be used:

Inline image 3

When you go on weekend and everyone else are at office trying to fix all issues:

Inline image 4

QR: Inline image 1

Posted via email from Jasper-net

Stupid, Stupid xBox!!

| Wednesday, February 13, 2013
...
...

xBox’s primary critical problem is the lack of a functional and growing platform ecosystem for small developers to sell digitally-/network-distributed (non-disc) content through to the installed base of xBox customers, period. Why can’t I write a game for xBox tomorrow using $100 worth of tools and my existing Windows laptop and test it on my home xBox or at my friends’ houses? Why can’t I then distribute it digitally in a decent online store, give up a 30% cut and strike it rich if it’s a great game, like I can for Android, for iPhone, or for iPad? Oh, wait, I can… sort of. Read some of the fine-print at the xBox registered developer program page (that “membership” would cost you $10,000/year and a ton of paperwork, with Microsoft holding veto power over your game being published), navigate the mess through to learning about XBLA (also costly, paperwork and veto approval) and you may end up learning about a carved off little hard-to-find store with a few thousand stunted games referred to as XBLIG where Microsoft has ceded their veto power (and instead just does nothing to promote your games). This is where indie developers have found they can go in order to not make money on xBox, despite an installed base of 76M devices. Microsoft, you are idiotic to have ceded not just indie game developers but also a generation of loyal kids and teens to making games for other people’s mobile devices.

Read more: ILIKE.CODE
QR: Inline image 1

Posted via email from Jasper-net

Connecting Android Phones Without Carrier Networks

|
After disasters (or to minimize expensive data use generally, and take advantage of available Wi-Fi), bypassing the cell network is useful. But it's not something that handset makers bake into their phones. colinneagle writes with information on a project that tries to sidestep a dependence on the cellular carriers, if there is Wi-Fi near enough for at least some users:

 The Smart Phone Ad-Hoc Networks (SPAN) project reconfigures the onboard Wi-Fi chip of a smartphone to act as a Wi-Fi router with other nearby similarly configured smartphones, creating an ad-hoc mesh network. These smartphones can then communicate with one another without an operational carrier network. SPAN intercepts all communications at the Global Handset Proxy so applications such as VoIP, Twitter, email etc., work normally.

Read more: Slashdot
QR: Inline image 1

Posted via email from Jasper-net

Bit9 Hacked, Stolen Certs Used To Sign Malware

|
Bit9, a company that provides software and network security services to the U.S. government and at least 30 Fortune 100 firms, has suffered a compromise that cuts to the core of its business: helping clients distinguish known 'safe' files from computer viruses and other malicious software. A leading provider of 'application whitelisting' services, Bit9's security technology turns the traditional approach to fighting malware on its head. Antivirus software, for example, seeks to identify and quarantine files that are known bad or strongly suspected of being malicious. In contrast, Bit9 specializes in helping companies develop custom lists of software that they want to allow employees to run, and to treat all other applications as potentially unknown and dangerous. But in a blog post today, the company disclosed that attackers broke into its network and managed to steal the digital keys that Bit9 uses to distinguish good from bad applications. The attackers then sent signed malware to at least three of Bit9's customers, although Bit9 isn't saying which customers were affected or to what extent. The kicker? The firm said it failed to detect the intrusion in part because the servers used to store its keys were not running Bit9's own software.

Read more: Slashdot
QR: Inline image 1

Posted via email from Jasper-net

Automating ClickOnce Deployment

|
Building a ClickOnce deployment outside of Visual Studio can be a difficult task. One point I want to make clear is that there is no magic going on to make your application deployable using ClickOnce. Well, unless you are using the tooling inside of Visual Studio, in which case there is a lot of magic happening. Much to its credit, Visual Studio does make it very easy to setup and publish a ClickOnce deployment for your application. That said, my suggestion would be to just use Visual Studio if it fits your workflow. However, if you need a fully automated solution to create a ClickOnce deployment outside of Visual Studio, then continue reading. In my environment, my builds are automated using NAnt, which are then built on a build server using CruseControl.Net.

My end goal with automating the ClickOnce deployment was to mimic the output as created by Visual Studio.  I didn't have to do this, but I wanted to just incase I might ever need to resort back to using Visual Studio.  I didn't want to get caught in a situation where my automated ClickOnce deployment files conflict with the files generated by Visual Studio.

In general, a ClickOnce deployment requires two files. An application manifest and a deployment manifest. The application manifest contains details of the application. Some of these details include dependencies, security privileges, and a complete listing of every file required by the application.

The deployment manifest contains details of, you guessed it, the deployment. For this file, my focus is primarily on the deployment strategy. It is also worth noting that this file will contain a dependency which is basically a pointer to the application manifest.

I know I'm only scratching the surface of what these two files actually contain. I'm calling out the details which are directly relevant here. I'm trying hard to avoid using the phrase, "beyond the scope of this article", but there it is. As much as I dislike that phrase, I'm using it anyway. Really, if you want to know more about these two files, look at the Microsoft documentation.

As I went through this process, I did find a walkthrough in the Microsoft documentation that you may find helpful. I followed the steps myself, but it didn't take me where I wanted to go and was hard to follow due to lack of detail. When I finished the walkthrough, I had more questions than when I started. But it did help to guide me in the right direction, so I want to point it out.

Steps to automate a ClickOnce application

1. Obtain or create a ".pfx" key file for signing the manifest files. The key file can also be used to sign the assembly/executable of the application if wanted, but not required. You can create a key file using the "Signing" tab of the project properties window. I think there are other kinds of keys that can be used for signing, but I am not an expert in this area so I'm saying as little about it as possible.

2. Add an "app.manifest" file to the project. This will give you a physical file that you can make custom edits to if needed. I personally didn't need to make any custom edits, but at least I have that option if I ever need to. This file will get updated post build using the Mage.exe utility.

3. Build the project/application to get all the files required for the application to run. Also, copy any extra files needed to deploy with the app such as the main app icon. The goal here is to create a folder containing your entire application. All your resource files, data files, help files, referenced dlls, everything.  I use NAnt to automate this process.

4. Make any last changes to configuration files or whatever content you need to change for the deployment target.  This is important. Do not change any application content after the application manifest has been updated because it will make the application manifest invalid. The application manifest contains hash codes for every file. This is a security measure to prevent any tampering with the files.

5. Use Mage.exe to update the application manifest. Note, if you are using the ".deploy" extension for your files, you'll want to do this step before appending the ".deploy" extension to the files. If this doesn't make sense right now, don't worry about it yet. I'll explain more about this with web hosted deployment.  Below is an example of this command. 

mage.exe -Update build\ClickOnceExample-Release\ClickOnceExample.exe.manifest 
    -ToFile "build\ClickOnceExample-Release\Application Files\1.1.0.6125\ClickOnceExample.exe.manifest" 
    -FromDirectory "build\ClickOnceExample-Release\Application Files\1.1.0.6125" 
    -Version 1.1.0.6125

Read more: Joe Wrobel
QR: Inline image 1

Posted via email from Jasper-net

Automatically Building Pull Requests from GitHub with TeamCity

|
Inline image 3

Scenario

You’re running an OSS project* and someone makes a pull request. You’ve got two choices:
  • Merge and Pray
  • Pull to local branch, build, run tests and merge if all OK
What do you do? Well, what is it going to be?

I know what I’d like to do, and GitHub makes it so so tempting:

Inline image 1

But unfortunately I go with the second option.

That’s a pain, specially if you do a quick code-review and things look decent. Yet you still need to make sure that it builds and all tests pass.

Well, luckily for me, and my ability to continuously interfere in conversations, I found out that there is a better way. And what’s even nicer, is that it’s also possible with TeamCity.

*This applies to non-OSS too

Automatically Building All Pull Requests
What I want to do is have TeamCity automatically build all Pull Requests for me of my main repository, and notify me if it is successful. And I want this to happen without me having to configure every single fork as a repository in TeamCity, because like that, it wouldn’t be manageable. Here’s a diagram explaining it:

Read more: Hadi Hariri's Blog
QR: Inline image 2

Posted via email from Jasper-net

Making your own Local root CA and using it as an SSL certificate for intranet websites.

|
Installation

You should install the Active directory certificate services. Go to technet to learn how to do that for your server, I did.
This should apparently be installed on your domain controller. And yes I tried on a member server and no that was no success, so just listen to me.

IIS

Now go to you IIS manager and click on your server and find the option Server certificates.

Inline image 1

Then in the Actions menu select Create Domain certificate.

Inline image 2

Read more: LessThanDot
QR: Inline image 3

Posted via email from Jasper-net

Some Notes on Git

|
This set of notes covers the main things that I think you need to know about working with git. It is not comprehensive and mainly serves as a reminder for myself.

Remotes

In a typical open source workflow using GitHub or BitBucket, you would fork the main repository into your own and then clone that copy to your local computer:

git clone git@github.com:akrabat/joind.in.git

You then need to connect your local repository to the main repository. By convention, the main repository is known as upstream:

git remote add upstream git://github.com/joindin/joind.in.git

To sync your local repository with upstream and update your copy back on BitBucket/GitHub:

git checkout master
git fetch upstream
git merge --ff-only upstream/master
git push origin

Branching

The main branch in the repository is called master. Never ever code directly on master. Always create a branch and code on that and then merge back to master when complete.

(Note that the push command is also used throughout this document to sync your local repository with your remote on BitBucket/GitHub. If don't want to publish, then don't push.)

Create a branch:

git checkout -b my-branch-name
git push origin my-branch-name

Read more: DZone
QR: Inline image 1

Posted via email from Jasper-net

Задачи и отмена в .Net — tips & tricks

|
С выходом .NET Framework 4.0 в состав BCL была добавлена библиотека Task Parallel Library (TPL), реализующая параллелизм на основе задач. В основе библиотеки лежат типы Task и унаследованный от него тип Task<TResult>. Эти типы являются обёртками для асинхронных операций; они позволяют абстрагироваться от таких технических деталей, как, например, потоки и синхронизировать асинхронные операции друг с другом.

В этой же версии .NET Framework появился мини-framework для кооперативной отмены асинхронных операций. Состоит он из всего трёх типов:
  • CancellationTokenSource — создаёт маркёры отмены (свойство Token) и обрабатывает запросы на отмену операции (перегруженные методы Cancel/CancelAfter).
  • CancellationToken — маркёр отмены; позволяет несколькими способами отслеживать запросы на отмену операции: опросом свойства IsCancellationRequested, регистрацией callback-функции (через перегруженный метод Register), ожиданием на объекте синхронизации (свойство WaitHandle).
  • OperationCanceledException — исключение, выброс которого по соглашению означает, что запрос на отмену операции был обработан и операция должна считаться отменённой. Предпочтительный способ генерации исключения — вызов метода CancellationToken. ThrowIfCancellationRequested.

Механизм отмены через CancellationToken является стандартным для TPL — есть перегрузки методов, принимающих CancellationToken, исключения OperationCanceledException специальным образом обрабатываются и т.д. Однако, как и в любом другом API, есть свои тонкости, хитрости, best practices.

Почему отмена кооперативная?

  • Код, выполняющий асинхронную операцию, можно условно поделить на три части (слоя):
  • Код «вокруг» асинхронной операции, внешний слой. Этот код инициирует операцию, обрабатывает её результат и исключения, возникшие при выполнении операции.
  • Код «внутри» асинхронной операции, внутренний слой. Этот код реализует саму операцию, выполняет полезную нагрузку — расчёты, ввод/вывод, обработку данных и т.п.
  • Код-посредник между внешним (1) и внутренним (2) кодом, инфраструктурный слой. Он отвечает за низкоуровневые детали — запускает операцию на выполнение в нужном потоке, публикует результат выполнения операции, чтобы он был доступен внешнему коду и т.д. В случае использования TPL этот код находится внутри самой TPL.

Read more: Habrahabr.ru
QR: Inline image 1

Posted via email from Jasper-net

The Document Foundation Announces LibreOffice 4.0

|

The free office suite the community has been dreaming of for twelve years

Berlin, February 7, 2013 – The Document Foundation announces LibreOffice 4.0, the free office suite the community has been dreaming of since 2001. LibreOffice 4.0 is the first release that reflects the objectives set by the community at the time of the announcement, in September 2010: a cleaner and leaner code base, an improved set of features, better interoperability, and a more diverse and inclusive ecosystem.

LibreOffice 4.0: a community on fire

In less than 30 months, LibreOffice has grown dramatically to become the largest independent free software project focused on end user desktop productivity. TDF inclusive governance and the copyleft license have been instrumental in attracting more than 500 developers – three quarters of them being independent volunteers – capable of contributing over 50,000 commits.

The resulting code base is rather different from the original one, as several million lines of code have been added and removed, by adding new features, solving bugs and regressions, adopting state of the art C++ constructs, replacing tools, getting rid of deprecated methods and obsoleted libraries, and translating twenty five thousand lines of comments from German to English. All of this makes the code easier to understand and more rewarding to be involved with for the stream of new members of our community.

“LibreOffice 4.0 is a milestone in interoperability and an excellent foundation for our continued work to improve the User Interface,” explains Florian Effenberger, Chairman of the Board of Directors. “Our project is not only capable of attracting new developers on a regular basis, but it also creates a transparent platform for cooperation based on a strong Free Software ethos, where corporate sponsored and volunteer developers work to attain the same objective.”

LibreOffice 4.0: the new features

LibreOffice 4.0 offers a large number of new characteristics, which are listed on this page: https://www.libreoffice.org/download/4-0-new-features-and-fixes.

  • Integration with several content and document management systems – including Alfresco, IBM FileNet P8, Microsoft Sharepoint 2010, Nuxeo, OpenText, SAP NetWeaver Cloud Service and others – through the CMIS standard.
  • Better interoperability with DOCX and RTF documents, thanks to several new features and improvements like the possibility of importing ink annotations and attaching comments to text ranges.
  • Possibility to import Microsoft Publisher documents, and further improvement of Visio import filters with the addition of 2013 version (just announced).
  • Additional UI incremental improvements, including Unity integration and support of Firefox Themes (Personas) to give LibreOffice a personalized look.
  • Introduction of the widget layout technique for dialog windows, which makes it easier to translate, resize and hide UI elements, reduces code complexity, and lays a foundation for a much improved user interface.
  • Different header and footer on the first page of a Writer document, without the need of a separate page style.
  • Several performance improvements to Calc, plus new features such as export of charts as images (JPG and PNG) and new spreadsheet functions as defined in ODF OpenFormula.
  • First release of Impress Remote Control App for Android, supported only on some Linux distributions. (The second release, coming soon, will be supported on all platforms: Windows, MacOS X and all Linux distros and binaries.)
  • Significant performance improvements when loading and saving many types of documents, with particular improvements for large ODS and XLSX spreadsheets and RTF files.
  • Improved code contribution thanks to Gerrit: a web based code review system, facilitating the task for projects using Git version control system (although this is not specific of LibreOffice 4.0, it has entered the production stage just before the 4.0 branch).
QR: Inline image 1

Posted via email from Jasper-net

dot42 — компилятор C# для Dalvik Runtime

|
Inline image 1

Главным недостатком Mono для Android является то, что для работы приложений требуется отдельная среда выполнения, отличная от Dalvik. И хотя полный доступ к CLR выглядит весьма привлекательно, проксирование и маршаллинг вызовов от одной среды выполнения к другой могут сильно повлиять на производительность. Так почему бы не убрать промежуточную компиляцию в IL-код и получать сразу рабочий Dex-код? Этим и занимается проект dot42.

В январе, после 1 года разработки, авторы проекта dot42 наконец-то перешли от обещаний к пряникам. И, хотя проект еще не дотягивает до состояния боевого продукта-конкурента Mono, стоит, как минимум, его рассмотреть и попробовать.

Признаюсь, я немного слукавил, сказав, что компилятор dot42 «убирает» IL-код. Это не совсем так. Вместо этого он читает IL-код и конвертирует его в новый язык Register Language или, если короче, RL. Главная разница между IL и RL в том, что IL-код работает на стековой модели выполнения (как и байт-код у Java), а RL-код на регистровой, так же как Dalvik. После получения RL-кода, dot42 производит ряд оптимизаций и наступает этап финальной компиляции. Именно после последнего этапа и получается dex-код, язык среды Dalvik. В чем отличие RL от Dex написано в самом первом посте в блоге разработчиков.

На каждом этапе работы компилятора оригинальная дебаг-информация сохраняется, разумеется, компилятору приходится конвертировать ее из формата PDB в дебаг-формат для dex-кода. dot42 использует adb (Android Debug Bridge) для подключения отладчика в Visual Studio.

После компиляции библиотеки Android'а используются напрямую. Компилятор понимает большинство типов, например, java.lang.Boolean сопоставляется с System.Nullable<bool>. Правда, кое-какие телодвижения с типами данных все-таки придется сделать. Поскольку dot42 оперирует непосредственно с dex-кодом, есть несколько ограничений на функции и возможности C# и .NET. Пожалуй самое главное из них — это отсутствие пользовательских value-типов (структур). В виртуальной машине Dalvik просто нет поддержки таких типов, поэтому и сопоставить структуры никак не получится.

Read more: Habrahabr.ru
Read more: dot42.com
QR: Inline image 2

Posted via email from Jasper-net

Планшет в качестве второго экрана под linux

|
Inline image 1

Решил попробовать для расширения рабочего пространства, сенсорного ввода и удаленного управления использовать планшет как дополнительный экран к своему ноутбуку c Linux.

Нашлось 2 способа сделать это. Чем и делюсь.

Все дальнейшие действия выполняются на ноутбуке. Для подключения на планшет надо установить любой VNC клиент.

Первый, самый быстрый

Понадобятся vnc4server и x2x:
sudo apt-get install vnc4server x2x

При первом запуске vnc4server спросит пароль для подключения. После чего запустит X сессию и будет ждать vnc подключения на 5901 порту. Конфигурация сессии задается в файле ~/.vnc/xstartup.

Для управления сессией с компьютера можно использовать x2x:
x2x -to :1 -east

Теперь при перемещении курсора мыши за правую границу экрана, он будет появляться на планшете и ввод с клавиатуры будет переключаться туда же.

Такой способ имеет недостаток: нельзя перетащить окно с одного экрана на другой.

Второй способ

Использовать dummy драйвер в качестве второй видеокарты, объединить их с основной с помошью xinerama и отдать часть рабочего стола через x11vnc.

sudo apt-get install xserver-xorg-video-dummy x11vnc

Придется написать конфигурацию для xorg. Пример конфигурации /etc/X11/xorg.conf
#Основная видеокарта, надо указать нужный драйвер
Section "Device"
   Identifier      "Configured Video Device"
#тут ваш драйвер, можно подсмотреть в /var/log/Xorg.0.log
   Driver "radeon"
EndSection

Section "Monitor"
       Identifier      "Configured Monitor"
EndSection

Section "Screen"
       Identifier      "Default Screen"
       Monitor         "Configured Monitor"
       Device          "Configured Video Device"
EndSection

#Dummy видеокарта
Section "Device"
 Identifier "Videocard0"
 Driver "dummy"
 VideoRam 256000
EndSection

Section "Monitor"
 Identifier "Monitor0"
 HorizSync   10.0 - 300.0
 VertRefresh 10.0 - 200.0
 DisplaySize 300 200
 #The following modeline is invalid (calculator overflowed):
 #Modeline "32000x32000@0" -38917.43 32000 32032 -115848 -115816 32000 32775 32826 33601
 Modeline "16384x8192@10" 2101.93 16384 16416 24400 24432 8192 8390 8403 8602
 Modeline "8192x4096@10" 424.46 8192 8224 9832 9864 4096 4195 4202 4301

Read more: Habrahabr.ru
QR: Inline image 2

Posted via email from Jasper-net

.NET Framework: Какую версию вы используете?

|
Фреймворк .NET развивается очень быстро, в языки с каждой версией добавляется множество новых возможностей. Однако интересно, как быстро этими обновлениями удаётся воспользоваться.

Краткая историческая справка (неполная):

.NET 4.5 (Windows Vista SP2+): Metro, async/await, Unicode console, generics in MEF, IDN, EAI, ZIP; WPF: Ribbon control, async validation, VirtualizingPanel pixel scrolling, static properties bindings, live shaping, better weak events support.

.NET 4.0 (Windows XP SP3+): Parallel Extensions, Parallel LINQ, Task Parallel Library, dynamic dispatch and DLR, covariance and contravariance, named parameters, optional parameters, indexed properties, code contracts, BigInteger and Complex classes.

.NET 3.5 (Windows XP+): LINQ, Expression Trees, Compact Framework, HashSet, EventSchemaTraceListener, GC latency mode, reflection in partial trust, ReaderWriterLockSlim, DateTimeOffset, TimeZoneInfo; WCF: Workflow Services, Durable Services, Web Programming Model, Atom and RSS, Web Services Interoperability; WPF: IME for TextBox, image caching, binding debugging, IDataErrorInfo, WinForms Interoperability.

.NET 3.0 (Windows XP+): Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF), Windows Workflow Foundation (WF), Windows CardSpace.

.NET 2.0 (Windows XP+): 64-bit, generics, generic collections, partial classes, nullable types, anonymous methods, iterators, remoting, ACL, Console improvements, debugger attributes, Edit and Continue, FTP requests, HTTP caching, proxy discovery, HttpListener, custom cultures and other globalization improvements, GZIP, ping, SerialPort, SMTP, Semaphore and other threading improvements, trace data filtering, transactions; WinForms: DataGridView, ToolStrip, MaskedTextBox, SoundPlayer, SplitContainer, WebBrowser, layout panels.

.NET 1.1 (Windows 2000+): side-by-side execution, IPv6, security permission changes.

.NET 1.0 (Windows 98+): чудо свершилось.

(Возможны ошибки и неточности. Если что, поправляйте.)

Read more: Habrahabr.ru
QR: Inline image 1

Posted via email from Jasper-net

HOWTO: Generate C# request object for GitHub hooks

|
This week I needed to create a web service for synchronizing changes from GitHub repository into our internal environment. This is easily achievable using two great tools, I just came across.

First, GitHub has created requestb.in - which is really awesome development tool. You can create your own bins, which exposes an endpoint for you that tracks all the requests made to it. As GitHub suggested, I added new hook (go to github.com -> settings -> service hooks -> webhook urls) with this bin I created in requestb.in. This way, I received the json object that GitHub sends to the endpoint.

After I got the json object, I used another awesome tool that I'm going to keep in my bookmarks: http://json2csharp.com/ It converts your json object to c# class definition. Much more convenient than writing all the classes from scratch.

Read more: Code It !
QR: Inline image 1

Posted via email from Jasper-net

Proxmark

|
The Proxmark III is a device developed by Jonathan Westhues that enables sniffing, reading and cloning of RFID (Radio Frequency Identification) tags. For my master thesis I wanted to look at the communication of Mifare Classic cards. Mifare Classic is used in many applications and is the most popular contactless card around. It is used in e-ticketing, public transport and access control. The higher-level protocol is kept secret by the manufacturer (NXP). I made an implementation of the ISO14443 type A standard for the Proxmark since Mifare is based on this communication standard.

After a lot of debugging and many noisy traces the Proxmark was ready for some real analysis. I focused on the Mifare Classic card and was happy to let the communication between card and reader appear on my screen. I could see the anticollision phase where the reader selects the card to communicate with. This was followed by an authentication and after that all communication was encrypted. The findings of this research are published on arxiv.org as A Practical Attack on the Mifare Classic

Read more: Proxmark
QR: Inline image 1

Posted via email from Jasper-net

How to Implement IDisposable and Finalizers: 3 Easy Rules

| Monday, February 11, 2013
Microsoft's documentation on IDisposable is needlessly confusing. It really boils down to three simple rules.

Rule 1: Don't do it (unless you need to).

There are only two situations when IDisposable does need to be implemented:

The class owns unmanaged resources.
The class owns managed (IDisposable) resources.
See The First Rule of Implementing IDisposable and Finalizers for more details.

Rule 2: For a class owning managed resources, implement IDisposable (but not a finalizer)

This implementation of IDisposable should only call Dispose for each owned resource. It should not have any other code: no "if" statements, no setting anything to null; just calls to Dispose or Close.

The class should not have a finalizer.

See The Second Rule of Implementing IDisposable and Finalizers for more details.

Rule 3: For a class owning a single unmanaged resource, implement both IDisposable and a finalizer

QR: Inline image 1

Posted via email from Jasper-net

Hyper-V for Developers Part 2

|
In Part 1 of this series we detailed a number of infrastructure tasks for getting your Client Hyper-V environments up and running quickly on a Windows 8 developer workstation.  With this post we will focus inward into our datacenter simulation and complete the work necessary to prepare for simulation of real-life application deployment scenarios.

What do you mean I can’t cut and paste into a VM?!?
One of the earliest pain points developers discover when using Hyper-V virtual machines is that unlike some other popular desktop hypervisor products the Virtual Machine Connection (VMC) does not allow files to be cut and paste from the host machine into a virtual machine.  Out of the box the options under the Clipboard menu of a virtual machine connection simply allow us to virtually type text via the Type clipboard text command.  These limitations have been the “way it is” for sometime. 

So what is the intrepid developer to do in order to copy his or her files into a VM for the purposes of installation, application deployment, or whatever other file transfer tasks are required? Enter the Internal Network to the rescue.  In Part 1 you may remember I showed that one of my two standard Hyper-V virtual switches is called Guest2Host which I configure on an internal network.  Now let’s setup a internal network between our APP1 server and the Windows 8 host machine.

First shutdown the APP1 server and navigate to the Hyper-V settings for this VM.  Under the Add Hardware section add a second virtual NIC to this server and set this NIC to be connected to the Guest2Host virtual switch.  Your setup should resemble the screen clipping below.

Inline image 1

Now startup the APP1 server and login via the VMC.  A quick glance at the desktop wallpaper will show that the newly added NIC on the internal network has obtained an auto-configured 169.254.150.87 address (which is actually working by design as part of RFC 3927).  This may be familiar to some people who have seen this type of address before when their PC experiences difficulty obtaining a lease for a new address on a DHCP network.  We are going to use this address as a means to access our VM’s from our Windows 8 host.

Read more: Ken Kilty's Blog
QR: Inline image 2

Posted via email from Jasper-net

Avoiding C++ types in your P/invokes

|
It's easier to explain this in an example. Let’s say you have a export function in your native DLL:

void WINAPI MyFunction(_com_ptr_t<IMyInterface> ptr)
 {
    // ... do something with ptr
    ptr->Func();
 }

And the DllImport would be something like this:

[DllImport("mydll.dll")]
void MyFunction(IMyInterface ptr);

Everything seems to be perfectly valid, except that there is a extra release, and you'll end up crashing later when the RCW finalizes.

The problem here is the _com_ptr<IMyInterface> argument. This is a C++ smart COM pointer, and it AddRef the pointer when it is created, and Release the pointer when it goes out of scope. Normally, when you are calling it in C++, C++ will take care of everything, making sure the contruction of _com_ptr is done correctly, making sure the AddRef is done. For example, when you are calling MyFunction with a IMyInterface* in C++, the actual code generated will look like this:

IMyInterface *p;
 _com_ptr_t<IMyInterface> ptr(p);     // -------> C++ inserts this code for you
MyFunction(ptr);  

However, when you are calling this as a P/invoke, the construction of ptr is not done at all - CLR is not C++, and has absolutely no knowledge about your _com_ptr_t. Whatever CLR passes as the interface pointer, becomes the _com_ptr_t. This happens to work (except for the extra release part), because _com_ptr_t only has one pointer field. As a result, AddRef is not done, and _com_ptr_t does an extra Release on the interface pointer. Then when CLR is trying to release the COM object, CLR will crash because the COM object will be gone/deleted before the last release from CLR. And people typically blame CLR for that because CLR dll shows up on the stack...

The underlying problem here, is that C++ types come with additional semantics that is not part of the P/invoke signature and is not understood by CLR, and there is no way CLR could follow C++ semantics and make sure they are done correctly. Some common mistakes that people make are:
  1. Assume constructors are called
  2. Don't realize that C++ classes might come with v-tables that change the layout of other fields
  3. Assume C++ 'standard' type like std::string is understood by CLR

QR: Inline image 1

Posted via email from Jasper-net

Microsoft's 'Blue' wave is coming to more than just Windows

|
As we've known for a few months, the Windows client team at Microsoft is working on its first "feature-pack" update for Windows 8, supposedly due this summer/fall, which is codenamed "Blue."

But it turns out Blue isn't a Windows thing only, according to one very accurate tipster of mine who doesn't want to be identified.

Blue also is the way Microsoft is referring to the next substantial platform update for Windows Phone, the Windows Services (like SkyDrive, Hotmail, etc.), and Windows Server, according to my source. In other words, Blue is a wave of product refreshes which are not expected to arrive exactly all on the same day, but which are meant to be released more or less around the same time.

Before these various Blues come to market, there will continue to be minor fixes, firmware updates and new features added to Windows 8, Windows RT, Windows Services and Windows Phone. On the phone side of the house, for example, the first minor update, codenamed Portico, already has made its way out to a number of Windows Phone users. 

Read more: ZDnet
QR: Inline image 1

Posted via email from Jasper-net

Visual Studio 2012 Update 1: Understanding Code Map

|
Inline image 2

Requirements
Before we get started you need to be aware of the requirements for Code Map.  Below are the requirements to leverage this feature:

Visual Studio 2012.1 and one of these editions:

Visual Studio 2012 Ultimate to create code maps from the code editor or from Solution Explorer.

 Note: Before you share maps with others who use Premium or Professional, make sure that all the items on the map are visible, such as hidden items, expanded groups, and cross-group links.

Visual Studio 2012 Premium or Visual Studio 2012 Professional to open code maps, make limited edits, and navigate code.

A solution with Visual C# .NET or Visual Basic .NET code

With that said, I often see many larger organizations who usually have a few extra Ultimate licenses so you might ask around at your company to see if there are any available licenses if you need the higher level version.

What are Code Maps?

We will get to examples of maps in a minute but I wanted to help clarify their origin.  Code Maps are a more user-friendly approach to something we have had in Ultimate for a while known as Dependency Graphs.  With this new feature we make creating and manipulating visualizations easier.  I bring this up because you may want to explore creating Dependency Graphs to learn more about how to work with these visualizations.  You can find out more here:

Creating Code Maps

The need for maps will usually manifest itself when you are writing or debugging code and need to understand code relationships.  Let’s take, for example, TailSpin Toys from the Brian Keller Virtual machine found at:

Let’s say I happen to be looking at the AddItem method and want to get a handle on what is calling this method.  I can right-click the method and choose Show on Code Map (note the shortcut key as well):

Inline image 3

QR: Inline image 1

Posted via email from Jasper-net

Composing maintainable apps in XAML

|
Speaker:

Michael Perry

Abstract:

Of all the user interface technologies that have reached the main stream, from HTML to Windows Forms to Java Swing, XAML is the most composable. It offers an incredible degree of code reuse, customization, and componentization. It has so many options for piecing interfaces together, that selecting the right one can sometimes be overwhelming.

This February at Dallas XAML, we will dive deep into several composition patterns. These include:

User controls
Data templates
Control templates
Content presenters
Bring your laptop and code along. The workshop will include several checkpoints to ensure you stay caught up.

Choose the right pattern, and your WPF, Silverlight, Phone, or Metro code will be well organized and easy to maintain. Your co-workers will buy you lunch, and your apps will bring in tons of cash.

Read more: UserGroup.tv
QR: Inline image 1

Posted via email from Jasper-net

Identify the User-Mode Drivers Loaded into a WUDFHost.exe Instance

|
Once upon a time, it was fairly challenging to determine which services were running in an individual svchost.exe process. Today, with Process Explorer, there’s nothing easier – just hover over the svchost.exe process and you get a list of services, or double-click an svchost.exe process and go to the Services tab:

Inline image 1

A similar problem can arise with user-mode drivers (UMDF). User-mode drivers are COM DLLs loaded into WUDFHost.exe processes, and some WUDFHost.exe processes may contain more than one user-mode driver. Process Explorer does not help in identifying which user-mode drivers are loaded into a WUDFHost.exe process, and although you can look at the list of DLLs and try to identify the ones that represent drivers, a more reliable way is desired. One option is to look at the list of threads inside the process, and identify command threads for UMDF drivers, such as this one:

QR: Inline image 2

Posted via email from Jasper-net

C#/.NET Little Wonders: Explicit Interface Implementation

|
Most of the time in C#, we implement interfaces implicitly. This is by far the simplest method and makes the method available both to consumers of the interface and the implementing type directly.

There are times, though, when you may want to implement an interface, but hide or change how the interface implementation is exposed in the implementing type.  This is done through explicit interface implementation, which we will discuss today. 

Implicit Interface Implementation

Implementing interfaces in C# is easy, we simply have our implementing type satisfy the interface by having it contain a member which satisfies the interface (or can be abstract of course).  The easiest way to do this is with implicit implementation.

So, for example, say we have a sample interface (yes, I could make it a generic, but bear with me for now):

   1: public interface IFactory
   2: {
   3:     object Create();
   4: }

We can implicitly implement this interface by creating a type that has a method with the same signature and return type:

   1: public class SentenceBuilder : IFactory
   2: {
   3:     // ...
   4:  
   5:     // Because this method has the same signature and return type, it
   6:     // is considered an implicit interface implementation
   7:     public object Create()
   8:     {
   9:         return “Both class and interface see this.”;
  10:     }
  11: }

When we do this, we call the same method whether we call the method from an instance of IFactory or SentenceBuilder:

   1: // same object, one as SentenceBuilder, one as Factory 
   2: var builder = new SentenceBuilder(); 
   3:  
   4: IFactory factory = builder; 
   5:  
   6: // result will be the same regardless of the reference we call from 
   7: Console.WriteLine(factory.Create()); 
   8: Console.WriteLine(builder.Create()); 

Many times, this is sufficient for our needs. But sometimes, we’d like a little bit more control of how a type implements an interface while still being required to satisfy the interface contract. This is where explicit interface implementation comes into play.

Read more: James Michael Hare
QR: Inline image 1

Posted via email from Jasper-net

One download of wonderful [Samples] for Windows 8. 258 samples, one'ish download. C++, C#, JavaScript and VB samples all available

| Sunday, February 10, 2013
Inline image 2

This sample pack includes all the app code examples developed for Windows 8. The sample pack provides a convenient way to download all the samples at once. The samples in this sample pack are available in C#, C++, VB.NET, and JavaScript.

The Windows Samples Gallery contains a variety of code samples that exercise the various new programming models, platforms, features, and components available in Windows 8 and/or Windows Server 2012. These downloadable samples are provided as compressed ZIP files that contain a Visual Studio solution (SLN) file for the sample, along with the source files, assets, resources, and metadata necessary to successfully compile and run the sample. For more information about the programming models, platforms, languages, and APIs demonstrated in this sample, please refer to the guidance, tutorials, and reference topics provided in the Windows 8 documentation available in the Windows Developer Center. This sample is provided as-is in order to indicate or demonstrate the functionality of the programming models and feature APIs for Windows 8 and/or Windows Server 2012. Please provide feedback on this sample!

QR: Inline image 1

Posted via email from Jasper-net

Augmented reality using C#

|
Inline image 1


Purpose

Here I will demonstrate how to use Graphics, fast Bitmaps and camera to create an augmented reality setting using C# in WPF.

Requirements

Using of the code provided requires the XNA framework to be installed (however, it is not crucial, since I only use Vector2). WPF is not a strict requirement, the same algorithm can be implemented in a simple Windows Forms Application. Also, the code is parallelized, so you will need .NET framework 4.0 to run it (or simply replace each Parallel.For with a for).

Introduction

The closest thing to holding a fireball or a lightning ball in your hand is probably seeing yourself with it in an augmented reality world. So, here I will show you how to create a simple magic effect that follows a light source. The Effect should look like this:

QR: Inline image 2

Posted via email from Jasper-net