
Read more: West Coats Hackers
This is a mirror of official site: http://jasper-net.blogspot.com/
This is a mirror of official site: http://jasper-net.blogspot.com/
Read more: TechBlips
Read more: makeuseof.com
Whether guys like you or I like it or not, McAfee still has a lot going for it. It's preinstalled on loads of OEM PCs and gets plenty of subscription buys as a result. It's a force to be reckoned with in the enterprise, and they're one of the most widely-recognized names in antivirus.
Read more: DownloadSquad
SQL Server Management Studio has been designed for a very fast interaction of the Administrator and/or users with the SQL Server objects. We can see the objects by just clicking in the appropriate item, example to get the views or the users.
The purpose of this article is to show how with a quick knowledge of assembler language and pointers, the possibility to extract useful information without have the source code for any app. You can apply this article to show the queries in runtime for any .NET system. Reverse Engineering for fun. It can be applied also for Worker Processes on IIS for live debugging without Visual Studio.
Let Start. You will need a basic knowledge of .NET Debugging on Runtime Debugging like Windbg. For heuristic knowledge for .NET environments a natural way to execute commands is: SQLCommand Object, but we need to confirm this by looking if Management Studio process has instantiated this class. Let Start.
Steps
Open SQL Server Management Studio.
Login to SQL Server and execute some operations like view the objects or databases.
Open Windows debugger tool and attach the SQL Server Management Studio Process:
Once attached we can find a command line inside windows debugger.
There is a useful helper for debugging we can load this by using:
.loadby sos mscorwks
SOS windbg extensions allows to explore .NET objects at low level, based on the correct mscorwks.
Execute:
!dumpheap -type SqlCommand -stat
Dump .NET Heap for SqlCommand type (-type) and obtain an statistics of it (-stat).
Read more: Codeproject
Method 1 : Use columnproperty function
select table_name,column_name from information_schema.columns where columnproperty(object_id(table_name),column_name,'isidentity')=1 order by table_name
select object_name(ac.object_id),so.name from sys.all_columns as ac inner join sys.objects as so on object_name(ac.object_id)=so.name where is_identity=1 and so.type='u'
One example I didn’t have the time to show was how to run IronPython script from within C# code. After the session I was asked by a group member to show this exact demo. So without further ado here is how to run IronPython from within the comfort of your C# application:
Step 1: Add references
Add the following assemblies to your project:
IronPython.dll
IronPython.Modules.dll
Microsoft.Scripting.dll
All of the assemblies above are can be found under the IronPython installation folder.
Step 2: write code
Running IronPython is very easy – I’ve decided to create a console application and run an IronPython file that was passed as an argument:
using IronPython.Hosting; using Microsoft.Scripting.Hosting; namespace IronPythonFileRunner { class Program { static void Main(string[] args) { ScriptRuntimeSetup setup = Python.CreateRuntimeSetup(null); ScriptRuntime runtime = new ScriptRuntime(setup); ScriptEngine engine = Python.GetEngine(runtime); ScriptSource source = engine.CreateScriptSourceFromFile(args[0]); ScriptScope scope = engine.CreateScope(); source.Execute(scope); } } }
Read more: Helper Code
We recognize that providing as much technical content as we can for the full range of developers is what developers deserve. While we plan on having more live training sessions in the coming weeks and months, we are also committed to making that content available as quickly as possible to as many developers as possible. Since this round of content is based on Beta Windows Phone Developer Tools, we will not be localizing it. For our non-English speaking developers, we will be providing localized training once we have released the final developer tools.
Andy and Rob provide a good bit of humor along with their incredible depth of knowledge on the topic of building apps and games for Windows Phone 7. We think they have covered a fair amount ground, but if there are topics you feel we need to cover more in depth, don't hesitate to let us know.
There are 12 sessions in total, each about :50 minutes in length. Think of this as a semester's worth of class time to help you in your quest to be an awesome Windows Phone 7 developer. It's self-paced, and both Rob and Andy are pretty approachable. Head on over to their blogs if you want to get more plugged into what they are doing.
Read more: Greg's Cool [Insert Clever Name] of the Day
Read more: Windows Phone 7 Jump Start
byte[] signature = rsa.SignData(data, new SHA256CryptoServiceProvider());
4. The SHA1CryptoServiceProvider did not reproduce the exception.
5. Additionally you have FIPS policy enabled.
The environment might be Windows Vista and above with .Net Framework version 3.5 or above. The code snippet that reproduces this issue is:
namespace SignData
{
class Program
{
static void Main(string[] args)
{
byte[] data = new byte[] { 0, 1, 2, 3, 4, 5 };
using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider())
{
SHA256CryptoServiceProvider ha = new SHA256CryptoServiceProvider();
byte[] signature = rsa.SignData(data, ha);
if (rsa.VerifyData(data, new SHA256CryptoServiceProvider(), signature))
{
Console.WriteLine("RSA-SHA256 signature verified");
}
else
{
Console.WriteLine("RSA-SHA256 signature failed to verify");
}
}
}
}
}
This code is directly referenced from the blog http://blogs.msdn.com/shawnfa/archive/2008/08/25/using-rsacryptoserviceprovider-for-rsa-sha256-signatures.aspx and my intension is to show the exception.
Read more: LogIn SDK - Windows SDK team blog
Install SQL Server 2005. Afterwards, Install SQL Server 2008. (Integration Services or Management tools features are enough usually)
Install your favorite new tool Visual Studio 2010.
Create or Open a solution for your C# or VB application. The Solution properties should target the “.Net Framework 3.5” to have this problem.
Add references to one or more of the SSIS dlls in the SDK folder. These assemblies may be referenced from References tree in the Solution Explorer pane of Visual Studio 2010, by browsing to the dll files in the 32-bit directories from either SQL Server 2005 or SQL Server 2008:
On a 64-bit platform:
C:\Program Files (x86)\Microsoft SQL Server\90\SDK\Assemblies
C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies
On a 32-bit platform:
C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies
C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies
Microsoft.SqlServer.Dts.Design.dll
Microsoft.SQLServer.ManagedDTS.dll
Microsoft.SqlServer.ScriptTask.dll
Microsoft.SqlServer.SQLTask.dll
Microsoft.SqlServer.TxScript.dll
Microsoft.SqlServer.VSTAScriptingLib.dll
Build menu > Build ApplicationName.
The warnings will appear in the Error List pane.
The build of the .Net application may report the following Warnings in the Error List pane:
The primary reference "Microsoft.SqlServer.Dts.Design, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "2.0.3600.0" than the version "2.0.0.0" in the current target framework.
Read more: Jason's Technical Topics
We encountered an interesting problem the other day I thought I would post on ReplTalk. Customer call when they noticed the SQL Server Agent resources in their SQL 2008 clustered installation would not start. The following error appeared in the Windows Application and System Event log.
Windows Application Event Log
SQLServerAgent could not be started (reason: SQLServerAgent must be able to connect
to SQLServer as SysAdmin, but '(Unknown)' is not a member of the SysAdmin role).
[sqagtres] StartResourceService: Failed to start SQLAgent$SQL2K5 service. CurrentState: 1
[sqagtres] OnlineThread: ResUtilsStartResourceService failed (status 435)
[sqagtres] OnlineThread: Error 435 bringing resource online.
Windows System Event Log
The Cluster service failed to bring clustered service or application 'SQL Server (SQL2K5 )' completely online or offline. One or more resources may be in a failed state. This may impact the availability of the clustered service or application.
Cluster resource 'SQL Server Agent (SQL2K5 )' in clustered service or application 'SQL Server (SQL2K5 )' failed.
We also looked in the MSSQL\LOG folder for SQL Server to see what error messages SQL Server Agent was reporting. Here is where we noticed Error: 15281.
Read more: Techie Tal
USE [AdventureWorks]
GO
Now let us see the resultset. Here we have specified negative identity Seed value as well negative Increment Interval.
Read more: Journey to SQL Authority with Pinal Dave
Cryptography play important role in Security. Using Cryptography we can Encrypt and Decrypt the information in the Coded form.
How we Encrypt the File using DES (Data Encryption standard) algorithm.
1.Open visual studio and create a project
2.Add the following assembly on the page
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Security;
using System.Security.Cryptography;
using System.Text;
using System.IO;
3.Now write the Code in the Page
public class Tester
{
public static void Main()
{
try
{
DESCryptoServiceProvider myDESProvider = new DESCryptoServiceProvider();
myDESProvider.Key = ASCIIEncoding.ASCII.GetBytes("12345678");
myDESProvider.IV = ASCIIEncoding.ASCII.GetBytes("12345678");
ICryptoTransform myICryptoTransform = myDESProvider.CreateEncryptor(myDESProvider.Key, myDESProvider.IV);
FileStream ProcessFileStream = new FileStream("test.txt", FileMode.Open, FileAccess.Read);
FileStream ResultFileStream = new FileStream("testDes.txt", FileMode.Create, FileAccess.Write);
CryptoStream myCryptoStream = new CryptoStream(ResultFileStream, myICryptoTransform, CryptoStreamMode.Write);
byte[] bytearrayinput = new byte[ProcessFileStream.Length];
ProcessFileStream.Read(bytearrayinput, 0, bytearrayinput.Length);
myCryptoStream.Write(bytearrayinput, 0, bytearrayinput.Length);
myCryptoStream.Close();
ProcessFileStream.Close();
ResultFileStream.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Read more: C# Corener
In a nutshell, all of the learning and hard lessons discovered through the school of hard knocks and best thinking of distributed systems (rather than whimsical, so-called vendor best practices) are baked into the heart and core of NServiceBus.
vs. Web Services
Previous to going to his class I had already done a decade of web services using SOAP and REST and I kept running into the same types of problems over and over again. I’ve read all of the best practices of the vendors and so forth, but the thing that always bugged me was how everything related to these "best practices” (if it’s even appropriate to call them that), always pointed us back to purchasing more licenses—such as database licenses, OS licenses, etc. If you want an eye opener and sample of what Udi brings to the table, take a look at his Reliability, Availability, and Scalability webcast. The biggest problem with with web services is that they run afoul of practically all of the fallacies.
So where do web services fit in? As integration points with 3rd parties that connect across the web. They’ve worked great in that arena and will continue to work well into the foreseeable future. Furthermore, a “web service” AJAX call from a browser into a service may also be appropriate.
vs. WCF
Essentially WCF is just a way of wrapping all of Microsoft’s myriad of integration and communication technologies under one API. The problem is that all of these technologies, with the exception of MSMQ, were built upon the paradigm of RPC—remote procedure call. Essentially, it’s all about blocking communication. Could you imagine a world in which you called someone on the phone and waited on hold until you received the information you needed? RPC is just like that. Your servers are at 0% CPU, but you have no threads left to serve because they’re all blocked waiting for remote services to respond. The MSMQ binding helps, but not if you use it in a synchronous blocking manner with an RPC-type interaction.
Read more: Inversion of Control Freak
http://www.iis.net/configreference
Even better, if you are a bit old fashioned like me and like a compiled help file (CHM) the download links at the bottom of that page let you download those too.
Read more: Notes from a dark corner
Read more: AgniPulse
Note
I will keep updating the logging providers with the current NH Trunk. When a version if NH3 is tagged I will provide a permanent Download for that particular release.Available Logging Providers
The current release contains log providers for the following logging frameworks.
- Common.Logging 2.0
Common.Logging 2.0 supports several other logging frameworks. So you can use each of them with NHibernate via Common.Logging 2.0 abstraction.
This web site hold an reference to most of the PL/SQL commands with examples.
Read more: C# Book
I am in process of updating that with few new questions and answers I have received from industry experts. Please provide your feedback on how we can further improve them or what kind of questions and answers would like to include in them.
Read more: Journey to SQL Authority with Pinal Dave
AFFECTED SYSTEMS:
Read more: Google Knol
Read more: MSDN Magazine
git clone https://vogella@github.com/vogella/de.vogella.rcp.example.git
// do some changes
git push https://vogella@github.com/vogella/de.vogella.rcp.example.git
If you are on Windows and if you are using msysGit then you may receive the following error:
error: error setting certificate verify locations:
CAfile: /bin/curl-ca-bundle.crt
CApath: none
while accessing your_repo
If you have this error you can disable ssl verification to solve it.
git config --global http.sslverify "false"
Read more: Eclipse Papercuts
Introduction and Goal
One of the important factors for performance degradation in .NET code is memory consumption. Many developers just concentrate on execution time to determine performance bottle necks in a .NET application. Only measuring execution time does not clearly give idea of where the performance issue resides. Ok, said and done one of the biggest task is to understand which function, assembly or class has consumed how much memory. In this tutorial we will see how we can find which functions consume how much memory. This article discusses the best practices involved using CLR profiler for studying memory allocation.
Please feel free to download my free 500 question and answer ebook which covers .NET , ASP.NET , SQL Server , WCF , WPF , WWF@ http://www.questpond.com .
Thanks a lot Mr. Peter Sollich
Let’s start this article by first thanking Peter Sollich who is the CLR Performance Architect to write such a detail help on CLR profiler. When you install CLR profiler do not forget to read the detail help document written by Peter Sollich.
Thanks a lot sir, if ever you visit my article let me know your inputs.
Read more: Codeproject
FireMon® is software that helps you manage your firewalls. FireMon will plan and report on any changes to the firewall policy, increasing visibility and reducing the cost of making changes. It will show you which of your rules are unused and how traffic flows through each rule, letting you clean up unnecessary access and tighten down existing rules. And, with continued, automated analysis of things like PCI and NSA guidelines, FireMon will greatly improve your compliance posture. It'll even help you with security management on other devices in the Enterprise, like routers and load balancers.
The bottom line? FireMon is software that will help you manage your security devices better so you can provide better service to your users at a lower cost to you.
Try FireMon on your own network.
Read more: Secure Passage
Eliminate Risks
Ensure Compliance
Optimize Your Security Policy
Effectively Manage Change
The AlgoSec Firewall Analyzer also comes with flexible deployment options and customization capabilities that makes deployment easy and tailored to your specific needs and environment. And a variety of licensing options makes it easy to chose the solution that best fits your needs.
Eliminate Risks
Analyzing complex firewall policies manually is time consuming and requires understanding of all possible options and combinations. As a result, many risks are not detected and impose a threat to the organization's security.
The AlgoSec Firewall Analyzer provides in-depth, intelligent analysis of the entire security policy leveraging unique algorithms that factor in network topology, all possible traffic variations and industry best practices resulting in a comprehensive identification of risks (and the specific rules that are causing them) and detailed and precise remediation guidance. This includes the ability to analyze several firewalls together -- taking into account their relative hierarchy in the network -- and presenting results in a single report, enabling more efficient and accurate risk management for groups of firewalls.
Read more: AlgoSec
Fire Walker is software that allows you to operate someone else's computer via a connection or through the internet, you can see their screen, send files, receive files, chat, draw and use their computer as if you were sitting in front of it.
Read more: Nexus Concepts
To make the bundle extremely cost effective, licenses for WPF Studio are priced to provide more than a 60% savings over the cost of purchasing all Actipro's WPF controls individually!
The company behind WPF Studio, Actipro Software, has been making top-notch Windows Forms controls since .NET was first introduced, and was the very first control vendor to release a commercial WPF control.
Read more: Actipro
protected void btnHey_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
sb.Append("<script language='javascript'>alert('HEY');</script>");
// if the script is not already registered
if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "HeyPopup"))
ClientScript.RegisterClientScriptBlock(Page.GetType(), "HeyPopup", sb.ToString());
}
Let's say that there is already a javascript method in the ASPX page. To run that method, you would use similar code, but with one difference:
// javascript method in ASPX page
<script language="javascript" type="text/javascript">
function ShowMessage(myMessage){
alert(myMessage);
}
</script>
// C# code
protected void btnHey_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
sb.Append("ShowMessage('hey');");
// if the script is not already registered
if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "HeyPopup"))
// notice that I added the boolean value as the last parameter
ClientScript.RegisterClientScriptBlock(Page.GetType(), "HeyPopup", sb.ToString(), true);
Read more: </dream-in-code>
Finalizers are a Ouija board, permitting dead objects to operate "from beyond the grave" and affect live objects. As a result, when finalizers are involved, there is a lot of creepy spooky juju going on, and you need to tread very carefully, or your soul will become cursed.
Let's step back and look at a different problem first. Consider this class which doesn't do anything interesting but works well enough for demonstration purposes:
class Sample1 {
private StreamReader sr;
public Sample1(string file) : sr(new StreamReader(file)) { }
public void Close() { sr.Close(); }
public string NextLine() { return sr.ReadLine(); }
}
What happens if one thread calls Sample1.NextLine() and another thread calls Sample1.Close()? If the NextLine() call wins the race, then you have a stream closed while it is in the middle of its ReadLine method. Probably not good. If the Close() call wins the race, then when the NextLine() call is made, you end up reading from a closed stream. Definitely not good. Finally, if the NextLine() call runs to completion before the Close(), then the line is successfully read before the stream is closed.
Having this race condition is clearly an unwanted state of affairs since the result is unpredictable.
Read more: The old new thing
Here is quick example which provides you two different details.
How many times the character/word exists in string?
How many total characters exists in Occurrence?
Let us see following example and it will clearly explain it to you.
DECLARE @LongSentence VARCHAR(MAX)
DECLARE @FindSubString VARCHAR(MAX)
SET @LongSentence = 'My Super Long String With Long Words'
SET @FindSubString = 'long'
SELECT (LEN(@LongSentence) - LEN(REPLACE(@LongSentence, @FindSubString, ''))) CntReplacedChars,
(LEN(@LongSentence) - LEN(REPLACE(@LongSentence, @FindSubString, '')))/LEN(@FindSubString) CntOccuranceChars
This will return following resultset.
CntReplacedChars CntOccuranceChars
-------------------- --------------------
2 2
Read more: Journey to SQL Authority with Pinal Dave
Let us consider the following example:
--Create a Table
CREATE TABLE test
(
id int identity(1,1),
names varchar(100)
)
--Insert Data
INSERT INTO test(names) SELECT 'testing'
--Get Identity Value that is Populated in the Current Scope
SELECT scope_identity()
--Get Identity value that is Populated in the Current Session
SELECT @@identity
--Get Identity value that is Populated in the Table
--Regardless of Scope and Session
SELECT ident_current('test')
Note that first two methods wont give correct values if data are added to the ‘different tables’
Read more: SQL Server
The RichTextBox extends the System.Windows.Control.RichTextBox control that represents a rich editing control which operates on FlowDocument objects. The RichTextBox control has a Text dependency property which allows a user to data bind content to the RichTextBox.Document property. The RichTextBox control introduces the concept of Text Formatters. Text Formatters allows a user to format the content of the RichTextBox control into any format of their choice. Three Text Formatters are included; PlainTextFormatter, RtfFormatter, and a XamlFormatter. The RtfFormatter is the default Text Formatter. A user can create their own custom Text Formatter by creating a class that inherits from ITextFormatter and implimenting the contract accordlingly.
Usage
When data binding to the Text property, you must use the Text Formatter that matches the format of the underlying data. If your data is in RTF you must use the RTF formatter. If your data is in plain text, you must use the PlainTextFormatter.
Read more: <ELEGANTCODE>
The other day they released a separate product, called NHibernate Designer, that offers similar functionality for those developers using the NHibernate O/R Mapper. Again, this is a Visual Designer that quickly and easily integrates within Visual Studio and allows you to do model-first development using the designer or reverse engineer tables from a database.
Read more: David Hayden
http://www.bing.com/visualsearch?q=World+leaders&g=world_leaders&FORM=Z9GE74#
Steps to get the GC information are
Read more: Naveen's Blog
Here are the steps. Open the IIS MMC, open the Site Bindings, and then add a HTTPS binding. Select this certificate from the certificates drop down list, and click OK. Then, got follow error:
A specified logon session does not exist. It may already have been terminated.
(Exception from HRESULT: 0x80070520)
There was no problem using other certificates in the drop down list. Using CertUtil command to verify the certificate, we got error s like the Encryption test failed for the certificate imported.
The problem is due to Administrators group doesn’t have permission to access the private key file which is under "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys". By default, administrators group and system account have full control for this folder. This was resolved by giving administrators group full control to this folder.
Reference:
278381 Default permissions for the MachineKeys folders
http://support.microsoft.com/default.aspx?scid=kb;EN-US;278381
Read more: AsiaTech: Learning by Practice
In this article, I will explain
It disables meta data
It disables WSDLIt disables end pointIt prevents meta data publishing
Autometically create End Point
It autometically creates the end point for all contracts using webHttpBindingNo need to call AddServiceEndPoint
Autometically add WebHttpBehaviour
It adds behavior to all end point adding behavior ensures URI+Verb routing will work for all incoming requests
So there's lots of good stuff - here are all the links (FYI: previously published links are gray):
Overviews (100 level)
Scenarios (200 level)
declare @status bit
set @status=1
if @status=0
print 'The event is closed'
else
print 'The event is started'
if @status=0
Begin
print 'use id column in the where clause'
select * from #t where id=2
End
else
Begin
print 'use names column in the where clause'
select * from #t where names='Suresh'
End
Read more: Beyond Relational
Introduction
You all know that, Silverlight 4 has the feature to talk with COM APIs. In my earlier posts I already mentioned various Interoperability functionalities of Silverlight. You can see some articles I have written here. In this article, I will show you how Silverlight can read your local files, folders and drives. At the end of this Article you will be able to open any file/folder/drive and read their attributes. Here I will demonstrate by creating a small application like Windows Explorer and reading all your drives and their contents
Read more: dot net spark
Fortunately, a (now-defunct) blog post from "Jeff" suggested a hack that works rather well—use Reflection to grab internal fields (including the challenge-response string) from a dummy WebRequest object. While using Reflection to grab internal fields is inherently fragile (e.g. subject to breakage in updated versions of the framework) this particular trick appears to work reliably in both .NETv2 and .NETv4 frameworks.
Each Fiddler session keeps a dummy WebRequest variable which is not initialized by default.
private WebRequest __WebRequestForAuth = null;
If, however, the server returns a WWW-Authenticate header demanding NTLM or Negotiate, and the Session Flag x-Builder-AutoAuth is present on the session, then the object will be initialized, with the current session's URL:
if (null == __WebRequestForAuth)
{
__WebRequestForAuth = HttpWebRequest.Create(this.fullUrl);}
try
{
#region Use-Reflection-Magic-To-Tweak-Internals
Type tWebReq = __WebRequestForAuth.GetType();
tWebReq.InvokeMember("Async", BindingFlags.Default | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.SetProperty, null, __WebRequestForAuth, new object[] { false });
object objServerAuthState = tWebReq.InvokeMember("ServerAuthenticationState", BindingFlags.Default | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.GetProperty, null, __WebRequestForAuth, new object[0]);
if (objServerAuthState == null) throw new ApplicationException("Auth state is null");
Type tAuthState = objServerAuthState.GetType();
tAuthState.InvokeMember("ChallengedUri", BindingFlags.Default | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetField, null, objServerAuthState, new object[] { new Uri(this.fullUrl)});
Response.Redirect();http://localhost/SilverlightSampleTestPage.aspx#/About
In the above example we are trying to redirect to About page.
The application worked liked a charm until it was noticed that when redirected to the About page, the About page would get loaded twice. In order to confirm the same, we used Fiddler which helped us confirm the behavior.
On further investigation it was found that Response.Redirect causes the browser to do a fresh navigation rather than fragment navigation. Due to this Internet Explorer demands for a new copy of the file and hence loads it twice. This is by design.
As the behavior cannot be changed, the following workaround can be used-
1) Create an initialization parameter, for example initparam.
2) Assign the page name to which the re-direction is required, to the value attribute, example value="link=/About"
3) Write the following code to redirect to the new page mentioned in the value attribute
Application.Current.Host.NavigationState = App.Current.Resources["link"].ToString();4) This will help us, get the same results as Response.Rediect without the issue of the page loading twice.
Read more: User Interface Support Team Blog
WPF Thread Affinity
Almost every WPF element has thread affinity. This means that access to such an element should be made only from the thread that created the element.
In order to do so, every element that requires thread affinity is derived, eventually, from DispatcherObject class. This class provides a property named Dispatcher that returns the Dispatcher object associated with the WPF element.
The Dispatcher class
The Dispatcher class is used to perform work on his attached thread. It has a queue of work items and it is in charge of executing the work items on the dispatcher thread.
So, when you want to change a property of a WPF element from a thread different of the one who created the element, you should use the element’s Dispatcher property to dispatch the operation to the correct thread. This is done using the BeginInvoke method that accepts a method to be invoked.
Where is the Dispatcher of the thread saved?
Every thread should have their dispatcher object, so you would think they will save the dispatcher on the Thread Local Storage (TLS).
It turns out they store a static list of all available dispatcher objects.
Of course, this list is synchronized using a private global static object (this is a common best practice when locking object).
Whenever the dispatcher of an object is needed, they go over the list, comparing the dispatcher’s Thread property with the current thread, until they find the correct dispatcher object for this thread.
The reason, as they note in the comments is that managed TLS is rather expensive.
Above this list they add the following optimization: before going over the dispatchers list they check if the last given dispatcher is suitable, so only a thread context switch will derive a new list search.
Read more: Arik Poznanski's Blog
"%UserProfile%\Desktop\AdbeRdr933_en_US.exe" -nos_ne
Read more: הבלוג שלי
IMAPI2 is written using COM, so no additional wrappers/interops required in order to get it working in powershell. The advantage of IMAPI is the possibility to write to different medias, for example to CDRW So, let’s begin:
First of all you'll need to build in memory file system image, which will contain your files. There are few steps to achieve that:
Create file system object
PS C:\Temp> $fsi = New-Object -ComObject IMAPI2FS.MsftFileSystemImage
Select appropriate settings like File System type, revision and so on
To view current state of any object you can just type its name in PowerShell:
PS C:\Temp> $fsi
PS C:\Temp> $fsi.FileSystemsToCreate = 7
PS C:\Temp> $fsi.VolumeName = "MyImage"
Add files to your file system:
PS C:\Temp> $fsi.Root.AddTreeWithNamedStreams("C:\test\imt\data\2tracks")
Create result stream, that will contain your data in required format:
PS C:\Temp> $resultimage = $fsi.CreateResultImage()
PS C:\Temp> $resultStream = $resultimage.ImageStream
Actually at this step you can stop and save resulted image to the local hard disc, this will be a pure iso image.
To perform writing disc recorder needs to be initialized:
Enumerate available recorders through MsftDiscMaster2
PS C:\Temp> $dm = New-Object -ComObject IMAPI2.MsftDiscMaster2
Create DiscRecorder object
PS C:\Temp> $recorder = New-Object -ComObject IMAPI2.MsftDiscRecorder2
Initialize recorder with unique id from discmaster2
PS C:\Temp> $recorder.InitializeDiscRecorder($dm.Item(0))
Read more: OpticalStorage
The Entity Framework provider is usually the one that most people use for its simplicity. The simplicity of this provider resides on the fact that you actually don’t need to do much for getting a data service up and running. You only need to define a entity framework model and expose it in the data service using the DataService<T> class.
The Reflection Provider on the other hand requires some more work, as you also need to implement the IUpdatable provider if you want to make your model read-write (otherwise, it’s read-only by default).
While the Entity framework provider is simple to use, the resources you want to expose in the data service gets tied to all the limitations you find in an Entity Framework model (for instance, you might entities or properties you don’t really want to persist in a database). This provider also implements IUpdatable and that implementation can not be customized, extended or replaced for providing some additional business logic functionality in the data service. And although you can use interceptors, I find that technique very limited as they represents aspects that are applied to a single entity. There is no way to inject cross-cutting aspects that affect all the entities (Entity based Authorization for instance). You can use the Data Service Pipeline for injecting that logic, but you don’t have entities at that point, only the messages on the wire (atom feeds or json messages). A technique I used in the past was to extend the EF entities with partial classes to add some additional business logic to the entities, and attach the data service to the Saving event in the Entity framework to run some logic before the entities were created, updated or deleted. However, I still don’t like this technique much because you end up with a model totally limited to what you can define in EF.
The advantage of using the reflection provider is that you can expose a much rich object model in your data service, even if you need to write some more code. In addition, as you are also writing an IUpdatable implementation, you can inject all the business logic or cross-cutting concerns that are common for all the entities in that class. However, the problem with the reflection provider is to make the service implementation efficient enough to resolve the queries in the data source and not the memory. It does not make sense at all to use a rich object model on top of entity framework for instance, if you still need to load all the object in memory to use linq to objects to perform the queries (unless the number of entities you manage is really small). So, the only possible solution to implement a service that manages a large number of entities and expose a rich object model at the same time is to use an ORM other than EF, like Linq to SQL or NHibernate.
NHibernate in that sense is a much mature framework, you are not tied to a single db implementation (sql server), and the number of features that this framework can offer is obviously higher, making NHibernate a good technology for implementing data services. In addition, NHibernate 3.0 already ships with a Linq provider out of the box that works really well (Entity Framework Code Only looks promising too but it is a CTP at this point).
In order to use NHibernate in a data service, you need to provide an IUpdatable implementation for making it read/write (support for POST PUT and DELETE). Otherwise it will behave as read only by default (only GETs supported).
Read more: Pablo M. Cibraro (aka Cibrax)
The Cardinal Rule
There is, essentially, a single cardinal rule.
Do the absolute minimum required to display your main screen.
Write this on a sticky note and hang it on your monitor. This may seem like common sense (I like to think so), but I’ve analyzed many an application that violates this rule in more ways than one. The less deterministic the code is that you’re executing, the more you’re asking for trouble. To subdivide this rule into some specific examples:
Minimize your download size.
Never wait on network I/O before displaying your main screen.
Minimize disk I/O, delay-load any data or business logic that you can.
Minimize your download size
Since your application has to be downloaded before it can start up, your download size directly affects startup time. Consider dividing your application into multiple XAP files. The first XAP should include only what is necessary to display your main screen and provide core functionality. Tim Heuer has put together a great video on silverlight.net titled “Loading Dynamic XAPs and Assemblies” that explains this concept in detail. Use this method to componentize and delay load parts of your application that pull in large dependencies and/or don’t absolutely need to be available when your application starts up.
Another great tip on Silverlight XAP compression comes from David Anson. A Silverlight XAP is just a renamed Zip file, but as of Silverlight 4 our XAP compression algorithm isn’t as efficient as it could be. By simply re-zipping your XAP files using an optimal compression algorithm you can shave about 20% off your download size (as high as 70% in extreme cases). Check out David’s post, “Smaller is better!” for the details and a useful script to help you automate the process.
Never wait on network I/O
No-doubt, this is one of the riskiest things you can do during startup. Network I/O latency is non-deterministic; when you make a call to a web service or access data from a network share your request could return in 2 milliseconds, 2 seconds, 2 minutes, or it may never return at all! If your application waits for this data to be retrieved before showing your UI, it may never show up. At best, you are gambling on the speed of your network connection to determine your startup time.
Minimize disk I/O
When you increase the amount of data that you load from disk (whether raw data files or loading unnecessary assemblies) you increase the amount of time that you’re waiting for physical media. It takes a substantial amount of time for your hard disk to seek to each new read location, and it takes time to read the data once you seek there.
Read more: Silverlight Performance Blog
How to use the provided files
1. Change SqlCeMembershipProvider::encryptionKey to a random hexadecimal value of your choice.
2. Copy the three files in the /App_Code folder to your web sites' ~/App_Code folder.
3. Copy the /App_Data/SqlCeAspnetdb.sdf database file to to your web sites' ~/App_Data folder.
Read more: Codeplex
Read more: Codeplex
Before diving into this, I did not want multiple XAML pages and chain them together. I wanted to use some of the built in behaviors and states and use no procedural code.
You may want to see a demo of this live before reading further. You can check it out here: http://mbcrump.web01.appliedi-labs.net/fadein/Default.html
To get started, we will create a new Silverlight 4 application using Expression Blend 4. After we create the application, we will add 2 buttons and it will look like the following. Pretty simple right? I went ahead and added names and a background color but this is completely optional.
Step 1
In firefox, at the address bar type "about:config" without the quotes. If done correctly you will see a little warning.
Step 2
Accept the warning. Tell it you will be careful, you promise.
Step 3
In the filter field, type "dom.ipc.plugins.enabled.npctrl.dll" and you should see only 1 entry.
Step 4
Change the value from "true" to "false". You can do this by just double-clicking the entry.
Step 5
Restart the browser and you should be good to go.
Of course you could ignore all that and manually attach the visual studio debugger to "plugin-container.exe" but that would be painful and the above way is much easier.
Read more: XAMLmammal
Copyright © 2011 Jasper22.NET | Design by Smashing Wordpress Themes - Blogger templates by Blog and Web