Tuesday, January 01, 2008

Happy New Year 2008

Last year I posted some off-shoulder comments that I didn't realize were fulfilled in 2007.

I spent the holidays like the previous two, unbelievably enough. At home. Except for a sidetrip here and there, I am still able to celebrate Christmas at home no matter who my employer is.

Last year, I said:
I am currently looking at alternative careers that would not shorten my life expectancy and still not make my prior training useless.
In May, I was asked to leave a hospital where I trained for the last 10 years. So I was forced by circumstances not to continue training for the time being. 7 months after, I feel like that chapter of my life has been all but forgotten; if not only for this blog I would never have remembered everything.

As a matter of necessity, I had to change careers. And change careers I did.

I recall some days ago, when we visited some relatives in Anilao, Iloilo, that my maternal grandmother was aghast (yes, look it up) upon seeing me there, with long hair and a belly to boot. When she mustered enough confidence to ask me, she gingerly said: "What happened? I heard you were working at a call center?"

Without missing a beat, I replied: "Yes, I am, because the last two hospitals I worked for could not reasonably pay me for all the health hazards I face."

During our trip to Bacolod and Mambucal, Joy and I met her classmate who was doing good as a Chief of a small primary hospital in a remote area somewhere 4 hours away. I could only admire his courage to do such a thankless job (but I heard he's well compensated). I guess the sheer lack of technology would make me dull and probably bore me to death.

I hear that my old co-residents have not felt any hardship from my departure. Good for them! I'm sure (and I do wish) that most of the doctors slaving away in government hospitals would not have the same set of gripes that I had. Or else, if they had been any smarter, they would do the exact same thing and save themselves from further self-immolation.

Apparently, the cited 1:30,000 doctor to population ratio of the Philippines was low enough for Cuba to offer assistance by sending some of theirs. The article even quotes the Cuban Ambassador:

"We have offered (them) to the Philippines, but your government has yet to make its move," the ambassador said.
Mr. Ambassador, I blogged about Republic Act 8042 in August, you may have to read a more convenient solution to our "brain drain" problem from our brilliant government. If they come to the realization that your health care system is to be emulated, we'll get back to you.

Two years ago I was so apprehensive about leaving Medicine post-haste, because it was the only thing I was trained to do back then. I returned to the pressure cooker, believing that the first hiatus was a fluke. Now I realize that I have to chart everything according to my road map, and if I needed to take a detour, I will be flexible enough to accept the side trip. Lest I be unyielding and the journey would break my spirit.

==

Some of my exercises:

13.5** (Displaying numbers in a triangular pattern) Write a program that displays numbers in a triangular pattern, as shown in Figure 13.28(b). The number of lines in the display changes to fit the window as the window resizes.

import java.awt.*;
import javax.swing.*;

public class DisplayTriangularNumbers extends JFrame {

public DisplayTriangularNumbers() {
getContentPane().add(new TriangularPanel());
}

public static void main(String[] args) {
DisplayTriangularNumbers frame = new DisplayTriangularNumbers();
frame.setTitle("Display Triangular Numbers");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(250, 250);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}

class TriangularPanel extends JPanel {

private String output = "";
private int yCoordinate = 0;

public String getOutput() {
return output;
}

public void setOutput(String output) {
this.output = output;
repaint();
}

public int getYCoordinate() {
return yCoordinate;
}

public void setYCoordinate(int yCoordinate) {
this.yCoordinate = yCoordinate;
repaint();
}

protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.setFont(new Font("Times", Font.BOLD, 15));
int numOfLines = getHeight() / 20;

for (int row = 1; row <= numOfLines; row++) { for (int column = 1; column <= row; column++) { output += column + " "; } g.drawString(output, 10, row * 20); output = ""; } } }
13.8** (Drawing an octagon) Write a program that draws an octagon

import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Graphics;
import java.awt.Polygon;

public class DrawOctagon extends JFrame {

public DrawOctagon() {
setTitle("DrawOctagon");
add(new PolygonsPanel());
}

/** Main method */
public static void main(String[] args) {
DrawOctagon frame = new DrawOctagon();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(200, 250);
frame.setLocationRelativeTo(null); // Center the frame
frame.setVisible(true);
}
}

// Draw a polygon in the panel
class PolygonsPanel extends JPanel {

protected void paintComponent(Graphics g) {
super.paintComponent(g);

int xCenter = getWidth() / 2;
int yCenter = getHeight() / 2;
int radius = (int) (Math.min(getWidth(), getHeight()) * 0.4);

// Create a Polygon object
Polygon polygon = new Polygon();

// Add points to the polygon
polygon.addPoint(xCenter + radius, yCenter);
polygon.addPoint((int) (xCenter + radius *
Math.cos(2 * Math.PI / 8)), (int) (yCenter - radius *
Math.sin(2 * Math.PI / 8)));
polygon.addPoint((int) (xCenter + radius *
Math.cos(2 * 2 * Math.PI / 8)), (int) (yCenter - radius *
Math.sin(2 * 2 * Math.PI / 8)));
polygon.addPoint((int) (xCenter + radius *
Math.cos(3 * 2 * Math.PI / 8)), (int) (yCenter - radius *
Math.sin(3 * 2 * Math.PI / 8)));
polygon.addPoint((int) (xCenter + radius *
Math.cos(4 * 2 * Math.PI / 8)), (int) (yCenter - radius *
Math.sin(4 * 2 * Math.PI / 8)));
polygon.addPoint((int) (xCenter + radius *
Math.cos(5 * 2 * Math.PI / 8)), (int) (yCenter - radius *
Math.sin(5 * 2 * Math.PI / 8)));
polygon.addPoint((int) (xCenter + radius *
Math.cos(6 * 2 * Math.PI / 8)), (int) (yCenter - radius *
Math.sin(6 * 2 * Math.PI / 8)));
polygon.addPoint((int) (xCenter + radius *
Math.cos(7 * 2 * Math.PI / 8)), (int) (yCenter - radius *
Math.sin(7 * 2 * Math.PI / 8)));

// Draw the polygon
g.drawPolygon(polygon);
}
}
I'm sorry if I'm not posting my Java solutions as much as before. Rendering Graphics is not an easy task especially if you are to hand-code every aspect. If I had a WYSIWYG IDE... well, that would be cheating.

==

New Year's resolutions/predictions?

Well, I'm giving myself more leeway by not elaborating on these in detail :) because my New Year's postings tend to be self-fulfilling.

No comments: