MVVM Study Part 3 – Why? |
- MVVM Study Part 3 – Why?
- Introducing The Windows Cache Extension for PHP
- Silverlight minor update released today
- Silverlight minor update released today
- Game Camp User Group Meeting
- Enter "Code 7" to Win a Trip to PDC09
- How Do I: Use the SDL Process Template Documentation and Reporting?
- Build the Newest Silverlight 3 Applications with Expression
- Data Templating Overview
- Compiler Warning C4789
- Multi-Monitor Support (VS 2010 and .NET 4 Series)
- Multi-Monitor Support (VS 2010 and .NET 4 Series)
- 7 Stages of new language keyword grief
- Silverlight Cream for August 31, 2009 -- #680
- querySelectorAll on old IE versions: something that doesn’t work
- Importing Adobe Illustrator files in Expression Blend 3
- Simple Color Animation in Blend for a Button State
- My SketchFlow .NET Rocks TV Episode is up (DNR-TV)
- Silverlight Drum Machine
- Data Templating Overview
Posted: 01 Sep 2009 01:39 PM PDT There are several major architectural approaches used in building user interfaces. MVC, MVP and MVVM seam to be the most popular of the bunch. From among them, MVVM has risen to the top of the stack for WPF and Silverlight developers. Even ignoring the...( read more )...(read more) |
Introducing The Windows Cache Extension for PHP Posted: 01 Sep 2009 11:44 AM PDT Today the Microsoft IIS team has released the beta of the Windows Cache Extension 1.0 for PHP . The Windows Cache Extension for PHP is a PHP accelerator , that is used to increase the speed of PHP applications running on the Windows operating systems. Any PHP application can take advantage of the functionality provided by the Windows Cache Extension for PHP without any code modifications. All that is required is that the extension is enabled and loaded by the PHP engine. Install the Windows Cache Extension 1.0 for PHP - Beta or, download: Windows Cache Extension 1.0 for PHP 5.2 - Beta Windows Cache Extension 1.0 for PHP 5.3 – Beta Follow the instructions at " Using Windows Cache Extension for PHP " to install, enable and configure...(read more) |
Silverlight minor update released today Posted: 01 Sep 2009 10:45 AM PDT Small public service announcement here for Silverlight developers…we released a minor update to the runtime and SDK today. You may see this referred to as Silverlight 3 GDR2 . Formally it is version 3.0.40818.0. Usually when a release pops up people are Read More......(read more) |
Silverlight minor update released today Posted: 01 Sep 2009 10:45 AM PDT Small public service announcement here for Silverlight developers…we released a minor update to the runtime and SDK today. You may see this referred to as Silverlight 3 GDR2 . Formally it is version 3.0.40818.0. Usually when a release pops up people are...( read more )...(read more) |
Posted: 01 Sep 2009 09:06 AM PDT On Thursday 3rd of September, we're having another Game Camp User Group meeting. As always, great content and nothing you should miss out on. We're hosting it, as always, in Oslo at NITH. The agenda consist of the following: 18:00 - 19:00 "Creating...( read more )...(read more) |
Enter "Code 7" to Win a Trip to PDC09 Posted: 01 Sep 2009 10:38 AM PDT Get in it to win it! The Code 7 Contest recognizes and rewards applications built on the Windows 7 platform which are innovative, cool and showcase the new features in Windows 7. |
How Do I: Use the SDL Process Template Documentation and Reporting? Posted: 01 Sep 2009 10:38 AM PDT This 5-minute video will help you learn how to use the new SDL Process Template's document templates and security metrics reporting. The built-in SDL document templates will help you jump start your use of the Microsoft SDL. |
Build the Newest Silverlight 3 Applications with Expression Posted: 01 Sep 2009 10:38 AM PDT Silverlight 3 and Expression Studio 3 help you create and deploy Web sites and rich Internet applications more easily than ever. Download Silverlight 3 and the Expression Studio 3 60-day trial today. |
Posted: 01 Sep 2009 10:15 AM PDT Learn how to use the data templating features in WPF to define the presentation of your data |
Posted: 01 Sep 2009 09:29 AM PDT When Visual Studio 2010 ships, it will have improvements to warning C4789; allowing it to catch more cases of buffer overrun. This blog post will cover what C4789 warns about, and how to resolve the warning. What does C4789 mean?
When compiling your source file, you may receive the warning: "warning C4789: destination of memory copy is too small." This message means that the compiler has detected a possible buffer overrun in your code. Example 1Let's say we have the source file a.cpp that contains the following: 1: #include <memory.h> 2: 3: int p[1]; 4: 5: void bar() { 6: memset(&p[1], 1, sizeof(int)); 7: }
From the "Visual Studio 2008 Command Prompt", if you compile this with the command: cl /c /O2 a.cpp You will receive the warning: a.cpp(6) : warning C4789: destination of memory copy is too small For the example above, the compiler has detected a buffer overrun for the variable 'p'. 'p' has been allocated as an array with one element. Arrays are zero-indexed, so the memset on line 6 is taking the address of the second element of an array; this means that we are actually writing to memory outside the array, corrupting memory! In this case, the user most likely meant to memset the first element, and thus to fix this issue, the memset would be changed to memset(&p[0], 1, sizeof(int));
Typical User Scenarios
In practice, a lot of buffer overruns will not be as obvious as Example 1, so I'll provide some more examples to help you in your investigations. Example 2Let's say we have the source file a.cpp that contains the following: 1: short G1; 2: 3: void foo(int * x) 4: { 5: *x = 5; 6: } 7: 8: void bar() { 9: foo((int *)&G1); 10: } From the "Visual Studio 2010 Command Prompt", if you compile this with the command: cl /c /O2 a.cpp You will receive the warning: a.cpp(9) : warning C4789: destination of memory copy is too small In this example, we've created a variable 'G1' of size short (which is only two bytes), but we've taken the address of it and casted it to 'int *' to pass to 'foo'. 'foo' then writes 4 bytes to the memory location pointed at by 'x'. As 'G1' is only 2 bytes in length, the store "*x = 5" will write past 'G1', resulting in a buffer overrun. There are a couple of important things to note about this example. This buffer overrun will only be caught with the improvements made in Visual Studio 2010. Also, this warning is caught by inlining 'foo' into 'bar'. This means that this buffer overrun is only caught when optimizations are enabled. To fix the buffer overrun in Example 2, we declare 'G1' as int. If that isn't an option, we can create a new variable to pass to 'foo,' and assign that variable to 'G1' (which truncates the int to a short): int y; foo(&y); G1 = y;
Example 3Let's say we have the source file a.cpp that contains the following: 1: int G1; 2: int G2; 3: 4: void foo(int ** x) 5: { 6: *x = &G2; 7: } 8: 9: void bar() { 10: foo((int *)&G1); 11: } From the "Visual Studio 2010 X64 Cross Tools Command Prompt", if you compile this with the command: cl /c /O2 a.cpp You will receive the warning: a.cpp(10) : warning C4789: destination of memory copy is too small This example is exactly like Example 2 with a key difference. We've casted "int" to "int *". On x86, this is a harmless cast (int and int * are the same size, 4 bytes). However, on x64, "int" is 4 bytes, and "int *" is 8 bytes, so this code is no longer correct when this code is run on x64. C4789 False Positives
You may hit cases of C4789 where the warning is incorrect. This can happen because the compiler detects a buffer overrun along a code path that will never fire. Example 41: __int64 G1; 2: int lengthOfG1 = 8; 3: 4: void foo(char * x, int len) { 5: if (len > 8) { 6: x[8] = 1; 7: } 8: } 9: 10: void bar() { 11: foo((char *)&G1, lengthOfG1); 12: } From the "Visual Studio 2010 Command Prompt", if you compile this with the command: cl /c /O2 a.cpp You will receive the warning: a.cpp(11) : warning C4789: destination of memory copy is too small In this example, the compiler thinks that 'G1' can be buffer overrun because of "x[8] = 1" would assign outside of the size of 'G1.' However, as long as 'lengthOfG1' is the correct length of 'G1,' "x[8] = 1" will never fire for 'G1,' and thus a buffer overrun will never occur. For some of these false positives, the only option will be to disable the warning. In this particular example, however, changing "int lengthOfG1 = 8" to const int lengthOfG1 = 8; would solve the problem. Workarounds
If you have proven that the warning is a false positive, there are a couple of different ways to disable the warning. 1. Disable the warning for one function (recommended) 2. Disable the warning for all functions Disable the warning for one functionThe compiler allows you to disable a warning for a particular function. This is done by putting #pragma warning ( disable : 4789 ) before the function, and putting #pragma warning ( default : 4789 ) after the function. This will disable the warning (in this case warning 4789) for that function (and any functions which inline it). Example 51: __int64 G1; 2: int lengthOfG1 = 8; 3: 4: #pragma warning ( disable : 4789 ) 5: void foo(char * x, int len) { 6: if (len > 8) { 7: x[8] = 1; 8: } 9: } 10: #pragma warning ( default : 4789 ) 11: 12: void bar() { 13: foo((char *)&G1, lengthOfG1); 14: } 15: 16: void bar1() { 17: foo((char *)&G1, 9); 18: } With the #pragma around 'foo,' you will receive no warnings; while without it you will receive the warnings: a.cpp(13) : warning C4789: destination of memory copy is too small a.cpp(17) : warning C4789: destination of memory copy is too small You can also choose to disable the warning for one of the functions where the warning occurs. In the example above, we could put the #pragma around 'bar' instead of 'foo', and then we'd eliminate the warning for line 13, but still receive the warning on line 17. Disable the warning for all functionsIf you need to ignore warning 4789 completely, you can specify /wd4789 on the command line. cl /c /O2 /wd4789 a.cpp This option isn't recommended as it will hide potentional buffer overruns in your code.
|
Multi-Monitor Support (VS 2010 and .NET 4 Series) Posted: 31 Aug 2009 10:37 PM PDT This is the fourth in a series of blog posts I'm doing on the upcoming VS 2010 and .NET 4 release. Today's post covers one of the general IDE improvements that I know a lot of people are already eagerly looking forward to with VS 2010 – multiple-monitor...( read more )...(read more) |
Multi-Monitor Support (VS 2010 and .NET 4 Series) Posted: 31 Aug 2009 10:37 PM PDT This is the fourth in a series of blog posts I'm doing on the upcoming VS 2010 and .NET 4 release. Today's post covers one of the general IDE improvements that I know a lot of people are already eagerly looking forward to with VS 2010 – multiple-monitor support. Using Multiple Monitors VS 2008 hosts all documents/files/designers within a single top-level window – which unfortunately means that you can't partition the IDE across multiple monitors. VS 2010 addresses this by now allowing editors, designers and tool-windows to be moved outside the top-level window and positioned anywhere you want, and on any monitor on your system. This allows you to significantly improve your use of screen real-estate, and optimize your overall development...(read more) |
7 Stages of new language keyword grief Posted: 31 Aug 2009 10:27 PM PDT My last post on the new dynamic keyword sparked a range of reactions which are not uncommon when discussing a new language keyword or feature. Many are excited by it, but there are those who feel a sense of…well…grief when their language is "marred" by a new keyword. C#, for example, has seen it with the var keyword and now with the dynamic keyword. I don't know, maybe there's something to this idea that developers go through the seven stages of grief when their favorite programming language adds new stuff ( Disclaimer: Actually, I'm totally making this crap up ) 1. Shock and denial. With the introduction of a new keyword, initial reactions include shock and denial. No way are they adding lambdas to the language! I had a hard enough time with...(read more) |
Silverlight Cream for August 31, 2009 -- #680 Posted: 31 Aug 2009 10:06 PM PDT In this Issue: Rick Barraza , Colin Blair , Joe Stagner , Chris Klug , Andrea Boschin , Laurent Bugnion , and Al Pascual . Shoutout: Blendables announced a New Desklighter Build in Labs , but I can't seem to get the link to open for me... give it a shot...( read more )...(read more) |
querySelectorAll on old IE versions: something that doesn’t work Posted: 31 Aug 2009 06:03 PM PDT In today's post, I'm going to show an interesting technique to solve a problem and then I will tear it to pieces and explain why it is actually useless. I believe that negative results should also be published so that we can save other people from wasting time trying the same thing. So here goes… A few days ago, a post on Ajaxian proposed a new version of a somewhat old technique to implement querySelectorAll on old versions of IE, using the browser's native CSS engine. That sounds like a great idea at first, and the hack is quite clever. The idea is to dynamically add a CSS rule to the document that has the selector that you want to evaluate, and an expression that adds the matched elements to a global array. When I read this, it reminded me...(read more) |
Importing Adobe Illustrator files in Expression Blend 3 Posted: 31 Aug 2009 05:13 PM PDT I previously wrote a few blog posts about importing Adobe Photoshop files into Expression Blend 3. This post focuses on the ability to import an Adobe Illustrator .ai file and converting the content to Silverlight 3 or WPF objects. You can also use this...( read more )...(read more) |
Simple Color Animation in Blend for a Button State Posted: 31 Aug 2009 04:59 PM PDT This tutorial shows off a few concepts in Silverlight that Blend makes very simple to work with including: Custom Control creation, Color Animation, Resources and State Management. Although you can not animate between Brushes during different States,...( read more )...(read more) |
My SketchFlow .NET Rocks TV Episode is up (DNR-TV) Posted: 31 Aug 2009 12:44 PM PDT URL : http://dnrtv.com/default.aspx?ShowID=148 I am excited to announce that my new DNR-TV episode is up at .NET Rocks. Carl and I visited while we were both at DevTeach to show off Blend's new SketchFlow functionality. If you have time, give it a spin...( read more )...(read more) |
Posted: 31 Aug 2009 03:08 PM PDT A simple looping drum machine that allows you to select which beat the sample will play and also lets you adjust the tempo....(read more) |
Posted: 31 Aug 2009 03:25 PM PDT |
You are subscribed to email updates from "microsoft" via reza in Google Reader To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment