If you are using a login form in your .Net Windows Forms application you might want to show a progress bar to the user during authentication takes a little time. Doing that makes your application responsive and makes the users think your application is doing some work and not stuck. You choose the Style property of the progress bar as "Marquee" since you do not know how long authentication will take (possibly not more than 1 or 2 seconds but sometimes servers may respond a little longer than that). By creating the progress bar control with the Marquee style, you can animate it in a way that shows activity but does not indicate what proportion of the task is complete. The highlighted part of the progress bar moves repeatedly along the length of the bar. You can start and stop the animation, and control its speed. In this example when the user enters the user name / password and hits the "Go" button, the lengthy operation is emulated by Thread.Sleep(3000) call. All the labels, textboxes and the submit button are disabled when the highlight of the progress bar moves for 3 seconds. After it finishes moving the controls are enabled again and progress bar is hidden by Hide() method of itself. This gives the cue to the users that they cannot change their input during the authentication process. Download the code (Visual Studio project)
Add Comment Peynir, ekmek, zeytin, domates, biber 07/13/2011
Kızarmış ekmek üzerinde Bergama tulumu ve Gemlik zeytini ve balkonumda yetişen taze biber ve domates. Ağzım sulandı. Sometimes you need to keep sensitive information in a Windows Forms application settings file. The settings file is plain text by default. In this case, you'd better encrypt this sensitive information, like a password, to protect from someone capturing the file (user.config, app.config depending on your choice) and seeing the content of the settings file and trying to abuse it. Encrypting settings is very easy. Al you need is:
A settings class derives from ApplicationSettingsBaseusing System; using System.Configuration; namespace EncryptingWindowsFormsSettings { internal class AppSettings : ApplicationSettingsBase { // Shared secreet is used for encryption // You can change this according to your preference private const string SharedSecret = "sSDffdf46FFs"; // this attribute specifies that an application settings group or // property contains distinct values for each user of an application [UserScopedSetting] public string Password { get { // this part is necessary // for the first time when there is still nothing to // read in the settings file. In other words, the // "Password" is null or empty. try { // Crypto is the utiliy class that holds the encryption logic // You can use your own encryption utility class for more control return Crypto.DecryptStringAES(((string)this["Password"]), SharedSecret); } catch (FormatException) { // simply return nothing in case of exception return ((string)this["Password"]); } } set { // When you save the settings, the password will be encrypted this["Password"] = Crypto.EncryptStringAES(value, SharedSecret); } } } } An encryption utility classusing System; using System.IO; using System.Security.Cryptography; using System.Text; namespace EncryptingWindowsFormsSettings { // Encrypt/Decrypt string in .NET // http://stackoverflow.com/questions/202011/encrypt-decrypt-string-in-net public static class Crypto { private static readonly byte[] Salt = Encoding.ASCII.GetBytes("dE4ffrTy7/!"); /// <summary> /// Encrypt the given string using AES. The string can be decrypted using /// DecryptStringAES(). The sharedSecret parameters must match. /// </summary> /// <param name="plainText">The text to encrypt.</param> /// <param name="sharedSecret">A password used to generate a key for encryption.</param> public static string EncryptStringAES(string plainText, string sharedSecret) { if (string.IsNullOrEmpty(plainText)) throw new ArgumentNullException("plainText"); if (string.IsNullOrEmpty(sharedSecret)) throw new ArgumentNullException("sharedSecret"); string outStr; // Encrypted string to return RijndaelManaged aesAlg = null; // RijndaelManaged object used to encrypt the data. try { // generate the key from the shared secret and the salt Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(sharedSecret, Salt); // Create a RijndaelManaged object // with the specified key and IV. aesAlg = new RijndaelManaged(); aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8); aesAlg.IV = key.GetBytes(aesAlg.BlockSize / 8); // Create a decrytor to perform the stream transform. ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV); // Create the streams used for encryption. using (MemoryStream msEncrypt = new MemoryStream()) { using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)) { using (StreamWriter swEncrypt = new StreamWriter(csEncrypt)) { //Write all data to the stream. swEncrypt.Write(plainText); } } outStr = Convert.ToBase64String(msEncrypt.ToArray()); } } finally { // Clear the RijndaelManaged object. if (aesAlg != null) aesAlg.Clear(); } // Return the encrypted bytes from the memory stream. return outStr; } /// <summary> /// Decrypt the given string. Assumes the string was encrypted using /// EncryptStringAES(), using an identical sharedSecret. /// </summary> /// <param name="cipherText">The text to decrypt.</param> /// <param name="sharedSecret">A password used to generate a key for decryption.</param> public static string DecryptStringAES(string cipherText, string sharedSecret) { if (string.IsNullOrEmpty(cipherText)) throw new ArgumentNullException("cipherText"); if (string.IsNullOrEmpty(sharedSecret)) throw new ArgumentNullException("sharedSecret"); // Declare the RijndaelManaged object // used to decrypt the data. RijndaelManaged aesAlg = null; // Declare the string used to hold // the decrypted text. string plaintext; try { // generate the key from the shared secret and the salt Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(sharedSecret, Salt); // Create a RijndaelManaged object // with the specified key and IV. aesAlg = new RijndaelManaged(); aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8); aesAlg.IV = key.GetBytes(aesAlg.BlockSize / 8); // Create a decrytor to perform the stream transform. ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV); // Create the streams used for decryption. byte[] bytes = Convert.FromBase64String(cipherText); using (MemoryStream msDecrypt = new MemoryStream(bytes)) { using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)) { using (StreamReader srDecrypt = new StreamReader(csDecrypt)) // Read the decrypted bytes from the decrypting stream // and place them in a string. plaintext = srDecrypt.ReadToEnd(); } } } finally { // Clear the RijndaelManaged object. if (aesAlg != null) aesAlg.Clear(); } return plaintext; } } } A couple of lines to get, set and save the settingsusing System; using System.Windows.Forms; namespace EncryptingWindowsFormsSettings { public partial class Form1 : Form { private AppSettings _appSettings; public Form1() { InitializeComponent(); Load += Form1_Load; } private void Form1_Load(object sender, EventArgs e) { // get an instance of the AppSettings object _appSettings = new AppSettings(); // bind the 'Text' property of textBoxPassword with // the 'Password' property of _appSettings textBoxPassword.DataBindings.Add(new Binding("Text", _appSettings, "Password")); } private void ButtonCloseClick(object sender, EventArgs e) { _appSettings.Save(); } } } Aylık ve Yıllık Enflasyon Değişim Tabloları; 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 11/03/2010
Aylık ve Yıllık Enflasyon Değişim Tabloları
TÜFE (AYLIK)
TÜFE (YILLIK)
TEFE (AYLIK)
TEFE (YILLK)
Kaynak: Türkiye İstatistik Kurumu I encountered the below error when I tried to do "heroku db:pull" c:/ruby/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/utils.rb:138:in] `union': can't convert Array into String then I commented the related line in utils.rb # ESCAPE_HTML_PATTERN = Regexp.union(ESCAPE_HTML.keys) and everything worked fine YAML error occurred parsing 10/06/2010
Eğer heroku da uygulama gerçekleştiriyorsanız ve $ heroku rake db:fixtures:load komutunu çalıştırdığınızda aşağıdaki hatayı alıyorsanız. "...rake aborted! a YAML error occurred parsing Please note tha t YAML must be consistently indented using spaces. Tabs are not allowed..." sorun hata mesajındaki "Tab" larla ile ilgili olmayabilir ve bir ihtimal fixture dosyalarınızda geçen Türkçe karakterlere ve dosyanın encoding' ine dayanabilir. Eğer fixture dosyalarınızda Türkçe karakterler bulunuyorsa dosya encoding ayarını utf-8 olarak değiştirmeyi deneyebilirsiniz. Yankoltuk, 2010-07-31 08/02/2010
Uzun bir aradan sonra tüm ekip biraraya geldik. İstanbul'un küresel iklim değişikliğine ayak uyduran kavurucu bir yaz Cumartesi'de Nero Cafe'nin klimayla soğutulmuş üst salonunda rahat bir çalışma ortamına yerleştik. Herkes laptopları açtı ve Yankoltuk'u test ettik. Bir düzine bug ve iyileştirme tekliflerini ticketlar haline getirdikten sonra evlere dağıldık. Son derece verimli bir çalışma olduğunu söylemeliyim. Kod yazmaktan arınıp böyle bir çalışma yapmak ta ayrıca hepimiz için keyifli oldu. Şimdi tekrar Boğaç'la bir araya gelip kod yazmamız gerekecek. Bu sefer işlerimizin büyük bir bölümünü bitirmiş olmanın rahatlığıyla ama... Yankoltuk, 2010-07-23 08/02/2010
Yankoltuk için tekrar Boğaç'la birlikte bir Cuma gecesi çalışması yaptık. Sabah kaltığımızda da geceden kalma bazı hataları ayıkladık ve nihayet Yankoltuk'un ilk major versiyonunu bitirdik. Başından beri yapmak istediğimiz ama zaman yetersizliğinden tamamlayamadığımız kordinat bazında aramayı bitirdik. Artık Yankoltuk kullanıcıları arama sonuçlarını aradıkları A-B arasındaki yolculukları kordinat bazında bulacaklar. Bu özellik Google Map API sayesinden sağlanıyor. Biz bu API ile Yankoltuk'u bütünleştirdik. Biraz sancılı bir süreç olduğunu söylemem lazım. Bize yeni olan bazı teknolojiler kullandık; bu yüzden öğrenmek için geçirdiğimiz zaman da oldukça uzundu. Bundan sonra artık arkamıza yaslanıp bir dizi test yapacağız, hatalar varsa bunların üstüne gideceiğiz. Bunlar bitince de iyileştirme ile ilgili çalışmalara başlayacağız. Başlığı hergün ziyaret ettiğim güvenilir bir haber sitesinden alıntıladım. Sokataki adamın çok zeki olmadığını ima eden bir cümle sadece. Haberin güvenilirliği çok önemli değil aslında, bu lafa biz zaten alışığız; kanıksamışız: sokaktaki adam "zor idrak eder". Yani sokaktaki adamın pek birşey bildiği yok. Peki sokaktaki adamlar herşeyi anlamıyorsa bunun sorumlusu kim? Size alternatif birkaç cevap: Hepimiz, devlet, hükümet...Bu lafı kullanan bir milletvekili; bizden biri. Bizim abimiz, ablamız, kardeşimiz, amcamız, komşumuz...neyse...Kötü olan o milletvekilinin ikiyüzlülüğü esasen. Gerektiğinde o "sokaktaki adam"ın oyuyla övünen, gerektiğinde o adamı aşağılayan ve üstüne o insanları temsil ettiğini söyleyen biri. Bu arada o adamların eğitimiyle de ilgili yükümlülüğü olan biri. Sormak istediğm şu: "demokratik, parlementer sistem" sizce de aslında "ideal birşey" olarak bir illüzyon değil mi? Sahiden biz insanların böyle bir düzene ihtiyacı var mı? Ben bu aralar daha çok düşünüyorum. Siz de bir düşünün bakalım... :) 400+ adam milyonların hayatıyla oynamalı mı? Yankoltuk, 2010-06-11 06/13/2010
Bu sefer değişiklik yaparak bizim evde çalıştık. Boğaç iş çıkışı bize geldi ve Pideci den sıparş ettiğimiz güzel pideleri yedikten sonra işe koyulduk. Geçen hafta konuştuklarımızdan sonra Boğaç ve ben birçok değişiklik yapmıştık. Bu değişiklerin üsütünden geçerek kodlarımızı birleştirdik. Bu çalışmada geçen toplantıda belirlediğimiz birçok hatayı düzelttik ve küçük geliştirmeler de yaptık. Hala ufak tefek sorunlarımız ve eklememiz gereken çok büyük bir özellik var. Bütün bunları da sanırım önümüzdeki ay içinde tamamlayacağız ve public betamızı sonunda yayınlayacağız diye düşünüyorum. Böylece bu blogu okuyup ta hiçbirşey anlamayanlar sonunda aklındaki sorulara cevap bulabilecekler. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||






RSS Feed