Thursday, September 29, 2005

Outlook Anti-Phishing

Microsoft Office Service Pack 2 ile birlikte Outlook’a bir güvenlik özelliği olan “anti-phishing” de eklenmiş oldu.

Phishing, bilinen web sitelerinden, çalışılan bankalardan veya internet servis sağlayıcılarından gönderilmiş gibi gelen e-posta'lar aracılığı ile kişisel bilgilerin elde edilmesini sağlayan dolandırıcılık yöntemi olarak tanımlanıyor.

Phishing mesajları SP2 ile birlikte otomatik olarak Junk E-Mail klasörüne düşüyor, mesaj plain text olarak gösteriliyor ve en önemlisi içerinde bulunan linkler gerçek yönlendirilen adresle birlikte gösteriliyor. Bu sayede istenmeyen web sitelerine yönlendirilmenin önüne geçilmesi amaçlanıyor.

Daha çok bilgi almak için http://office.microsoft.com/en-us/assistance/HA011841931033.aspx adresini ziyaret edebilirsiniz.

Friday, September 23, 2005

Spam Mesaj Gönderimi ve Filtreler - Spam Confidence Level

Spam mesajlar nasıl mı filtreleniyor? Her mesajın “Spam Confidence Level” adında bir değeri bulunuyor. Bu 1-9 arası değişen bir rakam ve mesajın “ne kadar spam” olduğunu bildiriyor. 1=mesaj spam değil, 9= mesaj maximum spamlikte. Bizdeki Exchange Server, 5’in üzerinde spam değer olan mesajları Outlook’a ulaştırmıyor. Spam değeri 4-5 olan mesajlar ise Outlook’da Junk Mail folderına düşüyor.

Bu SPL sahası Outlook’un derinliklerinde gizli. Bu sahayı Outlook’ta ortaya çıkarmak için
http://blogs.msdn.com/exchange/archive/2004/05/26/142607.aspx adresinde bahsedilen adımları gerçekleştirmeniz gerekiyor. http://www.msexchange.org/tutorials/Microsoft-Exchange-Intelligent-Message-Filter.html adresinde de konu ile ilgili teknik bilgi yer alıyor.

Neler etkili olduğuna gelince... Öncelikle mesaj içerisinde yer alan resimler bu değeri artırıyor. Mesajın kimden gittiği de bir etken. Bazı kelimeler (promosyon, kampanya vs.) ve cümle kalıpları da bu rakamı etkilemekte. Bu nedenle mesajınızda bu özel kelimelerin, resimlerin yer almaması gerekiyor.

Bu konuda tam kesin bir sonuç yakalamak mümkün değil çünkü: The technology behind IMF is SmartScreen-based, which means the add-on is able to distinguish between legitimate e-mail messages and unsolicited commercial e-mail or other spam.
SmartScreen tracks over 500,000 e-mail characteristics based on data from hundreds of thousands of MSN Hotmail subscribers who volunteered to classify millions of e-mail messages as legitimate or as spam.

En iyi yöntem şu: Mesajı oluşturun, önce kendinize gönderin. Junk’a düşüyorsa SCL değerini düşürmek için resimleri ve bazı buzz word’leri çıkararak yeniden kendinize gönderin... ta ki mesaj junk’a düşmeyene kadar...

Kolay Gelsin!

Monday, September 19, 2005

Video camera capture in managed code

If you’re running Windows XP, you can use a little-known XP feature called Windows Image Acquisition (WIA) that has a COM library you can program against. This makes capturing either a single frame of a picture or video stream from a USB web cam as easy as 1-2 lines of code.

MSDN Windows Image Acquisition docs –
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wiaaut/wia/wiax/overviews/startpagewiaaut.asp

Code Samples:
http://www.codeproject.com/dotnet/wiascriptingdotnet.asp
http://www.codeproject.com/csharp/webcamservice.asp (DirectShow wrapper)
http://www.codeproject.com/csharp/Motion_Detection.asp

