MySQL Abstraction/Helper/Wrapper Class for PHP

By: arvin

I was making a Twitter bot earlier this week and I already finished the logic/control aspect of the bot and all I needed was the part where I needed to store or load the data for every user. And after weighing the choice between using just flat files or a database, I opted for the latter because the app needed it. The thing is, I have not made anything that uses a database for a while, or anything at all :P I made an abstraction class before so I got it from the server of my other website and tried to use it. Tried was the word.

I read my old scripts because I wasn’t sure how to use the class that I made. And I’ll cut the story short, it didn’t work.

I wish it was as simple as using a flat file data source, which I already have a different abstraction class for. So instead of debugging 600+ lines of code, I just made a new one from new file. Back to mysql_connect all over again. And yeah, you read that right, I made a ridiculously long 600-line abstraction class for a couple of PHP functions. It was the time where I started OOP in PHP so I got it all in the box: database server object, database object, table, field, data set, data request, and a whole lot of helper functions and mini classes.

It had a well thought-of data integrity verification process. You could list 20+ different ways to invoke the very same select statement. It could take in arrays, associative arrays, stdclasses, or comma-separated strings for the data. It used func_num_args and func_get_args to give you the idea.

But what I need is just a simple way to store data and load it at a later time.
Read the rest of this entry »

Post a Comment | Trackback | Permalink

Talk to Someone Random

By: arvin

Would you like to talk to someone random today?

I created an omegle-like app but instead of it being a website, you can add it on your IM buddies:) Check out the project page for the details.

Post a Comment | Trackback | Permalink

Sending a Google Voice SMS using PHP

By: arvin

The very first obstacle that I encountered after getting my Google Voice invite was that it needed a US number to be activated. Good thing my girlffriend lives in Texas so we used their home phone for my account’s forwarding number, but before that, I tried using my Bueno account, but Google doesn’t seem to pick up the button presses on Bueno’s softphone. Gone through all that, the very first thing I tried was to be able to send an SMS message from a php script. Read the rest of this entry »

22 Comments | Trackback | Permalink

Technorati Blog Claim Post

By: arvin

6QGTCGHZMXZM

Thinking about it while eating, awhile ago I was wondering why Technorati uses a post to verify blog claims. Why not go with the others like Google Webmaster Tools, MyBlogLog or BlogCatalog where you can either place an html file on your site directory, a meta tag on your homepage, or an image anywhere on your sidebar, anything but a blog post. Posting a blog entry for the sake of a claim disrupts normal blog flow. And even if we could quickly delete this post after the claim, some other websites could have gotten the update already and posted it somewhere.

I’m probably just thinking too much.

Well, Technorati maybe just thought of the people using blog engines that does not allow them to edit their blog’s html source, or save a file on their document root, and believe or not, verification using an image or link placed on the sidebar will not work on Calliope, the Wordpress-derived blog engine used by i.ph where every sidebar widget is placed on an iframe, hosted on a different subdomain. So what’s the one thing that every blog engine support? Posting blog entries.

So now I’m posting this entry so as not to bother deleting this post right after verification, and for you not to just see some randomly-generated claim code.

But why does Technorati not give out any other options on claiming a blog?

Post a Comment | Trackback | Permalink

Hello World!

By: arvin

the tradition of using the phrase “Hello world!” as a test message was influenced by an example program in the seminal book The C Programming Language. The example program from that book prints “hello, world” (without capital letters or exclamation mark), and was inherited from a 1974 Bell Laboratories internal memorandum by Brian Kernighan, Programming in C: A Tutorial, which contains the first known version. http://en.wikipedia.org/wiki/Hello_world

Countless times have I written the hello world program using programming languages from Assembly to Zk. And as with everybody else, that was just the start.

I created this blog to share the code that I have written and will be writing in my life as a blogger and student. This will be my programmer blog, and code archive since using something as formal as google code or github and the like is too much for the simple scripts that I have made.

I have done a few web apps or mashups using different publicly available APIs like Twitter, Google Maps, MyBlogLog, Goodreads, some URL shortening services, etc. which is listed on my other blog kundiman.net, a conjugal blog shared with my girlfriend karmi. I will not be able to move all those services here, primarily because this free hosting service I am using does not provide all the features that several of my scripts require. Well, just one thing. Sending and receiving email.

I can do away with sending emails by using GMail’s SMTP, but is there a workaround to make my scripts parse incoming emails? If only some other website could receive the emails and make a HTTP POST to one of my scripts. That would be wonderful, but I can’t find anybody offering that kind of service.

And I am still figuring out the best way to include my scripts on my blog posts. Do I make a blog entry or a page? Not really sure.

Post a Comment | Trackback | Permalink