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

AWESOMIUM

| Tuesday, April 13, 2010
webflow_1.6_screen-300x187.jpg
What Is “Awesomium”?

The Web is changing. The way we browse that web is not. Users today are wholly dependent upon mainstream browsers to access their content (in fact, you’re probably using one right now to read this sentence).

Our vision to break the Web out of this box by providing developers the tools they need to develop the next generation of browsers.

Awesomium is a software library that allows developers to embed the client-side web in their own applications.

A few examples of usage

   * An offscreen renderer for snapshots or recordings of web-pages
   * A framework for an advanced, 3D web-browser
   * Powering a GUI using Web-based content
   * The implementation of in-game advertisting.


Read more: Khrona

Posted via email from jasper22's posterous

My Visual Studio Theme for Windows 7

|
original.aspx

This is a simple Visual Studio theme I put together for Windows 7 on my laptop. Enjoy!

Read more: Rob Caron

Posted via email from jasper22's posterous

How I made our websites run 10 times faster

|
For a very long time our websites have been very sluggish. There are several reasons to this, some obvious, while other not so obvious. Here I will explain to you how we made our websites perform at lightning speed!
How I made our websites run 10 times faster

The first thing you have to realize when working with a website project, which isn't just merely HTML documents offed at some server somewhere, is that although YSlow is a very good product, the assumption that most of your website speed is in the client-layer just isn't true. YSlow is a *KICK-ASS* product, and start out with YSlow, but once you have gone through the issues you can fix that YSlow shows you, please do not stop there...!

If you have any kind of complex server back-end, you will have to move on further and also optimize your server back-end...

What we did...

First of all I started out with figuring out how to reduce the impact of the ViewState. The ViewState has a very bad reputation, and to be quite frankly, most of its bad reputation is not justified. The ViewState is a really beautiful thing, and if you're going to develop any kind of complex application or website, you will have to use some kind of either similar mechanism to the ViewState, or the ViewState itself.

Though when you couple the ViewState with a Modularized Framework like Ra-Brix, the ViewState problems accumulate. Since all our websites are built on Ra-Brix, we had to do something about it. A couple of weeks ago I wrote a pretty detailed blog about how we fixed our ViewState problems in Ra-Brix. To summarize; we saved it on the server...

Read more: Ra-Ajax

Posted via email from jasper22's posterous

Plants vs Zombies - iPad Games

|
plants-vs-zombies-ipad.jpg

I am not really into games, but the Plants vs. Zombies game on the Apple iPad is a blast!

The HD graphics are awesome and the variety of plants, zombies, and situations can keep the game interesting each day. You are battling zombies in the front yard, back yard, day, night, in the fog, on land, in the pool, etc. Plants vs. Zombies is not only fun, but it requires strategy. And best of all, each stage lasts the perfect amount of time such that you can play it on the train, waiting for a haircut, etc.

Read more: David Hayden

Posted via email from jasper22's posterous

Microsoft Sync Framework 1.0 SP1

|
Microsoft Sync Framework is a comprehensive synchronization platform that enables collaboration and offline scenarios for applications, services, and devices. Developers can build synchronization ecosystems that integrate any application and any type of data, using any protocol over any network. This service pack is intended to fix a handful of bugs as well as to transition to a public-facing change tracking API that is new in SQL Compact 3.5 SP2. In SQL Compact, the change tracking feature is used to track information about all changes that occur in a given database and is used to retrieve metadata related to these changes. In previous versions of SQL Compact, this change tracking feature was automatically enabled the first time a synchronization operation was initiated in a SQL Compact database, and developers did not have the ability to interact directly with this API themselves. SQL Compact 3.5 SP2 makes this API public and Sync Framework 1.0 SP1 is updated to leverage this new public API surface. SQL Compact 3.5 SP2 makes this API public and Sync Framework 1.0 SP1 is updated to leverage the new public API surface. Making this API surface public provides developers with a finer grain of control and insight into the tracking of changes within SQL Compact. In some cases, making this change tracking feature public has resulted in performance degradation because there are more layers to interact with when accessing change tracking information. Because of this, before you upgrade to Sync Framework 1.0 SP1 you must carefully consider whether your need for this public change tracking feature outweighs the performance impact of leveraging this new API.

As mentioned above, a handful of bugs are fixed in this release:
# An access violation error occurred when you synchronized a deleted folder that contained a Desktop.ini file or a Thumbs.db file by using the file sync provider in Microsoft Sync Framework 1.0; KB961221.
# Uninstall or repair of Sync Framework on the Windows Vista operating system failed with the following message: "This setup requires .NET Framework 2.0" even though .NET Framework 2.0 was installed.
# Prerequisite check for .NET framework failed when .NET Framework 4.0 was the only version installed; KB962229.
# Sync Framework assemblies were disabled in the Visual Studio 2010 Add References dialog box; KB970102.

Read more: MS Download

Posted via email from jasper22's posterous

Visual Studio 2010 Tools for Office Runtime

|
This download installs the Visual Studio 2010 Tools for Office Runtime, which is required to run Microsoft Office based solutions built using Microsoft Visual Studio 2010.

Read more: MS download

Posted via email from jasper22's posterous

!Host HTML in XAML

|
כן כן! אתם רואים נכון, הגולם קם על יוצרו… ניתן לארח דפי ווב בXAML!! יותר מדויק בסילברלייט.

הרבה אנשים צריכים להציג דפי HTML, דפי ASPX, ואין בנמצא קונטרול שמבצע את העבודה כמו שצריך (נפתחו בעבר מספר פרויקטים כמו זה וזה, האחרון מדבר על אירוח GE בSL, אך הם קשים לתפעול, חסרי תיעוד עד אי הבנה כיצד להשתמש). אחרי יום חיפושים מפרך אחר פקד שכזה (צריך לדבר עם גוגל, לא לענין…), מצאתי אותו! מבית Divelements.

אז איך? ככה:

1. הורידו מכאן את הספרייה Divelements.SilverlightTools.dll.

2. לפרויקט המדובר הוסיפו רפרנס לספריה הנ"ל.

3. בדף הXAML תנו כינוי לספריה


<Page ...
xmlns:divtools="clr-namespace:Divelements.SilverlightTools;assembly=Divelements.SilverlightTools">

4. מקמו את הפקד HTMLHost בדף הXAML:

<Grid x:Name="LayoutRoot" Background="White">

<Border Margin="30">

     <!-- Embed HTML within the page -->

            <divtools:HtmlHost Name="htmlHost" SourceUri="http://blogs.microsoft.co.il" />

    </Border>

</Grid>

5. קבעו את פרויקט הSL שיוצג  כwindowless. בדף אירוח קובץ הxap כתבו כך:

 

 ...

וקיבלתם אירוח מושלם.

Read more: Miri's Blog

Posted via email from jasper22's posterous

BugTracker.NET 3.4.1

|
Release Notes

   * For the tasks/time tracking feature, added a way of viewing all the tasks at once, not just the tasks for one bug. Also added a way of exporting all the tasks into Excel. These features are weak, but they are better than nothing.

   * Fixed merge bugs feature. It wasn't merging tasks, flags, and svn/hg/git data.

   * Added checkbox to send_email.aspx page that controls whether the "comments visible to internal users only" are included in the email body.

   * Corrected Web.config comments for "NotificationSubjectFormat". Added $ASSIGNED_TO$ as one of the variables.

Read more: Codeplex

Posted via email from jasper22's posterous

Microsoft Visual Studio Team Explorer Everywhere 2010

|
Microsoft Visual Studio Team Explorer Everywhere 2010 is the Eclipse plug-in and cross-platform command-line client for Visual Studio 2010 Team Foundation Server.

Read more: MS Download

Posted via email from jasper22's posterous

SQL Optimization Tips

|
This article lists some of the optimization tips for SQL Server development.

  1. Use views and stored procedures instead of heavy-duty queries. This can reduce network traffic, because your client will send to server only stored procedure or view name (perhaps with some
     parameters) instead of large heavy-duty queries text. This can be used to facilitate permission management also, because you can restrict user access to table columns they should not see.
  2. Try to use constraints instead of triggers, whenever possible. Constraints are much more efficient than triggers and can boost performance. So, you should use constraints instead of triggers, whenever possible.
  3. Use table variables instead of temporary tables. Table variables require less locking and logging resources than temporary tables, so table variables should be used whenever possible.
     The table variables are available in SQL Server 2000 only.
  4.  Try to use UNION ALL statement instead of UNION, whenever possible. The UNION ALL statement is much faster than UNION, because UNION ALL statement does not look for duplicate rows, and UNION statement does look for duplicate rows, whether or not they exist.
  5. Try to avoid using the DISTINCT clause, whenever possible. Because using the DISTINCT clause will result in some performance degradation, you should use this clause only when it is necessary.
  6. Try to avoid using SQL Server cursors, whenever possible. SQL Server cursors can result in some performance degradation in comparison with select statements. Try to use correlated sub-query or derived tables, if you need to perform row-by-row operations.
  7. Try to avoid the HAVING clause, whenever possible. The HAVING clause is used to restrict the result set returned by the GROUP BY clause. When you use GROUP BY with the HAVING clause, the GROUP BY clause divides the rows into sets of grouped rows and aggregates their values, and then the HAVING clause eliminates undesired aggregated groups. In many cases, you can write your select statement so, that it will contain only WHERE and GROUP BY clauses without HAVING clause. This can improve the performance of your query.

