Java Date Formatter

, , , , , , , Yorum Yok »

Her seferinde javada tarih(Date) objesini istediğim formatta yazıya(String) çevirmem gerektiğinde googleda aramaktan bıktım :) . Örnek kod aşşağıda:

I’ve got bored to googling everytime when I need to convert Date object to String in a format that I wanted :) . Example code is below:

SimpleDateFormat formatter= new SimpleDateFormat ("yyyy.MM.dd ww 'at' hh:mm:ss a zzz");
Date now = new Date();
System.out.println("for:" + formatter.format( now ));

Make Me Social

, Yorum Yok »

I have just installed make me social plug-in and its a trial blog post :) .

Java Time to Service Desk Time

, , , , , 2 Yorum »

Geçenlerde bir keresinde lazım oldu; Service Desk üzerind bir tarih kaydedecek oldum ama Service Desk’in API’sindeki metod parametre olarak double istiyordu. Ufak bir dönüşüm gerekiyormuÅŸ;

Date date = new Date();
double newDate = date.getTime()/86400000D + 25569D;

English Version;
Recently i had to set a date into Service Desk by using its API. But the method for this purpose needs a double parameter. The required double time format can be fetched with a small conversation (as it seem in the 2 line code above).

İngilizce versiyon gogol’dan ziyaretçi çekebilmek amaçlıdır :D

Emulating Windows

, , , , , 4 Yorum »

Today i needed to emulate the windows Xp, because i needed to use Internet Explorer 6.

I know using explorer 6 stupid but every computer not smart as i am or as the majority. We need to test our project on İnternet Explorer 6. I don’t like Internet Explorer (all the versions), even i don’t like Windows. I did like it someday, but it was really long time (about 9 years) ago.

After saying these all, if i said installing windows xp instead of my beautiful Linux distribution, you could easily say stupid to me. Firstly, i wanted to use Vmware-server but i couldn’t find any installation candidate at repositories. Then i started to download from its site. But i found out there is an alternative virtual machine tool called VirtualBox.

I easily installed from my distro’s add & remove programs, then i installed windows xp from its iso file. It was even faster than installation to real machine. Here is a screenshot :

Emulated Windows

Türkçesi :

Bugün internet explorerı kullanmam gerektiği için, windows xp yi linux üzerinde emülatörle çalıştırmam gerekti.

İnternet explorer 6 ya ihtiyaç duymanın salakça olduğunu biliyorum ama herkesin benim ve çoğunluk kadar zeki değil. Projemizi internet explorerda test etmemiz gerekiyordu. İnternet explorerı sevmiyorum, hatta windowsuda sevmiyorum. Bir zamanlar severdim ama bayağı bir önceydi bu (yaklaşık 9 yıl önceydi).

EÄŸer bunca ÅŸeyi söyledikten sonra benim güzel linux dağıtımımın yerine windows xp yi kurduÄŸumu söyleseydim, benim hakkımda kolayca salak diyebilirdiniz. Öncelikle Vmware-server’ı kurmak istedim ama depolarda kurmaya aday bir paket bulamadım. Ardından sitesinden indirmeye baÅŸladım. Fakat Virtualbox diye alternatif bir araç olduÄŸunu öğrendim.

Kolayca dağıtımımın program ekleme & kaldırma programından kurdum ve windows xp’yi iso dosyasından kurdum. BoÅŸ bilgisayara kurmaktan bile hızlı kurdu. Ekran görüntümüzde yukarıda…

Core’u geniÅŸ Tutki Patlamasın :) (Segmentation Fault Core Dumped C++)

, , , , , , 4 Yorum »

İngilizce bilen kardeşler için bir açıklama yapayım :D
( maksat sitenin gavur ziyaretçiside olsun :D )

For English Press 9:

I was coding a small program on C++ then I have the error;
master@slave:~/project/oop2$ g++ MyString.cc MyString.h -o trial
master@slave:~/project/oop2$ ./trial
Segmentation fault (core dumped)

It was because using a pointer without specifying its borders. It grows and grows then it violates the memory addresses belonged by other variables, methods or what ever. The solution is simple just reserving the needed memory. So how to do that? The answer is also simple. You should allocate the memory using malloc() function which is both available in C and C++.

for example you need a pointer to put inside 100 int.
int somenumber = 100; // the number of integer you will put in pointer
int *intPointer;
intPointer = (int *)malloc(somenumber * sizeof(int));
// malloc function needs the byte value of the needed area in memory
// that’s why you should multiply it with the byte value of an integer
// it is generally 4 in 32-bit and 64-bit processor aimed compilers

Don’t press 8 it is for Dutch :D , my Dutch is still poor,
Press 7 for Turkish :)

Evet Türkçesine gelince olayın, Tercüme edin Allah Allah, beni uğraştırmayın :) .
Neyse ben biraz bahsedeyim yine :) ;

Yazdığım programda bir adet int pointer kullanıyordum (çok adet te bir tanesi patlıyordu :) ) ve bu memoryde sınırlarını zorluyordu, hatta altüst edip programımı öldürüyordu. Aslında çok basit bir problem ama yeni başlayanların ve benim gibi unutup tekrar hatırlayanların sık karşılaştıkları ve harşılaşacakları bir problem bu.
Tek yapılması gereken ise iÅŸinize yarayacak kadar memory’i o deÄŸiÅŸken için ayırmanız. Bu iÅŸlem için örnek kod yukarda.
Umarım googledan gelen arkadaşların işine yarar, ve bana bol bol ziyaretçi getirir :D

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in