Monday, April 20, 2015

Did you know there is a Windows Remix?

Just heard a pretty awesome tune but wait till you see the video.

How many of these screens have you seen?

Fake listings on Google Maps

Why would you want to create a fake listing on Google Map?

Nice write-up from Danny Sullivan of Search Engine Land on Bryan Seely who presented this weakness at TEDx Kirkland.

Advantages of being in the open source software is apparent here. If developers picked up on this, some form of followup or monitoring would have taken place.

Wednesday, April 15, 2015

Read DVD with Avidemux

Avidemux cannot directly open a DVD file. Instead a readable VOB file is needed to provide a format to access the DVD.

Operating system: MS Windows 7

Open a command prompt.

To create VOB for title 1, chapter 1, or in the DVD file its called VTS_01_0.vob, type

"E:\mplayer-svn-37386\mplayer.exe" dvd://1 -chapter 1 -dumpstream -dumpfile rippeddvd1_1.vob

To create VOB for title 2, or in the DVD file its called VTS_01_1.vob, type

"E:\mplayer-svn-37386\mplayer.exe" dvd://2 -dumpstream -dumpfile rippeddvd1_2.vob

To create VOB for chapter 2, or in the DVD file its called VTS_01_1.vob, type

"E:\mplayer-svn-37386\mplayer.exe" dvd://1 -chapter 2 -dumpstream -dumpfile rippeddvd1_2.vob

Alternatively if above still fails, use another application and convert the DVD to a readable format. E.g. Handbrake software.

Read www.avidemux.org for further details

Friday, March 20, 2015

PhpPgAdmin ERROR: column “spclocation” does not exist



The Installation of PostgreSQL and phpPgAdmin was great with the following;
phpPgAdmin 5.0.4-1.el6
Centos 6.3
PostgreSQL 9.4.1

Attempt to create a new database using phpPgAdmin, the following error appears
ERROR: column “spclocation” does not exist

Possible cause;
Using outdated phpPgAdmin
and
There is no definition of the column spclocation for PostgreSQL version 9.4.

Solution:

Step 1: Edit Connection.php

In Centos Linux, go to the folder /usr/share/phpPgAdmin/classes/database/ and notice that there are no Postgresql file for 9.4. Edit the file Connection.php. Add the case '9.4' line around line number 82, as shown below;

// Detect version and choose appropriate database driver
                switch (substr($version,0,3)) {
                        case '9.4': return 'Postgres94'; break;
                        case '8.4': return 'Postgres'; break;

Step 2: Edit files

Make a copy Postgres84.php file with the command below;
#cp Postgres84.php Postgres94.php

Open Postgres.php and copy the functions getTablespaces and getTablespace to the file Postgres94.php

Edit Postgres94.php;

Replace all references of version from 8.4 to 9.4. E.g.

Amend the 2 lines
$sql = "SELECT spcname, pg_catalog.pg_get_userbyid(spcowner) AS spcowner, spclocation,
to
$sql = "SELECT spcname, pg_catalog.pg_get_userbyid(spcowner) AS spcowner, pg_tablespace_location(oid) as spclocation,

and

$sql = "SELECT spcname, pg_catalog.pg_get_userbyid(spcowner) AS spcowner, spclocation,
to
$sql = "SELECT spcname, pg_catalog.pg_get_userbyid(spcowner) AS spcowner, pg_tablespace_location(oid) as spclocation,

Step 3: Create database

Open the web browser and access phpPgAdmin to create a new database.


Friday, March 13, 2015

Installation of Postgresql and phpPgAdmin

PostgreSQL is an object-relational database management system and can be downloaded from http://www.postgresql.org or via Linux packagers like Yum or through other 3rd party solutions. PgAdmin3 can be installed to manage the database.

It is available under PostgreSQL License, similar to the MIT license.

Today, a large number of PHP programming framework have support to use PostgreSQL.

PhpPgAdmin is a web based administration tool for PostgreSQL. Source and binary can be downloaded from http://phppgadmin.sourceforge.net

It is available under GNU General Public License.

Steps listed if for installation environment:
Centos 6.3
Selinux in permissive mode
Apache httpd version 2.2.15

Step 1:  Install PostgreSQL

Refer previous posting for the installation. PostgreSQL version 9.4 is available at this point and its safe to say that just replacing 9.3 with 9.4 will work. Here are list of the changes;

Yum repository

  • 32bits: http://yum.postgresql.org/9.4/redhat/rhel-6-i386/pgdg-centos94-9.4-1.noarch.rpm
  • 64bits: http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm

RPM packages: postgresql94-server postgresql94-contrib

Ensure TCPIP connection is setup, edit /var/lib/pgsql/9.4/data/postgresql.conf
listen_addresses = '*'
port = 5432

Important files:
Configure authentications: /var/lib/pgsql/9.4/data/pg_hba.conf
Configure server to accept TCPIP: /var/lib/pgsql/9.4/data/postgresql.conf


Starting and enabling at Linux bootup.
service postgresql-9.4 start
chkconfig postgresql-9.4 on

Step 2: Configure firewall

Its good to keep local firewall enabled. Edit at end of /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Restart iptables.

Note: Although the Linux is in permissive, its good to enable web servers to access the database using the command;
setsebool -P httpd_can_network_connect_db 1

Step 3: Install phpPgAdmin

From the command line, type
yum install epel-release
yum install phpPgAdmin

Edit /etc/httpd/conf.d/phpPgAdmin.conf

Alias /phpPgAdmin /usr/share/phpPgAdmin


        # Apache 2.2
        Order deny,allow
        Allow from all


Then restart httpd.

Step 4: Configure phpPgAdmin

Lets use a server administration configuration called "Test Server" that we can practice with. Edit and/or add following server instance to /etc/phpPgAdmin/config.inc.php
Add
        $conf['servers'][1]['desc'] = 'Test Server';
        $conf['servers'][1]['host'] = 'localhost';
        $conf['servers'][1]['port'] = 5432;
        $conf['servers'][1]['sslmode'] = 'allow';
        $conf['servers'][1]['defaultdb'] = 'postgres';
        $conf['servers'][1]['pg_dump_path'] = '/usr/bin/pg_dump';
        $conf['servers'][1]['pg_dumpall_path'] = '/usr/bin/pg_dumpall';

Edit
        $conf['extra_login_security'] = false;
        $conf['owned_only'] = true;

Restart PostgreSQL.

Open a web browser and type in the URL http://localhost/phpPgAdmin



Some important files that might be of use;

  • /usr/share/phpPgAdmin/conf/config.inc.php
  • /etc/httpd/conf.d/phpPgAdmin.conf
  • /etc/phpPgAdmin/config.inc.php



Notes:
  1. phpPgAdmin: If keep getting "Login failed", check the PostgreSQL server for problems. Most likely the pg_hba.conf isnt fully using md5.
  2. References on administration from PostgreSQL Documentation.

Thursday, February 12, 2015

What causes Mozilla Thunderbird to Freeze constantly?

The last 1 month after a re-installation of MS Windows 8 and Mozilla Thunderbird, some productivity have drop and temper going up. One of the reasons is due to Thunderbird 31.4 freezing constantly.

Thunderbird email client, have always been on my Linux and MS Windows PC for years. But somehow, something changed that caused a lot of difficulties for me to work with emails. It is not clear when this started but its about the time I re-installed the computer.



Thunderbird setup:

  1. Thunderbird updated to version 31.4.0
  2. Email profile uses IMAP with the SMTP server in the same local network. There are few folders apart from the standard INBOX, SENT, which is less than 12 folders. Check for new messages is set to every 10 minutes and at startup.
  3. Address book includes sync with Google contacts
  4. Calendar includes Lightning sync with Google calendars
  5. Local folder is contains standard folders, which is less than 5 folders.
  6. The Profile folder is in the onedrive folder

Symptoms;

  1. After login, every 1 to 10 minutes Thunderbird freezes rather randomly. This "freeze" last about 30 seconds to 3 minutes and its not predictable.
  2. After I stop onedrive sync, problem still persist.
  3. Disconnect network and problem still persist.
Findings (to some extend)
Its unfortunate that I could not exactly identify the problem but I found 2 steps taken that have made this "freeze" vanish. In rush to resolve the problem, I did both at the same time.
  1. Using the Windows Explorer, access the C:\users\username and right click "appdata" folder, click "Advanced". UNCHECK Allow files in this folder to have contents indexed in addition to file properties, click "OK". Click "Apply" and choose to include subfolders.
  2. Open McAfee Internet Security Suite, it the default antivirus on the computer. Click on Real-Time Scanning (status is ON). Click "Real-Time Scanning:", current status is again On. Click "Settings", UNCHECK Email attachments. CHECK Strike a balance between the scan throroughness and my PC's speed (Recommended). Go back to the antivirus main screen, and turn off the "Scheduled Scans:"
If you encounter the same problem, do test and see which works for you.

Monday, February 2, 2015

Install Android Studio on Microsoft Windows 8

Android SDK is used for the development of Android mobile application and it utilises Java Technology. There are a number of ways to develop Android application but using command line, notepad or IDE, they will all require the basic system requirements;

  1. Java development Kit (JDK)
  2. Android SDK Tools. Alternatively, the Android Studio can be installed which comes with all the required SDK.
Following are steps to prepare for Android development on MS Windows 8 64-bit.

Step 1: 

Read information provided at the Android developer site. Then read up installation at Java site. More materials on JDK 7 is at docs.oracle.com/javase/7/docs
Good point to note is that Oracle has declared that the year 2015 is the end of public updates for JDK 7.

Following steps are just additional guide in case you prefer not to read fully the official installation guides.

Step 2:

Download JDK and install. At the point of writing, JDK 7 (jdk-7u25-windows-x64.exe) is downloaded from Oracle. Uccess MS Windows with Administration right to install and double click to start installation. This will have the JDK installed at C:\Program Files\Java\jdk1.7.0_25 which also installs a public JRE at C:\Program Files\Java\jre7 directory.

Click the Windows 8 search icon ->Settings, and type "Variable". Click on option to edit the system environment variables, then click "Environment variables", locate the system variables area, click the Variable "Path", then click "Edit". Append to the end of the "Variable value:"

;C:\Program Files\Java\jdk1.7.0_25\bin

Then click "OK".

Next, in  System variables, click "New..." and enter following values;
name: JAVA_HOME
value: C:\Program Files\Java\jdk1.7.0_25

Then click "OK" until all the window closes.

Step 3:

Download and install the Android studio bundle from developer.android.com. Double click and follow the installation instructions.

Note: this install at C:\Program Files\Android\Android Studio
and the SDK location: C:\Users\tboxmy\AppData\Local\Android\sdk

There is an option to manually install Android SDK Tools which is at revision 24.0.2. Ignore it.

Step 4:

Start Android Studio, start a new project and click
Tools-> Android-> SDK Manager.

It should recommend to install several basic packages to compile using the latest SDK (or Android). If you intend to compile for the Android 3.0 API, then check the box for "Android 3.0 (API 11)".

Click on the "Install ... packages..." button. Click on the accept license, then "Install".

Post Installation


  1. If your PC have the Intel Virtualization Technology feature, install Intel HAXM (see link) to speed up the Android Emulator. 
  2. Update the Android Studio (see My past post).
  3. Access the Android command line with ADB (see Debug Android App in Android Studio)


Post install notes:

These are just ramblings and just for personal reference.

As a minimum when setting up the Android SDK, download the latest tools and Android platform:

1. Open the Tools directory and select:
        Android SDK Tools
        Android SDK Platform-tools
        Android SDK Build-tools (highest version)
2. Open the first Android X.X folder (the latest version) and select:
        SDK Platform
        A system image for the emulator, such as
        ARM EABI v7a System Image


Finally

Proceed to create the first application from https://developer.android.com/training/basics/firstapp/index.html

Ref https://developer.android.com/sdk/installing/adding-packages.html


Howto Update to Android Studio 1.1

The Android Studio 1.1 Preview 2 is released to address bug fixes. Many new Android developers will benefit lots from the bug fixes and will have better experience on Android development with this powerful IDE.

Look for details on the update at android.com. One nice feature is having the AVD Manager on a separate window. This is great for multi display set ups.






Thursday, January 8, 2015

Android: Calling Toast in Fragment class


A quick way to pop up messages within Android application is to use the Toast class. This doesn't require users to click any button for it to go away and helps in debugging Android interaction. The class reference can be found at developers.android.com. An introduction to use of Toast can be found at developer.android.com. It shows the basics of Toast and how to position it.

Syntax for the Toast is straight forward as the static function makeText is used. Syntax:

makeText(Context context, int resId, int duration)
and
makeText(Context context, CharSequence text, int duration)


Both gets the Context as the 1st param where this is commonly called via  the getApplicationContext() function from the Activity class. This is common in examples to use the ListView, e.g. Vogella.

Following error is given if this function is used outside of an Activity class;

can't resolve method getApplicationContext()

Sometimes, a piece of the user interface is separated from the Activity into smaller chunk called the Fragment class. For example, getting the Toast to pop up messages in the class that extends Fragment class involves getting the Activity context to be used in the Toast 1st param. Use the function getActivity( ) in Fragment class instead of getApplicationContext( ) function in Activity class.

In the example below, the Toast will contain message from text retrieved in the ListView.

ListView lv = (ListView) rootView.findViewById(R.id.listview_attendance);
        lv.setAdapter(mAttendanceAdapter);
        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView parent, View view, int position, long id) {
                int duration = Toast.LENGTH_SHORT;
                String text = (String)parent.getItemAtPosition(position);

                Toast toast = Toast.makeText(getActivity(), text, duration);
                toast.show();

            }
        });


---
Project build: minSdkVersion 10