Enabling HTML5 for Blipblip.tv in WordPress plugin Video Sidebar Widgets

English Begin E

The problem

Visiting my blog from a tablet I noticed that theBlip.Tv videos I set in Video Sidebar Widgets were not shown. Doing a research I realized the plugin loaded the old flash-based player  instead of the HTML5 version, so videos coudn’t be played from mobile devices with not flash support, which are the majority of the handheld systems nowadays.

The solution

I just had to add some conditionals in files helper-functions.php and class-videosidebarwidget.php to consider the Blipblip.tv case and thus I added the HTM5 player. In particular, I added the following lines to helper-functions.php:

elseif($admin=="true"){
 if($source == "Blip"){
 echo "\n<iframe src=\"$value.html?p=1\" width=\"250\" height=\"250\" 
 frameborder=\"0\" allowfullscreen>
 </iframe> 
 
 <embed type=\"application/x-shockwave-flash\" src=\"http://a.blip.tv/api.swf#$v_id2\" 
 style=\"display:none\">
 </embed>\n\n"; 
 }else{ 
 // echo video in admin
 echo "\n<object width=\"212\" height=\"172\">\n";
 echo $flashvar;
 echo "<param name=\"allowfullscreen\" value=\"true\" />\n";
 echo "<param name=\"allowscriptaccess\" value=\"always\" />\n";
 echo "<param name=\"movie\" value=\"$value\" />\n";
 echo "<param name=\"wmode\" value=\"transparent\">\n";
 echo "<embed src=\"$value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" ";
 echo "allowfullscreen=\"true\" allowscriptaccess=\"always\" ";
 echo $flashvar2;
 echo "width=\"212\" height=\"172\">\n";
 echo "</embed>\n";
 echo "</object>\n\n";
 }
}else{

And in file class-videosidebarwidget.php I edited the below code:


case 'Blip': $rv_value = "http://blip.tv/play/$Embed_id"; $rv_flashvar = ""; $rv_flashvar2 = ""; $rv_cap = $Embed_cap;

And I added the following lines:

if($select_source == "Blip"){ 
 echo "\n<iframe align=\"left\" src=\"$rv_value.html?p=1\" width=\"$RV_width\" height=\"$RV_height\" 
 frameborder=\"0\" allowfullscreen>
 </iframe>
 
 <embed type=\"application/x-shockwave-flash\" src=\"http://a.blip.tv/api.swf#$Embed_id\" 
 style=\"display:none\">
 </embed>\n\n";
}else{
 echo "\n<object width=\"$RV_width\" height=\"$RV_height\">\n";
 echo $rv_flashvar;
 echo "<param name=\"allowfullscreen\" value=\"true\" />\n";
 echo "<param name=\"allowscriptaccess\" value=\"always\" />\n";
 echo "<param name=\"movie\" value=\"$rv_value\" />\n";
 echo "<param name=\"wmode\" value=\"transparent\">\n";
 echo "<embed src=\"$rv_value\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" ";
 echo "allowfullscreen=\"true\" allowscriptaccess=\"always\" ";
 echo $rv_flashvar2;
 echo "width=\"$RV_width\" height=\"$RV_height\">\n";
 echo "</embed>\n";
 echo "</object>\n\n";
 }
 if(!empty($rv_cap)){echo "<p class=\"VideoCaption\">$rv_cap</p>\n\n";};
 
 
 echo $after_widget;
 }

After these changes random HTM5 videos are loaded without problems.

Plugin support

By the way, I tried to contact the plugin developer to include these changes and he said he had not time for doing it. It a shame it’s not open-sourced so somebody else can maintain the code.

,

No Comments

How to install VMWare Tools on Red Hat and CentOS

 

VMWare how to install VMWare tools on CentOS and Red Hat - running If you need to install VMWare Tools on virtual machines running Red Hat or CentOS as operating system, you can follow the procedure described next:

Procedure

First of in VMWare vSphere locate the virtual machine you want to install the VMWare Tools and click on “Install VMWare Tools” as shown in the next image: VMWare how to install VMWare tools on CentOS and Red Hat You will see a dialog window indicating that the VMWare Tools will be mounted by clicking on the “mount” button. Then in the virtual machine where you want to install the VMWare Tools you must do the following in the terminal:

# mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only

# cp /mnt/VMwareTools-9.0.0-782409.tar.gz /opt/

# cd /opt/
# tar xvzf VMwareTools-9.0.0-782409.tar.gz

# cd vmware-tools-distrib/

#./vmware-install.pl

