I am using SQL Server 2008 and the Table schema is as below: The name of the table is ‘ImageEmployee’:
Display Images from Database in Windows Phone 7 (WP7) using WCF service
The Windows Phone 7 (WP7) Developer Toolkit RTW provides an excellent mechanism to built Rich UX applications on mobile devices (phone). One of the interesting aspect of WP7 programming is that it provides the Silverlight platform for application development. I am a great fan of Silverlight and WPF development and I am going to adopt a similar programming mechanism with WP7, for consuming WCF service and perform the data communication. In this article, I have designed a WCF service which makes a call to a Database and reads data from the table. This table contains Images stored in binary form and through the WCF service, we make the byte array data available to the WP7 application.
I am using SQL Server 2008 and the Table schema is as below: The name of the table is ‘ImageEmployee’:
I am using SQL Server 2008 and the Table schema is as below: The name of the table is ‘ImageEmployee’:
Read more: net curry.com
Lazy Load XAML content from External File and Vice Versa
Posted by
jasper22
at
10:48
|
XAML is the most flexible language built ever. More I see XAML, more I know about it. Today while tweaking around with XAML code, I found XAML could be loaded dynamically from any XML string. That means if you have a xaml in a xml file you can probably load the part of the XAML into your ContentControl or to any control element you want and the UI will appear instantly. Once you compile a XAML it produces BAML. BAML is in binary format for the XML, so if you can pass a BAML into the UI separately somehow during runtime,you would be seeing the content instantly in the Window. In this post I am going to discuss how easily you could load a Dynamic content of XAML file into a normal WPF ContentControl just like what we do for normal htmls. What is XamlReader and XamlWriter? If you look into the implementation of these classes you could wonder how flexible these are. They are highly capable of parsing the whole content of the file. It uses a XAMLDictionary which holds all the XAML elements that a XAML can see. The Reader parses the Xml content very cautiously to ensure it makes the XAML file to contain no reference of outside. Thus the class is used to Refactor the XAML from outside and hence allows you to put the content anywhere such that everything will be applied on that instantly. Read more: DOT NET TRICKS
A Real WPF 4.0 WebBrowser
Posted by
jasper22
at
10:45
|
“Console” checkbox – Shows a console allowing you to execute arbitrary javascript on the page.Read more: Chris Cavanagh's Blog
SQL: how to find table by column name
Posted by
jasper22
at
10:44
|
Hi,What happens if you have about a hundred tables in unknown database, and all you know - it's column name in a table you look for? - The trick is quite simple: run next stored procedure, while replacing "THE_COLUMN_NAME" with your column name. SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name = 'THE_COLUMN_NAME' ) This one is good for a case, while you know only a part of column name:SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name like '%PART_OF_NAME%' ) Read more: Yonathan Masovich
SQL Server Error Handling
Posted by
jasper22
at
10:43
|
Microsoft SQL Server 2005 introduced new error handling capabilities for scripts and stored procedures. This article describes the use of the try / catch block in Transact-SQL that permits errors to be captured and allows for graceful recovery. Error Handling
Prior to the introduction of SQL Server 2005, error handling in Transact-SQL (T-SQL) scripts was very restrictive. If error handling was included in a batch or stored procedure, it would usually be limited to reading the value of @@ERROR immediately after attempting to execute a statement. If @@ERROR was zero, all was probably well. However, this approach was far from ideal, particularly as the value would be cleared after every executed statement. Newer versions of SQL Server have improved error handling with the addition of the try / catch block, which is similar in operation to the try / catch block provided by C# and other languages. This code structure can be used in batches, stored procedures, triggers and other areas. It allows one or more statements to be executed within a try block. If an error occurs during processing, the block is exited immediately and control is passed to the catch block, where you can include statements that allow graceful recovery or report the error and leave the system in a stable state. Try / Catch Blocks
The try / catch structure contains two blocks of statements. These are the statements that are to be attempted and those that will execute if an error is raised. The syntax for these blocks is as follows: BEGIN TRY
[statements to try]
END TRY
BEGIN CATCH
[statements to run on error]
END CATCHCapturing Errors
The use of the try / catch block can be made more obvious with an example. In the script below the statement within the try block is attempting to divide one by zero before outputting a success message. This will always cause an error because the result of such a division cannot be represented in T-SQL. The catch block outputs a message if an error occurs. Read more: Black Wasp
Prior to the introduction of SQL Server 2005, error handling in Transact-SQL (T-SQL) scripts was very restrictive. If error handling was included in a batch or stored procedure, it would usually be limited to reading the value of @@ERROR immediately after attempting to execute a statement. If @@ERROR was zero, all was probably well. However, this approach was far from ideal, particularly as the value would be cleared after every executed statement. Newer versions of SQL Server have improved error handling with the addition of the try / catch block, which is similar in operation to the try / catch block provided by C# and other languages. This code structure can be used in batches, stored procedures, triggers and other areas. It allows one or more statements to be executed within a try block. If an error occurs during processing, the block is exited immediately and control is passed to the catch block, where you can include statements that allow graceful recovery or report the error and leave the system in a stable state. Try / Catch Blocks
The try / catch structure contains two blocks of statements. These are the statements that are to be attempted and those that will execute if an error is raised. The syntax for these blocks is as follows: BEGIN TRY
[statements to try]
END TRY
BEGIN CATCH
[statements to run on error]
END CATCHCapturing Errors
The use of the try / catch block can be made more obvious with an example. In the script below the statement within the try block is attempting to divide one by zero before outputting a success message. This will always cause an error because the result of such a division cannot be represented in T-SQL. The catch block outputs a message if an error occurs. Read more: Black Wasp
WHDC White Papers and Documentation
Posted by
jasper22
at
10:34
|
Overview
White papers, documentation, and other resources for driver and hardware developers from the WHDC Web site.Read more: MS Download
White papers, documentation, and other resources for driver and hardware developers from the WHDC Web site.Read more: MS Download
Removing .SVC from WCF REST Service
When we call a service , we call it using the extension of the service. For example , if we are calling a WCF service in the service URL .SVC extension is visible. If we want to remove this extension from the service URL , we will use HTTP Module. This article is going to show how we can achieve that. I got a mail asking question, “How could we remove .SVC from a WCF REST Service? “To remove service extension, we will write a HTTP Module and remove the extension and rewrite the path.Now to remove .svc follows below steps Add a class in WCF Application project.
Add the namespace System.Web
Implement the class from IHttpModule publicclassRemovesvc : IHttpModuleBefore starting of current context take the context path and rewrite the URL. context.BeginRequest += delegate
{
HttpContextcxt = HttpContext.Current;
string path = cxt.Request.AppRelativeCurrentExecutionFilePath;
int i = path.IndexOf('/', 2);
if (i > 0)
{
string a = path.Substring(0, i) + ".svc";
string b = path.Substring(i, path.Length - i);
string c = cxt.Request.QueryString.ToString();
cxt.RewritePath(a, b, c, false);
}
};Read more: Beyond Relational
Add the namespace System.Web
Implement the class from IHttpModule publicclassRemovesvc : IHttpModuleBefore starting of current context take the context path and rewrite the URL. context.BeginRequest += delegate
{
HttpContextcxt = HttpContext.Current;
string path = cxt.Request.AppRelativeCurrentExecutionFilePath;
int i = path.IndexOf('/', 2);
if (i > 0)
{
string a = path.Substring(0, i) + ".svc";
string b = path.Substring(i, path.Length - i);
string c = cxt.Request.QueryString.ToString();
cxt.RewritePath(a, b, c, false);
}
};Read more: Beyond Relational
AutoFS - Auto-Mount of Hard Drives
Posted by
jasper22
at
15:51
|
I have an external USB drive, which interacts as my backup and media file system. Very often I switch off this hard drive, because of energy savings. But after enabling I have to mount manually this drive. Furthermore my Samba server access to that and from my other Linux working stations I also have to manually mount the Samba accounts. After sometime I was really nerved. That's why I tried to add the USB drive and my Samba accounts to the fstab files. But after a switch off the USB drive they wasn't be reconnected. So I looked for another solution and I found one. The AutoFS daemon solved my problem. Below I describe how to install and configure the AutoFS feature. It's very easy. First you have to install the autofs package (e.g. Ubuntu):sudo apt-get install autofsSecond you edit the /etc/auto.master file:# absolute directory for mounting and
# dedicated configuration file path
/media /etc/autofs/auto.media --timeout=5Last you add your USB drive to the auto.media file:# relative mount directory, file system type, further options
# dev path
BackupAndFiles -fstype=ext3,rw,nosuid,nodev,uhelper=udisks :/dev/sdb1 Read more: Developers Blog - Programming Languages, Technologies and Visions
# dedicated configuration file path
/media /etc/autofs/auto.media --timeout=5Last you add your USB drive to the auto.media file:# relative mount directory, file system type, further options
# dev path
BackupAndFiles -fstype=ext3,rw,nosuid,nodev,uhelper=udisks :/dev/sdb1 Read more: Developers Blog - Programming Languages, Technologies and Visions
Out of memory? Easy ways to increase the memory available to your program
Posted by
jasper22
at
15:50
|
When you run your VB or C# application, you might get an OutOfMemoryException thrown, even if your machine has lots of memory. Every 32 bit process has a 2^32 bit (4 Gig) address space. That means every pointer has a size of 32 bits (4 bytes) and thus is limited to 4 Billion. That’s the equivalent of saying a vehicle license plate number consists of 6 digits and thus there are 1 million possible numbers. That 4 Gigs is divided into half: the user application gets the lower half and the OS gets the upper. (This boundary can be changed: see below). Start VS 2010. File->New->Project->VB or C# Windows WPF Application.
Paste the VB or C# code below. It creates a heap then allocates 100Meg of memory in a loop continuously until an exception is thrown. On my 64 bit Windows 7 machine with 8 Gigs of RAM (your digital camera or phone might have more memory!), I get about 1.4Gig allocated before it dies. Iter #10 1,048,576,000
Iter #11 1,153,433,600
Iter #12 1,258,291,200
Iter #13 1,363,148,800
Exception Exception of type 'System.OutOfMemoryException' was thrown. Now choose Project->Properties->Compile->Build Events->PostBuildEvent Command and added these 2 lines
call "$(DevEnvDir)..\..\vc\vcvarsall.bat" x86
"$(DevEnvDir)..\..\vc\bin\EditBin.exe" "$(TargetPath)" /LARGEADDRESSAWARE Note: the positions of the quotes are critical
The first line calls a BAT file that makes various tools available on the path.
The second runs EditBin on the target binary, using the LARGEADDRESSAWARE flag (that’s almost all left hand keys on the keyboard!)
Also uncheck the option: Project->Properties->Debug->Enable the Visual Studio Hosting Process Read more: Calvin Hsia's WebLog
Paste the VB or C# code below. It creates a heap then allocates 100Meg of memory in a loop continuously until an exception is thrown. On my 64 bit Windows 7 machine with 8 Gigs of RAM (your digital camera or phone might have more memory!), I get about 1.4Gig allocated before it dies. Iter #10 1,048,576,000
Iter #11 1,153,433,600
Iter #12 1,258,291,200
Iter #13 1,363,148,800
Exception Exception of type 'System.OutOfMemoryException' was thrown. Now choose Project->Properties->Compile->Build Events->PostBuildEvent Command and added these 2 lines
call "$(DevEnvDir)..\..\vc\vcvarsall.bat" x86
"$(DevEnvDir)..\..\vc\bin\EditBin.exe" "$(TargetPath)" /LARGEADDRESSAWARE Note: the positions of the quotes are critical
The first line calls a BAT file that makes various tools available on the path.
The second runs EditBin on the target binary, using the LARGEADDRESSAWARE flag (that’s almost all left hand keys on the keyboard!)
Also uncheck the option: Project->Properties->Debug->Enable the Visual Studio Hosting Process Read more: Calvin Hsia's WebLog
Windows 2008 R2 - Groups, Processors, Sockets, Cores Threads, NUMA nodes what is all this?
Posted by
jasper22
at
14:37
|
Industry Standard Architecture (ISA) technologies have progressed extremely rapidly in the last 10 years. Both Intel and AMD based systems are dramatically different than even just 5-6 years ago. Ten years ago servers usually had either 2 or 4 physical processors plugged into sockets on the server motherboard. The typical memory installed in these systems was 1-2GB, with very few ISA based systems supporting 8 or more processors. The Windows operating system displayed each CPU as one bar in Windows Task Manager. The machine architecture also was very simple with each processor having the same access latency to memory and other resources. Today ISA servers have increased exponentially in processing capacity to be on par with high cost proprietary UNIX system and complexity. These developments and the associated terminology tends sometimes to confuse people a little. The implications for software licensing of the Windows operating system and SQL database is sometimes unclear. Today SAP on Win/SQL customers routinely run on servers with 8 processors, 128 logical processors and 512 GB of RAM is nothing unusual. Even on 4 processor commodity Intel servers such as the HP DL 580 G7 we have customers with 512GB RAM. Typical 2 CPU servers are now configured with 128GB of RAM and have 24 logical processors. Let's go through some terms: ProcessorSometimes referred to as "CPU" or "Socket". This is the packaged physical piece of silicon that contains all the cores and required shared components. The CPU is the package of components that needs to be put in the processor socket on the motherboard. Besides the multiple cores which are contained on each processor, the current generation of processors by AMD and Intel contains the Memory Controller and the bus to external memory which is administrated by this one processor. In the Windows and SQL Server space, we use the term socket or processor side by side also due to Microsoft's per socket or per processor licensing. Read more: Running SAP Applications on SQL Server
Why not to use HttpResponse.Close and HttpResponse.End
Posted by
jasper22
at
14:36
|
I’ve seen many times developers use HttpResponse.Close and HttpResponse.End when they want to end the request and send a response to the client. If you read the MSDN explanation about HttpResponse.Close Method, in Remarks you will see the following explanation: This method terminates the connection to the client in an abrupt manner and is not intended for normal HTTP request processing. The method sends a reset packet to the client, which can cause response data that is buffered on the server, the client, or somewhere in between to be dropped. You might use this method in response to an attack by a malicious HTTP client. However, typically you should call CompleteRequest() instead if you want to jump ahead to the EndRequest event and send a response to the client. So, as it says, this method terminates the connection to the client in an abrupt manner and is not intended for normal HTTP request processing.On the other hand, the HttpResponse.End Method, from the first versions of .NET Framework, was provided for compatibility with the COM based Web Programming technology that was predecessor of the ASP.NET (the classic ASP), which in this case is not anymore needed to be used. So, if you read the MSDN remarks for both HttpResponse.Close and HttpResponse.End methods, you will see that in normal cases, we should replace both with the HttpApplication.CompleteRequest method. This method will directly call the EndRequest event and the request will end. See the comparison with the following code examples.Here is one code example where I’ve used Response.End to terminate the current connection to the client.protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Hello Hajan");
Response.End();
Response.Write("<br />Goodbye Hajan");
}After calling the Response.End method, no other code line after this will execute. So, if you have any other code that needs to be executed, this will skip executing the code, which might result in a wrong or unexpected behavior. Read more: Hajan's Blog
{
Response.Write("Hello Hajan");
Response.End();
Response.Write("<br />Goodbye Hajan");
}After calling the Response.End method, no other code line after this will execute. So, if you have any other code that needs to be executed, this will skip executing the code, which might result in a wrong or unexpected behavior. Read more: Hajan's Blog
Customize the Debugging Windows : Change Debugging Window View as per your requirements
Posted by
jasper22
at
14:29
|
In this blog post I am going to explain how you can customize the complete view of the debugging window during debugging of application. By complete view means, where you can add own Properties, can customize the result, manipulate the data, hide properties which may not need during debugging etc. In one of my previous blog post, I have explained how we can customize the view of the debugging windows using DebuggerBrowseable and DebuggerDisplay attributes over Few Tips on Customizing Debugging Window View in Visual Studio . But, both these two attributes are limited to customize the view for a specific class and they can only show you the information for the particular class members . In this blog post you will see how we can create new view for some existing debugging view using “DebuggerTypeProxy” attributes. From the below snaps you can understand what kind of customization we can do inside a debugging window.
Create sequetial UUID
Posted by
jasper22
at
14:28
|
I got a lot of interesting answers for the riddle, and here is my solution:private static int sequentialUuidCounter;
public static Guid CreateSequentialUuid()
{
var ticksAsBytes = BitConverter.GetBytes(DateTime.Now.Ticks);
Array.Reverse(ticksAsBytes);
var increment = Interlocked.Increment(ref sequentialUuidCounter);
var currentAsBytes = BitConverter.GetBytes(increment);
Array.Reverse(currentAsBytes);
var bytes = new byte[16];
Array.Copy(ticksAsBytes, 0, bytes, 0, ticksAsBytes.Length);
Array.Copy(currentAsBytes, 0, bytes, 12, currentAsBytes.Length);
return bytes.TransfromToGuidWithProperSorting();
} Basically, we use the current system ticks as the 1 – 8 bytes, and a counter incremented atomically on the 12 – 16 bytes. This ensures that even concurrent calls on the same tick will have a different value. Read more: Ayende @ Rahien
public static Guid CreateSequentialUuid()
{
var ticksAsBytes = BitConverter.GetBytes(DateTime.Now.Ticks);
Array.Reverse(ticksAsBytes);
var increment = Interlocked.Increment(ref sequentialUuidCounter);
var currentAsBytes = BitConverter.GetBytes(increment);
Array.Reverse(currentAsBytes);
var bytes = new byte[16];
Array.Copy(ticksAsBytes, 0, bytes, 0, ticksAsBytes.Length);
Array.Copy(currentAsBytes, 0, bytes, 12, currentAsBytes.Length);
return bytes.TransfromToGuidWithProperSorting();
} Basically, we use the current system ticks as the 1 – 8 bytes, and a counter incremented atomically on the 12 – 16 bytes. This ensures that even concurrent calls on the same tick will have a different value. Read more: Ayende @ Rahien
Reading Excel File in Silverlight 4.0 - COM Programming
Posted by
jasper22
at
13:11
|
There have been several new features in Silverlight 4.0 which we have been discussing in the previous articles. One of the Silverlight 4.0 features you should know is COM programming capabilities. Using this feature in a Silverlight 4 application, you can Read and Write data to an Excel file. In this article, I will demonstrate the COM programming feature for reading data from Excel worksheet and displaying it in Silverlight 4 application. Creating Silverlight 4.0 client application Step 1: Start VS2010 and Create a new Silverlight 4.0 application, name it as ‘SLIV4_Reading_Excel_File’.
Step 2: To read the local disk file contents and the files from the ‘MyDocuments’ folder, the Silverlight must be running in an Out-of-Browser mode with elevated rights. Right click on the Silverlight project and select properties. Check the ‘Enable running application out of browser’ Read more: dot net curry
Step 2: To read the local disk file contents and the files from the ‘MyDocuments’ folder, the Silverlight must be running in an Out-of-Browser mode with elevated rights. Right click on the Silverlight project and select properties. Check the ‘Enable running application out of browser’ Read more: dot net curry
TinyGet – load testing on your development environment
Posted by
jasper22
at
13:10
|
Load testing and performance testing, are usually done on a dedicated environment that was configured for this specific purpose. using TinyGet you could do some load testing right in your development environment. TinyGet is a small (but very useful) command line based utility, that is part of the IIS 6 Resource kit that get be downloaded for free from here.you can use it the following way:tinyget -srv:localhost -uri:/<YourVirtualDirectory>/<YourPage>.aspx -threads:30 -loop:50
srv - your server DNS / IP (you can use the “r” parameter is port is needed)
uri – the uri for the page to be tested
threads - the number of threads that will run your page
loops – the number of loops for each thread.
there are a lot of parameters that can be used in order to add authentication,
add secure settings or even control the HTTP request if needed.Read more: Gadi Berqowitz's Blog
srv - your server DNS / IP (you can use the “r” parameter is port is needed)
uri – the uri for the page to be tested
threads - the number of threads that will run your page
loops – the number of loops for each thread.
there are a lot of parameters that can be used in order to add authentication,
add secure settings or even control the HTTP request if needed.Read more: Gadi Berqowitz's Blog
Using Direct2D with WPF
Posted by
jasper22
at
11:51
|
IntroductionWith Windows 7, Microsoft introduced a new technology called Direct2D (which is also supported on Windows Vista SP2 with the Platform Update installed). Looking through all its documentation, you'll notice it's aimed at Win32 developers; however, the Windows API Code Pack allows .NET developers to use the features of Windows 7 easily, with Direct2D being one of the features supported. Unfortunately, all the WPF examples included with the Code Pack require hosting the control in a HwndHost, which is a problem as it has airspace issues. This basically means that the Direct2D control needs to be separated from the rest of the WPF controls, which means no overlapping controls with transparency. The attached code allows Direct2D to be treated as a normal WPF control and, thanks to some COM interfaces, doesn't require you to download the DirectX SDK or even play around with any C++ - the only dependency is the aforementioned Code Pack (the binaries of which are included in the attached). This article is more about the problems found along the way the challenges involved in creating the control, so feel free to skip to the Using the code section if you want to jump right in. BackgroundWPF architectureWPF is built on top of DirectX 9, and uses a retained rendering system. What this means is that you don't draw anything to the screen, but instead create a tree of visual objects; their drawing instructions are cached and later rendered automatically by the framework. This, coupled with using DirectX to do the graphics processing, enables WPF applications not only to remain responsive when they have to be redrawn, but also allows WPF to use a "painter's algorithm" painting model. In this model, each component (starting at the back of the display, going towards the front) is asked to draw itself, allowing them to paint over the previous component's display. This is the reason it's so easy to have complex and/or partially transparent shapes with WPF - because it was designed taking this scenario into account. For more information, check out the MSDN article. Read more: Codeproject
Check if Database Exists In SQL Server – Different ways
Posted by
jasper22
at
11:51
|
A very frequently asked question is how to to check if a Database exists in SQL Server. Here are some different ways.The following code will be common for all the methods:DECLARE @db_name varchar(100)
SET @db_name='master'Method 1: Use sys.sysdatabases viewIF EXISTS(SELECT * FROM sys.sysdatabases where name=@db_name)
PRINT 'The database exists'
else
PRINT 'The database does not exist' Method 2: Use sysdatabases system table from master databaseIF EXISTS(SELECT * FROM master..sysdatabases WHERE name=@db_name)
PRINT 'The database exists'
else
print 'The database does not exist' Method 3: Using of sp_msforeachdbRead more: SQL Server curry
SET @db_name='master'Method 1: Use sys.sysdatabases viewIF EXISTS(SELECT * FROM sys.sysdatabases where name=@db_name)
PRINT 'The database exists'
else
PRINT 'The database does not exist' Method 2: Use sysdatabases system table from master databaseIF EXISTS(SELECT * FROM master..sysdatabases WHERE name=@db_name)
PRINT 'The database exists'
else
print 'The database does not exist' Method 3: Using of sp_msforeachdbRead more: SQL Server curry
10 must-have Linux desktop enhancements
Posted by
jasper22
at
11:50
|
If you haven’t experienced the Linux desktop as offered by one of the more recent distributions, you don’t know what you’re missing. Not only is the default desktop a thing to behold, it also allows for the addition of some amazing enhancements. From eye candy to tools that make your work more efficient, the Linux desktop can be expanded to include just about anything you want. I’m going to share some desktop enhancements that will make your Linux desktop experience far better. Some of these tools you might already know (or use) and some of them you might not — if you find one listed that you haven’t tried, install it and let us know what you think. Note: This article is also available as a PDF download.1: CompizCompiz is to the Linux desktop as HiDef is to the world of television. Is it necessary? Not at all. Will it enhance your experience? Absolutely. Compiz is a compositing window manager that adds tons of functionality to the desktop — from the stellar Desktop Cube to the various window switchers and everything in between, on top, on bottom, and around the corner. If you haven’t experienced Compiz, you have no idea what the PC desktop can really do. 2: ScreenletsScreenlets are tiny applications that live on your desktop and provide extra functionality. Some of these applets do little and some do quite a bit. My personal favorites are the ring sensors (various sensors for your PC) and CopyStack (a stack of clipboards that allow you to select from your clipboard history as well as drag and drop a “page” of your clipboard onto a document). 3: EmeraldRead more: TechRepublic
Using Value Converters in Silverlight
Posted by
jasper22
at
11:49
|
When you start to bind data in Silverlight (or WPF for that matter) you will most likely have data that is in one format that you may need to convert to another format. For example if you have a decimal number (price) that is 19.95, you would want to display it as $19.95. Of course you can use a normal .NET format string to accomplish this, but you could also write some code to convert the decimal number 19.95 to a string with the dollar sign in front of it “$19.95”. In the sample that you are going to read about, you have a Boolean value of true or false, and based on this true or false value you will return one bitmap image or another bitmap image. To accomplish this you need to tell Silverlight that instead of displaying the Boolean value that it should pass the Boolean value to a method in a class you create and have that method return a bitmap image back and to display that bitmap (Figure 1 and Figure 2).
Read more: Paul Sheriff's Blog for the Real World
Read more: Paul Sheriff's Blog for the Real World
Read Environment Variables in T-SQL
Posted by
jasper22
at
11:46
|
I had recently posted on Use xp_cmdshell results in T_SQL. One of the blog readers Andrew got back asking if it was possible to read Environment Variables using this method and store the value in a variable for later use. Here’s the query. The variable @windir holds the value and you can use it as you want: (Thanks to my colleague Karthi for simplying the query further)DECLARE @windir nvarchar(255)
CREATE TABLE #Tmp
(
EnvVar nvarchar(255)
)
INSERT INTO #Tmp exec xp_cmdshell 'echo %windir%'
SET @windir = (SELECT TOP 1 EnvVar from #Tmp)SELECT @windir as 'Windows Directory'
-- DROP TABLE #Tmp Note: Observe I am using ‘TOP 1’ in the query since the subquery returned more than one row, one of them being a blank row. I am not sure why is the blank row returned and till I find it out, I will stick with the ‘TOP 1’ command. Read more: SQL Server curry
CREATE TABLE #Tmp
(
EnvVar nvarchar(255)
)
INSERT INTO #Tmp exec xp_cmdshell 'echo %windir%'
SET @windir = (SELECT TOP 1 EnvVar from #Tmp)SELECT @windir as 'Windows Directory'
-- DROP TABLE #Tmp Note: Observe I am using ‘TOP 1’ in the query since the subquery returned more than one row, one of them being a blank row. I am not sure why is the blank row returned and till I find it out, I will stick with the ‘TOP 1’ command. Read more: SQL Server curry
Binding Html to the Web Browser Control
Posted by
jasper22
at
11:45
|
Currently the fastest way to display a string of html on the Windows Phone 7 is to use the Web Browser control, simply call the NavigateToString method passing the html you want to display.When trying to use this in an MVVM pattern the method call becomes slightly problematic, we'd much rather have a bindable property. Thankfully we can use attached properties to achieve this. public static class WebBrowserHelper
{
public static readonly DependencyProperty HtmlProperty = DependencyProperty.RegisterAttached(
"Html", typeof(string), typeof(WebBrowserHelper), new PropertyMetadata(OnHtmlChanged)); public static string GetHtml(DependencyObject dependencyObject)
{
return (string)dependencyObject.GetValue(HtmlProperty);
} public static void SetHtml(DependencyObject dependencyObject, string value)
{
dependencyObject.SetValue(HtmlProperty, value);
} private static void OnHtmlChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var browser = d as WebBrowser; if(browser == null)
return;Read more: compiled experience
{
public static readonly DependencyProperty HtmlProperty = DependencyProperty.RegisterAttached(
"Html", typeof(string), typeof(WebBrowserHelper), new PropertyMetadata(OnHtmlChanged)); public static string GetHtml(DependencyObject dependencyObject)
{
return (string)dependencyObject.GetValue(HtmlProperty);
} public static void SetHtml(DependencyObject dependencyObject, string value)
{
dependencyObject.SetValue(HtmlProperty, value);
} private static void OnHtmlChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var browser = d as WebBrowser; if(browser == null)
return;Read more: compiled experience
How to execute a Local File using Html Application?
Posted by
jasper22
at
11:44
|
Did you ever want to run an application from your local resource inside your HTML page? If so, you will face some issues. It will never run any application from local resource directly. It may ask you to download the file before running it. This is due to browser security issue as the code runs inside the browser sandbox. So, what to do for this? In this post, I will describe you the steps resolve to do this. Read the complete post in order to learn the same. As I mentioned above, you can’t run application from browser window due to security reasons. To execute file you need to use .HTA applications (which is a HTML Application). HTA applications run outside the browser window just like a normal application and have full trust support. If you are new to Html Application, read more about it here: http://msdn.microsoft.com/en-us/library/ms536471(v=VS.85).aspx<script type="text/javascript" language="javascript">
function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
}
</script> Here you can see that, first I am creating the instance of the “WScript.Shell” ActiveXObject and then calling the Run() method of the newly created object with proper parameters. Read more: Kunal's Blog
function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
}
</script> Here you can see that, first I am creating the instance of the “WScript.Shell” ActiveXObject and then calling the Run() method of the newly created object with proper parameters. Read more: Kunal's Blog
If I had to draw circles to visualize SQL Joins, I would… cheat and use this…
Posted by
jasper22
at
11:42
|
IntroductionThis is just a simple article visually explaining SQL JOINs.BackgroundI'm a pretty visual person. Things seem to make more sense as a picture. I looked all over the Internet for a good graphical representation of SQL JOINs, but I couldn't find any to my liking. Some had good diagrams but lacked completeness (they didn't have all the possible JOINs), and some were just plain terrible. So, I decided to create my own and write an article about it. Using the codeI am going to discuss seven different ways you can return data from two relational tables. I will be excluding cross Joins and self referencing Joins. The seven Joins I will discuss are shown below: INNER JOIN
LEFT JOIN
RIGHT JOIN
OUTER JOIN
LEFT JOIN EXCLUDING INNER JOIN
RIGHT JOIN EXCLUDING INNER JOIN
OUTER JOIN EXCLUDING INNER JOIN
For the sake of this article, I'll refer to 5, 6, and 7 as LEFT EXCLUDING JOIN, RIGHT EXCLUDING JOIN, and OUTER EXCLUDING JOIN, respectively. Some may argue that 5, 6, and 7 are not really joining the two tables, but for simplicity, I will still refer to these as Joins because you use a SQL Join in each of these queries (but exclude some records with a WHERE clause).
LEFT JOIN
RIGHT JOIN
OUTER JOIN
LEFT JOIN EXCLUDING INNER JOIN
RIGHT JOIN EXCLUDING INNER JOIN
OUTER JOIN EXCLUDING INNER JOIN
For the sake of this article, I'll refer to 5, 6, and 7 as LEFT EXCLUDING JOIN, RIGHT EXCLUDING JOIN, and OUTER EXCLUDING JOIN, respectively. Some may argue that 5, 6, and 7 are not really joining the two tables, but for simplicity, I will still refer to these as Joins because you use a SQL Join in each of these queries (but exclude some records with a WHERE clause).
Changing the security context with Dynamic SQL [T-SQL]
Posted by
jasper22
at
10:41
|
I’ve always found that understanding the SQL security model can be a finicky affair; that’s no criticism, its more to do with my reluctance to actually spend time immersing myself in it – I generally know what I need to know and that’s all. I remember back when I was first learning T-SQL I found the whole area of security around dynamic SQL difficult to grok until I saw an actual example of it and I figured it might be useful to anyone in the same position if I were to share a code sample demonstrating these peculiarities. Hence this blog post. The particular vagary that I want to demonstrate is that where the use of dynamic T-SQL inside a stored procedure will change the security context under which that dynamic T-SQL is executed. Code inside a stored procedure will execute as the owner of the stored procedure until some dynamic T-SQL is encountered at which time the security context switches to that of the user that called the stored procedure. Allow me to demonstrate: --Create demo DB with objects
SET NOCOUNT ON;
USE MASTER
BEGIN TRY
DROP DATABASE DynSQL;
END TRY
BEGIN CATCH
END CATCH
CREATE DATABASE DynSQL;
GO
USE DynSQL
GO
CREATE SCHEMA [sch];
GO
CREATE TABLE [sch].[foo] ([bar] INT);
GO
--===The important bit============================
CREATE PROC [sch].[demoproc] AS
BEGIN
--The following statement will be executed as [sch]
SELECT * FROM [sch].[foo];
DECLARE @sql NVARCHAR(MAX) = 'SELECT * from [sch].[foo];';
--The dynamic SQL in @sql will be executed as the user that called [sch].[demoproc]
EXEC sp_executesql @sql;
END
GO CREATE LOGIN [u] WITH PASSWORD = 'p@ssw0rd';
CREATE USER [u] FOR LOGIN [u];
GRANT EXECUTE ON [sch].[demoproc] TO [u] Read more: SQLBlog.com
SET NOCOUNT ON;
USE MASTER
BEGIN TRY
DROP DATABASE DynSQL;
END TRY
BEGIN CATCH
END CATCH
CREATE DATABASE DynSQL;
GO
USE DynSQL
GO
CREATE SCHEMA [sch];
GO
CREATE TABLE [sch].[foo] ([bar] INT);
GO
--===The important bit============================
CREATE PROC [sch].[demoproc] AS
BEGIN
--The following statement will be executed as [sch]
SELECT * FROM [sch].[foo];
DECLARE @sql NVARCHAR(MAX) = 'SELECT * from [sch].[foo];';
--The dynamic SQL in @sql will be executed as the user that called [sch].[demoproc]
EXEC sp_executesql @sql;
END
GO CREATE LOGIN [u] WITH PASSWORD = 'p@ssw0rd';
CREATE USER [u] FOR LOGIN [u];
GRANT EXECUTE ON [sch].[demoproc] TO [u] Read more: SQLBlog.com
MVC view engines, WebFormViewEngine, Spark, NHaml and Razor - zomg my head is going to explode. Could a developer please put these side-by-side and do a review to help me intelligently pick one?… Hey, the Coding4Fun team and Jason Haley have done jus
Posted by
jasper22
at
10:40
|
In this Developer Review, we evaluate four view engines available for use with ASP.NET MVC. First, we discuss the role a view engine plays in a website built with ASP.NET MVC, then we provide details about the four view engines in order to help you decide which one suits your needs. Jason Haley, http://jasonhaley.com/blog/What Does a View Engine Do?When we refer to a view engine in ASP.NET MVC, we are talking about three pieces of functionality:
· A template locator/provider (implementation of IViewEngine)
· A template that can render itself (implementation of IView)
· A template engine that can parse and compile the view file syntax into executable code Combining these three pieces, a view engine provides your controllers with the ability to translate views into Html.Why Use an Alternate View Engine?Read more: Greg's Cool [Insert Clever Name] of the Day
· A template locator/provider (implementation of IViewEngine)
· A template that can render itself (implementation of IView)
· A template engine that can parse and compile the view file syntax into executable code Combining these three pieces, a view engine provides your controllers with the ability to translate views into Html.Why Use an Alternate View Engine?Read more: Greg's Cool [Insert Clever Name] of the Day
Introducing the Microsoft Lync Client Platform SDK
Posted by
jasper22
at
10:39
|
Microsoft Lync is the new name for the next generation of Microsoft’s highly successful Communicator product. The Microsoft Lync Client Platform SDK makes its debut with this release, and provides developers with a powerful set of tools for creating highly connected business applications which integrate all of Lync’s most exciting features. The SDK has two parts: A .NET API which enables a wide variety of scenarios, including audio/video/IM conversations, contact management, presence subscriptions & publication, UI automation, and UI extensibility.
A rich set of customizable UI controls for both WPF and Silverlight which give developers the ability to easily integrate Microsoft Lync functionality into their applications.
The addition of this compelling new SDK to the already powerful set of managed API’s included with Lync is fantastic news for developers. This blog will be dedicated to helping developers make the most of these API’s, and the next several posts will be focused on the many new features introduced by the Lync Client Platform SDK. Read more: Lync by Lync
A rich set of customizable UI controls for both WPF and Silverlight which give developers the ability to easily integrate Microsoft Lync functionality into their applications.
The addition of this compelling new SDK to the already powerful set of managed API’s included with Lync is fantastic news for developers. This blog will be dedicated to helping developers make the most of these API’s, and the next several posts will be focused on the many new features introduced by the Lync Client Platform SDK. Read more: Lync by Lync
ResourceDictionary in WP7
Posted by
jasper22
at
10:38
|
WP7 is based on Silverlight 3+ and by default it’s not possible to create a new resource dictionary. However it’s pretty easy to work around – just follow the same guidelines as if it was in Silverlight 3. 1) Create a new Class and rename it YourResourceDictionary.xaml (or whatever fits you).2) Replace the content from the Class with the content you need:<ResourceDictionary
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”</ResourceDictionary>3) Unless you’re creating a Generic.xaml resource dictionary in the Themes folder you need to add the resource dictionary to the list of merged resource dictionaries in your App.xaml file: <Application.Resources>
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” >
<!– Your resources goes here –>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source=”YourResourceDictionary.xaml” />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary></Application.Resources> Read more: XAMLGEEK
A guide to cleaner XAML with custom namespaces and prefixes (WPF/Silverlight)
Posted by
jasper22
at
10:37
|
Introduction
When working with any type of application it's a good idea to split up your solution in multiple projects (assemblies) and namespaces. As your project grows you'll see your amount of namespaces grow with it. And if you plan to use classes / controls from these namespaces in your XAML code, you'll have to declare them with the following syntax: xmlns:PREFIX="clr-namespace:NAMESPACE"An example could be:xmlns:conv="clr-namespace:Sandworks.Silverlight.NamespaceExample.Converters"If you are referencing an other assembly, you'll also need to add the assembly name: xmlns:PREFIX="clr-namespace:NAMESPACE;assembly=ASSEMBLYNAME"For example:xmlns:lib="clr-namespace:Sandworks.Silverlight.NamespaceExample.ClassLibrary.Converters;assembly=Sandworks.Silverlight.NamespaceExample.ClassLibrary" Some namespaces are added by default when you add a new XAML control in your project (be it a UserControl or a Page).
This is how it should look like:<UserControl x:Class="Sandworks.Silverlight.NamespaceExample.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" But, as stated before, when your project starts growing and you need to work with different namespaces and assemblies your references might start piling up and your XAML code gets bloated.Read more: Sandrino Di Mattia
When working with any type of application it's a good idea to split up your solution in multiple projects (assemblies) and namespaces. As your project grows you'll see your amount of namespaces grow with it. And if you plan to use classes / controls from these namespaces in your XAML code, you'll have to declare them with the following syntax: xmlns:PREFIX="clr-namespace:NAMESPACE"An example could be:xmlns:conv="clr-namespace:Sandworks.Silverlight.NamespaceExample.Converters"If you are referencing an other assembly, you'll also need to add the assembly name: xmlns:PREFIX="clr-namespace:NAMESPACE;assembly=ASSEMBLYNAME"For example:xmlns:lib="clr-namespace:Sandworks.Silverlight.NamespaceExample.ClassLibrary.Converters;assembly=Sandworks.Silverlight.NamespaceExample.ClassLibrary" Some namespaces are added by default when you add a new XAML control in your project (be it a UserControl or a Page).
This is how it should look like:<UserControl x:Class="Sandworks.Silverlight.NamespaceExample.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" But, as stated before, when your project starts growing and you need to work with different namespaces and assemblies your references might start piling up and your XAML code gets bloated.Read more: Sandrino Di Mattia
Hositing Silverlight XAP in Blogger... Aah At last succeded.. Yipeee
Posted by
jasper22
at
10:35
|
When i first googled, i found this wonderful post of timheuer which explains about cross-domain hositing of silverlight application in detail.The big question which i had after reading tim's blog post is, where do i host my xap file as i need to set the XAP mime type on the hosting server, I personally do not own any hosting space nor any domain.
In the next moment i started searching for free file hosting providers, which can provide me a direct link for hosted file with file extension so that i can refer to the xap file directly. I tried around 5 different file hosting servers but i couldn't figure out how to set the mime extension type on that perticular server to render my silverlight xap on my blogger blog. In my 6th attempt to host xap, i have tried with xtreemhost file hosting which has not only provided me with a direct link to the hosted file but also provided access to the .htaccess file where i could add my MIME types. So here are few things which we need to take care before hosting a silverlight application on to blog:Make sure you have added the EnableHtmlAccess parameter to the object tag in html<param name="enableHtmlAccess" value="true" /> Make sure you have set ExternalCallersFromCrossDomain to ScriptableOnly in the AppManifest.xml file in silverlight project<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ExternalCallersFromCrossDomain="ScriptableOnly">
<Deployment.Parts>
</Deployment.Parts>
</Deployment>
Read more: Dot + Net <=> Digging .Net
In the next moment i started searching for free file hosting providers, which can provide me a direct link for hosted file with file extension so that i can refer to the xap file directly. I tried around 5 different file hosting servers but i couldn't figure out how to set the mime extension type on that perticular server to render my silverlight xap on my blogger blog. In my 6th attempt to host xap, i have tried with xtreemhost file hosting which has not only provided me with a direct link to the hosted file but also provided access to the .htaccess file where i could add my MIME types. So here are few things which we need to take care before hosting a silverlight application on to blog:Make sure you have added the EnableHtmlAccess parameter to the object tag in html<param name="enableHtmlAccess" value="true" /> Make sure you have set ExternalCallersFromCrossDomain to ScriptableOnly in the AppManifest.xml file in silverlight project<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ExternalCallersFromCrossDomain="ScriptableOnly">
<Deployment.Parts>
</Deployment.Parts>
</Deployment>
Read more: Dot + Net <=> Digging .Net
Использование Windows Biometric Framework (WBF) в .NET приложениях
Posted by
jasper22
at
10:33
|
Небольшое дополнение к моей предыдущей статье
(Использование сканера отпечатков пальцев в Windows приложениях).
Microsoft вместе с Windows 7 анонсировал Windows Biometric Framework. Этот компонент призван стандартизировать работу с биометрическими данными в Windows. В настоящее время поддерживается только информация об отпечатках пальцев. Ближайшие планы включают в себя также поддержку изображений с веб-камеры. В процессе экспериментов по добавлению идентификации по отпечатку пальца в мое приложение одним из перспективных направлений виделось использование WBF. Для того, чтобы отвязаться от оборудования и работать с любым сканером от любого производителя этот производитель должен предоставить для своего устройства специализированный драйвер, который может работать в составе WBF. Для моего сканера (Upek Eikon) такой драйвер в наличии имеется как для 32 разрядных так и для 64 разрядных систем. Документация к WBF от Microsoft к сожалению не отличается полнотой и предполагает использование C++ для разработки WBF приложений. Я работаю с C# и поэтому задался целью найти подходящий Wrapper, который я мог бы использовать в моих проектах. Относительно быстро я нашел два примера использования WBF которые включали в себя свои реализации Wrapper. Но как выяснилось реализованы были всего пара методов, необходимые для работы этих примеров. Read more: DV Team Blog
(Использование сканера отпечатков пальцев в Windows приложениях).
Microsoft вместе с Windows 7 анонсировал Windows Biometric Framework. Этот компонент призван стандартизировать работу с биометрическими данными в Windows. В настоящее время поддерживается только информация об отпечатках пальцев. Ближайшие планы включают в себя также поддержку изображений с веб-камеры. В процессе экспериментов по добавлению идентификации по отпечатку пальца в мое приложение одним из перспективных направлений виделось использование WBF. Для того, чтобы отвязаться от оборудования и работать с любым сканером от любого производителя этот производитель должен предоставить для своего устройства специализированный драйвер, который может работать в составе WBF. Для моего сканера (Upek Eikon) такой драйвер в наличии имеется как для 32 разрядных так и для 64 разрядных систем. Документация к WBF от Microsoft к сожалению не отличается полнотой и предполагает использование C++ для разработки WBF приложений. Я работаю с C# и поэтому задался целью найти подходящий Wrapper, который я мог бы использовать в моих проектах. Относительно быстро я нашел два примера использования WBF которые включали в себя свои реализации Wrapper. Но как выяснилось реализованы были всего пара методов, необходимые для работы этих примеров. Read more: DV Team Blog
Action Filters in ASP.NET MVC
Posted by
jasper22
at
10:29
|
The biggest challenge many software architects face today is how to design and implement an application that can meet all version 1 requirements plus all others that can show up afterward. Maintainability has been one of the fundamental attributes of software design since the first draft of the ISO/IEC 9126 paper, back in 1991. (The paper provides a formal description of software quality and breaks it down into a set of characteristics and sub-characteristics, one of which is maintainability. A PDF version of the paper can be obtained at iso.org.) The ability to serve a customer’s present and future needs certainly isn’t a new requirement for any piece of software. However, what many Web applications require today is a subtle and short-term form of maintainability. Many times customers don’t want new functions or a different implementation of an existing feature. They just want you to add, replace, configure or remove small pieces of functionality. A typical example is when Web sites with large audiences launch specific advertising campaigns. The overall behavior of the site doesn’t change, but extra actions must be performed along with existing actions. Moreover, these changes usually aren’t persistent. They must be removed after a few weeks to then be reincorporated a few months later, be configured differently and so forth. You need the ability to program any required functionality by composing small pieces together; you need to track dependencies without greatly impacting the source code; and you need to move toward an aspect-oriented design of software. These are some of the primary reasons behind the rapid adoption of Inversion of Control (IoC) frameworks in many enterprise projects. So what’s this article all about? It isn’t meant to be a boring lecture on how software is changing today. Instead, it’s an in-depth exploration of a powerful feature of ASP.NET MVC controllers that can notably help you in the building of aspect-oriented Web solutions: ASP.NET MVC action filters. What’s an Action Filter, Anyway?
An action filter is an attribute that, when attached to a controller class or a controller method, provides a declarative means to attach some behavior to a requested action. By writing an action filter, you can hook up the execution pipeline of an action method and adapt it to your needs. In this way, you can also take out of the controller class any logic that doesn’t strictly belong to the controller. In doing so, you make this particular behavior reusable and, more importantly, optional. Action filters are ideal for implementing crosscutting concerns that affect the life of your controllers. Read more: MSDN Magazine
An action filter is an attribute that, when attached to a controller class or a controller method, provides a declarative means to attach some behavior to a requested action. By writing an action filter, you can hook up the execution pipeline of an action method and adapt it to your needs. In this way, you can also take out of the controller class any logic that doesn’t strictly belong to the controller. In doing so, you make this particular behavior reusable and, more importantly, optional. Action filters are ideal for implementing crosscutting concerns that affect the life of your controllers. Read more: MSDN Magazine
Creating WIX Installer for ASP.NET Web Application
Posted by
jasper22
at
10:29
|
Table of Contents
IntroductionIt is a couple of months I started to write an installer for a web application. I decided to learn how to write it in WIX because I’ve heard positive reviews about it. It wasn’t so easy at the very beginning but the time I’ve spent in that platform is very valuable for me. Since then I realized that having an installer is important part of software delivery process. After writing an installer for a few projects, this activity become easy and fast. In this article I introduce a code for creating an installer for a web application in WIX and I show you how to compile it using commands from command line. I also introduce msbuild script for creating an installer for a web application starts from publishing a web application through harvesting the application content finished by compiling the installer. You will understand the process and thus you will be able to extend it according to the demands of your web application. Why Do We Need Installer for Web Application?In my professional career I’ve been mostly developing ASP.NET web applications. Not all of them but most of them. The software delivery process was always pushed to be secondary activity and therefore underestimated by almost all of the team members. Not only in the early days but also today I meet good programmers with the vision that building installer is not necessary. Xcopy (robocopy) will always work well and raised issues will be solved ad-hoc in the production environment. But that’s not professional, isn’t it? Well, if you are creating a blog page for you or friend of yours which should be deployed to a hosting service then you probably don’t need to create an installer for it. You will probably have no option to execute the installer on the hosting service because of lacking privileges. The only thing you will have available is FTP access. So, why is needed to write an installer for a web application anyway? I would consider to write an installer for a web application which should be installed more than once and by someone else than the author of the web application. I would also consider to write an installer for a web application if there is the continuous integration or continuous delivery process as the part of the development. Read more: Codeproject
- Introduction
- Why Do We Need Installer for Web Application?
- Creating a web application
- Creating WIX Code
- ConfigurationInitialize.wxi – Definition of variables
- Product.wxs – the main code of the installer
- IISConfiguration.wxs – configuration of IIS
- UIDialogs.wxs – Customized UI screens
- MyWebUI.wxs
- WebSiteContent.wxs
- The way to building msi package
- Why is there an exclamation mark in harvesting web application content?
- From bat file to msbuild
- Conclusion
- References
- History
IntroductionIt is a couple of months I started to write an installer for a web application. I decided to learn how to write it in WIX because I’ve heard positive reviews about it. It wasn’t so easy at the very beginning but the time I’ve spent in that platform is very valuable for me. Since then I realized that having an installer is important part of software delivery process. After writing an installer for a few projects, this activity become easy and fast. In this article I introduce a code for creating an installer for a web application in WIX and I show you how to compile it using commands from command line. I also introduce msbuild script for creating an installer for a web application starts from publishing a web application through harvesting the application content finished by compiling the installer. You will understand the process and thus you will be able to extend it according to the demands of your web application. Why Do We Need Installer for Web Application?In my professional career I’ve been mostly developing ASP.NET web applications. Not all of them but most of them. The software delivery process was always pushed to be secondary activity and therefore underestimated by almost all of the team members. Not only in the early days but also today I meet good programmers with the vision that building installer is not necessary. Xcopy (robocopy) will always work well and raised issues will be solved ad-hoc in the production environment. But that’s not professional, isn’t it? Well, if you are creating a blog page for you or friend of yours which should be deployed to a hosting service then you probably don’t need to create an installer for it. You will probably have no option to execute the installer on the hosting service because of lacking privileges. The only thing you will have available is FTP access. So, why is needed to write an installer for a web application anyway? I would consider to write an installer for a web application which should be installed more than once and by someone else than the author of the web application. I would also consider to write an installer for a web application if there is the continuous integration or continuous delivery process as the part of the development. Read more: Codeproject
Embedding a webserver in your Win32/C++ application
Posted by
jasper22
at
10:28
|
IntroductionThis article will explain how to integrate an embedded webserver with your Win32/C++ application, using the Lacewing networking library. It could be used for things like:Web administration - server applications often have a web interface, for remote administration - nothing but a web browser is required to administrate the server
Web applications - web applications written in C++ can be much faster and more scalable than PHP or ASP, with lower resource usage and nothing else to be installed
BackgroundI decided to write my own webserver class as an experiment over the Lacewing::SocketServer class, which uses multithreading and IO completion ports (the most scalable way to do sockets on Windows). Lacewing::Webserver soon became a powerful HTTP/1.1 implementation, featuring:HTTP GET/POST, with stream operators for the response (like cout)
Automatic GET/POST parameter parsing
File sending, internally using TransmitFile
Getting/setting cookies
Multipart file upload via POST
Getting/setting the last modified date, to easily implement caching
Full HTTPS support
And much more (the header file is well commented).
Installing the library Lacewing is compatible with any version of Visual C++ from VC6 and up. Applications developed using Lacewing will run on Windows 2000 and greater.The first thing you'll need to download and install the Lacewing library from here. Extract the ZIP, and put the contents of the C++ folder in a folder somewhere on your hard drive. The Lacewing.dll file will need to be distributed alongside your executable file, but you may put it in your Windows\System32 folder (or Windows\SysWOW64 on a 64 bit system) for development convenience if you want. Read more: Codeproject
Web applications - web applications written in C++ can be much faster and more scalable than PHP or ASP, with lower resource usage and nothing else to be installed
BackgroundI decided to write my own webserver class as an experiment over the Lacewing::SocketServer class, which uses multithreading and IO completion ports (the most scalable way to do sockets on Windows). Lacewing::Webserver soon became a powerful HTTP/1.1 implementation, featuring:HTTP GET/POST, with stream operators for the response (like cout)
Automatic GET/POST parameter parsing
File sending, internally using TransmitFile
Getting/setting cookies
Multipart file upload via POST
Getting/setting the last modified date, to easily implement caching
Full HTTPS support
And much more (the header file is well commented).
Installing the library Lacewing is compatible with any version of Visual C++ from VC6 and up. Applications developed using Lacewing will run on Windows 2000 and greater.The first thing you'll need to download and install the Lacewing library from here. Extract the ZIP, and put the contents of the C++ folder in a folder somewhere on your hard drive. The Lacewing.dll file will need to be distributed alongside your executable file, but you may put it in your Windows\System32 folder (or Windows\SysWOW64 on a 64 bit system) for development convenience if you want. Read more: Codeproject
ajax control toolkit combobox - style, add item from javascript, clear items from javascript, get selected value
Posted by
jasper22
at
10:27
|
בפוסט זה נראה איך אפשר לעבוד עם Ajax:ComboBox
(מקורות - stackoverflow, forums.asp.net, ajax sample)
(קרדיט ליוסי גולדברג על הפוסט הזה)
מי שעדיין לא מכיר את הפקד מוזמן לקרוא עליו בלינק למעלה, בפוסט הזה נדבר על הדברים הבאים:
להורדת הקוד המלא
איך מעצבים אותו ב - Windows Style.
איך מוסיפים מ - Javascript עוד ערכים.
איך מנקים אותו מערכים.
איך מקבלים ב - javascript את מה שהמשתמש בחר.
איך נרשמים ל - onchange ב - javascript.
השימוש הראושני בו הוא פשוט.
השלבים הראשונים משותפים לכל פקדי ה - ajax toolkit
Read more: שלמה גולדברג (הרב דוטנט) How do I find what queries were executing in a SQL memory dump?
Posted by
jasper22
at
10:26
|
In this post, we’ll see how to find out which queries were executing from a SQL Server memory dump. You might have a dump file from a crash of the SQL Service, or you may have taken a diagnostic dump with sqldumper. What we do in this post assumes you are working with a full or filtered dump of SQL Server. For more information on dumping SQL Server, read this post:http://blogs.msdn.com/b/askjay/archive/2010/02/05/how-can-i-create-a-dump-of-sql-server.aspx Some of the objects contained in the dump that are needed to completely understand this process can only be resolved with private symbols. What this means is that to fully track down the executing query text, you need to be internal to MS with access to “private” symbols. However, after finding the query text with the private symbols, we can quickly get to the query text with public symbols and a few specific memory addresses and offsets.So first, set your public symbol path: 0:000> .sympath srv*c:\symbols\public*http://msdl.microsoft.com/download/symbols
Symbol search path is: srv*c:\symbols\public*http://msdl.microsoft.com/download/symbols
0:000> .reload /f sqlservr.exeSearch the stacks:0:000> ~* kRead more: Jay's notes on SQL
Symbol search path is: srv*c:\symbols\public*http://msdl.microsoft.com/download/symbols
0:000> .reload /f sqlservr.exeSearch the stacks:0:000> ~* kRead more: Jay's notes on SQL
Installing the SQL Server 2008 R2 Management Pack for System Center Operations Manager 2007 R2
Posted by
jasper22
at
10:25
|
AbstractIn this blog post, I will go over the steps to install System Center Operations Manager (SCOM) 2007 R2 and the recent release of the SQL Server 2008 R2 Management Pack (MP) on a bare bones Windows Server 2008 R2 Hyper-V virtual machine. I’ll include where you can download the various software components (free & evaluation copies). My goal is to make operational DBAs familiar with SCOM 2007 and the various MPs that are available to help you better manage large number of server instances. This blog post is part of the series of posts that I’m using to prepare for my SQL PASS 2010 session on the SQL MP.Read more: Bill Ramos on SQL Server
MSDN Magazine: October 2010 Issue
Posted by
jasper22
at
09:46
|
The October edition of MSDN Magazine is now available in online format. This month’s topics include ThreadPools, Bing Maps, .NET Micro Framework, Interop with the Enterprise Distributed Cache, Windows Phone 7 Development and AppFabric Serivce Bus Discovery, along with a range of topics covered in the regular columns. Read more: MSDN
CREATING WINDOWS PHONE 7 APPLICATION AND MARKETPLACE ICONS
Posted by
jasper22
at
09:29
|
This guide steps you through the process of creating icons for your Windows Phone 7 application as well as for the Marketplace Hub and Marketplace catalog. The icon requirements come out of the Windows Phone 7 Application Certification Requirements guide. Those icon requirements are shown in the tables below. Read more: Expression Blend and Design
Breaking .NET encryption with or without Padding Oracle
Posted by
jasper22
at
09:29
|
I have had many question regarding Padbusterdotnet after our previous post Investigating .NET Padding Oracle Exploitation. Here I'll try to answer some of them.How can I download the Web.config?
Since Microsoft patches are already out now I will disclose how to download the files remotely. Padbuster v0.2 and Pudbusterdotnet cannot alone download the Web.config. For achieving this result I have made a Poc that you can find here. Update 04/10/10: A couple of days after the release of our initial exploit Brian Holyfield added these (and more features) in Padbuster v0.3. Now Padbuster is a swiss army knife to fully exploit .NET Ajax handlers. Read more: MINDED SECURITY BLOG
Since Microsoft patches are already out now I will disclose how to download the files remotely. Padbuster v0.2 and Pudbusterdotnet cannot alone download the Web.config. For achieving this result I have made a Poc that you can find here. Update 04/10/10: A couple of days after the release of our initial exploit Brian Holyfield added these (and more features) in Padbuster v0.3. Now Padbuster is a swiss army knife to fully exploit .NET Ajax handlers. Read more: MINDED SECURITY BLOG
ASP.NET Security Fix Now on Windows Update
Earlier this week I blogged about the availability of a patch on the Microsoft Download Center to fix the recent ASP.NET Security Vulnerability.Today we also made it possible to update systems through Windows Update (WU) and Windows Server Update Services (WSUS). This enables administrators to more easily streamline patch installs, and enables you to take advantage of the WU/WSUS infrastructure to detect which patches you should install based on what versions of .NET are on your system. Please make sure to install these updates as soon as possible on your servers. This will prevent attackers from using the vulnerability to attack your systems.Using Windows UpdateIf you run Windows Update on your system you’ll see the security updates listed if you haven’t already installed them on your computer. Note that you’ll see a separate update available for each version of .NET you have installed on your system:
Displaying Images in Silverlight 4 DataGrid using Converter
Posted by
jasper22
at
16:39
|
Silverlight 4 being a technology for Line-Of-Business (LOB) application has provided lots of features to developers. One of them is implementing value converters. In a Proof Of Concept (POC) assignment recently, I came across a requirement for displaying images in Silverlight DataGrid. I used IValueConverter for this requirement. In this article, I have also used a WCF service which reads images from the Database and returns a Byte array. This service is consumed by the Silverlight application, where a converter is implemented.
Creating WCF service In this task we will create a WCF service using VS2010 targeted for .NET 4.0 framework.
Step 1: Open VS2010 and create a blank solution, name it as ‘SILV4_Converters’. To this solution, add a WCF service and name it as ‘WCF4_ImageService’.
Step 2: Add the following interface and the DataContract class in ‘IService1.cs’:
C#
using System.Runtime.Serialization;
using System.ServiceModel; Namespace WCF4_ImageService
{
[ServiceContract]
Public Interface IService
{
[OperationContract]
ImageEmployee[] GetAllEmp();
} [DataContract]
Public Class ImageEmployee
{
[DataMember]
public int EmpNo { get; set; }
[DataMember]
public string EmpName { get; set; }Read more: dot net curry.com
Creating WCF service In this task we will create a WCF service using VS2010 targeted for .NET 4.0 framework.
Step 1: Open VS2010 and create a blank solution, name it as ‘SILV4_Converters’. To this solution, add a WCF service and name it as ‘WCF4_ImageService’.
Step 2: Add the following interface and the DataContract class in ‘IService1.cs’:
C#
using System.Runtime.Serialization;
using System.ServiceModel; Namespace WCF4_ImageService
{
[ServiceContract]
Public Interface IService
{
[OperationContract]
ImageEmployee[] GetAllEmp();
} [DataContract]
Public Class ImageEmployee
{
[DataMember]
public int EmpNo { get; set; }
[DataMember]
public string EmpName { get; set; }Read more: dot net curry.com
Different Ways to Bind Data Grid in Silverlight
Posted by
jasper22
at
16:36
|
In the previous article I described the basics of Data Binding in Silverlight. In this article I will demonstrate How to Bind Data grid with different data sources like:Binding with Static Collection/List
Binding with XML
Binding with Database via WCF Services
Binding with Database via WCF RIA ServicesTo setup an example let’s create a new Silverlight project is VS 2010 called “DataBinding”. See “How to create Silverlight application in VS 2010” for more information. Let’s create add a new Class file called “Item.cs” with Item Class as following: namespace DataBinding
{
public class Item
{
public string ItemNumber { get; set;}
public string ItemDescription { get; set; }
public int Quantity { get; set; }
public Item()
{
}
public Item(string ItemNumber, string ItemDescription, int Quantity)
{
this.ItemNumber= ItemNumber;
this.ItemDescription = ItemDescription;
this.Quantity = Quantity;
}
}
}Read more: Beyond relational
Binding with XML
Binding with Database via WCF Services
Binding with Database via WCF RIA ServicesTo setup an example let’s create a new Silverlight project is VS 2010 called “DataBinding”. See “How to create Silverlight application in VS 2010” for more information. Let’s create add a new Class file called “Item.cs” with Item Class as following: namespace DataBinding
{
public class Item
{
public string ItemNumber { get; set;}
public string ItemDescription { get; set; }
public int Quantity { get; set; }
public Item()
{
}
public Item(string ItemNumber, string ItemDescription, int Quantity)
{
this.ItemNumber= ItemNumber;
this.ItemDescription = ItemDescription;
this.Quantity = Quantity;
}
}
}Read more: Beyond relational
Best open source alternativeness to NHibernate
Posted by
jasper22
at
16:14
|
nHydrate - Conceive, Model, Generate
nHydrate is an object-relational mapping (ORM) solution for the Microsoft .NET platform providing a framework for a relational database to be mapped to .NET objects. It is designed to alleviate the software developers experience writing persistence domains. The model controls database generation, LINQ syntax, API, DAL, etc. Fluent NHibernate - Fluent mapping for model
Fluent, XML-less, compile safe, automated, convention-based mappings for NHibernate. Fluent NHibernate offers an alternative to NHibernate's standard XML mapping files. Rather than writing XML documents, you write mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code. BL-Toolkit - Business Logic Toolkit for .NET
Business Logic Toolkit is a set of components to simplify .NET application development. BLToolkit is provided as source code that you can use "as is" or customize for your applications. It is written in C# and compatible with .NET Framework 3.5 and 4.0. SubSonic - Data access for .NET
SubSonic is A Super High-fidelity Batman Utility Belt that works up your Data Access (using Linq in 3.0), throws in some much-needed utility functions, and generally speeds along your dev cycle. Read more: Best Open Source
nHydrate is an object-relational mapping (ORM) solution for the Microsoft .NET platform providing a framework for a relational database to be mapped to .NET objects. It is designed to alleviate the software developers experience writing persistence domains. The model controls database generation, LINQ syntax, API, DAL, etc. Fluent NHibernate - Fluent mapping for model
Fluent, XML-less, compile safe, automated, convention-based mappings for NHibernate. Fluent NHibernate offers an alternative to NHibernate's standard XML mapping files. Rather than writing XML documents, you write mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code. BL-Toolkit - Business Logic Toolkit for .NET
Business Logic Toolkit is a set of components to simplify .NET application development. BLToolkit is provided as source code that you can use "as is" or customize for your applications. It is written in C# and compatible with .NET Framework 3.5 and 4.0. SubSonic - Data access for .NET
SubSonic is A Super High-fidelity Batman Utility Belt that works up your Data Access (using Linq in 3.0), throws in some much-needed utility functions, and generally speeds along your dev cycle. Read more: Best Open Source
Step-by-Step Guide to Silverlight Shape Controls
Posted by
jasper22
at
16:07
|
As mentioned in my previous post, you need “Microsoft.Expression.Drawing.dll” assembly to get the new Shape controls in hand to work with. You can get this dll once you install the Expression Blend SDK to your development PC. If you don’t have the Expression Blend, you can easily download it from the Microsoft Expression site. Apart from this, your development environment should have the following Tools already installed:Microsoft Visual Studio 2010
Silverlight 4 Tools for Visual Studio 2010
Introducing the Shape Controls
Once your development environment is ready, you can open the Expression Blend IDE and create a new Silverlight Application Project. I am demonstrating with the help of Expression Blend here, so that, it will be easy for you to understand properly. Read more: Silverlight Show
The Immediate Window: Running WinDbg and SOS (Son of Strike) Commands
Posted by
jasper22
at
12:13
|
I could take a long time to teach you about WinDbg and SOS (Son of Strike) so I will avoid that here. I want to give you a quick view into how SOS works in the Immediate Window. If you want to get hardcore with debugging then the absolute best places to learn are these two blogs: John Robbins over at Wintellect: http://www.wintellect.com/CS/blogs/jrobbins/default.aspx
Tess Ferrandez an ASP.NET Escalation Engineer at Microsoft: http://blogs.msdn.com/b/tess/ Loading SOS In The Immediate WindowWith that said, let's take a look at what it takes to get SOS going in the Immediate Window. As we go along I will also show you the most common messages you will encounter when trying to set this up. First, open the Immediate Window (CTRL + ALT + I) and put in ".load sos" then press ENTER. x86You will most likely get this message:"SOS not available while Managed only debugging. To load SOS, enable unmanaged debugging in your project properties."The fix is, obviously, to go to your project properties (the Debug tab):
Read more: Visual Studio Tips and Tricks
Tess Ferrandez an ASP.NET Escalation Engineer at Microsoft: http://blogs.msdn.com/b/tess/ Loading SOS In The Immediate WindowWith that said, let's take a look at what it takes to get SOS going in the Immediate Window. As we go along I will also show you the most common messages you will encounter when trying to set this up. First, open the Immediate Window (CTRL + ALT + I) and put in ".load sos" then press ENTER. x86You will most likely get this message:"SOS not available while Managed only debugging. To load SOS, enable unmanaged debugging in your project properties."The fix is, obviously, to go to your project properties (the Debug tab):
Read more: Visual Studio Tips and Tricks
Clay: A Generic Programming Language With an LLVM Backend
Posted by
jasper22
at
12:08
|
The Clay programming language is a type-safe variant of C/C++ that was developed at Tachyon technologies. It recently appeared on bitbucket's open source repository to let developers find new, innovative uses for its highly reusable and efficient code. Clay's runtime overhead and memory footprint are on the same level as C. The language is perfect for writing embedded systems, garbage collectors, database servers, games, and more. Programmers who have written C++ templates know that the longer type names in generic code make the templates verbose, but Clay solves this issue with a whole-program type propagation. When generic programming is combined with the entire program type propagation, developers can write high-level code that is on par with scripting language conciseness. These are a few code samples form the 'test' directory:Read more: JavaLobby
The Truth About Value Types
Posted by
jasper22
at
12:07
|
As you know if you've read this blog for a while, I'm disturbed by the myth that "value types go on the stack". Unfortunately, there are plenty of examples in our own documentation and in many books that reinforce this myth, either subtly or overtly. I'm opposed to it because:
The way in the past I've usually pushed back on this myth is to say that the real statement should be "in the Microsoft implementation of C# on the desktop CLR, value types are stored on the stack when the value is a local variable or temporary that is not a closed-over local variable of a lambda or anonymous method, and the method body is not an iterator block, and the jitter chooses to not enregister the value." Read more: Fabulous Adventures In Coding
- It is usually stated incorrectly: the statement should be "value types can be stored on the stack", instead of the more common "value types are always stored on the stack".
- It is almost always irrelevant. We've worked hard to make a managed environment where the distinctions between different kinds of storage are hidden from the user. Unlike some languages, in which you must know whether a particular storage is on the stack or the heap for correctness reasons.
- It is incomplete. What about references? References are neither value types nor instances of reference types, but they are values. They've got to be stored somewhere. Do they go on the stack or the heap? Why does no one ever talk about them? Just because they don't have a type in the C# type system is no reason to ignore them.
The way in the past I've usually pushed back on this myth is to say that the real statement should be "in the Microsoft implementation of C# on the desktop CLR, value types are stored on the stack when the value is a local variable or temporary that is not a closed-over local variable of a lambda or anonymous method, and the method body is not an iterator block, and the jitter chooses to not enregister the value." Read more: Fabulous Adventures In Coding
Introducing Microsoft RemoteFX USB Redirection
Posted by
jasper22
at
10:16
|
In April, Max Herrmann posted a blog article announcing our newest device redirection feature for Remote Desktop Virtualization Host: RemoteFX USB redirection. In this three-part series, we’ll take a closer look at the feature and how it helps close the gap between the user experience of a local user sitting at their physical desktop and that of a remote user connected to a virtual desktop. The first part of the series gives an overview of the feature and what it can do, and how to set up a basic deployment of the feature. Feature Overview
The goal of RemoteFX USB redirection is simple: the user should be able to use any device they want, and have it just work. RDP has numerous high-level redirections that allow specific types of devices to be used effectively in a remote session, such as: Easy Print, which allows users to print to local printers in remote sessions
Drive Redirection, which allows users to access the file system on any local drive in a remote session, including USB drives
Smart Card Redirection, which allows users to authenticate to and in a remote session by using smart cards/e-tokens
Plug-and-Play Device Redirection, which allows users to access PTP digital cameras, MTP music players, and POS for .NET devices in a remote session, among others
Input Redirection, which allows the use of keyboards/mice in remote sessions
Audio Redirection, which allows recording and playback of audio in remote sessions
Port Redirection, which allows the use of serial and parallel ports in remote sessions
However, there are many devices which are not covered by these redirections, such as scanners, multifunction printers, webcams, and more. RemoteFX USB redirection acts as a catch-all mechanism that redirects these USB devices! Unlike high-level redirections such as drive redirection, RemoteFX USB redirection happens at the port protocol (USB request block or URB) level, and is similar to how one can redirect serial or parallel ports via RDP. This provides some unique advantages, as you’ll see below. However, RemoteFX USB redirection is meant to supplement high-level redirections, not to supplant them. By combining RemoteFX USB redirection with RDP high-level device redirections, you can have the best of both worlds. Here is a table that compares and contrasts the two forms of redirection. Read more: Remote Desktop Services (Terminal Services) Team Part 1, Part 2
The goal of RemoteFX USB redirection is simple: the user should be able to use any device they want, and have it just work. RDP has numerous high-level redirections that allow specific types of devices to be used effectively in a remote session, such as: Easy Print, which allows users to print to local printers in remote sessions
Drive Redirection, which allows users to access the file system on any local drive in a remote session, including USB drives
Smart Card Redirection, which allows users to authenticate to and in a remote session by using smart cards/e-tokens
Plug-and-Play Device Redirection, which allows users to access PTP digital cameras, MTP music players, and POS for .NET devices in a remote session, among others
Input Redirection, which allows the use of keyboards/mice in remote sessions
Audio Redirection, which allows recording and playback of audio in remote sessions
Port Redirection, which allows the use of serial and parallel ports in remote sessions
However, there are many devices which are not covered by these redirections, such as scanners, multifunction printers, webcams, and more. RemoteFX USB redirection acts as a catch-all mechanism that redirects these USB devices! Unlike high-level redirections such as drive redirection, RemoteFX USB redirection happens at the port protocol (USB request block or URB) level, and is similar to how one can redirect serial or parallel ports via RDP. This provides some unique advantages, as you’ll see below. However, RemoteFX USB redirection is meant to supplement high-level redirections, not to supplant them. By combining RemoteFX USB redirection with RDP high-level device redirections, you can have the best of both worlds. Here is a table that compares and contrasts the two forms of redirection. Read more: Remote Desktop Services (Terminal Services) Team Part 1, Part 2
What XNA Game Studio 4.0 functionality works in what version of Visual Studio and on what version of Windows
Posted by
jasper22
at
10:12
|
Since XNA Game Studio 4.0 and the Windows Phone Developer Tools shipped a couple of weeks ago, I’ve run into some common questions about the supported OS and Visual Studio matrix, so I decided to try to create a couple of tables to better illustrate what XNA Game Studio 4.0 functionality you can use where and provide a little more detail about the install scenarios. XNA Game Studio 4.0 – how to installYou can download and install XNA Game Studio 4.0 two different ways:1. As an integrated part of the Windows Phone Developer ToolsThis installer works on Windows Vista and Windows 7
It includes an edition of Visual Studio
It provides the ability to develop games for Windows, Xbox 360 and Windows Phone
2. As a standalone XNA Game Studio 4.0 packageThis installer works on Windows XP, Windows Vista and Windows 7
It does not include an edition of Visual Studio – you must install Visual Studio 2010 yourself before being allowed to install the standalone package
It provides the ability to develop games for Windows and Xbox 360
The following tables provide different views into what functionality is supported where.XNA Game Studio 4.0 – Supported Visual Studio editionsThe following table shows what type of games you can develop with XNA Game Studio 4.0 in what editions of Visual Studio 2010. Read more: Aaron Stebner's WebLog
It includes an edition of Visual Studio
It provides the ability to develop games for Windows, Xbox 360 and Windows Phone
2. As a standalone XNA Game Studio 4.0 packageThis installer works on Windows XP, Windows Vista and Windows 7
It does not include an edition of Visual Studio – you must install Visual Studio 2010 yourself before being allowed to install the standalone package
It provides the ability to develop games for Windows and Xbox 360
The following tables provide different views into what functionality is supported where.XNA Game Studio 4.0 – Supported Visual Studio editionsThe following table shows what type of games you can develop with XNA Game Studio 4.0 in what editions of Visual Studio 2010. Read more: Aaron Stebner's WebLog
Redirecting between SSL secured and non-secured pages in ASP.net
Posted by
jasper22
at
10:10
|
A simple Javascript solution that changes https: to http: in URLs for secured and non-secured pages
IntroductionA simple JavaScript solution to prevent 403.4 errors during redirects in ASP.net applications where some pages are secured with SSL.
BackgroundWhile I was working with SSL encryption on a recent project, I realized the need to have a dynamic and reliable way to redirect the browser to the next page regardless of whether the current page uses SSL and the next page doesn't, or visa versa. Server solutions didn't work. I read several forum posts suggesting that the programmer use code-behind on the server like this, placed in the Page_Load event: Dim strURL As String = Request.Url.ToString()
If Request.IsSecureConnection Then
If strURL.IndexOf("http:") > -1 Then
strURL = strURL.Replace("http:", "https:")
Response.Redirect(strURL)
End If
Else
If strURL.IndexOf("https:") > -1 Then
strURL = strURL.Replace("https:", "http:")
Response.Redirect(strURL)
End If
End IfThis method uses Request.IsSecureConnection to test whether or not SSL is required by IIS for the current page, then Response.redirect to send the browser back to the same requested URL, replacing the http: with https: for the second request. This idea seemed to make sense until I realized that IIS 7 (and maybe other versions of IIS) doesn't pass the request to the web application if a page that is secured with SSL is requested without the https: prefix. Instead, an error is raised in IIS and the user gets an ugly 403.4 error page which, despite Microsoft's best efforts to help users solve their own problems, reads like instructions on how to program a VCR from 1988. Read more: Codeproject
IntroductionA simple JavaScript solution to prevent 403.4 errors during redirects in ASP.net applications where some pages are secured with SSL.
BackgroundWhile I was working with SSL encryption on a recent project, I realized the need to have a dynamic and reliable way to redirect the browser to the next page regardless of whether the current page uses SSL and the next page doesn't, or visa versa. Server solutions didn't work. I read several forum posts suggesting that the programmer use code-behind on the server like this, placed in the Page_Load event: Dim strURL As String = Request.Url.ToString()
If Request.IsSecureConnection Then
If strURL.IndexOf("http:") > -1 Then
strURL = strURL.Replace("http:", "https:")
Response.Redirect(strURL)
End If
Else
If strURL.IndexOf("https:") > -1 Then
strURL = strURL.Replace("https:", "http:")
Response.Redirect(strURL)
End If
End IfThis method uses Request.IsSecureConnection to test whether or not SSL is required by IIS for the current page, then Response.redirect to send the browser back to the same requested URL, replacing the http: with https: for the second request. This idea seemed to make sense until I realized that IIS 7 (and maybe other versions of IIS) doesn't pass the request to the web application if a page that is secured with SSL is requested without the https: prefix. Instead, an error is raised in IIS and the user gets an ugly 403.4 error page which, despite Microsoft's best efforts to help users solve their own problems, reads like instructions on how to program a VCR from 1988. Read more: Codeproject
Microsoft SQL Server 2008 Service Pack 2
Posted by
jasper22
at
10:09
|
Overview
Microsoft SQL Server 2008 Service Pack 2 (SP2) is now available for download. These packages may be used to upgrade any edition of SQL Server 2008. We remain committed to providing our customers with essential changes via Service packs. Service Pack 2 contains updates for SQL Server Utility, Data-Tier Application (DAC), as well as integration capability for Microsoft Reporting Services with the Microsoft SharePoint 2010 Technologies. Service Pack 2 introduces support for a maximum of 15,000 partitions in a database, and includes SQL Server 2008 SP1 Cumulative Update 1 to 8. While keeping product changes contained, we have made significant investments to ease deployment and management of Service Packs. Microsoft SQL Server 2008 Service Pack 1 is not a prerequisite for installing SQL Server 2008 Service Pack 2. For more information about SQL Server 2008 Service Pack 2, please visit our Release Notes. Read more: MS Download
Microsoft SQL Server 2008 Service Pack 2 (SP2) is now available for download. These packages may be used to upgrade any edition of SQL Server 2008. We remain committed to providing our customers with essential changes via Service packs. Service Pack 2 contains updates for SQL Server Utility, Data-Tier Application (DAC), as well as integration capability for Microsoft Reporting Services with the Microsoft SharePoint 2010 Technologies. Service Pack 2 introduces support for a maximum of 15,000 partitions in a database, and includes SQL Server 2008 SP1 Cumulative Update 1 to 8. While keeping product changes contained, we have made significant investments to ease deployment and management of Service Packs. Microsoft SQL Server 2008 Service Pack 1 is not a prerequisite for installing SQL Server 2008 Service Pack 2. For more information about SQL Server 2008 Service Pack 2, please visit our Release Notes. Read more: MS Download
Five Must Have Tools for MVC Developers
Posted by
jasper22
at
10:08
|
Chirpy Zippy – A Visual Studio add-in that Mashes, minifies, and validates your JavaScript, Stylesheet, and dotless files. Chirpy can also auto-update T4MVC and other T4 templates.
In the past, I typically would run all of my script and CSS files through a compressor before deploying them to a production web server. However, with Chirpy installed, your CSS and script files will be automatically compressed based on their name. For example, if you have a script file named myscript.js that you want compressed, you would rename the script to myscript.yui.js and your file will automatically be minified using the YUI compressor. The minified file shows up as a child item in solution explorer so you still have your non-minified, human-readable scripts for debugging purposes. T4MVC - I blogged about T4MVC before but its always worth mentioning again. T4MVC is a T4 template for ASP.NET MVC apps that creates strongly typed helpers that eliminate the use of literal strings when referring the controllers, actions and views. It helps make your MVC code much more maintainable, and gives you intellisense where you normally would not have any. MVC Contrib – T4MVC is a small part of the MVC Contrib library which contains various utilities for the realm of ASP.NET MVC development. I recently wrote a post about the Grid HTML Helper which I am using in a few of my personal projects. However, MVC Contrib contains many features and libraries which you may find useful in your day to day development. ASP.NET Sprite and Image Optimization Framework – One of the best ways to boost the performance of your website is to reduce the number of HTTP requests required to render a page. One way to reduce the amount of requests is to use CSS sprites or inline images. Read more: CodeCapers
In the past, I typically would run all of my script and CSS files through a compressor before deploying them to a production web server. However, with Chirpy installed, your CSS and script files will be automatically compressed based on their name. For example, if you have a script file named myscript.js that you want compressed, you would rename the script to myscript.yui.js and your file will automatically be minified using the YUI compressor. The minified file shows up as a child item in solution explorer so you still have your non-minified, human-readable scripts for debugging purposes. T4MVC - I blogged about T4MVC before but its always worth mentioning again. T4MVC is a T4 template for ASP.NET MVC apps that creates strongly typed helpers that eliminate the use of literal strings when referring the controllers, actions and views. It helps make your MVC code much more maintainable, and gives you intellisense where you normally would not have any. MVC Contrib – T4MVC is a small part of the MVC Contrib library which contains various utilities for the realm of ASP.NET MVC development. I recently wrote a post about the Grid HTML Helper which I am using in a few of my personal projects. However, MVC Contrib contains many features and libraries which you may find useful in your day to day development. ASP.NET Sprite and Image Optimization Framework – One of the best ways to boost the performance of your website is to reduce the number of HTTP requests required to render a page. One way to reduce the amount of requests is to use CSS sprites or inline images. Read more: CodeCapers
Saving Files Into Database Using .NET Web Services
Posted by
jasper22
at
10:03
|
IntroductionA few months ago, my boss asked me to create Outlook Add-In which can save email attachments on SQL Server database. Main problem was that users could not connect to SQL Server directly, because instance of SQL Server was behind firewall. Second problem was, users wanted to see percentage status of file transferring. So I decided to create .NET Web Service to solve this problem. In this article I will show you, how to save big files on SQL Server database by Web Service. BackgroundOne of the options, how to store big files into the database using .NET Web Service is to parse file into a few smaller parts and then transfer this parts separately on the server into temporary file. After upload, you can save this file into database. DatabaseOur first step is creating a database. In this sample I created database called FileStorage with one table FileRead more: Codeproject
StickyBeak Version 0.3 Released
Posted by
jasper22
at
10:00
|
Finally found some time to add a couple of features to StickyBeak. StickyBeak is a logging utility for asp.net websites which can log every request to your site. It provides similar features as IIS log files but provides additional logging information (which just isn’t possible with IIS logs) and easy viewing of logs via a admin page. You can also use the StickyBeak log file parser in your own code. StickyBeak records request details such as url, ip address, unique session Id, datestamp, cookies, querystring, form values, session variables etc. StickyBeak allows you to track the requests that lead up to errors/exceptions on your site. So it provides valuable context for figuring out exactly what caused an error. StickyBeak is complimentary to elmah. Read more: Marks asp.net / mvc blog
jQuery Alert Dialogs Plug-in
Posted by
jasper22
at
09:40
|
When you want to alert the user in the client side of a web application probably you are embarrassed (or you don’t give a damn) when you use Javascript built-in alerts. I know I do. Javascript built-in alerts are very ugly IMHO and therefore I try to use alternatives instead. In this post I’ll show a very useful alternative that I’ve been using lately in more then one project – the jQuery Alert Dialogs plug-in. jQuery Alert Dialogs Plug-inOne of the benefits of using jQuery is the amount of jQuery plug-ins that exists in jQuery eco-system. But the amount of plug-ins also makes it very difficult to find your desired plug-in for each behavior you need. One of the plug-ins I’m using frequently is the jQuery Alert Dialogs. The plug-in “aims to replace the basic functionality provided by the standard JavaScript alert(), confirm(), and prompt() functions”. The plug-in also simulate the use of these standard functions and also gives you the power to create your own style. How to use the plug-in?First you will have to download the plug-in from this link – jQuery Alert Dialogs. Also you will have to download jQuery UI Draggable plug-in which the plug-in has dependency on it (or download all the jQuery UI package like I did). After you downloaded all the relevant scripts you will have to add the plug-ins to your web application. Read more: Gil Fink on .Net
WCF: The right way. A Quick Reference Guide.
Posted by
jasper22
at
09:38
|
IntroductionMiguel Castro (MC from now on) gives a compelling argument why the included project templates for WCF Service Applications "creates too much baggage" and does not promote "best practices". He continues by suggesting adding service references is also "falling a bit short". To put it in context he notes that WCF "is probably one of the absolutely coolest technologies to come out of Microsoft". The WCF template method does not separate the contracts, tightly couples the service to a web-service (although other transports can be used), web-service webconfig contains too much metadata, and service references duplicate contracts. A summary of MC’s Critique can be found here. What turns this article into a constructive exercise is he also outlines a manual way of creating and consuming WCF services: that is loosely coupled, follows good design standards, and most importantly, is simple to maintain. This article breaks his process into a concise developer workflow, broken into distinct actions and steps - a Quick Reference Guide. Read more: Codeproject
ASP.NET MVC Custom Model Binding
Posted by
jasper22
at
09:37
|
One item I take for granted when I'm using ASP.NET MVC is the powerful feature that is model binding. Model binding is ASP.NET MVC's mechanism for mapping HTTP request data directly into action method parameters and custom .Net objects. Each time your application receives an HTTP request containing the form's data as a pair of key/value pairs, the ControllerActionInvoker invokes the DefaultModelBinder to transform that raw HTTP request into something more meaningful to you, which would be a .Net object. This just works and I love it. Sometimes you need to customize the default model binding to work a little differently. For example, if you were expecting a strongly typed collection of values posted from a multi select control, the default model binding won't work as expected. I'll demonstrate one workaround for this so your action can expect a strongly typed object, and not just an array of strings.
Open visual studio 2010 and create a new ASP.NET MVC 2 empty web application. The model for this will be simple as I want to illustrate the technique of model binding. Here's the model below: public class Car
{
public string Make { get; set; }
public int Id { get; set; } public static List<Car> GetCars()
{
return new List<Car>
{
new Car { Id = 1, Make = "Ford"},
new Car { Id = 2, Make = "Holden"},
new Car { Id = 3, Make = "Chevrolet"}
};
}
}
Now to fast track things. I've got an action that receives HTTP post request and its signature is below:[HttpPost]
public ActionResult PostCars(List<Car> cars)
{
return Content("Ok");
}
Read more: net curry .com
Open visual studio 2010 and create a new ASP.NET MVC 2 empty web application. The model for this will be simple as I want to illustrate the technique of model binding. Here's the model below: public class Car
{
public string Make { get; set; }
public int Id { get; set; } public static List<Car> GetCars()
{
return new List<Car>
{
new Car { Id = 1, Make = "Ford"},
new Car { Id = 2, Make = "Holden"},
new Car { Id = 3, Make = "Chevrolet"}
};
}
}
Now to fast track things. I've got an action that receives HTTP post request and its signature is below:[HttpPost]
public ActionResult PostCars(List<Car> cars)
{
return Content("Ok");
}
Read more: net curry .com
Installing the F# PowerPack on Linux / Mono
Posted by
jasper22
at
09:36
|
The F# PowerPack is an open source collection of libraries provided by the Microsoft F# team on top of the standard distribution. It can be found here. It is recommended to always install the F# PowerPack when using F#. 1. Download the F# PowerPack ZIP-file from CodePlex2. Go to your F# installation location (and switch to root if necessary)~> cd /usr/local/lib/FSharp-2.0.0.0/bin/
host:/usr/local/lib/FSharp-2.0.0.0/bin> su
Password:
host:/usr/local/lib/FSharp-2.0.0.0/bin #3. Unzip the file
Read more: 2#4u
host:/usr/local/lib/FSharp-2.0.0.0/bin> su
Password:
host:/usr/local/lib/FSharp-2.0.0.0/bin #3. Unzip the file
Read more: 2#4u
Deploying your Windows Phone 7 Application to the actual hardware.
Posted by
jasper22
at
09:35
|
I’ve blogged about the tools and have played with the hardware, now its time to put an application on the actual Windows Phone 7 hardware. I will guide you through the entire process step-by-step. Please note that I have an early version of the phone and had to get a Connect Login to download Zune 4.7. If you are reading this after the phone has launched then you can probably just go to the Zune web page and download it directly. You will also want to skip down until the next section that starts the Zune install. For those using Microsoft Connect, the first thing that you will need to do is get your Microsoft representative to grant you a Connect login Note: You have to be nominated by someone at Microsoft in order to join the program/get a phone. Read more: Michael Crump
Subscribe to:
Posts (Atom)