Tuğrul BOSTAN
Burası benim ilk blog denemem olmakla beraber çoğunlukla bi halta yaramayacak bilgiler, resimler, videolar, müzikler vs paylaşacağım kendime özel alanımdır. Tabii ki arada önemli bilgiler de paylaştığım olur, ama komik seyler de olacaktır eminim.
26 Ağustos 2016 Cuma
2 Kasım 2013 Cumartesi
Bob Seger - Turn The Page (Studio Version)
http://www.youtube.com/v/FaxjUUdGdH8?version=3&autohide=1&autohide=1&feature=share&showinfo=1&autoplay=1&attribution_tag=NWy3_DKamN8NXRnoCqwD4Q
28 Ağustos 2012 Salı
22 Kasım 2011 Salı
C# ile MSSQL Query
using System.Data;
using System.Data.SqlClient;
private void button2_Click(object sender, EventArgs e)
{
int YevNo = 17;
SqlCommand cmd = new SqlCommand("update AnaIslem set Firma = 4 where
yevmiyeno = @yn", new SqlConnection(@"Data Source=DESTEK1\SQLSERVER;Initial
Catalog=Muhasebe;Integrated Security=SSPI;"));
cmd.Parameters.Add("@yn",YevNo);
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
}
31 Ekim 2011 Pazartesi
Olmayaydık İyiydi
Yapmayaydın iyiydi-*
Sana gözlerini açma demiştim.
Senin gözlerin de yeşildir şimdi.
Girersem çıkamam içinden.
Üzülürüm.
Üzülürsün,
üzülür yastıkların.
Duvarların üzülür demiştim.
Etiketler:
can bonomo,
şiir
3 Ekim 2011 Pazartesi
C# http den dosya indirme
public bool dosyaindir(string dosyaadi, string ProgAd)
{
bool bitti = false;
HttpWebRequest httpIstegi = null;
HttpWebResponse yanit = null;
Stream httpStream = null;
FileStream stream = null;
string uri = "http://www.mysite.com.tr/update/" + ProgAd + "/" + dosyaadi;
try
{
stream = new FileStream(dosyaadi + "_tmp", FileMode.Create);
//Alinacak dosyayi bul
httpIstegi = (HttpWebRequest)HttpWebRequest.Create(new Uri(uri));
// Yapilacak islem (Download)
httpIstegi.Method = WebRequestMethods.File.DownloadFile;
yanit = (HttpWebResponse)httpIstegi.GetResponse();
httpStream = yanit.GetResponseStream();
//Buffer uzunlugu
int bufferUzunlugu = 2048;
byte[] buffer = new byte[bufferUzunlugu];
int okumaSayisi = httpStream.Read(buffer, 0, bufferUzunlugu);
while (okumaSayisi > 0)
{
stream.Write(buffer, 0, okumaSayisi);
okumaSayisi = httpStream.Read(buffer, 0, bufferUzunlugu);
}
bitti = true;
return true;
}
catch (System.Net.WebException webex)
{
//MessageBox.Show("Güncelleme Sırasında Bir Hata Oluştu\nHata:" + webex.Message);
return false;
}
catch (Exception ex)
{
// throw ex;
return false;
}
finally
{
if (httpStream != null)
httpStream.Close();
if (stream != null)
stream.Close();
if (yanit != null)
yanit.Close();
if (bitti && File.Exists(dosyaadi + "_tmp"))
{
File.Copy(dosyaadi + "_tmp", dosyaadi, true);
File.Delete(dosyaadi + "_tmp");
}
}
}
{
bool bitti = false;
HttpWebRequest httpIstegi = null;
HttpWebResponse yanit = null;
Stream httpStream = null;
FileStream stream = null;
string uri = "http://www.mysite.com.tr/update/" + ProgAd + "/" + dosyaadi;
try
{
stream = new FileStream(dosyaadi + "_tmp", FileMode.Create);
//Alinacak dosyayi bul
httpIstegi = (HttpWebRequest)HttpWebRequest.Create(new Uri(uri));
// Yapilacak islem (Download)
httpIstegi.Method = WebRequestMethods.File.DownloadFile;
yanit = (HttpWebResponse)httpIstegi.GetResponse();
httpStream = yanit.GetResponseStream();
//Buffer uzunlugu
int bufferUzunlugu = 2048;
byte[] buffer = new byte[bufferUzunlugu];
int okumaSayisi = httpStream.Read(buffer, 0, bufferUzunlugu);
while (okumaSayisi > 0)
{
stream.Write(buffer, 0, okumaSayisi);
okumaSayisi = httpStream.Read(buffer, 0, bufferUzunlugu);
}
bitti = true;
return true;
}
catch (System.Net.WebException webex)
{
//MessageBox.Show("Güncelleme Sırasında Bir Hata Oluştu\nHata:" + webex.Message);
return false;
}
catch (Exception ex)
{
// throw ex;
return false;
}
finally
{
if (httpStream != null)
httpStream.Close();
if (stream != null)
stream.Close();
if (yanit != null)
yanit.Close();
if (bitti && File.Exists(dosyaadi + "_tmp"))
{
File.Copy(dosyaadi + "_tmp", dosyaadi, true);
File.Delete(dosyaadi + "_tmp");
}
}
}
C# da INI Dosyası Okuma - Yazma
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);kod blogunda kernel32 dll dosyasını projeye dahil etmiş oluyoruz.
bunları dahil etmeden ini dosyaları üzerinde işlem yapmamız daha zor oluyor.
daha sonra;
StringBuilder ProgYol = new StringBuilder();
// StringBuilder tipli bir değişken tanımlıyoruz , bu değişkene alacağımız verileri atacağız
GetPrivateProfileString("Tahsilat", "Yol", "", ProgYol, 150, @"C:\Windows\TugrulProgs.ini"); // okuma
// Burda da Param(1) : INI dosyasının section'ı// Param(2) : INI Dosyasının secilen section ı içindeki String Key'i
// Param(3) : geri dönecek default deger
// Param(4) : geri dönecek değişken burdaki değişkene atılacak.
// Param(5) : geri dönecek değerin uzunluğu
// Param(6) : INI Dosyasının Yolu seklinde parametreleri ayarlanıyor.
WritePrivateProfileString("Tahsilat", "Yol", "Yeni Yol", @"C:\Windows\TugrulProgs.ini"); // yazma
// Burda da Param(1) : INI dosyasının section'ı// Param(2) : INI Dosyasının secilen section ı içindeki String Key'i
// Param(3) :String Key in Yeni Değeri
// Param(4) : INI Dosyasının Yolu seklinde parametreleri ayarlanıyor.
Kaydol:
Kayıtlar (Atom)