Categories
Work

Avro Phonetic Web User Control for ASP.NET

The idea is pretty simple: A web user control for ASP.NET that loads the Avro Phonetic keyboard and binds the text inputs and text areas.

The control can be downloaded from: http://masnun.googlecode.com/files/Avro.zip

How to use it?

1) Extract Avro.zip and you shall get two files in the Avro folder: “Avro.ascx” and “Avro.ascx.cs”. First one is the user control and second one is the codebehind file.

2) Crate a new website project in Visual Studio or open your existing project.

3) Copy the above mentioned two files (NOT the entire directory, just the files) into your project. For better organization you might want to create a “Controls” directory (if you haven’t already). Paste the two files inside your desired directory.

4) Now, we add the controls to a web form. Open a page, say Default.aspx. Just below the Page directives, add the following Register directives to register the control:

Here, Src is the location to the Avro.ascx file. TagPrefix and TagName makeup the custom tag that loads the control. In this case, you now have a <asp:Avro> tag which you can use to load the control.

5) Let’s add the control:

The control accepts two attributes – “Bangla” and “Callback”. Setting Bangla to “true” or “false” enables or disables Bangla by default. The Callback attribute accepts the name of a Javascript function which is called when the keyboard state changes.

6) Let’s test the control by adding a text area and the defined callback function:

Load the web page in your browser. If you have Firebug installed in Firefox, the callback should print out state of the Bangla layout on the console.

For brevity, here is my entire Default.aspx file:

Categories
Javascript PHP Work

Avro Phonetic Plugin for WordPress

Rifat vai has released an awesome jQuery plugin which adds Avro Phonetic layout to your text inputs. I converted it into a WordPress Plugin. Hats off to Rifat vai for the awesome job!

How to use it?

Click on the download link below. It should show you the raw php source of the plugin file. Save it as “avro-phonetic.php” and upload the file to “wp-content/plugins/” directory. Now go to your “Plugins” page from WP Dashboard. Activate the plugin.

Download: https://raw.github.com/masnun/Avro-Phonetic-WP-Plugin/master/avro-phonetic.php

Github Repo: https://github.com/masnun/Avro-Phonetic-WP-Plugin

Official Page: http://torifat.github.com/jsAvroPhonetic/

Knows Issues:

  • Doesn’t work with the Visual Editor (TinyMCE) of WordPress. Please use the HTML editor.
  • Doesn’t show any visual clue of which language (English or Bangla) is active.

    It now shows a black box with language identification

    Thanks to the Avro team for the nice icons.

  • Ctrl + M toggles between Bangla and English. It’s your responsibility to let the users know how to use it. The plugin doesn’t have any fancy instructions displayed to the users.

    It now has a widget. Add the widget to your sidebar.

  • Forces to load jQuery 1.7.2 without caring if an older version is already loaded. Had to do this because wp_enque_script() was not loading jQuery on some themes/setup.

    Thanks to Mehdi vai, the loading is now done using JS after checking if a version is loaded already! 🙂

Contribute:
Feel free to fork the codes on Github and send me pull requests. If you’re not used to Git, send me the modifications over email. I shall merge them and commit. My email address is available on masnun.com 🙂

Have fun!

Categories
PHP Work

PhpTube: A PHP Class to get download links from Youtube Watch URLs

THE API HAS BEEN BROKEN FOR A LONG TIME, AND I DON’T WANT TO FIX IT SINCE THERE ARE BETTER ALTERNATIVES LIKE “youtube-dl”.

Let me get to it straight: I wrote a php class that takes a youtube watch url (the typical url to watch a video, the url has a “watch” GET parameter in it) and returns the download links for different available formats of the video. Please note that these links will be valid for the requesting IP address. That is you can not download the videos from other IP addresses except the only one IP adress that actually originated the download request. So if you put it on your server and send these links to your users, they’ll certainly not be able to download from these links since their IP addresses will be different from your server IP address. In that case, you should first download it to your server and then link to those downloaded videos.

You can download the source codes from my github repo: https://github.com/masnun/phptube 🙂

An example:

Output: