Yu Sasaki's Blog

Icon

プログラミングとか英語とかの練習!

Release 0.1

Currently I’ve been working on the bug 173912, and with help of the comment at the bottom of the bug post, I tried locating the package which seemed related to the bug.

org.eclipse.debug.core.sourcelookup includes methods for source lookup, and one said this was the place where the bug might be located. However I was unable to find the source regarding the debug.core in CVS Repository.

Here’s my assumption of the cause of this bug.

There must be some locator method that mistakenly determines the app by only app’s project title.

Anyway I’ll try to locate the source code and analyze the bug more tomorrow.

See you!

Filed under: open source

Release 0.0 – Bug#173912

For the release 0.0 for OSD600, I’d like to work on the bug #173912 Debugger shows source from wrong web app

The bug seems a bit too difficult for me now, but I think it’s worth a try.

See you!

Filed under: Java, open source

Palindrome example using recursion in C

Today I tried resolving a problem with the palindrome example.

Here’s my code:

#include<stdio.h>
#include<string.h>

int do_palindrome(char *str, int offset){
	int ok = 1;
	int length = strlen(str);

	if(length/2 > 0)
		ok = (str[0] == str[length - 1 - offset])?
				do_palindrome(++str, ++offset):0;

	return ok;
}
int main(){
	int i = 0;
	int ok = 0;
	char* str[] = {"sasaki", "SOS", "12344321", "1234322",
                                             "555", "0", "ikki"};

	for(i=0 ; i<7 ; i++){
		ok = do_palindrome(str[i], 0);
		printf("%s is palindrome? : %d\n", str[i], ok);
	}

	printf("Finished!");
	return 0;

}

sasaki is palindrome? : 0
SOS is palindrome? : 1
12344321 is palindrome? : 1
1234322 is palindrome? : 0
555 is palindrome? : 1
0 is palindrome? : 1
ikki is palindrome? : 1
Finished!

According to Danny, our professor for DSA555, the keys to create a recursive function are the following:

1. Determine the base case

2. Make a progress toward the base.

If we apply the rule to our example above, the 1st rule is for “length/2 > 0.” The 2nd rule is how we make a progress toward the condition of “length/2 > 0.” Each time the function is recurred, we have to make sure the 1st, 2nd, 3rd… character is always compared with the last nth, n-1th, n-2th,… character at a time so that both sides get decreased in order to be closed to the center point.

This would be really hard if I do not know the rule.
I like abiding by a rule.

See you!

Filed under: DSA555