Read more: C# Corner

Posted via email from jasper22's posterous

Closing Just the Selected Files You Want

|
image_thumb.png

What do you do when you have a lot of files open and only want to close a few of them?  You do it old school!  Just go to Window -> Windows. on the Menu Bar

Read more: Visual Studio Tips and Tricks

Posted via email from jasper22's posterous

New debugger extension for .NET (PSSCOR2)

|
Tom just blogged about a new debugger extension called PSSCor2, which is a superset to the SOS.dll extension that ships with the .net framework.

PSSCor2.dll has been around for quite some time at Microsoft, and pretty much everyone debugging .net code with windbg within Microsoft is using this since it contains all the goodness of sos.dll plus a lot of special methods for asp.net and other technologies running on top of the .net framework.  The news now is that after a lot of hard work by Tom and Jon Langdon in the CLR team, it is finally released publicly, YAY!!!

You can download it here and Tom promised to write some posts about the new commands so you might want to follow that… I will likely do the same later on as well…

Just to name two of the commands in there that I use a lot:

   !dae  (Dumps out all the exceptions on the .net heaps with callstacks)

   !aspxpages  (Dumps out all the asp.net pages that are currently executing or have been executing recently, along with the thread they are running on, what the timeout is and how long they have been running… excellent stuff)

Have a good one,
Tess

Read more: If broken it is, fix it you should

Posted via email from jasper22's posterous

Google Maps API for .NET

|
Fast and lightweight client libraries for Google Maps API.
Overview
This project intends to provide all the features available in the Google Maps API. It is being developed in C# for .NET Framework 3.5.

Please note that this project is still in design and development phase; the libraries may suffer major changes even at the interface level, so don't rely (yet) in this software for production uses.
Libraries
Designed with simplicity and extensibility in mind, there are different libraries according to what you need.

   * Google.Api.Maps.Core Google.Api.Maps.Service is a low-level API client library, providing just the basic support for communicating with the API services through strong types.
   * Google.Api.Maps (to be released in next version), works on top of the core library to provide a business-level interface as well as enhanced functionality such as distance calculations, HTML helpers, caching support and more.

API Support
Currently the service library supports full coverage of the following Google Maps APIs:

   * Geocoding
   * Elevation
   * Static Maps

Read more: Codeplex

Posted via email from jasper22's posterous

Cloud Mail

|
 Want to send email from Azure? Cloud Mail is designed to provide a small, effective and reliable solution for sending email from the Azure platform directly addressing several problems that application developers face.

Microsoft does not provide an SMTP Gateway (yet) so the application is forced to connect directly to one hosted somewhere else, on another network. Gmail might be fine for testing but do you really want to rely on a free service in production? To compound the problem what happens to your email if your chosen SMTP gateway is down or there are connection problems? Finally, what if you want to send email via a company’s mail server, from inside their firewall?

Cloud Mail solves these problems by providing a small client library that you can use in your solution to send emails from you application and a Windows Service that you run inside your companies network that acts as a relay. Because the send and relay are disconnected there are no lost emails and you can send from your own SMTP Gateway.


Read more: Codeplex

Posted via email from jasper22's posterous

Microsoft InteropForms Toolkit 2.1

|
This toolkit helps you bring the power of .NET to your existing VB6 applications, by allowing them to display .NET Forms and Controls from within the same application. Instead of upgrading the entire code base, these applications can now be extended one form at a time. The goal is a phased upgrade, with production releases at the end of each iteration containing both VB6 and VB.NET forms running in the same VB6 .exe process.

Read more: MS Download

Posted via email from jasper22's posterous

Checking Database Integrity

|
In theory, you should never need to manually check the integrity of your database, because nothing should ever go wrong with the database, the memory, or the I/O subsystems. However, in practice, checking the integrity of your database will give you confidence and ensure that your database files are in good shape, as well as detect any problems early enough to resolve them with minimal pain.
PAGE_VERIFY Options

Each database has an option that you can configure to determine how much integrity checking is happening in real time with your database pages. You can set the option to OFF, TORN_PAGE_DETECTION, or CHECKSUM. In general, you should set the option to CHECKSUM. Each time that the SQL Server database page is written to or read from the disk, a checksum is computed from the page. If that checksum does not match what's been previously recorded on the page, SQL Server knows that the page should no longer be trusted. Enabling the CHECKSUM option does cause some additional CPU workload so that the checksum can be computed. If your SQL Server workload became such that you needed to reduce your CPU workload, you could consider turning this feature off, but at the risk of failing to detect database page corruption.
DBCC CHECKDB

DBCC CHECKDB is the primary tool you will use to check the integrity of your database outside of the page verification options. You run this Transact-SQL command just like you run any other Transact-SQL statement. To run a DBCC CHECKDB command, you must be either a system administrator (a member of the sysadmin role) or a member of the DB_Owner fixed database role (or be the dbo user).

DBCC CHECKDB does the following:

   * It checks the integrity of your database physically, verifying that the pages of your database are allocated correctly. This check can be run separately as a DBCC CHECKALLOC command if you want only a physical integrity check, rather than a full CHECKDB.
   * It runs a DBCC CHECKTABLE command on all the tables and views in your database, verifying that the pages that belong to that table or view are actually allocated to the table. Additionally, it verifies the other internal structures of the objects.
   * It runs a DBCC CHECKCATALOG command, verifying the integrity of the system tables.
   * It validates indexes, varbinary(max) links with FILESTREAM objects, and service broker data.

You do not need to run each of these separate commands. DBCC CHECKDB will take care of them all for you.

If DBCC CHECKDB finds any problems, you can repair the database by using one of the REPAIR options, or you can restore the database from a backup. Unless you are very confident in what you are doing and in exactly what the REPAIR option is going to accomplish, you should not use the command without Microsoft or your Dassault Systèmes support team on the telephone with you.

Read more: Dassault Systèmes ENOVIA V6 on SQL Server

Posted via email from jasper22's posterous

Visual Studio 2010 and C# 4 Launch!

|
As I’m sure you’ve heard, we’re done! And you can download everything at your pleasure. Visual C# Express 2010 is available for free at the following link. For free!

http://www.microsoft.com/express/downloads/

You can also download trial versions of the full Visual Studio SKUs from here:

http://www.microsoft.com/visualstudio/en-us/download

MSDN’s main page is covered in purple and full of more links than you have time to click on, so you can check out everything there too.

The C# compiler and the support for dynamic, including the DLR, come in the box on every distribution of the .NET Framework 4.0. And also, of course, with every edition of Visual Studio. In addition to that, you’re going to want to use C# dynamic with some good dynamic languages. Happily, IronPython has released a final version (2.6.1) built for use with .NET 4.0. Check it out!

http://ironpython.codeplex.com/

Thanks!

UPDATE: It wasn’t up when I posted this, but now IronRuby has also pushed a final build (1.0) that runs on top of the released .NET 4.0!

Read more: Chris Burrows' Blog

Posted via email from jasper22's posterous

Using Marshal.GetDelegateForFunctionPointer() to Execute Assembler with Managed Code

| Monday, April 12, 2010
I never noticed the Marshal.GetDelegateForFunctionPointer()  function in the .NET Framework 2.0 until Devin Jenson posted about using it to run native assembly code from C#.  This was a wonderfully timed post for me as I was just putting together the finishing touches on the code for my how to detect virtual machine execution.  What Marshal.GetDelegateForFunctionPointer()  enables is certainly impressive.

