jump to navigation

How to get the current date in java March 14, 2009

Posted by leppastar in java tips.
add a comment

import java.util.*;

public class Demo{
static String[] month = {“January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”}

public static void main(String[] args){
Calendar currentDate = Calendar.getInstance();
String month_str = month[currentDate.get(Calendar.MONTH);
String day = currentDate.get(Calendar.DATE);
String year = currentDate.get(Calendar.YEAR);

System.out.println(month+” “+day+”, “+year);


How to change to Look and Feel of your java program to the user’s OS? March 1, 2009

Posted by leppastar in java tips.
add a comment

use UIManager..


//remember to surround it with try catch statements..XD

How to set the size of a frame into the user’s screensize in java? March 1, 2009

Posted by leppastar in java tips.
add a comment

use toolkit..

JFrame frame = new JFrame(“Frame”);

Big Spider November 14, 2008

Posted by leppastar in Amazing.
Tags: ,

Last night, as I was getting a drink on our fridge, I saw a big spider. Yeah. That’s the one.img_2146

If you notice it has a white thing under it.


I believe it’s its egg containing lots and lots of spider.


I’m just amazed because it’s the first time i get to see a big “pregnant” spider. Hahaha.

However, early this morning, my mother saw it dead on our washroom. 😦

My Laptop – when will you be my mine? October 8, 2008

Posted by leppastar in Uncategorized.
add a comment

I’ve been wanting a laptop ever since I entered college. Not because I envy some of my friends, nor because I want to have what’s “in”. I want it because I need it. I’m a computer science student anyway. And I know that desktop alone is not enough.

Yeah, yeah. I know that I should be thankful because we have a computer and a dsl connection. 521 kbps to be exact. But let’s be realistic here. I need a portable pc. I waste almost 30% of my time doing nothing. SImply because I have long vacant hours. If I have a laptop, I could have done something more acad-related. I could have practiced programming. Or I could have read one of those pdf books. But the thing is, I don’t.

I can’t ask my mother to buy me one because I know that she can’t. She’s already having a hard time balancing all our expenses, how much more if I ask for a laptop? I just can’t ask her that.

Save for it? I’ve tried. Oh yes, several times. But I always end up spending my savings for other stuffs. Some “emergencies” always happen. My desktop crashed, my monitor gave up on me, my mother needs money, and many more. But here I am again, starting from scratch. Saving all my money. From my allowance, to my coins, guess I got to save it all. For my laptop. My ultimate goal.

Will i ever buy a laptop? I hope so. Because I need it. I need it soon.

Python.. ssSSssSSShhhHHHHhh October 8, 2008

Posted by leppastar in Uncategorized.
1 comment so far

As a BS Computer Science student, I’ve encountered many programming languages. C, Java, Assembly, Oz, Lisp, Prolog and many more. Recently, I’ve learned another language. And so far, it’s my favorite. It’s none other than Python.

I’ve just learned Python so my comparison here is not really in-depth.

Anyway, here are the reasons why I love Python:

1. It has no ending marker. In other languages like C and Java, you must each statement or expression with a semi-colon. In Prolog, you must end it with a period. In Python, just finish your statement and you’re done.

2. Blocks are not enclosed with parenthesis or curly braces. In C and Java, each block is enclosed in curly braces. Every condition is enclosed inside a parenthesis. In lisp, everything is enclosed in parenthesis. There’s just no end in parenthesis. On the other hand, in python, no more curly braces nor parenthesis for blocks. All you have to do is to indent it properly. Wish you would normally do with other languages. Besides, more readable if it’s indented.

3. It’s dynamically-typed. Just like lisp, prolog and oz, you can create variables instantly. You don’t have to assign its type. Plus, you can change its type. For example, you used it as an integer. You can use it next time as a string. Just assign a new value to it and it’s type is automatically changed.

4. It’s very high-level. You don’t have to concern yourself with low-level stuffs like the inner workings of for-loops or sorting algorithms. Most of the functions you need are already built-in. You just have to search it using the help function. Hence, more time for devising algorithms and less time for coding. hehe.

5. You can create list/tuple/dictionary of different types. For example, you can create a list with an integer, a string, and a list. The size is not even fixed. You can even extend it (though not on tuples). You can create an initial list and not concern yourself with the other contents. Plus, list functions are also built-in.

That’s it for now. I’ll post another blog once i get to know it better. But so far so good. I love it and i still am lovin’ it. Hope you love it too!

First Blog in WordPress September 15, 2008

Posted by leppastar in Uncategorized.
add a comment

Woah. This is my first-ever “real” blog here in WordPress. Anyway, i’m just gonna share my day. Let’s begin.

I had my exam in cs150 earlier. As usual, i know nothing. I am studying each topic and answering an item simultaneously. I’m grateful that i have answered 2 questions. Lol. I wonder what my grade will be in this subject? This is supposed to be one of the most important subjects for me but it’s at the bottom of my priority list. I’ve been so focused with my organization that I sometimes forget that i am a student first before i became an officer. And the sad thing is, my efforts are not appreciated. I don’t know. I’ve sacrificed a lot. My grades. my sleep. my money. And yet, it seems that it’s all not worth it. Perhaps i’ve been so overwhelmed by everything that i didn’t notice my environment changing. Everyone seems to be focused with their acads. And me? ha! ASA. This is a wake-up call. At the end of the day, i must realize that i go to up to study. not to work in kumon. not to mingle with friends. and lastly, not to serve my organization. my focus is my acads. all other things are just “add-ons”.