Categories
PHP

Google’s Text to Speech API : A PHP Wrapper Class

It’s really amazing how Google is providing cool APIs for every this and that! And here comes another one that impressed me 😀 I am talking about the Text To Speech API by Google. It’s fantastic! I wrote a php wrapper class that would help you create mp3 files from texts 🙂 Of course, using Google as the medium!

Here’s the source code:

And here’s demo :

You can alternatively pass the text to the constructor of the object like this:

That is simple, isn’t that? Hope you like it!

Categories
PHP

FeedParser: A PHP Class for Quick Feed Parsing

Well, it doesn’t require any further explanation — we the web developers know how often we need to parse feeds. It’s a very common practice to use SimpleXML for parsing feeds. But today Hasin vai (Hasin Hayder) showed me a very cool thing — the Google Feed Parser. It’s a web based feed parser that is internally used by Google. The coolest thing about the parser is that it returns data as JSON 🙂

Seeing the point, I quickly fired off my netbeans IDE and wrote a php class for quick feed parsing 😀 Why fetch the feed and then parse it? Let Google handle the parsing and fetch the parsed results 🙂 Google is really making our lives simpler!

Here’s the class definition:

So, how do you use it? Initiate a new FeedParser object and then call the parse() method with the feed URL and entry count. The second parameter is optional and is “5” by default.

So what do we get in the $data array? Good question, lets see :

Categories
Javascript

JSDB: A JavaScript Interpreter

Recently I have taken keen interest in JavaScript, mainly because to handle jQuery better. I have always found JS very cool but never had the time to dig deeper into the language. In this EID vacation at KU, I had plenty of leisure times even after my tasks at Leevio and the free lance jobs. I started passing time with JS and found something really cool that I didn’t know so far.

JavaScript is a programming language. Yeah, just like the interpreted languages like Python, PHP and Ruby, JS is another good old programming language. My ignorance, I never knew this! 🙁 I have always thought that JavaScript is merely a client side scripting language that works with web browsers only 😛

My perceptions started changing few months ago when I saw some server side applications of JavaScript coding. Lately, a few days back I saw the node.js projects which is quite similar to the Twisted project implemented in Python. I started wondering how JS is being interpreted on the server side. Google answered me 😀 There are JavaScript interpreters for even shell scripting 🙂

I first tried the interpreters from Mozilla but unfortunately couldn’t make them work on my machine. So, I switched to JSDB 😀 The interpreter is available free for download at: http://www.jsdb.org/ 🙂

They say on their homepage:

JSDB is JavaScript for databases, a scripting language for data-driven, network-centric programming on Windows, Mac, Linux, and SunOS. JSDB works with databases, XML, the web, and email. It is free and open-source. Use it as a JavaScript shell, to run CGI programs, or as a web server.

Yeah, I indeed use it as a JavaScript Shell 😀

Here is the Documentation of what JSDB has inside. I have made a PDF print out of the page for offline reading!

I really find the tool interesting because I am writing small throw away programs those are not really that much useful but the development curve is contributing to my JS skills 😀