Monday, December 03, 2012

jsp compress

you can combine and merge all your JS files into one in java. here is how

http://code.google.com/p/granule/

enjoy and if you share your experience with granule I will enjoy to read those :)

Saturday, December 01, 2012

eclipse juno slow solved

you will see the end of this page

https://bugs.eclipse.org/bugs/show_bug.cgi?id=385272


1) Help>Install New Software

2) use the site: http://download.eclipse.org/eclipse/updates/junoSR1Patch-tmp

3) select Eclipse UI Juno SR1 Optimizations, install, and restart

this will make eclipse 4.2 work faster when you change tabs in xml files. that was bugging me for a long time.

cheers :)

Wednesday, November 21, 2012

javada duplike loglar görmek

genelde log4j ayarları dosyası şişmesinden kontrolden çıkmasından kaynaklanır. xml ile configuration ayrı bir hatadır ya neyse. şimdi xml leri gezdin pathlerde gerekenleri ayarladın ama çözümlenmiyormu o zaman java koduyla



bu bütün loggerları silip bi tanecik konsol appender eklememizi sağlar. veya tamamen bütün loggerlarımı kapatıcaz o zamanda before bölgesine aşağıdaki eklenir



 aslında logu kapamıoda rama gidiobuild bitince silinir ramdende rahat olun :) junit testlerinde bu kodlar bana gerekti.

Monday, November 19, 2012

my first technologic toy

I started games with this



then I turn to this(commodore 64)
nowadays I dont play any games just watch e-sports and enjoy star craft mostly

Sunday, November 18, 2012

spring circular reference bean problemi

spring de service ler reporsitoryler derken heryerimiz bean olmuş durumda ve uygulama bi şekilde çalışıyor. çok da nasıl çalıştığına önem vermeden kodlamaya devam ediyorum. javasimon için aop enable edip server start ediyorum birden şöyle bir exception alıyorum.

Error creating bean with name 'membershipProvider': Bean with name 'membershipProvider' has been injected into other beans [roleProvider] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.

daha evvelinde aop enable ettiğimde daoUtils can not be set $Proxy180 gibi exceptionlarda görmüştüm onları geçmek için springin root context xmlinde şöyle birşey yapmıştım

spring confundanda anlaşılacağı üzere interface kullanmıyorum pek. o kadar DI sevmiom bide çok kod kafa karıştırıo tek class da iş bitiriyorum genelde.

neyse allowEagerInit hatası içinde gittim memberShipProvide ın tepesine @Lazy ekledim sorunsuz çalıştı. okuduklarıma göre circular reference zaten design hatası fakat bazen gerekiyor. bu durumda @Lazyı anotasyonu işimizi çözüyor. java simonda güzel güzel çalıştı ama webconsole da gördüğüm çıktılar beni çok tatmin etmedi. olmadı jamon a dönücem. buda gelişim sürecinde bir spring hibernate projesinden küçücük bir kare :)

Wednesday, November 07, 2012

java telnet gibi

gün içinde sıkça
telnet ipadresi port

diyip bir makinenin diğer makineye bağlı olup olmadığını belirli porttan kontrol etmemiz gerekiyor. fakat bugün root olmadığımız bir linuxde telnet kurulu olmadığını fark ettim. hemen java classımı kondurdum buyrun ihtiyaç olursa
derlemek için
javac telnet.java
kullanımı
java telnet 10.210.60.55 22

yukardaki ipnin portuna bağlanmaya çalışır bağlanırsa success değilse problem ve sebebini yazar. koduda şöyle


Wednesday, October 31, 2012

oracle constraint bulma


gelen exceptionlar şu şekilde

ORA-00001: unique constraint (SCHEMA.SYS_C0067078) violated

sağolsun hibernate veya oracle create ederken çok nadide isim seçmiş SYS_C0067078 velhasılı bunu görücne insan bişey anlamıyor. constraintin ilişkili olduğu tablo ve detayı için oracle da

select * from all_constraints
where owner = 'SCHEMA'
and constraint_name = 'SYS_C0067078';

çalıştırmak yeterli.

Tuesday, October 30, 2012

linuxde çalışan javaların kaç gündür çalıştığını görmek

ps -ef|grep java|awk '{print $2}'|xargs ps -o pid,etime,command -p
yukardaki satır sistemdeki javaların kaç gündür çalıştığını gösterir. örnek çıktı

 PID ELAPSED COMMAND
16149 19-04:27:43 uzun komut
24767 12-04:55:26 komut

bold olanlar gün adedi sağdakide saat ve dakika ilk satırın anlamı: 19 gün 4 saat 27 dakikadır çalışıyor demek.

eğer javadan başka birşeyin kaç gündür çalıştığını görmek istiyorsanız yapmanız gereken aşağıdaki satırdaki bold bölgeyi taradığınız işlem adına çevirmek

ps -ef|grep java|awk '{print $2}'|xargs ps -o pid,etime,command -p

örnek kaç gündür makine açık

ps -ef|grep init|awk '{print $2}'|xargs ps -o pid,etime,command -p

görmek istediğim yerler

bazen içim bunaldığında açıom google maps i böyle sahil sahil bakınıyom. bu sayfayada ekleyip durcam işte nerelerde takılmak isterdim diye :) Daha Büyük Haritayı Görüntüle Daha Büyük Haritayı Görüntüle
Daha Büyük Haritayı Görüntüle
Daha Büyük Haritayı Görüntüle
Daha Büyük Haritayı Görüntüle

Thursday, October 25, 2012

eclipse de junit test fail fonksiyonu kayboldu

aşağıdaki class ı aldım junit testleri denemeye çalışıyorum. çokta bildiğim bir alan değil. neyse geliştirdim kendi servislerimi falan yazıyorum springle birleştirdim falan derken aşağıdaki fail("") fonksiyonu hata vermeye başladı. benim el alışkanlığımdır ctrl+shift+f ve ctrl+shift+o bakıom bakıom yok bu fonksiyon. ni olduki nere gitti bu derken aşağıdaki koddaki static import satırını gördüm hağ dedim. sonra test ettim eclipse silmiş onu hakkaten zira bende commentlemiştim o satırı :). neyse eclipse in bunu silmemesini sağlamak için gereken ayar şöle

maven ve jenkins

maven bilmek kullanmak javacı için artık sanırım kaçınılmaz bir gereklilik.

how to select hibernate envers audited dates in mysql

just select dates is easy like this

SELECT FROM_UNIXTIME( revtstmp/1000 )   FROM revinfo;

if you want the detailed data result you can do like this.



SELECT r.rev,FROM_UNIXTIME( revtstmp/1000 ),pa.* FROM revinfo r
left join picture_aud pa on pa.rev=r.rev;

well you just need to change table name up there picture to what ever is your table name is.

Monday, October 22, 2012

galleria da fullscreen yok

galleria.io baya ünlü ve becerikli bir javascript imaj albümü kütüphanesi. bende denemeler yaparken gördümki imajların fullscreen olması veya büyük hallerini göstericek özellik classic gelen ve free olan versiyonda yok.

yapılması gereken javascripti buldum ama jsfiddlerdan kopyaladığımda sorunlar çıkardı çalışan hali şöyledir.

javascript



css için



css deki fullscreenpng ye dikkat edin.

Sunday, October 21, 2012

java kod kalitesi

java kod kalitesi çokda zor olmayan ama dikkatsizlik nedeniyle yada zaman olmaması sebebiyle en son bakılan noktalardan biridir.

findbugs veya PMD veya sonar gibi oto-matize kod tarayıcıları ile bu işlem sağlanabilir. eğer maven projesi geliştiriyorsanız lokalinize sonar server kurup sonrasında mvn sonar:sonar demeniz yeterlidir. sonar içinde findbugs ıda barındırır.

debian ve diğer linux distroları için sonar kurulum paketlerine aşağıdaki adresten ulaşabilirsiniz.

http://sonar-pkg.sourceforge.net/

Saturday, October 13, 2012

hibernate ve kolon isimleri

hibernate ile uygulama geliştirenler artık pek database tarafınla ilgilenmeyebilirler. bir süre sonra hangi kolon hangi değişkene denk geliyor kodu yazan kişi tarafından bilinmez olmaya başlar.

özellike windows da uygulama geliştirirlip linux de mysql e deploy yapılıyorsa %90 kolon ismi büyük küçük harf bağımsızlığıyla ilişkili problemler çıkabilir. çünkü genelde class isimlerimi ClassForDeve gibi büyük küçük harfler barındırıyordur ve bunlar aslında windows daki mysql de sorun çıkarmazken linuxde sorunlara sebep olucaktır.

en güzel ve basit çözüm hibernate.properties veya persistence.xml e aşağıdaki satırı girmek:



bu sayede oluşturulacak tablo ve kolon isimleri class_for_deve şeklinde olucaktır. buda ister linux ister windows mysql versiyonu bağımsız çalışacaktır.

bir diğer çözümde her tablo ve kolon isminin java pojolarında @Column(name="biseler") veya @Table(name="tablo1") şeklinde verilmesidir. bu yöntem çok külfetli olucaktır.

Friday, October 05, 2012

şifresiz ssh

A makinesinden B makinesine ssh ile bağlanmanız gerekiyor. genelde scp de çıkar bu sorun. bi dosya kopyalicam habire şifre istemesi çileden çıkarır insanı. neyse kolay ve güzel çözüm şu.


  1. A makinesine ssh ile login olunur
  2. "ssh-copy-id username@B" çalıştırılır
artık A makinesinde ssh username@B diyerek B ye her daim login olunabilinir.

eğer şöyle bir hata alınırsa

/usr/bin/ssh-copy-id: ERROR: No identities found

aşağıdaki komut ile key oluşturulur

ssh-keygen -t rsa

Monday, September 24, 2012

apache shiro 404 and 500

in java web application you can easily set 400 and 500 error pages via web.xml like this



this means when someone clicks on a url which is 404 or 500 server will show them the pages you got in your app. this is better then showing them default server error pages. you can see good 404 examples from here