One thing that Devin pointed out in his post was the need for VirtualAllocEx() and VirtualProtectEx() calls to ensure the code executed was not in a Data Execution Protection block.  Since I needed to make those calls anyway to port my C/C++ code, I decided to post how to do it here:

   class MemoryManager
   {
       const uint MEM_COMMIT = 0x1000;
       const uint MEM_RESERVE = 0x2000;
       const uint MEM_DECOMMIT = 0x4000;
       const uint PAGE_EXECUTE_READWRITE = 0x40;

       [DllImport("kernel32.dll")]
       public static extern IntPtr GetCurrentProcess();

       [DllImport("kernel32.dll")]
       static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress,
           UIntPtr dwSize, uint dwFreeType);

       public static bool VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress,
           UIntPtr dwSize)
       {
           return VirtualFreeEx(hProcess, lpAddress, dwSize, MEM_DECOMMIT);
       }

       public static bool VirtualFreeEx(IntPtr lpAddress, UIntPtr dwSize)
       {
           return VirtualFreeEx(GetCurrentProcess(), lpAddress, dwSize, MEM_DECOMMIT);
       }

       [DllImport("kernel32", SetLastError = true)]
       static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress,
           UIntPtr dwSize, uint flAllocationType, uint flProtect);

       [DllImport("kernel32.dll", SetLastError = true)]
       static extern bool VirtualProtectEx(IntPtr hProcess, IntPtr lpAddress,
           UIntPtr dwSize, uint flNewProtect, out uint lpflOldProtect);

       public static IntPtr AllocExecutionBlock(int size)
       {
           return AllocExecutionBlock(size, GetCurrentProcess());
       }

       public static IntPtr AllocExecutionBlock(int size, IntPtr hProcess)
       {
           IntPtr codeBytesPtr;
           codeBytesPtr = VirtualAllocEx(
               hProcess, IntPtr.Zero,
               (UIntPtr)size,
               MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);

           if (codeBytesPtr == IntPtr.Zero)
           {
               throw new System.ComponentModel.Win32Exception();
           }

           uint lpflOldProtect;
           if (!VirtualProtectEx(
               hProcess, codeBytesPtr,
               (UIntPtr)size,
               PAGE_EXECUTE_READWRITE, out lpflOldProtect))
           {
               throw new System.ComponentModel.Win32Exception();
           }

           return codeBytesPtr;
       }
   }

Read more: Mark Michaelis' Weblog

Posted via email from jasper22's posterous

Dynamically Writing and Executing Native Assembly in C#

|
Generally, executing native assembly in C# is bad because you lose all the benefits of the managed world. In the cases where it is impossible to perform something in C#, it is better to make a C++ DLL. That said, the new method Marshal.GetDelegateForFunctionPointer() in the .NET Framework v2.0 opens up the possibility for dynamically writing and executing assembly code. Consider the following basic C function:


   int __declspec(noinline) __stdcall MyAdd(int x, int y)
   {
       return x + y;
   }

The C compiler will compile the code into assembly. Though the code which gets compiled may vary from compiler to platform, for x86 it will usually have this basic form:


   Instruction                 Code Bytes   Comment
   ------------------------------------------------------------------------------
   mov eax,dword ptr [esp+8] ' 8B 44 24 08  Load the x into eax
   mov ecx,dword ptr [esp+4] ' 8B 4C 24 04  Load the y into ecx
   add eax,ecx               ' 03 C1        Add eax and ecx, result goes into eax
   ret 8                     ' C2 08 00     Pop x and y off the stack, return eax

The instructions listed are disassembly copied from the VC++ debugger. The code bytes are what actually executes. The idea is to take those code bytes, write them into a native buffer, acquire a delegate for that buffer, and finally execute the delegate. Here is sample code to run these code bytes from C#:


   using System;
   using System.Runtime.InteropServices;


   class Program
   {
       private delegate Int32 MyAdd(Int32 x, Int32 y);

       private static void Main()
       {
           // A simple Add function
           Byte[] myAddNativeCodeBytes = new Byte[]
           {
               0x8B, 0x44, 0x24, 0x08, // mov eax,dword ptr [esp+8]
               0x8B, 0x4C, 0x24, 0x04, // mov ecx,dword ptr [esp+4]
               0x03, 0xC1,             // add eax,ecx
               0xC2, 0x08, 0x00        // ret 8
           };

           // We need to push the code bytes into a native buffer
           IntPtr myAddNativeCodeBytesPtr = IntPtr.Zero;

           try
           {
               // Allocate the native buffer
               myAddNativeCodeBytesPtr =
                   Marshal.AllocCoTaskMem(myAddNativeCodeBytes.Length);

               // Push the code bytes over
               Marshal.Copy(myAddNativeCodeBytes, 0,
                   myAddNativeCodeBytesPtr, myAddNativeCodeBytes.Length);

               // Get a function pointer for the native code bytes
               MyAdd myAdd = (MyAdd)Marshal.GetDelegateForFunctionPointer(
                   myAddNativeCodeBytesPtr, typeof(MyAdd));

               // Call the native code bytes
               Int32 result = myAdd(4, 5);

               // Did it work?
               Console.WriteLine("Result: {0}", result);
           }

           finally
           {
               // Free the native buffer
               if (myAddNativeCodeBytesPtr != IntPtr.Zero)
               {
                   Marshal.FreeCoTaskMem(myAddNativeCodeBytesPtr);
                   myAddNativeCodeBytesPtr = IntPtr.Zero;
               }
           }
       }
   }

In this sample I just used Marshal.AllocCoTaskMem(), but one should actually P/Invoke VirtualAllocEx and VirtualProtectEx to ensure the page where the code exists has PAGE_EXECUTE access. Additionally the above sample is targetted to my personal x86 machine, and will not run on x64 or any other platform for that matter.

Read more: Devin Jenson's WebLog

Posted via email from jasper22's posterous

Программирование сопроцессора на C#? Да!

|
Наверное все знают о существовании сопроцессора FPU. Как писать код для него читаем дальше  Если не все, то я напомню: FPU – floating point unit – часть центрального процессора, специально предназначенная для работы с типами данных, представляющими числа с плавающей точкой, или по-другому с типами float и double. Данный модуль в составе процессоров появился после появления на свет Pentium III, да вот так давно. И с тех пор именно он выполняет работу по вычислениям различных математических выражений, а точнее их в виде кода на языке ассемблера. Другими словами, компилятор не весь код программы преобразует в стандартный набор инструкций типа mov, sub и прочие, но и еще в fld, fstp, fsub, fadd…, если речь идет о вычислениях с участием типов double. Как видите, инструкции для FPU имеют приставку “f”, по которым собственно можно сразу отличить код, предназначенный для него. Всю информацию по FPU вы можете найти на просторах инета, погуглив его по имени, также рекомендую сайт wasm.ru – раздел «Процессоры». Сопроцессор очень интересная штука и программирование его очень интересное занятие, я бы даже сказал захватывающее – не знаю, что почувствуете Вы, но я был в восторге, когда у меня получилось «заклинать» код, давая команды непосредственно процессору без посредников-компиляторов, CLR-среды и др. Почему «заклинать»? Об этом чуть позже.
Термин «заклинать» я позаимствовал у автора замечательных статей на сайте. Это серия статей про «Заклинание кода», которые я Вам рекомендую почитать после прочтения моей статьи.
Сейчас я покажу Вам как же написать простой пример заклинания кода применительно для FPU. Сразу должен предупредить, что хоть в конце и будет участвовать C#, для самого заклинания нужен С++.
Допустим нам надо вычислить такое выражение: result = arg1 – arg2 + arg3.
Есть несколько вариантов составления кода. Чтобы не усложнить понимание происходящего, я покажу сначала один, чуть позже покажу другой.
Итак, первый вариант выглядит так:

fld [arg1]
fld [arg2]
fsubp
fld [arg3]
faddp
fstp [result]
ret

Read more: habrahabr.ru

Posted via email from jasper22's posterous

Simplified MVVM: Silverlight Video Player

|
This project demonstrates an implementation of the MVVM (Model-View-ViewModel) pattern to create a fully "Designable" Silverlight Video Player. This is not to be confused with a "Skinable" Video Player. A Skinable Video Player allows you to change the look and feel of the buttons that control the player. A Designable player allows a Designer to use ANY set of controls to implement the Video Player.

The MVVM pattern allows a programmer to create an application that has absolutely no UI. The programmer only creates a ViewModel and a Model. A designer with no programming ability at all, is then able to start with a blank page and completely create the View (UI) in Microsoft Expression Blend 4 (or higher).

Read more: Codeproject

Posted via email from jasper22's posterous

Upload file (ftp) using C#

|
דוגמת קוד שכתב אחי יוסי גולדברג  להעלאת קבצים ל - ftp

string url = "ftpUrl/FileName";

FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(url);

request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential("user name", "password");
request.UsePassive = true;
request.UseBinary = true;
request.KeepAlive = false;

byte[] buffer = File.ReadAllBytes("path");

using (Stream reqStream = request.GetRequestStream())
{
   reqStream.Write(buffer, 0, buffer.Length);
}

אם לא רוצים לקרוא את כל הקובץ בבת אחת אפשר כמובן לכתוב ככה

