Latest Entries »

Adding Colors to VIM

I was not happy with default settings of the vim editor on snow leopard. Following are my settings. So far i don’t have a problem with them. Just put in a file named .vimrc on home folder.

set nocompatible
set selectmode=mouse
set backupdir=/tmp
set directory=/tmp
set guifont=Lucida_Console:h8
set guioptions-=T
set errorfile=/tmp/vim.errors.log
set ic
set fileformats=dos,unix,mac
highlight StatusLineNC guifg=#ff0000 guibg=#000000
highlight StatusLine guifg=#00ff00 guibg=#000000
set hls
hi Normal guibg=black guifg=white
hi Search guibg=white guifg=black
hi IncSearch guibg=white guifg=black
set mousef
set tabstop=2
syntax on

KICK-ASS!!! Fucking Hilarious

First time in my life, i am amazed by a “based-on” movie, and it’s really fun as the original comic book. Well they’ve slightly changed the story, but it still rocks. Still I need to say that I did not like the way that they turn this into a “will-be-continued” story. Also i didn’t like that kick-ass got laid with sweet Kate. Well that guy is a true loser, come on. Other than that, it’s really fun movie. One of the best.

Sroups is coming out

Yeah it’s coming soon. We’re developing a social network application at OyunStudyosu where you can turn your website into a virtual world. In sroups (which is a flash application), users will step into a virtual isometric world and interact with other people who visit the website at the same time.

The idea, somehow, reminds me the matrix movie which is by far the most influenced movie for a programmer. In matrix, people log into the virtual world called matrix (not using flash application though :) ), and interact with other “virtual” people. Everything is software, everything is obkject in that world but the experience is real. I really wish that I have a world like that. Sroups gives us an opportunity to use the matrix (imo). But it’s a pity that we can’t bind our body to that world physically.

Well, I should mention that there are plenty of virtual worlds around, like warcraft (which is awesome), but the main difference is, sroups is like a simulation of the containig website, not a game, not a fantasy. At least it should. Of course the project is in (closed) beta now and it’s too primitive to make an analysis.

But yeah, for me, the idea is very excited.

Btw, I’ve decided to write my posts in english from now on. Will explain the reasons later.

Terminal Bash Renkleri

Mac bilgisayarımda command prompt rekleri olarak aşağıdaki olayı kullanıyorum

export PS1="[\e[0;32m\]\W\e[m]\[\e[0;31m\] > \e[m\]"

Directory renklendirmesi içinse ~/.bash_profile dosyası içine

export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx

iş yerinde ise “ubuntu” kullanıyorum. oradaki renk kodlarımı ise sonra yazıcam. evet evdeyim şu anda

Edit: Bash renklerimi değiştirdim. Yenisi aşağıda

export PS1="[\e[0;32m\]\u@\H \e[0;36m\w\e[m]\[\e[0;31m\] > \e[m\]"
export CLICOLOR=1
export LSCOLORS="DxGxFxdxCxdxdxhbadCxCx"

Mac’de port kullanımını görmek

için güzide bir komut var. işte şu:

sudo lsof -i -P

Ubuntu için de şu kullanışlı

sudo netstat -lntp

Servlet için Test Driven Development

Test driven development çok önemli bir olay. Standard java projelerinde junit kullanıyorum. Ancak bir web uygulaması yazıyorsanız servlet’leri test etmek bir dert olabilir.

Daha önce bu meseleyi şu şekilde çözüyordum: model ve controller class’larım için junit testlerimi yazıyor, servletlerin logic’ini daha basit bırakıyordum. Ancak yeni işimde (Oyun stüdyosu) komplex servlet implementasyonu ile karşılaştığım için servlet testi yazmam farz oldu.

Servlet’lerdeki testing problemi şu: bir container’a (tomcat gibi) ihtiyacınız var. Lakin muhteşem kütüphane HttpUnit kendi build-in container implikasyonuyla (türkçesini bilemedim) geliyor.

Kurulum için web sitesinden kaynağı indirip, jar ve dependency kutuphaneleri classpath inize eklemelisiniz.

Neyse lafı kısa kesip örneğe geçeyim. Örnek olabilecek en basit servlet testi. Ama giriş için iyidir bence.

Test kodu aşağıdaki gibi, bu benim için çalışan konfigurasyon.

@Test
public void testServlet() throws IOException, SAXException, ServletException {

File webXml = new File("./web/WEB-INF/web.xml");

// web.xml deki servlet tanımlarından olayi cozuyor
ServletRunner sr = new ServletRunner(webXml, "/BeerV1");
// servlet asagidaki gibi register de edilebiliyor ayrıca.
// sr.registerServlet("BeerSelect", BeerSelect.class.getName());

ServletUnitClient sc = sr.newClient();
WebRequest req = new PostMethodWebRequest("http://localhost:8080/BeerV1/BeerSelect.do");
req.setParameter("color", "Light");

InvocationContext ic = sc.newInvocation(req);
BeerSelect bs = (BeerSelect) ic.getServlet();

String servletInfo = bs.getServletInfo();
assertEquals("The servlet info is wrong", servletInfo, "My super beer selector");

// evet invocation context kullandıgımız için servlet metodlarını manual olarak cagiriyoruz.
bs.doPost(ic.getRequest(), ic.getResponse());
String color = bs.getColor();
assertEquals("The color is wrong", color, "Efes Light" );
}

Bu da servlet

public class BeerSelect extends HttpServlet {
private String _color = "";

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();
try{
String email = this.getServletConfig().getInitParameter("email");
request.setAttribute("email", email);

out.println("
Beer advisor
");
BeerExpert exp = new BeerExpert();
List res = exp.getBrands(request.getParameter("color"));

request.setAttribute("styles", res);

for( String s : res ){
this.setColor(this.getColor() + s);
}

RequestDispatcher dsp = request.getRequestDispatcher("result.jsp");
dsp.forward(request, response);

} finally {
out.close();
}

}

@Override
public String getServletInfo() {
return "My super beer selector";
}

public String getColor() {
return _color;
}
public void setColor(String _color) {
this._color = _color;
}
}

Bu kadar :)

Kolay, şöyle ki:

sed -i ’s/[orginal_text]/[new_text]/g’ filename.txt

ya da

grep -R –files-with-matches ‘OLDSTRING’ . | sort | uniq | xargs perl -pi~ -e ’s/OLDSTRING/NEWSTRING/’

Caspian konseri

Salı günü caspian konserindeydim, ilk defa kimin ne çaldığını anlamadığım bi konser oldu. sahneye 3 gitarist ile çıktıklarında bi süre bünyem kabul etmedi. 3. gitarist grupan değil herhalde diye düşündüm bi süre, lakin hepsi bişeyler çaldı. gürültülü bi soundları var. albumlerinde hiç klavye duymamıştım lakin konser sonuna kadar zivil gibi klavye sesi geldi. bir de davulcu oldukça minimal bi setup ile takıldı. sadece trampet, kick ve 3 tane zil vardı (hi-hat dahil). albumdeki gibi çalmadılar bi garip gürültü vardı hep. lakin performansları pek bi eğlenceliydi.

Zend Framework’da bir Bug

Call to undefined method Zend_View_Helper_Placeholder_Container::ksort()

Bu hatayı zend framework bir şekilde veriyor. Sanıyorum bir bug’dan kaynaklanıyor bu sorun. Yeni versionlarda bu hata giderilmiş olması lazım.  Lakin en kolay (geçici çözüm) ise aşağıdaki metodu Zend/View/Helper/Placeholder/Container/Abstract.php dosyasına eklemek.

Oh yeah.

/**
* Sort the array by key
*
* @return array
*/

public function ksort()
{
$items = $this->getArrayCopy();
return ksort($items);
}

Türkiyede psikiyatri

Bugün annemi Erenkoy ruh ve sinir hastanesinde psikiyatriste götürdüm. İlk izlenimlerim harikaydı. Para ödemedik ve çok fazla da sıra beklemedik. Sıra gelince, benim de muayene odasına girmem doğru olur mu gibi bi soru sordum anneme, o da sen gel dedi uygun görmezse çıkartır odadan. Tamam dedim girdim odaya. doktor buyrun dedi sıkıntınız ne? annem ameliyat olduğundan bahsetti. Oradan sonraki dialog aynen şu şekilde cereyan etti:

D: Sağ mı sol mu?
A: Sol
D: İlaç alıyo musunuz?
A: Evet 1 aydır x ilacını kullanıyorum.
D: İyi geliyor mu?
A: Hayır
D: O zaman iki katına çıkartalım x ilacını. 1 ay sonra da beni tekrar görün.

… sessizlik …

A: eee peki, şey yok mu aa
D: efendim?
A: Ben kemoterapi, moral bozuk, nasıl olcak, ehm
D: Yok yok bişey olmaz sen al bu ilacı, yetmezse biraz daha artır sonra görürüm ben seni
A: Peki, iygünler

Evet, dialogun tamamı bu kadar. Bu benim ilk psikiyatrist seansına tanık oluşum (kendim hiç gitmedim). Psikologa ise hiç tanık olmadım. Normal bir seans böyle mi oluyor bilmiyorum (irvin yalom kitapları ya da jung/freud yazılarında okuduğum bunlar değildi). Ancak tek bildiğim bişey var:

Burası Türkiye, Bitmiş bu işler (by Savaş)

Powered by WordPress | Theme: Motion by 85ideas.