Bu örnekte utf8_swedish_ci karekter setindeki bir veritabanını utf8_turkish_ci setine çeviriyoruz. Kullanmadan önce yedek almayı unutmayın!
<?php
$host = "localhost";
$user = "root";
$pass = "password";
$db = "database";
mysql_connect($host, $user, $pass);
mysql_select_db($db);
$eski = ’utf8_swedish_ci‘;
$yeni = ’utf8_turkish_ci‘;
$cset = ’utf8‘;
function sorgula($sql) {
$rs = mysql_query($sql);
if (!$rs) {
$message = ’Hata: ‘ . mysql_error() . "\n<br>";
$message .= ’Sorgu: ‘ . $sql . "\n<br>";
die($message);
}
return $rs;
}
$tablolar = sorgula("SHOW TABLES");
$html = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>";
$html .= "<meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" /></head>";
print $html. ’<body><pre>‘;
while ($sutunlar = mysql_fetch_row($tablolar)) {
$table = mysql_real_escape_string($sutunlar[0]);
sorgula("ALTER TABLE `$table` DEFAULT CHARACTER SET $cset");
echo "$table $cset e dönüştü! \r\n";
$rs = sorgula(" SHOW FULL FIELDS FROM `$table` ");
while ($sutun=mysql_fetch_assoc($rs)) {
if ($sutun['Collation']!=$eski)
continue;
$field = mysql_real_escape_string($sutun['Field']);
sorgula ("ALTER TABLE `$table` CHANGE `$field` `$field` $sutun[Type] CHARACTER SET $cset COLLATE $yeni");
echo "$table tablosu $field alani $yeni karekter setine dönüştürüldü\r\n";
}
}
print "</pre></body></html>";
?>
Tags:
conversion,
mysql,
php,
utf8
Netbeans idesinde php kodlarınıza debug yapmak isterseniz;
xdebug paketini kurun
sudo apt-get install php5-xdebug
daha sonra
/etc/php5/apache2/php.ini dosyasını editleyip aşağıdaki satıları ekleyin;
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
apacheyi restart edip hatalarınızı bulmaya başlıyabilirsiniz.
Tags:
debug,
netbeans,
php,
php debug,
xdebug
Eer benim gibi capslock durumunu dizüstünüzde ışık olmadığından dolayı göremiyorsanız aşağıdaki script işinizi görebilir.
bu scripti capsnotify.py ismiyle bir yere kaydedin.
daha sonra kullandığınız masaüstü ortamının otomatik başlangıç bölümüne ayarlayın.
#!/usr/bin/python
import pygtk
pygtk.require(’2.0′)
import pynotify
import sys
import gtk
import os
import time
__author__="xmaster"
__date__ ="$Feb 24, 2010 11:14:16 AM$"
def get_status():
status = None
p = os.popen("/usr/bin/xset q")
while 1:
line = p.readline()
if not line: break
if line.find("Caps") > -1:
status = line[21:25].strip()
break
p.close()
return status
def show_status(status):
if status == "on":
uri = "file:///usr/share/icons/gnome/scalable/devices/keyboard.svg"
n = pynotify.Notification("Caps Lock On", "", uri)
else:
uri = "file:///usr/share/icons/gnome/scalable/devices/keyboard.svg"
n = pynotify.Notification("Caps Lock Off", "", uri)
n.set_timeout(500)
if not n.show():
print "Failed to send notification"
sys.exit(1)
if __name__ == ‘__main__’:
if not pynotify.init("Caps toggle"):
print "Unable to initialize Python Notify"
sys.exit(1)
old_status = None
while 1:
status = get_status()
if old_status is None:
old_status = status
if status != old_status:
show_status(status)
old_status = status
time.sleep(0.5)
Tags:
capslock,
Linux,
notify,
Python,
xfce
trac kullanıyor ve source browser içinde utf-8 olan türkçe karakterleri düzgün göremiyorsanız trac.ini içerisinde
default_charset = iso-8859-15
satırını bulun ve
default_charset = utf-8
yapın. daha sonra
trac-admin <trac_dizini> resync
komutu ile güncellemeyi yaptıktan sonra artık türkçe karakterler düzgün görünecektir.
Tags:
default_charset,
encoding,
trac,
utf-8
Caused by: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Log4JCategoryLog does not implement Log
şeklinde bir hata alıyorsanız muhtemel sebebi proje dizininizde veya classpath içerisinde birden fazla commons-logging jar mevcuttur.
Kullanmadığınızı silin veya başka bir yere taşıyın.
Tags:
commons-logging,
Java,
log4j
Oracle Application Server üzerinde deploy yaparken Operation failed with error: org/apache/log4j/Category şeklinde bir hata alıyorsanız deploy sırasında apache.commons.logging kütüphanesini deploy sırasında classpath ayarlarından kaldırın
Tags:
classpath,
deploy,
Hata,
J2EE,
Java,
log4j,
Oracle Application Server
import sys
import MySQLdb
tablename = ""
mhost = ""
muser = ""
mpasswd = ""
mdb= ""
def head():
head = """
<html><head>
<style>
.minput {
border: 1px solid #fdfcf7;
font-family: "Times New Roman", Times, serif;
font-style: bold;
font-size: 14px;
color: #454743;
}
.mlabel {
font-family: "Times New Roman", Times, serif;
font-style: bold;
font-size: 13px;
color: #e7363e;
}
</style></head><body><form action="" method="post">
"""
return head
def sub():
sub = """
</form></body></html>
"""
return sub
def insert():
pass
def update():
pass
def input(name, label = None):
if not label:
label = name
return ‘<label style="mlabel">%s:</label><input style="minput" name="%s" type=text />’ % (label, name)
def clean(mrow):
pass
def deneme():
try:
conn = MySQLdb.connect (host = mhost, user = muser, passwd = mpasswd, db = mdb)
cursor = conn.cursor ()
msql = ‘select column_name from information_schema.columns where table_name="%s"’ % tablename
cursor.execute (msql)
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit (1)
row = cursor.fetchall ()
print head()
for r in range(len(row)):
print input("".join(row[r]))
print sub()
cursor.close ()
conn.close ()
if __name__ == "__main__" :
deneme()
Tags:
form,
generator,
html,
html generator,
mysql,
mysqldb,
Python,
python generator
import zipfile
import os
aranan = "deneme.class"
def yuru(param, dizin, dosyalar):
global aranan
for dosya in dosyalar:
if dosya.endswith(".jar") or dosya.endswith(".zip"):
zp = zipfile.ZipFile(os.path.join(dizin, dosya), "r")
for name in zp.namelist():
if name.endswith(aranan):
print os.path.join(dizin, dosya), ":", name
if dosya.endswith(aranan):
print os.path.join(dizin, dosya)
os.path.walk(".", yuru, None)
Tags:
jar,
jar search,
Python,
search,
zip
import java.text.SimpleDateFormat;
import java.util.Date;
public class JavaSimpleDateFormatOrnek{
public static void main(String args[]){
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
System.out.println("Bu gün " + sdf.format(date) );
}
}
Tags:
Örnek,
date,
Java,
SimpleDateFormat,
tarih
Windows üzerinde tortoisesvn kullanıyorsanız xfce üzerinde de benzer bir ssiteme ihtiyacınız varsa önce sisteminize git kurun.
sonra sisteminize aşağıdaki paketleri kurun
Thunar
Thunar-VFS 0.4.0 veya daha üstü bir versiyon
Thunarx 0.4.0 veya daha üstü bir versiyon
libsvn 1.5 veya daha üstü bir versiyon
libapr 0.9.7 veya daha üstü bir versiyon
gtk 2.6.0 veya daha üstü bir versiyon
glib 2.6.0 veya daha üstü bir versiyon
gobject 2.6.0 veya daha üstü bir versiyon
git (uygulama)
daha sonra
git clone git://git.xfce.org/thunar-plugins/thunar-vcs-plugin
cd thunar-vcs-plugin
./autogen.sh
make install
Kurulum tamam. Aktif hale getirmek için
killall thunar Thunar
komutu ile açık thunar uygulamalarını öldürün. thunar ı yeniden açtığınızda thunar-vcs-plugin plugini aktif durumda olacaktır.
Eğer svn menüsü gelmediyse libsvn-dev paketini sisteminize yükleyin ve
./configure
make install
killall thunar Thunar
Tags:
debian,
git,
Linux,
svn,
thunar,
thunar-vcs-plugin,
tortoisesvn,
vcs,
xfce