using (Stream reqStream = request.GetRequestStream())
{
   int count = 0;
   byte[] buffer = new byte[100];
   using (FileStream file = new FileStream("FileName", FileMode.Open))
   {
       while ((count = file.Read(buffer, 0, 100)) > 0)
       {
           reqStream.Write(buffer, 0, count);
       }
   }
}

Read more: שלמה גולדברג

Posted via email from jasper22's posterous

Cassandra: Fact vs fiction

|
Cassandra has seen some impressive adoption success over the past months, leading some to conclude that Cassandra is the frontrunner in the highly scalable databases space (a subset of the hot NoSQL category). Among all the attention, some misunderstandings have been propagated, which I'd like to clear up.

Fiction: "Cassandra relies on high-speed fiber between datacenters" and can't reliably replicate between datacenters with more than a few ms of latency between them.

Fact: Cassandra's multi-datacenter replication is one of its earliest features and is by far the most battle-tested in the NoSQL space. Facebook had Cassandra deployed on east and west coast datacenters since before open sourcing it. SimpleGeo's Cassandra cluster spans 3 EC2 availability zones, and Digg is also deployed on both coasts. Claims that this can't possibly work are an excellent sign that you're reading an article by someone who doesn't know what he's talking about.

Fiction: "It’s impossible to tell when [Cassandra] replicas will be up-to-date."

Fact: Cassandra provides consistency when R + W > N (read replica count + write replica count > replication factor), to use the Dynamo vocabulary. If you do writes and reads both with QUORUM, for one example, you can expect data consistency as soon as there are enough reachable nodes for a quorum. Cassandra also provides read repair and anti-entropy, so that even reads at ConsistencyLevel.ONE will be consistent after either of these events.

Fiction: Cassandra has a small community

