- del.icio.us buttons.
İnternette surf yaparken beğendiğim sayfaları del.icio.us profilime eklemek için kullanıyorum. http://del.icio.us/ilkinulas - AdBlockPlus
Olmazsa olmaz bir plugin. - Tab Mix Plus
Firefox'un tab özelliğine ilave özellikler ekliyor. Yanlışlıkla kapattığınız bir tab'ı yeniden açmak gibi. - Web Developer Plugin
Özellikleri saymakla bitmez. Web'de geliştirme yapıyorsanız çok işinize yaracak bir plugin. En beğendiğim özellikleri:
cookie arayüzü ve sayfa içindeki bütün HTML elemanlarını açıp kapayabilme özelliği. - Firebug
Özellikle Ajax ile geliştirme yapanlar için çok kullanışlı bir plugin. Firefox'un asenkron yaptığı HTTP request'leri firebug console'dan takip edebilirsiniz. - UnPlug
Bu plugin'i Youtube videolarını bilgisayarınıza indirmek için kullanabilirsiniz. - YSlow
Firebug plugin'ine ek olarak kullanılan bu plugin'i Yahoo geliştirmiş. We sayfasını yahoo'nun belirlediği kriterlere göre sınıyor. Bir nevi performans testi uyguluyor. - Greasemonkey
Bu plugin kısaca, sayfa yüklendikten sonra sayfada post-processing yaparak sayfanın yeniden yapılandırılmasını sağlar. Sadece greasemonkey plugin'ini kurmak yetmez. Greasemonkey sitesinden "user script" denen betikleri kurmanız gerekmektedir.
Friday, January 18, 2008
Kullandığım firefox eklentileri
Sunday, January 13, 2008
A Tutorial on XML Namespaces
XML namespaces are used to avoid element name conflicts. A namespace is a set of names in which all names are unique. An XML namespace can be tought as a Java package name. To distinguish two classes of the same name we put the classes in two different packages. For example; you may choose to put a class that is used to connect to a relational database system in com.foo.sql package (com.foo.sql.Connection) and a class that manages TCP/IP socket connections in com.foo.net package (com.foo.net.Connection).
An XML namespace is used in the same way. Namespaces make it easier to come up with unique names. Without namespaces all XML element names must be unique all over the world. I'll try to explain this with an example.
Xml representation of a java class.
<class>
<name>com.foo.bar.Customer</name>
<method>getName</method>
<method>setName</method>
<superclass>com.foo.bar.Person</superclass>
</class>
Xml representation of a college class.
<class>
<code>MATH101E</code>
<name>Mathematics 1</name>
<language>English</language>
<credits>4</credits>
<class>
If these two "class" XML elements are used in the same XML document there will a name conflict. These name conflicts can be resolved by using namespaces.
<j:class xmlns:j="http://java.sun.com/class">
<j:name>com.foo.bar.Customer</j:name>
<j:method>getName</j:method>
<j:method>setName</j:method>
<j:superclass>com.foo.bar.Person</j:superclass>
</j:class>
<itu:class xmlns:itu="http://java.sun.com/class">
<itu:code>MATH101E</itu:code>
<itu:name>Mathematics 1</itu:name>
<itu:language>English</itu:language>
<itu:credits>4</itu:credits>
</itu:class>
ITU : Istanbul Technical University
XML namespaces are defined with XML Namespace (xmlns) Attribute. The XML namespace attribute is placed in the start tag of an element and has the following syntax:
xmlns:namespace-prefix="namespaceURI"
When a namespace is defined in the start tag of an element, all child elements with the same prefix are associated with the same namespace.
If this tutorial is not enough for you can read these articles:
Thursday, December 6, 2007
Kill A Process By Name
My favorite shell command is kill. Don't worry I'm not a serial killer.
If you know the process id and if you have enough permissions you can kill any process you want . It is easier to kill a process by name. Here is the command.
If you know the process id and if you have enough permissions you can kill any process you want . It is easier to kill a process by name. Here is the command.
kill -9 `ps -ef | grep $1 | grep -v grep | awk '{print $2}'`
kill -9 processId sends SIGKILL signal to specified process. You can use a list of process ids as kill command argument. kill -9 pid1 pid2 pid3
ps -ef|grep $1Lists process that matches $1
ps -ef | grep $1 | grep -v grepList process that matches $1 except the process that runs grep command
ps -ef | grep $1 | grep -v grep | awk '{print $2} Lists only process ids of processes that matches $1 except the process that runs grep command.awk '{print $2}' lists the second column of the
ps -ef | grep $1 | grep -v grepcommand output.
Save kill -9 `ps -ef | grep $1 | grep -v grep | awk '{print $2}'` in a file called myKill.sh
Give execute permission to the myKill.sh file (chmod +x myKill.sh)
If you want to kill all java processes type
./myKill.sh javaOr you can use pgrep and pkill commands if they are available on your system.
Tuesday, December 4, 2007
Watch multiple log files with "tail"
Log files are the first place i look while debugging an application. To see the logs in real-time I am using the utility command "tail" with the "-f" option.
tail -f filename
When there are multiple log files to watch out, I used to open different xterm console to tail each file.But today I learned that "tail" can watch multiple files for changes. Example command and its output on my PC (Ubuntu 7.10).
tail -f logs/catalina.out InaWs.log InaWsUserActions.log
==> logs/catalina.out <==
[2007-12-04 09:39:18,746] INFO(ContextManager.java.initialize:56) - Context [vpn] initialized.
[2007-12-04 09:39:18,760] INFO(ContextManager.java.initialize:56) - Context [prepaid] initialized.
[2007-12-04 09:39:18,761] INFO(InaWsImpl.java.initialize:116) - Using auhentication factory : com.oksijen.inox.common.ws.auth.PlaintextAuthenticationFactory
Dec 4, 2007 9:39:19 AM com.sun.xml.ws.transport.http.servlet.WSServletDelegate
INFO: WSSERVLET14: JAX-WS servlet initializing
==> InaWs.log <==
[2007-12-04 09:39:18,743] INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] (InaWsContext.java.addAction:41) - Adding action. actionName[echoVpn]...
[2007-12-04 09:39:18,744] INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] (C3p0Impl.java.initialize:53) - Initializing C3P0 connection pool....
[2007-12-04 09:39:18,757] INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] (InaWsContext.java.addAction:41) - Adding action. actionName[echoPrepaid]...
[2007-12-04 09:39:18,758] INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] (C3p0Impl.java.initialize:53) - Initializing C3P0 connection pool....
==> InaWsUserActions.log <==
20071204093501054 REQ 117787e671a35c5c03e072efbd53bad3cea0ae49 root prepaid echoPrepaid [test]
20071204093501054 RES 117787e671a35c5c03e072efbd53bad3cea0ae49 1
20071204093520876 REQ 117787e671a35c5c03e072efbd53bad3cea0ae49 root vpn echoVpn [test]
20071204093520876 RES 117787e671a35c5c03e072efbd53bad3cea0ae49 1
20071204093530380 REQ 117787e671a35c5c03e072efbd53bad3cea0ae49 root mpbx echoMpbx []
20071204093546634 REQ 117787e671a35c5c03e072efbd53bad3cea0ae49 root mpbx listAgents []
20071204093549223 RES 117787e671a35c5c03e072efbd53bad3cea0ae49 100101
Monday, November 12, 2007
My favorite shell commands
The below one line shell script calculates the number of executions of commands and sorts the result.
history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -rg
Here is the result of this script on my Ubuntu.
Try this script to see what commands you use frequently.
history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -rg
Here is the result of this script on my Ubuntu.
66 ls 40 cd 32 sudo 32 mvn 31 ps 29 clear 26 more 22 vi 19 tail 18 kill 16 ssh 13 rm 13 eclipse 11 tomcat_start.sh 10 ll 10 find 9 locate 9 findJar 6 ifconfig 5 lnMost frequently used command is "ls". I was surprised to see "mvn" in the 4th place. As you can see I am developing (eclipse), testing-packaging (mvn) and deploying (tomcat_start.sh) web applications written in java these days. I have also "kill"ed a serious number of processes :)Try this script to see what commands you use frequently.
Thursday, October 18, 2007
Sınır Ötesi Operasyon
Son günlerde gündemi meşgul eden en önemli haber TBMM'nin hükümete sınır ötesi harekat için yetki vermesi. Sınır ötesi operasyon gerekli mi gereksiz mi tartışmaları sürerken gerçekler gözden kaçırılıyor. TBMM'de bizi temsil eden millet vekilleri arasında PKK'yı bölücü teror örgütü olarak tanımayan millet vekilleri var. Durum böyleyken bizim operasyonu sınır ötesinde değil öncelikle kendi millet meclisimiz içinde yapmamız gerekir. Türkiye Cumhuriyeti vatandaşlarını, devletin bölünmez bütünlüğüne zarar vermek için acımasızca öldüren, binlerce çocuğu anasız babasız bırakan eli kanlı bu terör örgütünü "TERÖR ÖRGÜTÜ" olarak adlandıramayan millet vekilleri meclis çatısı altında nasıl barınır aklım almıyor. Demokrasi böyle birşey olsa gerek.
Blogged with Flock
Thursday, October 4, 2007
Volatile Variables In JAVA
Java Memory model defines the possible rules for threads and the expected behavior of multi-threaded programs so that programmers can design their programs accordingly. JSR-133 describes the semantics of threads, locks, volatile variables and data races.
Volatile variables are treated different from other variables. When you mark a variable as volatile, this warns the compiler to get fresh copies of the variable rather than caching the variable in the registers.
Volatile variables can be used to store shared variables at a lower cost than that of synchronization, but they have limitations. While writes to volatile variables are guaranteed to be immediately visible to other threads (because JVM does not allow threads to cache volatile variables), there is no way to render a read-modify-write sequence of operations atomic, meaning, for example, that a volatile variable cannot be used to reliably implement a mutex (mutual exclusion lock) or a counter.
Let's demonstrate this with a counter example. In the example a volatile counter variable will be incremented by multiple threads simultaneously. Below is the main class that holds the volatile variable and starts the threads.
|
Here is our example thread source code:
|
I used jdk1.5.0_12 to run this application. I used 10 threads, each increments the variable 10000 times. The result is as expected. Volatile keyword does not guarantie mutual exclusion. Here is the result:
As a result: Volatile variables are best for use when there is only one thread that makes writes (updates volatile variable) and N threads that make reads. Reader threads get the most recent value of the volatile parameter when they perform a read.
Expected counter value : 100000
Result : 85751
Subscribe to:
Posts (Atom)
