Thursday, January 29, 2009

The Matador

Just now I was having dinner, and the TV was on. We're subscribed to DStv, and while I usually don't watch TV, my computer was busy in the room, so I had to manage until I was done with dinner. M-Net Movies was showing The Matador, and I just happened to watch the scene where Bean (Hope Davis) wakes up and meets Danny (Greg Kinnear) having breakfast. They start kissing and then it gets heavier; Bean asks Danny if he has enough time, Danny already strips to his shorts when he shouts, "Tree!" — and a tree crashes into their kitchen. I could hardly stop laughing. I don't care how hard your hard-on is—a tree crashing where you want to have sex will put a stop to that quickly. No, I didn't stick around to watch the rest of the movie (it's still running now). Oddly enough, while reading about the movie, I found out that Danny asks Bean if she's still horny after the tree crashes. Is he an idiot or what?. Now if I were God...

Baby steps with Mono

Mono is definitely some great software. I downloaded and built Mono on our Asterisk server because it seemed I'd have to develop the application to handle the automated calling on Linux. Not wanting to hurt myself with PHP, Ruby or Python (time frame), I decided to continue using C# and .NET, since I knew enough about Mono to know it is cross-platform. What I wasn't prepared for is just how cross-platform it (and .NET) is. After downloading and building it, I created a "Hello, World" application in it and ran it on the Linux server. I then moved the compiled assembly to my Windows desktop and it ran with the Microsoft .NET framework! After I got home, I built one of my old programs, which had a reference to the excellent FileHelpers library. The library was probably built with Microsoft's tools, but I was able to build (and run) the application using Mono (for Windows).

That's pretty amazing, but the last part is even more amazing. I just tested the Devshock SMPP component (which was definitely built on Windows, using VB.NET), in a program I wrote using Mono on Linux. There's a text on my phone now that proves that .NET is an awesome platform, and Mono is a great cross-platform implementation of that platform. Mono rocks. Period.

Monday, January 26, 2009

Using the Asterisk Manager Interface (AMI) to make calls in C#

for some reasons, i've been interested in using Asterisk.NET (mostly because code completion in a GUI beats grokking code in a command line). one problem i'd always had, though, was making calls. for some reason, i'd just get the message 'Originate failed' returned to me. today i was working on my sample program again, when i got the same error. i then started looking through the Asterisk.NET code to find out what i could be doing wrong. i also dug out my trusty copy of .NET Reflector to analyze the assembly.

the main source of aggravation was that i could use call files, and they'd work. but with Asterisk.NET, at most i'd get a missed call. my code went something like this:

var myManagerConn = new ManagerConnection();
myManagerConn.Hostname = "asterisk-server";
myManagerConn.Username = "admin";
myManagerConn.Password = "god";
myManagerConn.Port = 5038;
var action = new OriginateAction();
action.Channel = "SIP/3595009";
action.CallerId = "3595009";
action.Context = "robocall";
action.Exten = "10";
action.Priority = 1;

myManagerConn.Login();

myManagerConn.SendAction(action);

myManagerConn.Logoff();
after some sniffing around in Reflector, i found the Timeout property for the OriginateAction class. i went looking in the code, and found that Asterisk would set it to a specific value (30000 milliseconds) if it wasn't set. knowing .NET initialization, however, i guessed that the underlying field was probably set to 0, and set the property explicitly to 30000. i ran the program again, and the call came in, the phone kept ringing (yay!) — but the program generating the call threw an exception complaining about a timeout. i increased the timeout to one minute to no avail. i then decided to set the timeout parameter for the SendAction() method of the Asterisk.NET.Manager.ManagerConnection. the resulting call was like this:
myManagerConn.SendAction(action, 30000);
. and the program worked. like that. so i guess i may just be able to get this automated call thing done without using a terminal to the Asterisk server.

Tuesday, January 20, 2009

Installing PEAR on Windows

i wanted to install PEAR on my Windows machine as a prelude to installing symfony. i'd installed PEAR before on Windows, no biee. but when i tried using the batch file to install PEAR today, i was greeted with a list of 12 options after deciding to install a system-wide copy. the last option specified C:\\. as the PHP executable path. every time i changed it to C:\\php.exe, i couldn't continue to install PEAR. i had to leave it as-is, install PEAR, then edit the pear.ini file to specify a correct path. ideas, anyone?

Monday, January 19, 2009

Shallow Relationships

as an example of just how shallow my relationships are, i just told my neighbour "Happy New Year". on the 19th. my neighbour. we live in the same building. and have lived every single day of this year in said building. pretty pathetic, don't you think?

Sunday, January 18, 2009

where's the cotton-pickin' "Undo" command in real life?

quite a bit has happened since i was here last. for one thing, it's now over 5 years since my mum passed on. and it seems that my dad is "officially moving on" — whatever that means in English. monday i was going home from work, and i saw this really hot (translate: hawt) chick getting out at Obalende. great body, pretty as a flower and had this really nice musical voice (i have no idea what that means either, but it sounds good ;)…and i started thinking about my life.

an ache i hadn't felt in a while came up (though i did the sensible thing and went looking for my next bus instead of gawking), an ache to have someone to hold, to talk to (don't act like you never felt it before! guys really want to have a beaty to rescue!)…and all that. there is no such person in my life. and in the last couple of months, i've been asked (subtly and non-too-subtly) quite a number of times about my "relationshipital" status. no, there's no one either here or on the horizon. so if i really want to hug someone, i'd better grab my pillow. and maybe weep into it. except i'm not that lame. or so i'd like to think. or maybe not. either way, it doesn't really matter since what i do with my pillow doesn't affect the price at which i buy fish in the market.