The latter is a script which will ask you questions related to the VMWare Tools intallation. In genersl terms the default option are okay, but if you want to modify any parameter you can change any value according to your needs:

Creating a new VMware Tools installer database using the tar4 format.

Installing VMware Tools.

In which directory do you want to install the binary files?
[/usr/bin]

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc/rc.d]

What is the directory that contains the init scripts?
[/etc/rc.d/init.d]

In which directory do you want to install the daemon files?
[/usr/sbin]

In which directory do you want to install the library files?
[/usr/lib/vmware-tools]

The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]

The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]

The installation of VMware Tools 9.0.0 build-782409 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes]
Initializing...

Making sure services for VMware Tools are stopped.

The VMware FileSystem Sync Driver (vmsync) allows external third-party backup
software that is integrated with vSphere to create backups of the virtual
machine. Do you wish to enable this feature? [no]

Found a compatible pre-built module for vmci. Installing it...

Found a compatible pre-built module for vsock. Installing it...

The module vmxnet3 has already been installed on this system by another
installer or package and will not be modified by this installer. Use the flag
--clobber-kernel-modules=vmxnet3 to override.

The module pvscsi has already been installed on this system by another
installer or package and will not be modified by this installer. Use the flag
--clobber-kernel-modules=pvscsi to override.

The module vmmemctl has already been installed on this system by another
installer or package and will not be modified by this installer. Use the flag
--clobber-kernel-modules=vmmemctl to override.

The VMware Host-Guest Filesystem allows for shared folders between the host OS
and the guest OS in a Fusion or Workstation virtual environment. Do you wish
to enable this feature? [no]

Found a compatible pre-built module for vmxnet. Installing it...

The vmblock enables dragging or copying files between host and guest in a
Fusion or Workstation virtual environment. Do you wish to enable this feature?
[no]

!!! [EXPERIMENTAL] !!!
VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. By selecting yes,
you will be enabling this experimental feature. You can always disable this
feature by re-running vmware-config-tools.pl.

Would you like to enable VMware automatic kernel modules?
[no]

No X install found.

Creating a new initrd boot image for the kernel.
vmware-tools start/running
The configuration of VMware Tools 9.0.0 build-782409 for Linux for this running
kernel completed successfully.

You must restart your X session before any mouse or graphics changes take
effect.

You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the
command line.

