Archive for the ‘Yazılım’ Category

Bu örnekte _swedish_ci karekter setindeki bir veritabanını _turkish_ci setine çeviriyoruz. Kullanmadan önce yedek almayı unutmayın!


<?

$host = "localhost";
$user = "root";
$pass = "password";
$db =   "database";

_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  = ’: ‘ . mysql_error() . "\n<br>";
        $message .= ’Sorgu: ‘ . $sql . "\n<br>";
        die($message);
    }
    return $rs;
}

$tablolar = sorgula("SHOW TABLES");
$  = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>";
$html .= "<meta http-equiv=\"Content-type\" content=\"text/html; charset=\" /></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>";
?>

Bookmark and Share
Tags: , , ,
25
Feb

netbeans ile php debug

   Posted by: İsmail ÇAKIR Tags: , , , ,

idesinde kodlarınıza yapmak isterseniz;

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.

Bookmark and Share
Tags: , , , ,
24
Feb

linux capslock notify

   Posted by: Muhammed YÜRÜRDURMAZ Tags: , , , ,

Eer benim gibi 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/
import pygtk
pygtk.require(’2.0′)
import pynotify
import sys
import gtk
import os
import time

__author__="xmaster"
____ ="$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 "
        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)

Bookmark and Share
Tags: , , , ,
23
Feb

trac utf-8 ayarı

   Posted by: Muhammed YÜRÜRDURMAZ Tags: , , ,

kullanıyor ve source browser içinde olan türkçe karakterleri düzgün göremiyorsanız trac.ini içerisinde

 = 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.

Bookmark and Share
Tags: , , ,

Caused by: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Log4JCategoryLog does not implement Log

şeklinde bir alıyorsanız muhtemel sebebi proje dizininizde veya içerisinde birden fazla mevcuttur.

Kullanmadığınızı silin veya başka bir yere taşıyın.

Bookmark and Share
Tags: , ,

üzerinde yaparken Operation failed with error: org/apache//Category şeklinde bir alıyorsanız deploy sırasında apache.commons.logging kütüphanesini deploy sırasında ayarlarından kaldırın

Bookmark and Share
Tags: , , , , , ,


import sys
import 

tablename = ""
mhost = ""
muser = ""
mpasswd = ""
mdb= ""

def head():
    head = """
    <><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>< 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()

Bookmark and Share
Tags: , , , , , , ,
19
Feb

zip ve jar dosyalar içinde arama

   Posted by: İsmail ÇAKIR Tags: , , , ,


import zipfile
import os

aranan = "deneme.class"

def yuru(param, dizin, dosyalar):
    global aranan
    for dosya in dosyalar:
        if dosya.endswith(".") or dosya.endswith("."):
            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)

Bookmark and Share
Tags: , , , ,
19
Feb

java tarih formatlama (SimpleDateFormat)

   Posted by: Muhammed YÜRÜRDURMAZ Tags: , , , ,

import .text.;
import java.util.;

public class JavaSimpleDateFormatOrnek{
  public static void main(String args[]){
   date = new ();
   sdf = new ("dd/MM/yyyy");
  System.out.println("Bu gün " + sdf.format(date) );
  }
}
Bookmark and Share
Tags: , , , ,
18
Feb

xfce thunar svn entegrasyonu

   Posted by: Muhammed YÜRÜRDURMAZ Tags: , , , , , , , ,

Windows üzerinde kullanıyorsanız üzerinde de benzer bir ssiteme ihtiyacınız varsa önce sisteminize kurun.

sonra sisteminize aşağıdaki paketleri kurun


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/
cd 
./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--plugin plugini aktif durumda olacaktır.

Eğer menüsü gelmediyse libsvn-dev paketini sisteminize yükleyin ve

./configure
make install
killall thunar Thunar
Bookmark and Share
Tags: , , , , , , , ,

Switch to our mobile site