Sunday, April 29, 2007

Cute C/C++ puzzles from meebo

since I couldn't run Yahoo! Messenger, I went to Meebo and curiously browsed at their jobs page. (yeah, right)

anyway, they are hiring c/c++ developers and had these nifty little c/c++ questions that tests if you're alright for the job. Here were the samples.

Puzzlers! Try these out :)

1. With these variable declarations: int i, j[10], *k;
Which of the following are legal?

a. i = *(&(j[2]) + 1);
b. k = &(j[1]);
c. i = &(j[2]) + 1;

2. Assuming the function lookupName is defined, what’s wrong with this code (hint: 2 bugs)?

const char *getName(const char *c) {
std::string name = lookupName(c);
if (name == NULL)
return "Anonymous";
return name.c_str();
}


int main(int argc, char *argv[]) {
const char *name = NULL, *c = NULL;
if (argc >= 2)
c = argv[1];
name = getName(c);

printf("My name is %s\n", name);
return 0;
}

3. What’s wrong with this program? If you were to fix it, what would the intended output be?

void swap(char *str, int index1, int index2) {
char tmp = str[index1];
str[index1] = str[index2];
str[index2] = tmp;
}

int main(int argc, char *argv[]) {
char *planet1;
char *planet2;

planet1 = (char *) malloc(7 * sizeof(char));
if (!planet1)
return 0;

snprintf(planet1, 7, "Jupiter");
planet2 = "Saturn";

swap(planet1, 0, 3);
swap(planet2, 3, 4);

printf("results: %s and %s\n", planet1, planet2);
return 0;
}

yes, I'm so geeky. but it looks fun. :)

a healthy dose of loving from support

I went to the office Saturday in hopes of a quiet and peaceful environment from the hellhole I call home, only to go there to work. o_O

Anyway, client side counterparts complained of the simulator producing a core. the group decided that we valgrind the simulator for memleaks.

So I fixed another memleak yesterday reported by nina and assisted the team assigned that day on their tasks. I had to log in since I wasn't really expecting on doing actual work.

Anyway, I took a lighter load and just watched simpsons and reading ctrl+alt+del comic strips, which I am faithfully reading until i just get the daily dose.

I left my computer running and hopefully, HOPEFULLY, i won't get called for support tomorrow. T_T

Friday, April 27, 2007

gaim-terminal

I think my gaim window looks like a gnome-terminal, or maybe it's just me...

This is my gaim window...

This is my gnome-terminal...

They are totally different but they share similar qualities...
Both allows you to type something
Both may or may not give you response
Both have scrollbars so you can view the history
Both have tabs to managed multiple instances
Both have colors and themes to match your preferences

I sometimes mistakingly type console commands in my gaim window.
Although they do share some qualities, I like my gnome-terminal more.

Why?

1. gnome-terminal is fair
- it does not judge you for what you say

2. gnome-terminal is kind
- it does not say bad words

3. gnome-terminal is obedient
- it does what you tell it to do without asking why

4. gnome-terminal is forgiving
- it does not get mad at you no matter how many times you make mistakes

5. gnome-terminal is patient
- it continuously waits for your response

6. gnome-terminal is smart
- it (bash) completes my words and gives suggestions too

There are just some of the reasons why I like my gnome-terminal more...
I wish gaim behaves more like my gnome-terminal... :)

Thursday, April 26, 2007

well sometimes you really just...blow up.

when I got to work this morning, did the usual, procrastinate, settled on my messy, only-me-can-understand desk, and checked the emails.

so our counterparts have told our AM that they have found (yet again) another set of simulation mistakes from their target environment, which was never installed here because they couldn't really give us proper guidance with regards to their own nodes.

AND, they wanted us to investigate why this is happening, on THEIR target node, because they blamed our simulator for the mistakes of their target node.

he sent an e-mail to the project group, with a little P.S. note after the obligatory closing comments.
Oh, give me a break!
that made me laugh this morning.

Tuesday, April 24, 2007

aging foreigner higher-ups == worthless

i had a very lively conversation with the in-house admin regarding the deployment of some critical systems in the network. This deployment is something I've been planning and gunning for since time eternal (around 3 years). The current item in question is very old, looks like its a thread away from completely disintegrating, and is undeniably flaky, yes, like a girl. :P

The in-house admin has already completed everything. The new item is constructed, tested and is ready to go, deployment plans are completed. Scheduled to the T. The local foreigner higher-up has also OK'd the entire thing. Lo and behold, the foreigner higher-up at the other location is asking for some weird explanation on how it fits into the IT policy. WTF has this to do with policy? This is preventive maintenance you tool! This is standard procedure across the IT industry!

This is a nightmare. The higher-ups, who I am sad to say half the time do not know what they are doing, are turning into hybrid-Americans, fixated on policies and committees and meetings. Had they been as competent as the real norteamericanos, this could be a little more palatable. Sinverguenza.

I told the netad to keep all the correspondence between him and the person in question. Hey, we did what we can, planned, constructed and scheduled. That tool stopped the deployment. We can protect this company from damages resulting from equipment failure. That's what were doing here now. What we can't do is protect it from managers who can't tell where common sense should start and fanatical devotion to policies end.

pointsec == pointless

just because i have installed the wrong windows for my laptop at the office, i have to scrap out my current OS (completely skinned, patched and primped) to go back to a hell of an installation period.

I left the laptop for pointsec and left a sticky explaining to self-righteous people not to shut my laptop down since its still doing some encryption.

Talk about a total waste. It was a darned good thing our group was pretty free of work. For now.

now stitch (my computer at work) looks so plain and drab and so windows. x(

Monday, April 23, 2007

Hoy! Bawal PDA!

Just to make this a bit lively.

I was passing lengua de gato around the nearby cubes when I saw a couple of girl officemates who are hugging.

I shouted to them. "Hoy, bawal PDA" PDA is Prohibited.

Well not only did I startle the two of them, I also startled the guy who was actually using his PDA next to me...

Guilty as charged.