To enable advanced X features (e.g., guest resolution fit, drag and drop, and
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.

Enjoy,

--the VMware team

Found VMware Tools CDROM mounted at /mnt. Ejecting device /dev/sr0 ...
No eject (or equivilant) command could be located.
Eject Failed: If possible manually eject the Tools installer from the guest
cdrom mounted at /mnt before canceling tools install on the host.

When the script had finished the VMWare Tools will be installed on the virtual machine. Now you can umount the ISO by doing:

# umount /mnt

Theb in VSphere you can check that VMWare Tools are running as shown in the first picture of this articl.

,

No Comments

Programming Mobile Applications for Android Handheld Systems course

Programming Mobile Applications for Android Handheld Systems

Coursera just sent me the certificate for completing with distinction the course Programming Mobile Applications for Android Handheld Systems. This course is endorsed by the university of Maryland and lectured by Dr. Adan Porter.

Something worthy to mention about this Android course is that it’s really well structured, and the good quality of the videos and assignments. It makes me recall my time at college because the projects are very organized with clear objectives. In fact project’s evaluations are done automatically with JUnits. But the final project is evaluated by other peers (4 in total).

For this course I took the Signature Track, which is the paid option where the identity is checked by a keyboard pattern recognition software and verified by checking  the student’s photo (at the end of the course some assistants check those pics). With these validations they grant a certificate that can be verified using the following links:

If you are interested in this course, you can see the course’s content follow the above link.

,

4 Comments

How to move a physical volume on LVM

LVM move

If you need to move data from one disk to another one you could think in copying the data with cp, rsync, or any other tool, and then umount the partition, edit the /etc/fstab file to point to the new path, and all that involve to remove a disk or partition for another one. But if you forcasted and partitioned using LVM, there is a cleaner way of changing partitions on the fly, I mean, without umounting partitions and even leaving the same references in the /etc/file, because the same LVM partition will be used. Let’s see an example: if you have a 50 GB disk as a physical volume in /dev/sdb, which is set in a volume grup called data, and you need to move all data to another disk /dev/sdc, just do the following. First the initial distribution si shown:

LVM concepts

You can check the current state of the physical volumes using the pvs command:

# pvs
PV VG Fmt Attr PSize PFree
 /dev/sda2 system lvm2 a- 19.77g 0 
 /dev/sdb data lvm2 a- 50.00g 0

Then create the physical volume where the data will be moved:

# pvcreate /dev/sdc
 Physical volume "/dev/sdc" successfully created

Check the physical volumes again:

# pvs
PV VG Fmt Attr PSize PFree 
 /dev/sda2 system lvm2 a- 19.77g 0 
 /dev/sdb data lvm2 a- 50.00g 0 
 /dev/sdc lvm2 a- 50.00g 50.00g

Now check the volume groups:

# vgs
VG #PV #LV #SN Attr VSize VFree
 data 1 1 0 wz--n- 50.00g 0 
 system 1 6 0 wz--n- 19.77g 0

As you can see the volume group called data sizes 50 GB. Because this is the volume group which have the physical volume you want to move (/dev/sdb), you must add the physical volume to this group:

# vgextend data /dev/sdc
 Volume group "data" successfully extended

If you check it one more time you will see that the volume group has 100 GB  which correspond to  /dev/sdb (0 GB free) y /dev/sdc ( 50 GB free):

# pvs
PV VG Fmt Attr PSize PFree 
 /dev/sda2 system lvm2 a- 19.77g 0 
 /dev/sdb data lvm2 a- 50.00g 0 
 /dev/sdc data lvm2 a- 50.00g 50.00g
# vgs
 VG #PV #LV #SN Attr VSize VFree 
 data 2 1 0 wz--n- 99.99g 50.00g
 system 1 6 0 wz--n- 19.77g 0

Now let’s proceed to move the data from the physical volume  /dev/sdb to /dev/sdc:

LVM move

# pvmove /dev/sdb
/dev/sdb: Moved: 0.0%
/dev/sdb: Moved: 11.8%
/dev/sdb: Moved: 30.5%
/dev/sdb: Moved: 75.7%
/dev/sdb: Moved: 95.0%
/dev/sdb: Moved: 99.3%
/dev/sdb: Moved: 100.0%

There is not need to specify the other volume because the data will be distributed among the remaining physical volumes of the volume group, and in this case it is just /dev/sdc. Now, let’s check the distribution of the physical volumes:

# pvs
PV VG Fmt Attr PSize PFree 
 /dev/sda2 system lvm2 a- 19.77g 0 
 /dev/sdb data lvm2 a- 50.00g 50.00g
 /dev/sdc data lvm2 a- 50.00g 0

As you can see the /dev/sdb has no data (50 GB free) while /dev/sdc has the data (0 GB free). Just

Como puede verse el disco /dev/sdb no tiene datos (50 GB libres) mientras que /dev/sdc tiene los datos (0 GB libres). Now remove the physical volume to disincorporate from the volume group:

# vgreduce data /dev/sdb
 Removed "/dev/sdb" from volume group "data"

Now check the volume groups and the physical volumes:

# pvs
PV VG Fmt Attr PSize PFree 
 /dev/sda2 system lvm2 a- 19.77g 0 
 /dev/sdb lvm2 a- 50.00g 50.00g
 /dev/sdc data lvm2 a- 50.00g 0
# vgs
VG #PV #LV #SN Attr VSize VFree
 data 1 1 0 wz--n- 50.00g 0 
 system 1 6 0 wz--n- 19.77g 0

Finally proceed to wipe the physical volume::

# pvremove /dev/sdb
 Labels on physical volume "/dev/sdb" successfully wiped
# pvs
PV VG Fmt Attr PSize PFree
 /dev/sda2 system lvm2 a- 19.77g 0
 /dev/sdc data lvm2 a- 50.00g 0

This allows data to be moved from one disk to another without copying the data on operating system level, without interrupting services or restarting the computer. At the end we will have the disk /dev/sdc as the physical volume of the volume data as shown below:

LVM final

Reference: http://www.tldp.org/HOWTO/LVM-HOWTO/removeadisk.html

,

No Comments

LPIC-2 certification

LPIC-2 diploma  LPIC-2 credential card

At last my certificate and card ID for LPIC-2 have arrived, which involve exams 201 and 202.  Unlike the LPIC-1 certification, it took more time to arrive (in fact I had to insist in delivering them) but finally they already arrived.

If you are interested in achieving this certification you can get further info at LPI ‘s page for LPIC-2

, , ,

2 Comments

Gitlab full Postgresql backup and restore

GitLab and Posgresql

GitLab can be used with Postgresql as its database engine  (beside MySQL),  and all come ready to make backups and restores of its databases and git repositories by using a ruby script (rake). This is the recommended way because it lets you recover everything wit not pending transactiond on database and Git sides.

The problem

The documentation explains all you have to perform a manual backup and restore, but the latter fails because it tries to insert existing registers that generate conflicts like this one:

ALTER SEQUENCE
psql:/home/git/gitlab/tmp/backups/db/database.sql:812: ERROR: relation "users" already exists

The Solution

The postgresql backup must erase all tables before trying to recreate them and insert the registers. That can be done bu including the  –clean r -c  to the pg_dump command. This option must be edited in the ruby script that makes the backup, which is  /home/git/gitlab/lib/backup/database.rb by default. In this file you have to find this part of code and substitute the following bold line:

require 'yaml'
module Backup
 class Database
 attr_reader :config, :db_dir
def initialize
 @config = YAML.load_file(File.join(Rails.root,'config','database.yml'))[Rails.env]
 @db_dir = File.join(Gitlab.config.backup.path, 'db')
 FileUtils.mkdir_p(@db_dir) unless Dir.exists?(@db_dir)
 end
def dump
 success = case config["adapter"]
 when /^mysql/ then
 print "Dumping MySQL database #{config['database']} ... "
 system('mysqldump', *mysql_args, config['database'], out: db_file_name)
 when "postgresql" then
 print "Dumping PostgreSQL database #{config['database']} ... "
 pg_env
 system('pg_dump', config['database'], out: db_file_name)
 end
 report_success(success)
 end

This line mus be replaced with this other line:

system('pg_dump', config['database'], '-c', out: db_file_name)

Here you can see that option -c is passed as argument to command pg_dump. This will force to include all DROPS needed in the generated .sql  for the GitLab backup.

,

No Comments

Course Creative, Serious and Playful Science of Android Apps

Coursera androidapps101 2014 Computer Science and Programming Badge

Recently I received the awards for the Android course Creative, Serious and Playful Science of Android Apps lectured by Lawrence Angrave from University of Illinois at Urbana-Champaign. The course was designed to learn Android programing from scratch, therefore if you are interesting in developing for this platform this is a good starting point. The video lectures were made in English, but there are subtitles for Spanish and even English, so language is not barrier.

The Awards

The awards I earned were these:

  • Statement of Accomplishment:  This is a sort of of certificate which you earn when accomplishing 70% or higher. I got 94.6%
  • Computer Science and Programming Badge: This is a kind of badge they gave you also when you accomplished 70% or higher.

This awards are not part of the Signature Track, which let you share and validate this grade,  but you have to pay $49 for this feature.

,

No Comments

qBitTorrent Client for Android

Download application

If you are interested in this application you can install it from Google Play or download qBittorrent Client apk on your device. Also you can download the code from GitHub because it was released as GPL.

Features

  • See two panel view (fragments), for torrent list and details in the same window
  • Drawer menu for switching between All, Downloading, Completed, Paused, Active and Inactive torrent list
  • Pause or resume all torrents from the selected list
  • Auto refresh torrent list after performing an action on a torrent (pause, resume, or delete)
  • Add URL directly or by clicking the torrent link on your device’s browser
  • Pause, resume, delete or delete individual torrents with its downloaded data
  • Set and save a connection account

Phone’s view



Tablet’s view





,

2 Comments

Samsung Galaxy Tab P1000 with Android 4.3 – CyanogenMod 10.2

CyanogenMod 10.1 - Android 4.2.1 - Samsung Galaxy Tab 7 CyanogenMod 10.1 - Android 4.2.1 - Samsung Galaxy Tab 7 CyanogenMod 10.1 - Android 4.2.1 - Samsung Galaxy Tab 7

One more time I wanted to give another breath to my Samsung Galaxy Tab 7, because prices here in Venezuela are not encouraging, so I decided to install Cyanogenmod 10.2 con Android 4.3, thanks to HumberOS. This upgrade is valid only for the Latin American model, I mean Samsung Galaxy Tab 7 P1000N (o P1000L). Here I leave all you need to do so, and some tips.

Considerations

  • Remember that only you are responsible of what you do to your tablet. Although I followed this method, I won’t take any responsibility if you brick your tablet.
  • Backup your current rom and any data. This will help you to go back if something goes wrong.
  • Do this procedure with at least 75% of battery charge.
  • This rom ONLY works on P1000N / P1000L.

Requisites

  • To have installed a Recovery  capable of loading updates ( like CWM Recovery)

Installing

  1. Download and copy into internal o external sdcard’s root directory files cm-10.2-20130921-HumberOS-p1.zip, and gapps-jb-20130813-signed.zip. The first one is the ROM and the second one are the Googles’ apps for this Android version.
  2. Turn off the tablet and then turn it on in the CWM Recovery by pressing Power On + Volume Up buttons at the same time. When it boots you should see a screen like this one:

     CyanogenMod 10.1 - Android 4.2.1 - Samsung Galaxy Tab 7

  3. Make wipe data / factory reset and wipe dalvik cache on the wipe menu.
  4. On the  Install menu go to choose zip from internal sdcard (or choose zip from external sdcard if it’s your case). Choose  the cm-10.2-20130921-HumberOS-p1.zip file to flash it to the tablet.
  5. Later you must install the Google’s apps. To do so you have to go one more time to choose zip from internal sdcard option and choose the file gapps-jb-20130813-signed.zip.
  6. Once installed, go to reboot menu and reboot the tablet by choosing reboot system. The tablet will boot with the CyanogenMod’s logo. It will last quite a few, don’t turn off the tablet. Be patient.
  7. When it had finished, follow the tablet’s settings wizard, and enjoy it!

IMEI no valid

If you reboot your tablet and got the Invalid IMEI error as show below, I recommend you to got to the Stock ROM 2.3.3, and the update with the HumberOS’s kernel qith grants you root permission,  and finally do the above steps for upgrading to 4.3:

IMEI issue

The process can be a little tedious but it must be done to use a fresh operating system so it can recognize the device’s IMEI.

, , , ,

8 Comments

My first application on Android: BatteryReporter

batteryreporter

From a while I wanted to learn how to develop Android applications and when I saw that open a course at Coursera for developing Android appslications so I took the chance to learn. I must confess that it not  a piece of cake, I mean, it just not “copy and paste” code (although you can find example codes out there) and you must learn new concepts, because although you have programmed before (even Java) now you must learn how to do it the “Android’s way”.

After following the video lectures, read and read a lot, I build my first application, which in deed is part of the first assignment for the course. It’s a simple application which reads the device’s battery, and reports if it is charging or discharging, as well as the percentage of charge of the device.

For those interested in try my first application, or just take a look to the code for learninf, here I leave the apk file and the main code.

The code (MainActivity.java)

Here you can take a look to the code for the application:

package com.lgallardo.batteryreporter;
import android.os.BatteryManager;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.view.Menu;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 }
@Override
 public boolean onCreateOptionsMenu(Menu menu) {
 // Inflate the menu; this adds items to the action bar if it is present.
 getMenuInflater().inflate(R.menu.main, menu);
 return true;
 }
public void getStatus(View view) {
TextView statusValueTextView, chargingValueTextView, levelValueTextView;
 ImageView iconImageView;

 String charging = "";
int level, scale;
 float batteryPct;
// Get resources reference
 Resources res = getResources();
// Get values TextViews
 statusValueTextView = (TextView) findViewById(R.id.statusValue);
 chargingValueTextView = (TextView) findViewById(R.id.chargingValue);
 levelValueTextView = (TextView) findViewById(R.id.levelValue);

 // Get ImageView (icon)

 iconImageView = (ImageView) findViewById(R.id.imageView1);

 // Get battery's status
 IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
 Intent batteryStatus = registerReceiver(null, ifilter);
// Check if the battery is charging or is charged?
 int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
 boolean isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING
 || status == BatteryManager.BATTERY_STATUS_FULL;
// Update UI status
 statusValueTextView.setText(Integer.toString(status));
// Update UI charging
 if (isCharging) {
 charging = res.getString(R.string.yes);
// Get charging method
 int chargePlug = batteryStatus.getIntExtra(
 BatteryManager.EXTRA_PLUGGED, -1);
 boolean usbCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_USB;
 // boolean acCharge = chargePlug ==
 // BatteryManager.BATTERY_PLUGGED_AC;
if (usbCharge) {
 charging = charging + " " + res.getString(R.string.usb);
 } else {
 charging = charging + " " + res.getString(R.string.ac);
 }

 iconImageView.setImageResource(R.drawable.charging);
 } else {
 charging = res.getString(R.string.no);
 iconImageView.setImageResource(R.drawable.discharging);
 }
chargingValueTextView.setText(charging);
// Update UI level
 level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
 scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
 batteryPct = 100 * level / (float) scale;
levelValueTextView.setText(Float.toString(batteryPct)+"%");
}
}

,

2 Comments