Picture
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)

loginwithprogressbar.zip
File Size: 10 kb
File Type: zip
Download File

 
 
Kızarmış ekmek üzerinde Bergama tulumu ve Gemlik zeytini ve balkonumda yetişen taze biber ve domates. Ağzım sulandı.
Peynir, ekmek, zeytin, domates, biber
 
 
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 ApplicationSettingsBase
  • An encryption utility class
  • A couple of lines to get, set and save the settings
You can see the example files below and you can dowload the working VS 2010 Project here. You'll be needing .NET Framework 4.0.

encryptingwindowsformssettings.zip
File Size: 96 kb
File Type: zip
Download File

A settings class derives from ApplicationSettingsBase

using 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 class

using 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 settings

using 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ı

 

TÜFE (AYLIK)

 

  2002 2003 2004 2005 2006 2007 2008 2009 2010
OCAK 5,3 2,6 0,7 0,55 0,75 1,00 0,80 0,29 1,85
ŞUBAT 1,8 2,3 0,55 0,02 0,22 0,43 1,29 -0,34 1,45
MART 1,2 3,10 0,89 0,26 0,27 0,92 0,96 1,10 0,58
NİSAN 2,1 2,09 0,59 0,71 1,34 1,21 1,68 0,02 0,60
MAYIS 5,1 0,6 1,6 0,92 1,88 0,50 1,49 0,64 -0,36
HAZİRAN 0,6 -0,2 - 0,13 0,10 0,34 -0,24 -0,36 0,11 -0,56
TEMMUZ 1,4 -0,37 0,22 -0,57 0,86 -0,73 0,58 0,25 -0,48
AĞUSTOS 2,2 0,2 0,58 0,85 -0,44 0,02 -0,24 -0,30 0,40
EYLÜL 3,5 1,9 0,94 1,02 1,29 1,03 0,45 0,39 1,23
EKİM 3,3 1,4 2,22 1,79 1,27 1,81 2,60 2,41 1,83
KASIM 2,9 1,6 1,54 1,40 1,29 1,95 0,83 1,27 0,03
ARALIK 1,6 0,9 0,45 0,42 0,23 0,22 -0,41 0,53  

 

TÜFE (YILLIK)

 

  2002 2003 2004 2005 2006 2007 2008 2009 2010
OCAK 73,2 26,4 16,2 9,23 7,93 9,93 8,17 9,50 8,19
ŞUBAT 73,1 27,0 14,28 8,69 8,1 10,16 9,10 7,73 10,13
MART 65,1 29,41 11,83 7,94 8,16 10,86 9,15 7,89 9,56
NİSAN 52,7 29,45 10,18 8,18 8,83 10,72 9,66 6,13 10,19
MAYIS 46,2 30,7 8,88 8,70 9,86 9,23 10,74 5,24 9,10
HAZİRAN 42,6 29,8 8,93 8,95 10,12 8,60 10,61 5,73 8,37
TEMMUZ 41,3 27,44 9,57 7,82 11,69 6,90 12,06 5,39 7,58
AĞUSTOS 40,2 24,9 10,04 7,91 10,26 7,39 11,77 5,33 8,33
EYLÜL 37,0 23,0 9,00 7,99 11,19 7,12 11,13 5,27 9,24
EKİM 33,4 20,8 9,86 7,52 9,98 7,70 11,99 5,08 8,62
KASIM 31,8 19,3 9,79 7,61 9,86 8,40 10,76 5,53 7,29
ARALIK 29,7 18,4 9,32 7,72 9,65 8,39 10,06 6,53  

 

TEFE (AYLIK)

 

  2002 2003 2004 2005 2006 2007 2008 2009 2010
OCAK 4,2 5,6 2,6 -0,41 1,96 -0,05 0,42 0,23 0,58
ŞUBAT 2,6 3,1 1,64 0,11 0,26 0,93 2,56 1,17 1,66
MART 1,9 3,20 2,10 1,26 0,25 0,97 3,17 0,29 1,94
NİSAN 1,8 1,76 2,65 1,21 1,94 0,80 4,50 0,65 2,35
MAYIS 0,4 -0,6 -0,03 0,20 2,77 0,39 2,12 -0,05 -1,15
HAZİRAN 1,2 -1,9 -1,05 -0,48 4,02 -0,11 0,32 0,94 -0,50
TEMMUZ 2,7 -0,54 -1,52 -0,74 0,86 0,06 1,25 -0,71 -0,16
AĞUSTOS 2,1 -0,2 0,79 1,04 -0,75 0,85 -2,34 0,42 1,15
EYLÜL 3,1 0,1 1,85 0,78 -0,23 1,02 -0,90 0,62 0,51
EKİM 3,1 0,6 3,23 0,68 0,45 -0,13 0,57 0,28 1,21
KASIM 1,6 1,7 0,75 -0,95 -0,29 0,89 -0,03 1,29 -0,31
ARALIK 2,6 0,6 0,13 -0,04 -0,12 0,15 -3,54 0,66  

 

TEFE (YILLK)

 

  2002 2003 2004 2005 2006 2007 2008 2009 2010
OCAK 92,0 32,6 10,8 10,70 5,11 9,37 6,44 7,90 6,30
ŞUBAT 91,8 33,4 9,14 10,58 5,26 10,13 8,15 6,43 6,82
MART 77,5 35,15 7,97 11,33 4,21 10,92 10,50 3,46 8,58
NİSAN 58,0 35,08 8,91 10,17 4,96 9,68 14,56 -0,35 1 0,42
MAYIS 49,3 33,7 9,56 5,59 7,66 7,14 16,53 -2,46 9,21
HAZİRAN 46,8 29,6 10,53 4,25 12,52 2,89 17,03 -1,86 7,64
TEMMUZ 45,9 25,57 9,44 4,26 14,34 2,08 18,41 -3,75 8,24
AĞUSTOS 43,9 22,7 10,52 4,32 12,32 3,72 14,67 -1,04 9,03
EYLÜL 40,9 19,1 12,50 4,38 10,55 5,02 12,29 0,47 8,91
EKİM 36,1 16,1 15,48 2,57 10,94 4,41 13,29 0,19 9,92
KASIM 32,8 16,2 14,40 1,60 11,67 5,65 12,25 1,51 8,17
ARALIK 30,8 13,9 13,84 2,66 11,58 5,94 8,11 5,93  

 

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

 
 
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.


yaml utf-8 encoding turkish characters
Türkçe karakter içeren YAML dosyasını heroku için utf-8 encoding işaretlemenizde fayda var
 
 
Picture
Bu sefer herkes kamerya bakıyor. Ben hariç :)
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, Arda Başoğlu, Boğaç Aslanyürek
Çok sıcak bir Cuma akşamında Yankoltuk çalışması. Boğaç Aslanyürek, Arda Başoğlu
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ı?
 
 
Picture
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.