Friday, October 26, 2012

In Android: Long press = right click

Share anyone?
I just sat through an IPad demo for education. The demo was basically about using IPad as a teaching tool for college/university level instruction. It was pretty good but then I notice something wrong amiss with the IPads. You can't just share data between apps like I just can't just pass links from say Safari to Chrome.You have to do a copy-paste procedure which is kinda stupid and unnecessary.

For Android old-timers, doing stuff like that is a piece of cake. Just do a long press and you will be presented a "Share via" option and then you can send where you want it and the target know what to do with it.

New Android people seem to be limited to point-click and swiping with their phones and/or tablets. If they do a long presses on stuff in their phones they'll discover a whole new layer of features to play around with.

Android programmers know this as "Intents". In Android, the 3 core components of an application — activities, services, and broadcast receivers — are activated through messages, called intents. Thus allowing my app to pass data and stuff to other apps. That's cool in every which way you look at it. Which begs the questions:

Why the copy-paste procedure Apple?

Edit: Apparently, Windows Phone does the same with Bing Search and Internet Explorer. That's sad.

Saturday, October 20, 2012

Drupal Extended Filtered HTML tags

In Drupal (no matter the version), content editing uses text filters to "sanitize" the output. The text format contains filters that change the user input, for example stripping out malicious HTML or making URLs clickable. One of these filters is "Filtered HTML"; Due to security reasons, enabling Full HTML is only an option for trusted users.

But the default set of allowed HTML tags for "Filtered HTML" is quite narrow and limited. So, the first thing to do is to extend the list of allowed tags to:

<a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <<sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <strike> <caption>  

But remember, "Filtered HTML" not only strips disallowed tags, but also strips inline style definitions.

Saturday, October 13, 2012

Installing Maven 3 in Ubuntu 12.04 Precise

Ubuntu needs to no explanation and Maven is software project management tool. It manages software dependencies and how your code is compiled and deployed. Its pretty handy because now I don't have to hunt down jars that my other jars need and no more copying the binaries to target folders.

Unfortunately, the Ubuntu repos are a bit slow. The repos only have Maven2. Now, let's get to installing Maven3.

1. Install the Nate Carlson's PPA for Maven3
2. Open a terminal console and type in: sudo apt-get update
3. After update finishes, type in: apt-get install Maven3

You now have Maven3 installed but you can't run it from the terminal because you didn't set the paths. If you try to type: mvn --version; That should fail. To fix this you have to make a symbolic link from where Maven3 is installed to where it can be run it "globally" from the terminal.

$ sudo ln -s /usr/share/maven3/bin/mvn /usr/bin/mvn

You just created a symbolic link in /usr/bin/mvn. The mvn command now should work in your terminal.

Update (3/29/2013):
Caution: command "sudo add-apt-repository ppa:natecarlson/maven3" did not work on my Ubuntu and and had to run "sudo add-apt-repository -rm ppa:natecarlson/maven3" to get my apt-get to work again. ~AmirHD
See this Stackoverflow thread.