anyway while I was developing a web application with apache shiro I could not show my 404 or 500 pages and it was throwing a no securitymanager at this thread exceptions. after I research on this I find out that the example of shiro is not enough. because there was just a filter and it points /*. I tought that was enough but its not. you should change your apache shiro filter map like this.



after this change on web xml I finally got my error pages from my application..



Thursday, June 14, 2012

varnish performance problems

I was reading a forum post at linked in. and I saw someone having some performance issues at low level server. and I have one server too 4gb ram and 8 core cpu. anyway this is how he solved that problem .connect_timeout = 500s; .first_byte_timeout = 500s; .between_bytes_timeout = 500s; echo 'fs.file-max=1000000' >> /etc/sysctl.conf echo 'net.ipv4.ip_local_port_range = 1024 65535' >> /etc/sysctl.conf echo '* soft nofile 1000000' >> /etc/security/limits.conf echo '* hard nofile 1000000' >> /etc/security/limits.confecho 'session required pam_limits.so' >> /etc/pam.d/loginulimit -n 1000000 and another suggestion was DAEMON_OPTS="-a :80 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -p thread_pools=8 \ -p thread_pool_max=2500 \ -p thread_pool_min=200 \ -p thread_pool_add_delay=2 \ -p listen_depth=2048 \ -p session_linger=100 \ -p connect_timeout=600 \ -s malloc,4G" just a personal note if I have any performance problem at varnishd.

Saturday, May 12, 2012

Sunday, April 01, 2012

oracle coherence and clustering

I have been configuring this oracle coherence more then 2 weeks. and I must say its been a pleasure. I love clustered things. they mostly does not work and hard to figure out. but oracle coherence is not that complicated.

one thing. in our production environment I could not use multi casters and convert configuration to unicast stuff. its a p2p based tcmp network and solid work. I can say oracle coherence is something like memcached. and its easy to figure out. because it can run under tomcat and deployed to weblogic servers with our application.

while production tests I saw that if you change any simple detail in tangosol-coherence-override.xml I need to restart weblogic instances. because when coherence started it could not change its configuration on the fly. I think if we used coherence jar out of our war it would be more flexible. but our cache system does not need to configured every one day or so. so we keep those xmls(tangosol-coherence-override.xml,coherence-cache-config.xml) inside our war.

another thing. if I add well-known-addresses to tangosol xml it trys to connect while starting the war. and if there is no localhost coherence does not look for it. so I need to change tangosol like this.


this configuration looks for localhost and runs well in redhat enterprise linux. coherence version:3.7.1.0

Friday, March 30, 2012

linuxde makine startına komut eklemek

hep unuttuğum hep tekrardan yazdığım bişeydir. neyse glassfishimi start eden bir bash scripti var. onu init.d ye kopyalıyoruz

cp startGlassfish.sh /etc/init.d/

sonrada

update-rc.d startGlassfish.sh defaults

hayırlı olsun artık o script her açılışta çalışacaktır.

Tuesday, March 06, 2012

akşam akşam hataya gel

Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 can't find
referenced pointcut

li bir exception alınıyor springin aop sinden beri patlıo. ulan altına bakıom üstüne bakıom yok. tomcati ipv4 ile çalıştırıom bind adresi olarak 127 li veriom yemio. derken derken buldum meğer makineye java 1.7 kurulmuş.

http://issues.opennms.org/browse/NMS-4350

burdada şikayetler listelenmiş. sonuçda 1.7 kapsar 1.6 olması gerekmezmiydi. neyse 1.6 kurduk geçti ama nedir bizim çilemiz :) güle güle 1 saat.

Monday, March 05, 2012

axis log4j

log4j ile axis gelen gidenleri görmenin en uygun yolu log4j.xml

buyrun örnek configürasyon:

Saturday, February 11, 2012

mecidiyeköy şampiyon kokoreç

verdiğim siparişde ayvalık tostu vardı siz sucuklu kaşarlı tost yollamışsınız. allahtan etrafta başka eve servis tuzlama bulamıom yoksa töbe sizden bişe istemezdim :) neyse tuzlama yine iyiydi çok seviom sirke sarımsak limon sakatataı ya.

tuzlama dışında hiçbişey alınmicak dükkan mecidiyeköy şampiyon kokoreç bilgilerinize sunarım.

Thursday, February 09, 2012

şişli rezene

az evel tavuk bonfile yedim rezeneden gerçekten sosuyla falan şok güzeldi. üstünede tarihi dolmak üzere olan nutelladan yidim kendimi iyi hissediom uleyn =)

Wednesday, February 08, 2012

burger kinge bu sıralar neler oluyor

şu anda maltepedeyim saat 8 de yakalamayı planladığım bir servis vardı. saat 7 de verdiğimiz sipariş tam 8 e beş kala geldi ve ben servisi kaçırdım.

 sonuç: burgerlerin güzel olsada servisiniz gerçekten rezalet. bu durumun aynısı şişli tarafındada oluyor. 1 saat 15 dk sonra gelen burgerleri almamak durumunda kalıyorum. sebep buza kesmiş olmaları. çok gıcık durum.

paranla rezil olmak bu =)

Friday, January 27, 2012

find all columns in oracle named as district_id

I had a problem today. it was about changing all district_id in a whole database. so I need to find who used district_id as column name in tables in oracle.

here is how I find it.
and I changed all values from found tables.

Sunday, January 15, 2012

test your disks in linux

I have a linux server which has 2 disks on it. one of them is SSD and other is SATA disk. I wondered how fast is ssd is here is the output :) I should say this test done when server has load on it. pretty nice

Monday, January 09, 2012

EndoSession

one of my dead project which was about endoscopic data capture and saving in mp4 format. which was using blackmagic card to capture all data and it was working in linux with power of QT and ffmpeg.

I was thinking I may publish in google code svn repo. but there is no development plan on it so no need to have any repo. people who need to capture data from blackmagic capture card and save it in video file may find this as helpfull example.

Tuesday, January 03, 2012

strange java hibernate story from today

today I was developing a new request from customer. its not a big issue just adding a new Boolean field will cover the request and will work happly ever after. I added my new "isActive" field into hbm xml then pojo. and started the app in windows with tomcat maven plugin. there was nothing wrong hibernate started up smoothly and update the table and added my new field into the persistent level. I like hibernate more, everyday :)

its just like a dog. best friend of men. which helps for everything and expects only our love :D anyway I decided to deploy our new class to server which runs weblogic 11g. I went to ssh and run "svn up" then "mvn install" then went back to weblogic console for updating our big webapp. then I gave the path of war and said update then started the app. then started waiting log to come and make me smile :) and it said there is no getisactive function in the class. I just added and run in my laptop it was working fine. how the hell it happens I have no idea. java and oracle has a lot issues and terminology and keywords. I probably clash with one of them.

then I convert my field name to XboxActive and changed function names respectively. then without trying in my laptop directly deployed it. and it started working. sometime I dont have the power to investigate all details of a problem. and this is one of them :)

just a simple note dont use "isActive field ine a complex hibernate spring project if it runs on weblogic" :)

Sunday, January 01, 2012

publishing and reading from jms

simple java class for reading and writing to weblogic jms.

swt and maven example

Swt does not come from maven repo with the latest version. but you can use this pom to use latest swt version  from nexus testing repo.

pom.xml:

for a working example eclipse project visit this

odd string diff

 https://leetcode.com/problems/odd-string-difference/ Beats 19.92% of users with Java   class Solution { public String oddString ( S...