Fact: Although popularity has never been a good metric for determining correctness, it's true that when using bleeding edge technology, it's good to have company. As I write this late at night (in the USA), there are 175 people in the Cassandra irc channel, 60 in the HBase one, 32 in Riak's, and 15 in Voldemort's. (Six months ago, the numbers were 90, 45, and 12 for Cassandra, HBase, and Voldemort. I did not hang out in #riak yet then.) Mailing list participation tells a similar story.

It's also interesting that the creators of Thrudb and dynomite are both using Cassandra now, indicating that the predicted NoSQL consolidation is beginning.

Read more: Spyced

Posted via email from jasper22's posterous

How to Write a Memory Leak Unit Test

|
Unit tests are great for ensuring that your functionality is correct. But how do you make sure you don't have leaks in your code, leaks that eventually cause your application to crash when it runs out of memory? Unit tests don't typically don't run into memory problems directly because they tend to start up, run a little bit of code, and shut down -- getting a nice fresh memory environment on each test start.

One great way to help protect yourself from uptime problems is to write leak tests. These are unit tests where you first perform some operations, then do normal cleanup, and finally you assert that the objects you were using during the operation have been cleaned up completely. In other words, that there are no references left anywhere on the heap.

Testing for leaks isn't very hard; the basic trick is to create a weak reference to your to-be-cleaned object (by constructing a WeakReference wrapping your object), then you delete all your local references to the object, then you perform garbage collection, and finally you see whether the weak reference still contains your object. This works because the weak reference is handled specially by the garbage collection system.

It turns out things aren't quite as easy as that, because garbage collectors try to be smart, and simply calling System.gc() doesn't mean it's going to actually perform a complete and final garbage collection. This means that your unit test could incorrectly conclude you have a leak, since the reference is still held.

The NetBeans team has built a really good test infrastructure for this. When I wrote unit tests for NetBeans plugins, I could simply call their assertGC method to assert that the given weak reference should be garbage collected, and it would handle the rest. (Internally, they do things like actually allocating a bunch of memory chunks to really force the garbage collection to run.)

Here's an example:

// The following unit test fragment wants to ensure that a graphics object
// which shows the current selection in the authoring tool, is cleared up after
// the user clears the selection.
view.selectAll();
Node firstHandle = /* Node showing selection highlight, lookup code here */;
assertNotNull(firstHandle);

// Now clear view selection -- then assert that all the handles have disappeared
view.selectNone();

WeakReference<Node> ref = new WeakReference<Node>(firstHandle);
firstHandle = null;
assertGC("Selection handle leaked", ref);


Read more: Tor Norbye's Weblog

Posted via email from jasper22's posterous

Steve Jobs’ response on Section 3.3.1

|
After posting my reaction to clause 3.3.1 of the iPhone SDK terms I decided to write Steve Jobs the following email:

   Hi Steve,

   Lots of people are pissed off at Apple’s mandate that applications be “originally written” in C/C++/Objective-C. If you go, for example, to the Hacker News homepage right now:

   <http://news.ycombinator.com/>

   You’ll see that most of the front page stories about this new restriction, with #1 being: “Steve Jobs Has Just Gone Mad” with (currently) 243 upvotes. The top 5 stories are all negative reactions to the TOS, and there are several others below them as well. Not a single positive reaction, even from John Gruber, your biggest fan.

   I love your product, but your SDK TOS are growing on it like an invisible cancer.

   Sincerely,
   Greg

His response:

   We think John Gruber’s post is very insightful and not negative:

   http://daringfireball.net/2010/04/why_apple_changed_section_331

   Steve

Of course he was right, I had somehow missed that post by Gruber, having only read the original. Gruber’s second post, which Jobs appears to be endorsing here, is indeed, very insightful, and may explain Apple’s motivations for the updates to section 3.3.1.

Read more: TAO Effect

Posted via email from jasper22's posterous

SQL Server Bible Standards

|
a SQL Server design and development standards document.

Read more: Codeplex

Posted via email from jasper22's posterous

Solaris No Longer Free

|
Hot on the heals of Oracle's revamp of Solaris support, the licensing agreement for free downloads of Solaris 10 have changed. Infoworld broke the news on Friday.

Here is the bit in question. Notice this paragraph in the Licensing Agreement:

"Obtaining an Entitlement Document is simple. On the Solaris 10 Get It page, select the platform and format you desire from the drop-down menus, and then click the Download Solaris 10 button. When you arrive at the Sun Download Center, either sign in or register, ensuring that a valid e-mail address is part of your Sun Download Center account to receive the Entitlement Document. Fill out the Solaris download survey, specifying the number of systems on which you are installing the software. Once you have completed the survey, you will be redirected to the Solaris 10 download page for downloading, and your Entitlement Document will be sent to your registered e-mail address. Please remember, your right to use Solaris acquired as a download is limited to a trial of 90 days, unless you acquire a service contract for the downloaded Software."

That's the part that is that gets the interest... but here's the part that is more serious. Here is a line from the old license:

"In order to use the Solaris 10 Operating System for perpetual commercial use, each system running the Solaris 10 OS must have an entitlement to do so. The Entitlement Document is delivered to you either with a new Sun system, from Sun Services as part of your service agreement, or via e-mail when you register your systems through the Sun Download Center."

Read more: Ben Rockwood

Posted via email from jasper22's posterous

Base Class Libraries

|
The Base Class Libraries site hosts samples, previews, and prototypes from the BCL team.

This is a site for the BCL Team to get features to customers to try out without requiring a Beta or CTP of the .NET Framework. Our goal is to put generally useful functionality here, and to get feedback on it and have the chance to iterate on the design. Having a feature here does not mean that it will eventually end up in the BCL. Some items are samples that build on top of existing classes, and some features might be ones we were considering for the .NET Framework but decide not to include for one reason or another.

We'd love to get your feedback in the form of comments, bug reports, and feature requests, but please note that we cannot take code submissions. We plan to release updates with new features and updates to existing features on a quarterly basis, but we're just getting started with this and may adjust down the line depending on how things go.

And just to avoid confusion, you will not find the source code for the whole BCL on this CodePlex site. This site is for things we're thinking about for the future, not our existing classes.

Read more: Codeplex

Posted via email from jasper22's posterous

The great thing about URL encodings is that there are so many to choose from

|
The phrase URL encoding appears to mean different things to different people.

First, Tim Berners-Lee says that URLs are encoded by using %xx to encode "dangerous" characters, or to suppress the special meaning that would normally be assigned to characters such as / or ?. For example, the URL http://server/why%3F/?q=bother is a request to the server server with the path /why?/ and with the query string q=bother. Notice that by escaping the question mark, we prevent it from being interpreted as the start of the query portion of the URL.

Now, it so happens that when a form is submitted via GET, then the contents of the form are encoded (by default) into the query according to a set of rules laid out in the HTML 4.01 specification: The query string takes the basic form of var=value&var=value&.... If a variable name or a value contains a "dangerous" character or a special character like = or &, then it must be %-escaped. For example, co=AT%26T says that the variable co has the value AT&T. Encoding the ampersand prevents it from being interpreted as a separator.

And here is the special additional rule that confuses a lot of people: When submitting a form via GET, the form data is encoded into the query portion of a URL, and under the default encoding, the character U+0020 (space) is encoded as U+002B (plus sign). This special use of the plus sign applies only to the query portion of the URL. Sometimes people get confused and think that it applies to URLs in general.

Example:

http://example.com/embedded%20space.html?key=apple+pie#result%20panel

The base URL and fragment (colored in blue) use the %20 sequence to encode the embedded space, whereas the query (colored in green) uses the plus sign.

You'd think that would be the end of the story, but in fact it's just the beginning, because now we get to throw in all sorts of nonstandard URL encoders.

The PHP function urlencode treats the entire string as if it were a value (or variable name) in a query string, encoding spaces as a plus sign and being careful to escape all other punctuation. Not to be confused with rawurlencode which encodes everything (even characters like /).

JScript comes with a whole bucketload of functions for URL encoding. There's escape(), which encodes almost everything but leaves the slash and—bafflingly—the plus sign unencoded. And then there's the encodeURI() function which leaves a few more characters unencoded (including the colon (U+003A), and question mark (U+003F)). But wait, there's also encodeURIComponent() which goes to the effort of encoding slashes too. It's a total mess, but this site tries to make some sense out of the whole thing.

Read more: The old new thing

Posted via email from jasper22's posterous

Pushing the Limits of Windows: Handles

|
This is the fifth post in my Pushing the Limits of Windows  series where I explore the upper bound on the number and size of resources that Windows manages, such as physical memory, virtual memory, processes and threads. Here’s the index of the entire Pushing the Limits series. While they can stand on their own, they assume that you read them in order.

   Pushing the Limits of Windows: Physical Memory

   Pushing the Limits of Windows: Virtual Memory

   Pushing the Limits of Windows: Paged and Nonpaged Pool

   Pushing the Limits of Windows: Processes and Threads

   Pushing the Limits of Windows: Handles

   Pushing the Limits of Windows: USER and GDI Objects – Part 1

   Pushing the Limits of Windows: USER and GDI Objects – Part 2

This time I’m going to go inside the implementation of handles to find and explain their limits. Handles are data structures that represent open instances of basic operating system objects applications interact with, such as files, registry keys, synchronization primitives, and shared memory. There are two limits related to the number of handles a process can create: the maximum number of handles the system sets for a process and the amount of memory available to store the handles and the objects the application is referencing with its handles.

In most cases the limits on handles are far beyond what typical applications or a system ever use. However, applications not designed with the limits in mind may push them in ways their developers don’t anticipate. A more common class of problems arise because the lifetime of these resources must be managed by applications and, just like for virtual memory, resource lifetime management is challenging even for the best developers. An application that fails to release unneeded resources causes a leak of the resource that can ultimately cause a limit to be hit, resulting in bizarre and difficult to diagnose behaviors for the application, other applications or the system in general.

As always, I recommend you read the previous posts because they explain some of the concepts  this post references, like paged pool.
Handles and Objects

The kernel-mode core of Windows, which is implemented in the %SystemRoot%\System32\Ntoskrnl.exe image, consists of various subsystems such as the Memory Manager, Process Manager, I/O Manager, Configuration Manager (registry), which are all parts of the Executive. Each of these subsystems defines one or more types with the Object Manager to represent the resources they expose to applications. For example, the Configuration Manager defines the key object to represent an open registry key; the memory manager defines the Section object for shared memory; the Executive defines Semaphore, Mutant (the internal name for a mutex), and  Event synchronization objects (these objects wrap fundamental data structures defined by the operating system’s Kernel subsystem); the I/O Manager defines the File object to represent open instances of device driver resources, which include file system files; and the Process Manager the creates Thread and Process objects I discussed in my last Pushing the Limits post. Every release of Windows introduces new object types with Windows 7 defining a total of 42. You can see the objects defined by running the Sysinternals Winobj utility with administrative rights and navigating to the ObjectTypes directory in the Object Manager namespace

Read more: Mark's Blog

Posted via email from jasper22's posterous

Mono Tools for Visual Studio 1.1 has been released!

|
Monotools1-1-a.png

Mono Tools for Visual Studio 1.1  has officially been released, containing several of the most requested features, as well as many bugfixes.

Mono Tools for Visual Studio is a commercial add-in for Microsoft� Visual Studio� that enables developers to build, debug, and deploy .NET applications targeting Mono from within their preferred IDE.

Along with many bugfixes and small enhancements, the Mono Tools 1.1 update features the following improvements:

   * Smarter Remote File Copying
   * Automatically Detect Future Updates
   * Preview of Visual Studio 2010 Support
   * Easier Packaging of Precompiled Web Applications

More details regarding this release can be found in the Mono Tools for Visual Studio 1.1 Release Notes.

Read more: Mono

Posted via email from jasper22's posterous

50 Tips to Boost ASP.NET Performance – Part I

|
When we are looking to optimize the performance of  web applications we should keep in mind about Memory Load, Processor Load and Network Bandwidth. Here are 50  best practices to improve the performance and scalability of ASP.NET applications.

1. Page.IsPostBack Property

Keep code which only needs to be loaded once inside an IsPostBack block.

if(!IsPostBack)
{
BindDropDownList();
LoadDynamicControls();
}

As a result there will be no unnecessary database hits and server processing.

2. Enable Buffering

A buffer is a region in main memory to store temporary data for input and output .Data retrival from memory is faster than data retrieval from disk. We should leave buffering on unless there is any specific reason to turn it off. By default buffering is enable.

3. Remove unused HttpModules

There may be lot of HttpModules in Machine.Config that are not actually required for a particular application. In this scenario we should remove those unused HttpModules from application specific web.config file.

4. Trim Page Sizes

Reduce page size by removing any unnecessary space and tab characters from the page. As a result network traffic will be reduced.

5. Use a CDN

Not a performance tip exclusive to ASP.NET but an important step in speeding up a site is to use a Content Delivery Network (CDN) . CDN’s minimize the latency site visitors experience when they request a larger file from a data center that is located geographically far away. CDN’s cache files at numerous edge locations around the world to minimize latency.
If you are using Azure consider using the Windows Azure CDN , Amazon’s CloudFront cheap and easy to integrate into a website (if you happen to have a WordPress blog you can  integrate S3 and CloudFront into WordPress)
(more..)

Read more: ASP NET 101

Posted via email from jasper22's posterous

Calling PowerShell from .NET

|
I have been working with Windows Server AppFabric caching lately and have found it to be very impressive.  The more that I work with it the more that I can see areas that it can be utilized.  One of the things that will become quite evident as you start using it is that much of the setup and configuration is done through PowerShell cmdlets.

I am in the process of putting together an application and I want the application to be able to create and pre-populate the cache.  As I looked into creating the cache I knew that it could be created through PowerShell directly but I wanted to call the PowerShell cmdlets from .NET.  So, lets look at what is needed to create the cache from PowerShell first and then we will look at the code to call the cmdlets from .NET.

This assumes that AppFabric has been installed and configured.

Open a PowerShell command window.  The first thing that we are going to do is to import two modules and then we can start issuing commands.  First, type "Import-Module DistributedCacheAdministration" (without the quotes) and hit enter.  This will import the cache administration cmdlets. Next type "Import-Module DistributedCacheConfiguration" and hit enter.  This will import the cache configuration cmdlets.

The next command will bring the current machines' cluster configuration into the PowerShell session context.  So, type in Use-CacheCluster and hit enter.  We have now entered all that we need to start interacting with the cache.  The first thing that we need to do is to ensure that the cache service is running.  Type "Get-CacheHost" and hit enter.  Look on the screen and see if the Service Status show UP.  If it shows DOWN then issue the following commands to start it.  Type "$hostinfo = Get-CacheHost" and hit enter.  Then type in "Start-CacheHost $hostinfo.HostName $hostinfo.PortNo".

At this point we are ready to create the cache using the New-Cache cmdlet.  Type "New-Cache <your cache name here>" and hit enter.  This will create a cache with your name that is ready to use.

If you want to see the configuration for your newly created cache type in "Get-CacheConfig <your cache name here>" and hit enter.  You will see the following configuration attributes and their settings.

CacheName : MyCache
TimeToLive : 10 mins
CacheType : Partitioned
Secondaries : 0
IsExpirable : False
EvictionType : LRU
NotificationsEnabled : False


To do this all with code we need to add three references to our project.  Add the System.Management.Automation assembly as well as the Microsoft.ApplicationServer.Caching.Core and Microsoft.ApplicationServer.Caching.Client assemblies.  These two assemblies can be found in the Windows\System32\AppFabric directory.

Read more: Stephen Kaufman's WebLog

Posted via email from jasper22's posterous

Revealed: the final chip spec for Natal

|
Natal design to be based on tech by Israeli company PrimeSense

The final edition of Microsoft’s Project Natal control prototype features technology based on an all-encompassing system-on-a-chip.

And Microsoft says that the newly-revealed component will help the company “deliver revolutionary controller-free entertainment”.

Natal’s tech is now thought to be a modified version of the PS1080 chip – built by Israeli company PrimeSense and featuring a “multi-sense system” offering synchronised depth image, colour image and audio stream.

PrimeSense company president Aviad Maizels says that the “Xbox 360 Hardware Engineering teams developed the Natal sensor based on the PrimeSensor reference design.”

The technical specifications of Natal have always been a moving target, with Microsoft making constant adjustments to the device throughout its development.

Now, with a mere six months to go before Natal’s launch, the platform holder must fully finalise its design to aid its development partners and manufacturing firms.
Article continues below

Advertisement
MM

Last year Microsoft purchased a stake of camera technology group 3DV in what is thought to be a $7m deal, giving Natal advanced camera technology.

Read more: develop

Posted via email from jasper22's posterous

Sending SMS from the webpage

|
Introduction

In this article we will see an example of sending sms through the way2sms account. There are two pages in the demo

1. login.aspx
2. Sms.aspx

This is the login.aspx where you have to provide your way2sms username and password

NOTE: If you don't have account in way2sms, before using this demo you have to create account in way2sms.com

Read more: C# Corner

Posted via email from jasper22's posterous

Google Wave Federation Protocol: More Docs, More Code

| Sunday, April 11, 2010
When we shipped the FedOne code to demonstrate the Google Wave Federation Protocol, we included some overview information and basic documentation  on how to get it up and running. Since then, the community has stepped up and contributed some great documentation, and we wanted to highlight a couple of great resources that may be helpful to anyone interested in the Google Wave Federationn Protocol.

For example, Anthony Watkins wrote several articles to explain the architecture of the FedOne code:

   * Part 1 - Audience and Prerequisites
   * Part 2 - Startup Process
   * Part 3 - Dependency Object Graph
   * Part 4 - Communication Interfaces
   * Part 5 - Wavelet Container

In an effort to bring together this and other community-created resources in a single place, we've gathered links to Anthony's articles, along with links to articles by James Purser and Bryce into a wiki page. Be sure to check them out, and let us know if we've missed any great articles on the Google Wave Federation Protocol or the FedOne code. Share your links on the wave protocol discussion forum and we will update the wiki as they come in.

Read more: Google blog

Posted via email from jasper22's posterous

Gotcha: When Server-Scoped DDL Triggers don’t honor ROLLBACK

|
I’ve used DDL Triggers before to prevent database DROP DATABASE operations.  For example:

           CREATE TRIGGER ddl_ss_prevent_database_drop
ON ALL SERVER
FOR DROP_DATABASE
AS
PRINT 'Will not drop database until you disable this trigger.'
ROLLBACK
GO

If you try to drop a database with this DDL trigger in place, you’ll get the following message:

Will not drop database until you disable this trigger.
Msg 3609, Level 16, State 2, Line 2
The transaction ended in the trigger. The batch has been aborted.

What’s more – your DROP DATABASE truly is prevented, as one would expect. But this behavior isn’t universal across all operations.  Sometimes ROLLBACK isn’t possible.  Take the following example of a DDL trigger on an ALTER_DATABASE event

Read more: Joe Sack's SQL Server WebLog

Posted via email from jasper22's posterous

Types of managed code assemblies

|
Managed code assemblies can be a strange, many-headed beast. I say it has many heads because there are lots of nuances that have a significant impact on how and where managed code assemblies can be executed.

There are two main categories of managed code assemblies:

   * Pure MSIL
   * Mixed-mode

Pure MSIL assemblies contain only platform-independent byte code. At runtime this byte code has to be compiled (a.k.a. jitted) to the processor's native machine code. Pure MSIL code can run on any .NET platform be it i386, amd64 or ia64. It can even be run on Mono platforms without modification.

Mixed-mode assemblies contain a mix of native machine code and platform-independent byte code. Because it contains native machine code a mixed-mode assembly can only run on the platform for which it was compiled.

That didn't sound so bad, did it? Pure MSIL assemblies and mixed-mode assemblies, it's simple. But wait!

A pure MSIL assembly can be made into a platform-specific assembly. It'll still contain nothing but platform-independent byte code. At runtime this byte code will still need to be compiled (a.k.a. jitted) to the processor's native machine code. But it can only run on that one specific platform. See Spanky J's blog on generating platform-specific assemblies for more info on how all these different types of assemblies interact with one another.

Right about now you should be wondering how to tell the difference between a truly platform independent pure MSIL assembly, an i386 platform-specific pure MSIL assembly and an amd64 platform specific pure MSIL assembly. It turns out that getting the answer is pretty easy, but you'll have to take two properties into account: the assembly's container, EXE or DLL, file format and the assembly's .corflags metadata value. To see this information you'll need to run corflags.exe. (This is a free tool and it's included with the Windows SDK.) See Spanky J's blog on flipping bits on managed assemblies for more info on how to run corflags.exe.

Coreflags.exe dumps out the assembly's container file format info in the "PE" field. It dump's the assembly's .corflags metadata value in 4 different fields, but we'll only need to look at two of them, the "ILONLY" and 32Bit fields.

Let's go with the easy one first. This is a pure MSIL assembly that can be run on any platform.

Table 1: MSIL assembly that can be loaded in any environment

Version : v2.0.50727
CLR Header: 2.5
PE : PE32
CorFlags : 1
ILONLY : 1
32BIT : 0
Signed : 1

You should note that the PE field's value is PE32, the ILONLY field's value is 1 and the 32Bit field's value is 0. The PE field's PE32 value means the assembly can be loaded on any platform that knows how to read the PE32 file format. All .NET platforms and all Mono platforms know how to read the PE32 file format. The ILONLY field's 1 value means that the assembly contains only platform-independent byte code. The 32Bit field's 0 value means that the assembly will be jitted to platform native code at runtime. All this means that it will run as a native 32-bit app on 32-bit systems and a native 64-bit app on 64-bit systems.

Now we'll take it up a notch and look at a pure MSIL assembly that can be run only on an i386 platform.

Table 2: MSIL assembly that can be loaded only in an i386 environment

Version : v2.0.50727
CLR Header: 2.5
PE : PE32
CorFlags : 3
ILONLY : 1
32BIT : 1
Signed : 1

You should note that the PE field's value is PE32, the ILONLY field's value is 1 and the 32Bit field's value is 1. I've already explained the significance of the values for the PE and ILONLY fields. The 32Bit field's 1 value means that the assembly will be jitted to i386 platform specific code at runtime. All this means that it will run as a native 32-bit app on 32-bit systems and run as a native 32-bit app within the WoW64 subsystem 64-bit systems. (Remember that 64-bit Windows has the WoW64 subsystem that allows it to load and run code for the i386 platform.)

Next we'll look at a pure MSIL assembly that can be run only on an amd64 platform.

Read more: The Bloggernaut

Posted via email from jasper22's posterous

הפצה בחלונות 7 מי אמר אני

|

חלונות 7 היא לא עוד מערכת הפעלה ובטח שלהפיץ אותה צריך להכין "קצת" שיעורי בית , לא פעם נשאלתי האם מי שהפיץ XP יודע להפיץ 7 ומיד עניתי תשובה של ממש לא !! טוב אולי הרקע קצת יעזור אבל לא מעבר לכך . מה שאנסה לכתוב בפוסט זה הוא מידע כללי אודות הפצת חלונות 7 או לפחות איך להתחיל .

שינויים מהותיים : שיטת המבנה של קובת ההפצה – פורמט WIM במקום אותו image שהכנו על ידי תוכנת צד שלישי , ביטול התלות ב HAL שכבת החומרה (מי שהפיץ XP סבל מזה לא מעט ) , וייחודיות השפה .

כדי להתחיל בהכנת הפצה של חלונות 7 צריך להצטייד במספר כלים :

  1. Windows AIK
  2. MDT
  3. ידע בפקודת DISM
  4. שרת WDS להפצת אימגי'ם (קיים בשרת 2008 ) בשיטת Light Touch .
  5. שרת SCCM להפצת אימג'ים בשיטת Zero Touch  .

חשוב להדגיש כי SCCM היא לא חובה כתנאי להפצות של מערכת 7 וניתן להשתמש בשרת WDS אך כדי ליצור אוטומציה מלאה יש להצטייד ב MDT בנוסף יש להתקין WDS ללא קשר לשרת ה SCCM .


Read more: shayamar

Posted via email from jasper22's posterous

Breakout in Silverlight

|
gameplay.png

Silverlight technology serves one of the best platform to write web based games. The main advantage is that shapes in Silverlight draw themselves and they support the same events as other elements. So we don’t need to worry about painting process of shapes etc. This game also serves as the basics to develop game in Silverlight.

Read more: Codeproject

Posted via email from jasper22's posterous

MonoTouch and iPhone OS 4

|
This is an update from the MonoTouch team at Novell to the MonoTouch community.

Many have contacted us about reports on the changes in the iPhone Developer Program Agreement and while we can not comment on the specifics of a confidential agreement, we want to address some of the points that are being brought up.

We believe that MonoTouch brings an impressive value to the Apple ecosystem.

MonoTouch's C-powered runtime blends the power of native code and Apple's iPhoneOS APIs with type safety, automatic memory management, and other benefits that years of runtime innovation have delivered to the ISO Common Language Infrastructure.

We are reaching out to Apple for clarification on their intention, and believe there is plenty of room for course-correction prior to the final release of the 4.0 SDK.

MonoTouch's programming model exposes the iPhoneOS API to the C# language to give developers the same control and access that Objective-C developers get.
(more..)

Read more: Mono

From Miguel:
MonoTouch already has an option to compile to C + XCode: just call mtouch --xcode program.exe

Read more: Miguel twitter

Posted via email from jasper22's posterous

How to call CryptMsg API in streaming mode (C#)

|
The other day I posted an issue when signing large data with SignedCms  in .NET (at least up to version 3.5 SP1): "ASN1 value too large" error when calling SignedCms.ComputeSignature. In that post, I mentioned the following to work around the issue: "we will have to p/invoke CryptMsg API and use it in streaming mode".

Now the logical question will be, how do I do that? The following C# sample will show you how:

File form1.cs:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography.X509Certificates;
using System.IO;

namespace LargeCMS
{
   public partial class Form1 : Form
   {
       public Form1()
       {
           InitializeComponent();

           subjectTextBox.Text = "ALEX";
           originalTextBox.Text = "my1GBfile.txt";
           encodedTextBox.Text = "encodeddata.p7s";
           decodedTextBox.Text = "decodeddata.txt";
       }

       private void encodeButton_Click(object sender, EventArgs e)
       {
           // Variables
           X509Store store = null;
           X509Certificate2 cert = null;
           FileStream inFile = null;
           FileStream outFile = null;
           CMS cms = null;

           try
           {
               // Get user cert
               store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
               store.Open(OpenFlags.MaxAllowed);
               cert = store.Certificates.Find(X509FindType.FindBySubjectName, subjectTextBox.Text, true)[0];

               // Open file with data to encode
               inFile = File.Open(originalTextBox.Text, FileMode.Open);

               // Create file for encoded data
               outFile = File.Create(encodedTextBox.Text);

               // Encode data
               cms = new CMS();
               cms.Encode(cert, inFile, outFile);

               MessageBox.Show("Sucess!!!");
           }


Read more: Decrypt my World

Posted via email from jasper22's posterous

Exception injection: Throwing an exception in other thread

|
This article shows a way to "abort" a non-cooperating thread. More precisely, it can be used to abort some non-cooperating function called from another thread, and return execution to some "friendly" point within that thread. The method described in this article causes an exception to be raised in the target thread (similar to Thread.Abort  in .NET).
The method

First let's agree on the exception type that we may want to throw. Let's call it ThreadAbort and define it:

class ThreadAbort
{
__declspec (noreturn) static void Throw();
public:
static bool RaiseInThread(HANDLE hThread);
static void DontOptimize() throw (...);
};


Read more: Codeproject

Posted via email from jasper22's posterous

StreamArmor – Discover & Remove Alternate Data Streams (ADS)

|
StreamArmor is a tool for discovering hidden alternate data streams (ADS) and can also clean them completely from the system. It’s advanced auto analysis coupled with online threat verification mechanism makes it the best tool available in the market for eradicating the evil streams. StreamArmor comes with fast multi threaded ADS scanner which can recursively scan over entire system and quickly uncover all hidden streams. All such discovered streams are represented using specific color patten based on threat level which makes it easy for human eye to distinguish between suspicious and normal streams.

StreamArmor has built-in advanced file type detection mechanism which examines the content of file to accurately detect the file type of stream. This makes it great tool in forensic analysis in uncovering hidden documents/images/audio/video/database/archive files within the alternate data streams. StreamArmor is the standalone, portable application which does not require any installation. It can be copied to any place in the system and executed directly.

What are ADS (Alternate Data Streams)?

If you’ve had any experience with advanced malware or Windows forensics you’d already know what ADS are, but if you haven’t is a lesser known feature of the Windows NTFS file system which provides the ability to put data into existing files and folders without affecting their functionality and size. Any such stream associated with file/folder is not visible when viewed through conventional utilities such as Windows Explorer or DIR command or any other file browser tools.

Read more: darknet.org.uk

Posted via email from jasper22's posterous

Things to install on a new machine – revisited

|
as I prepare to get a new dev machine at work, I write the things I am going to install on it, before writing the first line of code on that machine:

Control Freak Tools:

  1. Everything Search Engine – a free and amazingly fast search engine for files all over your machine. (just file names, not inside files). This is so fast I use it almost as a replacement for my start menu, but it’s also great for finding those files that get hidden and tucked away in dark places on my system. Ever had a situation where you needed to see exactly how many copies of X.dll were hiding on your machine and where? this tool is perfect for that.
  2. Google Chrome. It’s just fast. very fast. and Firefox has become the IE of alternative browsers in terms of speed and memory. Don’t even get me started on IE.
  3. TweetDeck – get a complete view of what’s up on twitter
  4. Total Commander – my still favorite file manager, over five years now.
  5. KatMouse – will scroll any window your hovering on, even if it’s not an active window, when you use scroll the wheel on it.
  6. PowerIso or Daemon Tools – for loading up ISO images of discs
  7. LogMeIn Ignition – quick access to your LogMeIn computers
  8. for online Backup: JungleDisk or BackBlaze
  9. KeePass – save important passwords
(more...)

Read more: ISerializable - Roy Osherove's Blog

Posted via email from jasper22's posterous

Ten Great CodePlex Projects for ASP.NET Developers

|
One of the most commonplace dilemmas developers encounter when working with new technology is figuring out how to gain hands-on experience. It's a classic case of the chicken and egg paradox; without a sound understanding of the technology, how can one be expected to build a substantive project using it? On the other hand, if building something of substance isn't realistic, then how can progress be made towards becoming a knowledgeable developer? Often, the obvious solution is to simply bite the bullet and learn through trial-and-error. However, in an age where project turnaround time is often measured in days and not months, sometimes you just don't have the luxury to learn at a leisurely pace, not to mention conjure up an interesting idea for a practical project.

So what's the best alternative? Looking at the source code of other more knowledgeable developers, of course! For years the open source community has learned in precisely this fashion, sharing a wealth of code through sites such as SourceForge and GitHub. While the Microsoft community has also for years shared code, albeit in a much more loosely organized fashion, it wasn't until the founding of CodePlex that these efforts began in earnest.

In this article I'll introduce you to ten great CodePlex projects which can undoubtedly greatly reduce your learning curve when getting acquainted with ASP.NET MVC, the fantastic free MVC framework built atop ASP.NET. Some of these projects are shining examples of ASP.NET MVC's power, while others are still diamonds in the rough, however all of them undoubtedly offer useful, real-world implementation examples which will prove invaluable as you wade into the waters of this exciting technology.
NerdDinner

Success in the IT industry seems to be directly intertwined with the size of one's M&E expenses. Pre-conference dinners, post-conference drinks, user group pizza... it's almost like food is nerd flypaper.

To help the programming community manage the logistical intricacies involving dinner plans, Microsoft luminaries Rob Conery, Scott Hanselman, and Scott Guthrie created NerdDinner. A companion project to their book, "Professional ASP.NET MVC 1.0", the NerdDinner project includes many of the typical features you'll find in such a Website, including user registration and login, the ability to both add your own group dinner as well as find dinners occurring in various locations, and RSVP for upcoming dinners.

Read more: codeguru

Posted via email from jasper22's posterous

Policy file for NetTcp

|
As part of Silverlight 4, developers can now use the NetTcp framing protocol for their web services. This is an addition that we expect a lot of you will find useful. However, many of you will probably hit the dreaded CommunicationException that lurks the unsuspecting developer as soon as he tries to establish that first connection from their Silverlight client to the service.

You probably have seen this exception message before:

Could not connect to net.tcp://localhost:4502/MyService. The connection attempt lasted for a time span of 00:00:00.4270427. TCP error code 10013: An attempt was made to access a socket in a way forbidden by its access permissions.. This could be due to attempting to access a service in a cross-domain way while the service is not configured for cross-domain access. You may need to contact the owner of the service to expose a sockets cross-domain policy over HTTP and host the service in the allowed sockets port range 4502-4534.

This fairly long exception message comes to “there probably is not an adequate cross-domain policy for the service endpoint you are trying to access”. The Silverlight runtime requires all network communications to be authorized. This is done by retrieving a policy file to associate with a remote server before doing the actual communication. Hard core details about the mechanism can be obtained in the MSDN article entitled Network Security Access Restriction in Silverlight.

So how do you solve this fast and easy?

Short answer:

Create a file named clientaccesspolicy.xml with the file content described below and host it on an HTTP server at http://<<YourNetTcpIPAddress>>:80/clientaccesspolicy.xml.

Long answer:

For NetTcp connection, you must use a HTTP based socket policy.

If you already have HTTP web services in place, you simply will add a few lines to your clientaccesspolicy.xml file and you *should* be done. Otherwise, you need to create a file named clientaccesspolicy.xml that is served via HTTP at the base IP address of your service on the standard HTTP port 80.

Read more: Silverlight Web Services Team

Posted via email from jasper22's posterous

The Common Opensource Application Publishing Platform (CoApp)

|
Today, I’m announcing the beginning of a project that intends to bring a little joy into the hearts of Open Source aficionados on the Windows Platform.

The biggest challenge to using/building/maintaining many Open Source applications on Windows, is that Windows does a lot of things differently than Linux and Unix . Different filesystems, command lines, APIs, user experiences … well, pretty much everything. Regardless of personal opinions about it being the ‘right-way’ or ‘wrong-way’, it suffices to say that it is just simply different.

In order to build an Open Source application like PHP for Windows from scratch, I need to have a collection of libraries created from a fair number of different projects.  This creates a dependency between the code that I’m working on—PHP—and the project that supplies the library that I need.  It’s pretty important that I not simply rely upon a previously compiled version of the library (provided either by the project itself, or a third party) for a number of reasons:

   * I want to make sure that the library is compiled with the same version of the compiler and libraries as I use.
   * In order to fine-tune performance, I’m going to need to change the compiler settings.
   * As a security precaution against malicious third parties creating flawed binaries.
   * Hey!--It’s Open source. It’s pretty much a moral imperative that I compile the code for myself. Well, it is for me anyway.

Now, unfortunately, those dependencies don’t necessarily share the same development environments, practices, tools, operating systems, or even ideas as to how things should—from one’s own perspective—be done (because, as every developer knows, one’s own way is the ‘one true way’).

Interestingly, this problem really doesn’t happen on Linux (and other *NIX-like substances).  When someone builds that same application (PHP) on Unix, they do so knowing that the OS works a certain way (generally speaking), and along with the dark magic known as autoconf, you can put the source code on nearly any Unix-variant and just build it.

Read more: Garrett Serack: Open Source Development at Microsoft

Posted via email from jasper22's posterous

Getting Started with PostSharp

|
With PostSharp, you can easily write and apply custom attributes that add new behaviors to your code - tracing, thread management, exception handling, data binding, and much more.

   PostSharp is the number one choice for aspect-oriented programming on the Microsoft .NET platform.

PostSharp in Action
1. Write an aspect

Rather than explaining complicated theory, we'll show you.

Read more: PostSharp

Posted via email from jasper22's posterous

ECMA 2010 Common Language Infrastructure Public Draft

|
The ECMA working group that drives the Common Language Infrastructure standard (ECMA 335) has published the working draft for the 2010 edition of the standard.
These are the work-in-progress documents that the team is working on.

Read more: Miguel de Icaza's web log
Official site: Working draft for the 2010 edition of the standard.

Posted via email from jasper22's posterous

SET NOCOUNT ON

|
This is a setting that DBA are advised to place at the start of the stored procedure.

What this setting does?

Let us run an sample code for this.

USE AdventureWorks
GO
SELECT * FROM Person.Address
SET NOCOUNT ON
SELECT * FROM Person.Address
SET NOCOUNT OFF

You will that first select query (at line no 3), will execute with out the the above setting while second SELECT statement (at line no 7) will execute with the SET NOCOUNT ON setting.

Though both queries will result same output. So what is the different.

If you got the message tab, you will see following output there.

Only first query has returned the number of rows effected not the second query.

This is what BOL says,

“SET NOCOUNT ON prevents the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. For stored procedures that contain several statements that do not return much actual data, or for procedures that contain Transact-SQL loops, setting SET NOCOUNT to ON can provide a significant performance boost, because network traffic is greatly reduced.”

In simple term, SET NOCOUNT ON will not return number of records affected to the client. What is the bug deal. If you are not using this information, it is an unnecessary burden to your server and network. By not returning this information, you are using less resources. This might not be huge saving, but might be the string which will brake the back of the camel.

Read more: Dinesh Asanka

Posted via email from jasper22's posterous

Unit testing your App.config and ConfigurationSection using NUnit, Ninject and TestDriven.NET

|
Let me just make things clear. This post is not about creating mocks.
This post is about really unit testing the different scenarios you have when working with configuration files:

   * What if the section is missing?
   * What if required fields are missing?
   * What values can I expect when optional fields are missing?
   * ...

To get started you need the following:

   * NUnit: http://www.nunit.org/ (assembly included in my solution)
   * Ninject: http://ninject.org/ (assembly included in my solution)
   * TestDriven.NET: http://www.testdriven.net/ (to be installed)

NUnit is the testing framework we'll use to perform our unit tests.
Ninject will be for dependency injection.
TestDriven.NET will be used to run the tests.

And I presume you have a basic knowledge of unit testing and dependency injection.

Read more: Codeproject

Posted via email from jasper22's posterous

Development of 64-bit C/C++ applications. Lessons.

|
We regularly write articles on development and testing of 64-bit C/C++ programs. Each of the articles presents different viewpoints on 64-bit software development. But much information of these papers is repeated because we have to introduce the readers into the subject and various definitions. Unfortunately, it makes the process of reading series of articles very boring and therefore does not allow the readers to thoroughly study the issues of 64-bit software development.

We decided to unite all our knowledge into a single work where we will study all the questions concerning 64-bit programming at once. We have too many materials to arrange them in one article, so we decided to make it a course of lessons.

Let me briefly describe the course "Lessons on development of 64-bit C/C++ applications" and its contents.

The course concerns development of 64-bit applications in C/C++ language and is intended for those developers who use Visual Studio 2005/2008/2010 environment. Developers working with other 64-bit operating systems will also learn much interesting. The course will cover all the stages that allow the programmer to create a new safe 64-bit application and port an existing 32-bit code to a 64-bit system.

The course consists of 28 lessons devoted to studying 64-bit systems, issues of 64-bit software building, methods of searching for errors specific to 64-bit code and code optimization. We will also touch upon such questions as estimating the cost of migration to 64-bit systems and rationality of this move.

The authors of the course are me (candidate of physico-mathematical sciences Andrey Nikolaevich Karpov) and candidate of technical sciences Evgeniy Alexandrovich Ryzhkov. So we are ready to discuss this course here, explain various details to you, correct some mistakes if any and consider your opinions.

Read more: Codeproject

Posted via email from jasper22's posterous

Internet Magic (Proxy sever) windows application

|
In any Network each systems has a unique IP address which identifies the system in the network. This application aims at distributing the internet over a network, based on the IP address. Administrator register the IP addresses of the client in the application (proxy server), which then allows access to the various services provided by server on the systems identifies by these IP addresses.

This project is being developed using C SHARP .NET in Visual Studio 2005.
Feature Set

• IP address based internet sharing
• Network monitoring to monitor online client activity.

• Web filter which can be used to block specified web sites.

• Time scheduling to limit client’s on-line time.

• Bandwidth usage statistics to monitor the bandwidth.

• Account authentication for Socks protocol.

• Socks support allows various internet messengers and ftp downloader’s.

• Portmap maps a port on a specific IP address to another port on another IP address.

• This application also supports Http/Ftp.

Background

In computer networks, a proxy server is a server (a computer system or an application program) that services the requests of its clients by forwarding requests to other servers. A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource, available from a different server. The proxy server provides the resource by connecting to the specified server and requesting the service on behalf of the client. A proxy server may optionally alter the client's request or the server's response, and sometimes it may serve the request without contacting the specified server. In this case, it would 'cache' the first request to the remote server, so it could save the information for later, and make everything as fast as possible. A proxy server that passes all requests and replies unmodified is usually called a gateway or sometimes tunneling proxy. A proxy server can be placed in the user's local computer or at various points between the user and the destination servers or the Internet.

Read more: Codeproject

Posted via email from jasper22's posterous