There is also an open source project to program a webcam across any operating system that may interest you -
http://libusb.sourceforge.net/

Happy Coding!

Friday, September 16, 2005

Visual Studio.NET ile Outlook 2003 Uygulamaları - Attachment lar ile oynamak

Visual Studio 2003 ile managed code kullanarak Outlook'u yönetmek ve üzerinde uygulama geliştirmek mümkün. Çoğu zaman kodu sıfırdan yazmak yerine daha önce geliştirilmiş olan örnekleri kullanıp, bu örnekleri değiştirmek işleri hızlandırabiliyor. Böyle bir örneği inceleyelim:

Visual Studio.net 2003 öncelikle bir Com Add-in oluşturuyoruz. Visual Studio’da Com Add-in uygulamaları oluşturmak için: http://support.microsoft.com/?kbid=302901 adresindeki makaleden yararlanabilirsiniz.

- Yukarıdaki makaleyi inceledikten sonra Extensibility.IDTExtensibility2 interface’i hakkında bilgi edinmiş olacaksınız. Bir buton oluşturmak için bu interface’in OnStartupComplete prosedüründe aşağıdakine benzer bir kodla Outlook Standard toolbar’ında istediğiniz butonu ekleyebilirsiniz:

CommandBars oCommandBars;
CommandBar oStandardBar;

try
{
oCommandBars = (CommandBars) myApplication.GetType().InvokeMember("CommandBars", BindingFlags.GetProperty, null, myApplication, null);

}
catch (Exception)
{
object oActiveExplorer;
oActiveExplorer = myApplication.GetType().InvokeMember("ActiveExplorer", BindingFlags.GetProperty, null, myApplication, null);
oCommandBars = (CommandBars) oActiveExplorer.GetType().InvokeMember("CommandBars", BindingFlags.GetProperty, null, oActiveExplorer, null);

}

try
{
oStandardBar = oCommandBars["Standard"];
}
catch (Exception)
{
oStandardBar = oCommandBars["Database"];
}

try
{
MyButton = (CommandBarButton) oStandardBar.Controls["My Button"];
}
catch (Exception)
{
object omissing = System.Reflection.Missing.Value;

MyButton = (CommandBarButton) oStandardBar.Controls.Add(1, omissing, omissing, omissing, omissing);
MyButton.Caption = "My Button";
MyButton.Style = MsoButtonStyle.msoButtonCaption;
}

MyButton.Tag = "My Button";
MyButton.OnAction = "!";

MyButton.Visible = true;
MyButton.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(this.MyButton_Click);

- Burada MyButton_Click gibi bir methodda System.IO class’ını ve MailItem.SaveAs methodunu kullanarak mesajları kaydedebilirsiniz. Örneğin o an seçili mesajı kaydetmek için:

using OL= Microsoft.Office.Interop.Outlook ;
...
OL.MailItem mailItem = (OL.MailItem) myApplication.ActiveExplorer().Selection[1];
MailItem.SaveAs ...


Bir hatırlatma… Visual Studio.net 2003’de Com Add-in uygulaması oluştururken VS eski Office DLL’lerini kullanmakta. Uygulamaya başlamadan önce Referanslardan yeni COM class’ını eklemeyi unutmayın.

Son olarak Visual Studio Tools for Office 2005 ile birlikte çok daha kolay bir şekilde Office uygulamaları geliştirebeceğinizi hatırlatırım. Tabi bunun için biraz daha beklememiz gerekecek. :)

Wednesday, June 22, 2005

Two nice quotes...

Two nice quotes: One for developers, one for photographers...

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

Select the "Mesure Tool" (in the group as the "eyedropper")

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

Use the Aspnet_setreg.exe utility to encrypt and to store these attribute values in the registry under a secure key.

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 section. (You can also do this for the other sections that are mentioned in this article). To do this, type the following command at the command line:

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 section, the resulting section resembles the following:

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!