Wednesday, June 22, 2005
Two nice quotes...
It is not the strongest of the species that survive, nor the most intelligent, but the ones most responsive to change - Charles Darwin
"Life beats down and crushes the soul and art reminds you that you have one."-- Stella Adler (1902-1992), American actress
Sunday, June 19, 2005
A simple trick to straighten your photos in Photoshop
Draw a line on what "should be" straight on your image... edge, horizon, table, wall... anything goes!)
Select >Image>Rotate>Arbitrary... and just like magic, Photoshop has filled in the "angle" field...
Hit "ok"... and your image is now straight!
Crop the image, and scrap it!
Google's image organizer software Picasa 2 has an awesome Straightening tool. It is much easier to do it compared to Photoshop. Give it a try! - http://www.google.com/downloads
Saturday, June 18, 2005
Microsoft Integration Technologies Overview
If you are confused about Microsoft's Integration Technologies, here is a brief overview of their use-cases:
Integrating applications directly
ASP.NET Web Services (ASMX)
Connecting Windows applications with Windows and non-Windows applications via SOAP
.NET Remoting
Connecting Windows applications with other Windows applications via distributed objects
Enterprise Services
Connecting Windows applications with other Windows applications that use distributed transactions, object lifetime management, etc.
Indigo
Connecting Windows applications with Windows and non-Windows applications using web services, distributed transactions, lifetime management, etc. (subsumes ASMX,.NET Remoting and Enterprise Services)
Integrating applications through queues
Microsoft Message Queuing
Connecting Windows applications with other Windows applications using queued messaging
SQL Service Broker
Connecting SQL Server 2005 applications with other SQL Server 2005 applications using queued messaging
Indigo
Connecting Windows applications with other Windows applications using queued messaging (via MSMQ and/or SSB)
Integrating with applications and data on IBM systems
Host Integration Server 2004
Connecting Windows applications with IBM zSeries and iSeries applications and data
Connecting MSMQ with IBM WebSphere MQ
Integrating applications through a broker
BizTalk Server 2006
Connecting Windows applications and non-Windows applications using diverse protocols
Translating between different message formats
Controlling business processes with graphically-defined orchestrations
Connecting with business partners using industry standards, such as RosettaNet and HL7
Providing business process services, such as Business Activity Monitoring and a Business Rules Engine
Integrating data
SQL Server Integration Services
Combining and transforming data from diverse sources into SQL Server 2005 data
SQL Server Replication
Synchronizing SQL Server data with copies of that data in other instances of SQL Server, Oracle, or DB2
Friday, June 17, 2005
Getting the Windows User Identity
1) Add the following line in Web.config:
2) Set IIS access to Windows Authentication and disable anonymous access from IIS Management MMC Snap-in.
3) UserName= HttpContext.Current.User.Identity.Name;
Note: UserName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;" might also return the user name but there is a catch. If you define a static username and password in web.config then this code will always return the name in the web.config. However httpcontext returns the actual user name.
C Omega
C Omega ile Visual Studio 2005’in en önemli hedeflerinden biri olan “daha az kod ile daha çok iş” amacına daha da yaklaşılmış oluyor. C Omega yeni bir dilden ziyade var olan dilleri birleştirmek için geliştiriliyor.
Basit bir örnek vermek gerekirse (Contact veritabanından ismi Onur olan kişilerin isimlerini çekelim)
rows = select distinct FirstName, LastName from MyDatabase.Contacts where FirstName==”Onur”; // “…” kullanmıyoruz. Strong-Typed!
foreach( row in rows ) {
Console.WriteLine("{0}", row.LastName);
}
İşte bu kadar basit. Aynı şeyi XML / XPath queryleri için de yapmak mümkün. Üstelik enterprise uygulamalar için transaction desteği de bulunuyor. Hem de aşağıdaki kadar kolay:
transact(database) {
delete from MyDatabase.Contacts where FirstName == "Onur";
}
commit {
Console.WriteLine("Done");
}
rollback {
Console.WriteLine(“Failed");
}
How to use the ASP.NET utility to encrypt credentials
1) Download and Run Aspnet_setreg.exe. The file is available for download from the Microsoft Download Center.
2) Encrypt the userName and password attributes to be used with the
aspnet_setreg.exe -k:SOFTWARE\MY_SECURE_APP\identity -u:"yourdomainname\username" -p:"password"
This command encrypts the userName and password attributes, creates registry keys at any location that you specify, and then stores the attributes in those registry keys. This command also generates output that specifies how to change your Web.config or Machine.config file so that ASP.NET will use these keys to read that information from the registry.
3) Modify the corresponding configuration file to point to these registry keys. If these values must be used in the
4) Grant Read permissions to the Aspnet_wp.exe process account. Grant Read permissions to the Aspnet_wp.exe process account. - yourservername\ASPNET or yourservername\NetWorkService when using Windows Server 2003 (IIS 6.0).
Happy Coding!
Encrypting QueryStrings
The whole trick to this working is that the QueryString is encrypted and decrypted with the same private key. This is the secret key - if anyone gets a hold of your key, they can decrypt the data themselves, so keep it a secret!
We're going to use a hard-to-crack 8 byte key, !#$a54?3, to keep parts of our QueryString secret.
public string encryptQueryString(string strQueryString)
{
ExtractAndSerialize.Encryption64 oES = new ExtractAndSerialize.Encryption64();
return oES.Encrypt(strQueryString,"!#$a54?3");
}
public string decryptQueryString(string strQueryString)
{
ExtractAndSerialize.Encryption64 oES = new ExtractAndSerialize.Encryption64();
return oES.Decrypt(strQueryString,"!#$a54?3");
}
If we wanted to encrypt our QueryString on our first page, we could do something like this:
string strValues = "search term";
string strURL = "http://yoursite.com?search=" + encryptQueryString(strValues);
Response.Redirect(strURL);
Happy coding!