Thursday, February 17, 2005

The Evolution of a Programmer

High School/Jr.High
10 PRINT "HELLO WORLD"
20 END

First year in College
program Hello(input, output)
begin
writeln('Hello World')
end.

Senior year in College
(defun hello
(print
(cons 'Hello (list 'World))))

New professional

#include <stdio.h>
void main(void)
{
char *message[] = {"Hello ", "World"};
int i;

for(i = 0; i < 2; ++i)
printf("%s", message[i]);
printf("\n");
}

Seasoned professional
#include <iostream.h>
#include <string.h>

class string
{
private:
int size;
char *ptr;

string() : size(0), ptr(new char[1]) { ptr[0] = 0; }

string(const string &s) : size(s.size)
{
ptr = new char[size + 1];
strcpy(ptr, s.ptr);
}

~string()
{
delete [] ptr;
}

friend ostream &operator <<(ostream &, const string &amp;amp;amp;amp;amp;
amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;);
string &operator=(const char *);
};

ostream &operator<<(ostream &stream, const string &s)
{
return(stream << s.ptr);
}

string &string::operator=(const char *chrs)
{
if (this != &chrs)
{
delete [] ptr;
size = strlen(chrs);
ptr = new char[size + 1];
strcpy(ptr, chrs);
}
return(*this);
}

int main()
{
string str;

str = "Hello World";
cout << str << endl;

return(0);
}

Master Programmer
[
uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
]
library LHello
{
// bring in the master library
importlib("actimp.tlb");
importlib("actexp.tlb");

// bring in my interfaces
#include "pshlo.idl"

[
uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820)
]
cotype THello
{
interface IHello;
interface IPersistFile;
};
};

[
exe,
uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
]
module CHelloLib
{

// some code related header files
importheader(<windows.h>);
importheader(<ole2.h>);
importheader(<except.hxx>);
importheader("pshlo.h");
importheader("shlo.hxx");
importheader("mycls.hxx");

// needed typelibs
importlib("actimp.tlb");
importlib("actexp.tlb");
importlib("thlo.tlb");

[
uuid(2573F891-CFEE-101A-9A9F-00AA00342820),
aggregatable
]
coclass CHello
{
cotype THello;
};
};


#include "ipfix.hxx"

extern HANDLE hEvent;

class CHello : public CHelloBase
{
public:
IPFIX(CLSID_CHello);

CHello(IUnknown *pUnk);
~CHello();

HRESULT __stdcall PrintSz(LPWSTR pwszString);

private:
static int cObjRef;
};


#include <windows.h>
#include <ole2.h>

#include <stdio.h>
#include <stdlib.h>
#include "thlo.h"
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"

int CHello::cObjRef = 0;

CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk)
{
cObjRef++;
return;
}

HRESULT __stdcall CHello::PrintSz(LPWSTR pwszString)
{
printf("%ws
", pwszString);
return(ResultFromScode(S_OK));
}


CHello::~CHello(void)
{

// when the object count goes to zero, stop the server
cObjRef--;
if( cObjRef == 0 )
PulseEvent(hEvent);

return;
}

#include <windows.h>
#include <ole2.h>
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"

HANDLE hEvent;

int _cdecl main(
int argc,
char * argv[]
) {
ULONG ulRef;
DWORD dwRegistration;
CHelloCF *pCF = new CHelloCF();

hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

// Initialize the OLE libraries
CoInitializeEx(NULL, COINIT_MULTITHREADED);

CoRegisterClassObject(CLSID_CHello, pCF,
CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &dwRegistration);

// wait on an event to stop
WaitForSingleObject(hEvent, INFINITE);

// revoke and release the class object
CoRevokeClassObject(dwRegistration);
ulRef = pCF->Release();

// Tell OLE we are going away.
CoUninitialize();

return(0); }

extern CLSID CLSID_CHello;
extern UUID LIBID_CHelloLib;

CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */
0x2573F891,
0xCFEE,
0x101A,
{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
};

UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */
0x2573F890,
0xCFEE,
0x101A,
{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
};

#include <windows.h>

#include <ole2.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "pshlo.h"
#include "shlo.hxx"
#include "clsid.h"

int _cdecl main(
int argc,
char * argv[]
) {
HRESULT hRslt;
IHello *pHello;
ULONG ulCnt;
IMoniker * pmk;
WCHAR wcsT[_MAX_PATH];
WCHAR wcsPath[2 * _MAX_PATH];

// get object path
wcsPath[0] = '\0';
wcsT[0] = '\0';
if( argc > 1) {
mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1);
wcsupr(wcsPath);
}
else {
fprintf(stderr, "Object path must be specified\n");
return(1);
}

// get print string
if(argc > 2)
mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1);
else
wcscpy(wcsT, L"Hello World");

printf("Linking to object %ws\n", wcsPath);
printf("Text String %ws\n", wcsT);

// Initialize the OLE libraries
hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED);

if(SUCCEEDED(hRslt)) {


hRslt = CreateFileMoniker(wcsPath, &pmk);
if(SUCCEEDED(hRslt))
hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello);

if(SUCCEEDED(hRslt)) {

// print a string out
pHello->PrintSz(wcsT);

Sleep(2000);
ulCnt = pHello->Release();
}
else
printf("Failure to connect, status: %lx", hRslt);

// Tell OLE we are going away.
CoUninitialize();
}

return(0);
}

Apprentice Hacker
#!/usr/local/bin/perl
$msg="Hello, world.\n";
if ($#ARGV >= 0) {
while(defined($arg=shift(@ARGV))) {
$outfilename = $arg;
open(FILE, ">" . $outfilename) || die "Can't write $arg: $!\n";
print (FILE $msg);
close(FILE) || die "Can't close $arg: $!\n";
}
} else {
print ($msg);
}
1;

Experienced Hacker
#include <stdio.h>
#define S "Hello, World\n"
main(){exit(printf(S) == strlen(S) ? 0 : 1);}

Seasoned Hacker
% cc -o a.out ~/src/misc/hw/hw.c
% a.out

Guru Hacker
% echo "Hello, world."

New Manager
10 PRINT "HELLO WORLD"
20 END

Middle Manager
mail -s "Hello, world." bob@b12
Bob, could you please write me a program that prints "Hello, world."?
I need it by tomorrow.

Senior Manager
% zmail jim
I need a "Hello, world." program by this afternoon.

Chief Executive
% letter
letter: Command not found.
% mail
To: ^X ^F ^C
% help mail
help: Command not found.
% damn!
!: Event unrecognized
% logout

Wednesday, February 09, 2005

Dead disk drive? What would Fonzie do?

From: http://hardware.newsforge.com/article.pl?sid=05/01/31/1924226&from=rss--

In the '70s TV show "Happy Days," the character Fonzie was so cool
that he could make a dead jukebox play just by giving it a thump in
the right spot. If Fonzie were working on computers today, he'd
probably use some of these tricks for getting a reluctant hard drive
to come across with its data.

When a previously working disk drive suddenly won't come up at boot
time, one approach is to try freezing it. I don't know whether the
cold realigns the components or the condensation that forms when you
remove the drive from the icebox has a positive effect, but this
technique actually works. It revived a laptop drive of mine that quit
suddenly this morning.

Sometimes the problem isn't with the hardware but with a key system
component. In that case, you may be able to boot with a Linux LiveCD,
mount the drive, and copy off all your crucial files. This trick works
whether your hard drive was running Linux or Windows, as long as the
LiveCD understands the filesystem on the drive.

Of course, that assumes you have space to which you can copy the data.
Sometimes it's handy to just mount your laptop hard drive on a desktop
PC to copy the data quickly. Unfortunately, laptops and desktops use
different IDE connectors. But heeeey, that's not a killer problem.
Cables to Go makes a laptop-to-IDE hard drive adapter that lets you
hook up the notebook drive to your desktop PC. I just ordered one this
morning -- the cheapest I could find was at TechSunny.com.

Sunday, February 06, 2005

6 yrs after college

The long awaited get-together of our college yahoogroup has finally happened last feb4 (mali lang yung date sa cam).


college friends (clockwise) : jhem, melody(jhem's fiancee), jen, tochi, bell, mark, alvin, ed, gabo


pwestu!


"akin kayo!" - Tochi


hanapin si baluyot


hanapin si mark

Saturday, February 05, 2005

Happy Bday Darwin!

pre, happy bday. thanks sa ice cream :)

webcam


This image is taken live from our office every 5 minutes.

Friday, February 04, 2005

You're Fired!


Season 3 of the hit reality show The Apprentice has just started 2 weeks ago in the states. This time, Its the book-smarts vs the street-smarts. 8 with college degree and 8 with just high school diploma. As of this writing, i have seen the first 2 episodes. The first week, the street-smarts won. Second week, it was the book-smarts. This show is really exciting to watch, and at the same time educating. I gotta get the torrent for the 3rd episode asap. anyone?

Wednesday, February 02, 2005

Coke Commercial

familiar eh?
coke commercial uk version

Come On, Lets Join Us

Is it Dennis Padilla or someone else who said that in a movie? Uhmm cant remember. Anyway, I'm calling all members of the yahoogroup called buttercup_99 (geez, can we have another name pls
hehe) to attend a get-together on feb 4 around 8pm at glorietta. Pls invite our other college batchmates as well. Oh by the way, KKB to ha. Pero sana maging generous si Mark Romacruz hehe. Txt txt na lang :)

Why you shouldnt buy a Mac

found this posted in tipidpc.com

http://members.cox.net/clyqz/macs.html

Mourning Day

Nope, wala namang namatay but our office looks like parang namatayan.
Lahat walang ganang magwork or magsaya man lang. We just received our
pay yesterday and yet we arent happy. Eh paano ba naman, mabawasan ka ba naman ng almost half ng salary mo ng deductions! Income tax, SSS,
Pagibig, and Philhealth. All of these were deducted from the same
payday at end of the month pa ha. Eh syempre pag end of the month, we
have to pay our bills and all tapos you'll only get half of what
you're expecting! Employees went into panic and immedfiately requested
for a meeting. Actually yung office lang namin sa legaspi ang
nagmeeting, lucky them nandoon yung accounting ng company. Eh kami
dito sa manila office kami kami lang, wala kaming matanong about this
and that. I sent a message to an accounting personnel in legaspi
office but didnt replied. Haaayyy, kakapagod na magwork if you'll know
naman na half of it will be paid for taxes. I know we should pay for
our taxes, pero kasi this is the first time na nagdeduct ng tax sa
company namin and we havent informed beforehand that they're gonna do
it so lahat kami surprised talaga. Tapos yung computation pa ng salary
naman, eh matagal na naming inaargue with our manager yun. Kasi per
hour ang computation ng salary namin kahit na monthly ang rate namin.
So ayun ang nangyari, sira ang budget namin. One of my officemates
here pays for his house at 6k a month but he only got 5k for this
payday. Eh paano pa yung budget nya for his family's food, etc. Sa
akin naman, 1k na lang natira that i can spend until the next payday.
Grabe talaga, if only i can talk to the accounting face-to-face i
would have said things that may offend or hurt her. It is really a sad
day for us here at the office. We all do our job, and we finish our
tasks as fast as we can and yet we dont feel like we are working for a
company that deserves our hardwork. ano ba direk, tama na! naiiyak na ko :)

Tuesday, February 01, 2005

Resignation Every Week

3 employees from the company im currently working with resigned. One on every week for the last 3 weeks. Philip, one of our software engineers, left 3 weeks ago. Mc, my long-time co-worker/roommate/friend, left last week to pursue his dream of becoming a pilot someday. This week, the only woman in our Manila office had her last work day today. Grabe, kakawalang gana na tuloy magwork dito. Ive been wanting to leave na nga rin kaya lang im thinking that when all of the employees here left at ako na lang ang matira eh they might want to sponsor me para sa LA office na lang ako magwork nyahaha. asa ka pa alvin! basta pag kumita lang ako sa networking business ko, alis na agad ako then punta ako NJ :)