it's not like i've lacked opportunity to dig trenches and build bridges. at least i'm not in the "women are irritating" phase right now (on the contrary, they're currently interesting — but shall this soon come to pass also? i'm unhurried :D) it's just that for the most part — i get bored (ladies, seriously, it's got nothing to do with you. i easily get "bored" normally. so don't show up at my house with pitchforks, ok? ;), for lack of a better description. maybe they piss me off. maybe i piss them off. i dunno. rare has been the woman who held my attention for 6 weeks or more. i think i broke something. though i can't tell. few and far between are the friends with whom i share my secrets. that's another thing i realized. i've so many shallow relationships, i may just be scared of a real relationship. it's really easy to say, hi, bye. hey sweetie, you're looking good and all that crap, but…i need real relationships. not plastic people with vinyl smiles that are cracked and faded. i'm not even sure where this is coming from. despair? regret? but then, where exactly did i miss it? dunno. maybe this is just a random rant coming from a testosterone overload, but it doesn't matter. since it really doesn't affect the price of fish, anyway.

all said and done, i'll was over it in a couple of hours, then wonder why in the world i posted this anyway. since i wasn't the one who killed Jesus, and i'm not the third leg in humanity. just for fun, i wonder what kind of person would lose sleep thinking about me (ladies, here's an itty bitty cheat sheet: guys want to know you're thinking of them too. really. even though they act tough. guys like me, anyway. unless of course, i'm right and i'm in the minority ;). anyway, enough ranting. off to bed to start what i believe will be a glorious week. why? we two oddballs are going to be spending more time together. and it won't matter that there is no trench in progress. who's the other oddball? naisho da. have a great week!

PS: last year, i needed to do a head scan. i was somewhat excited about it because i believed that i would finally find out what nuts and whatnots were not in place in my head. the result came back…normal. seriously. i had a regular brain like everyone else. not a clockwork one. or an electronic one (might have fried a few circuits). it felt like a letdown. yet another proof that despite my best efforts, ore wa tada no ningen. ah well.

Saturday, January 10, 2009

2009!

still here. yep, opened this year rather late, but it's no biggie. 2008 was a great year, and i have high expectations of myself this year. nothing works until you make it work by finding how it should work then putting that knowledge into practice. so go out and make it a great year for yourself. and one more thing: new year resolutions suck. don't bother. just make normal decisions and live by them.