Converting mod video files + deinterlace

Posted on the October 26th, 2013 under Uncategorized by

FFMPEG is deprecated. You need to use aconv.

avconv -i MOV047.MOD -c:v libx264 -crf 18 -preset medium -filter:v yadif -c:a copy MOV047.avi

This adds the deinterlace filter:  -filter:v yadif

PHP Composer on a Hostgator Shared Account

Posted on the October 14th, 2013 under Internet,Linux by

If you were to try and install composer on a Hostgator Shared Account, you’ll likely get an error like below:

Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in – on line 399
#!/usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The phar extension is missing.
Install it or recompile php without –disable-phar

Your PHP (5.2.17) is too old, you must upgrade to PHP 5.3.2 or higher.

The problem is that PHP 5.3 is not the default, but it is available. To install, run instead:

curl -sS https://getcomposer.org/installer | /opt/php53/bin/php

Which results in:

#!/usr/bin/env php
All settings correct for using Composer
Downloading…

Composer successfully installed to: /home/tohir/www/example.com/composer.phar
Use it: php composer.phar

Lastly, when you are running composer install, the command needs to be:

/opt/php53/bin/php composer.phar install

Sample Output:

Installing dependencies (including require-dev) from lock file
- Installing respect/validation (dev-develop 3956203)
Cloning 39562034bd5cb692289f603bac8766f4d167426e

- Installing slim/slim (2.3.1)
Downloading: 100%

Generating autoload files

 

 

Starting a VNC from the command line

Posted on the July 18th, 2013 under Internet,Linux by

It’s great to remote desktop/VNC into another server and doing work via a visual desktop interface rather than the command line, but this often requires that the VNC be started from the desktop interface. Here’s how to start the remote desktop from the command line. This is with Ubuntu 10.04.

Instructions (Bold+Italic is for command):

1) SSH Into Machine

2) Become Root: sudo -s

3) export DISPLAY=:0.0

4) xhost +

5) Exit from root: exit

6) export DISPLAY=:0.0

7) nohup /usr/lib/vino/vino-server > /dev/null &

Disclaimer:

I know Ubuntu 10.04 is old, but that’s the context where the need for this arose in. Also, please note there is security implications when using remote desktop. Please Google that

Download a section of a website using wget

Posted on the July 18th, 2013 under Linux by

wget -r –mirror -p –convert-links -e robots=off –no-parent –random-wait  http://www.website.com/section/subsection/

Where’s the PHPUnit command-line test runner?

Posted on the April 29th, 2013 under Linux,Productivity,Software and Technology by

After you have installed the PHPUnit via PEAR, how do you get access to the phpunit executable. Here’s the steps from the beginning on Ubuntu.

1) Install PHP Pear if you don’t have it installed

sudo apt-get install php-pear

2) Enable auto discovery

sudo pear config-set auto_discover 1

3) Install PHPUnit via PEAR

sudo pear install pear.phpunit.de/PHPUnit

4) Locate the PHP PEAR bin(ary) directory

 pear config-get bin_dir

Mine shows:

tohir@tohir-MS-7759:~$ pear config-get bin_dir
/usr/local/zend/bin

If you then list the files in that directory, you’ll see:

tohir@tohir-MS-7759:~$ ls /usr/local/zend/bin
apachectl extract_meta_data.sh jqd.sh monitor-node.sh pecl phpize scd setup_sc.sh uninstall.sh zdd.sh ZManifest zs-setup
clean_semaphores.sh gui_passwd.sh lighttpdctl.sh pear php phpunit scd.sh shell_functions.rc watchdog zdpack zmd
create_cert.sh jqd MonitorNode peardev php-config rulemerge setup_jq.sh support_tool.sh zdd zendctl.sh zs-manage

You can then create a symlink to make it easier to access:

sudo ln -s /usr/local/zend/bin/phpunit /usr/bin/phpunit

wkhtmltoimage crashing at 25%

Posted on the April 13th, 2013 under Uncategorized by

I’ve had to turn off this functionality till I could find a fix. Sometimes, it worked, sometimes it didn’t. One URL in particular I had difficult fixing was: http://www.musjidnoor.za.net/index.html

Console Results

xvfb-run –auto-servernum –server-num=1 wkhtmltoimage –disable-javascript –use-xserver -f png -n ‘http://www.musjidnoor.za.net/index.html’ /var/www/docprogress_temp/1365305896.png
Loading page (1/2)
Rendering (2/2)
^C==============> ] 25%

Thought came in my mind, maybe it’s because there page is either big or long. Let’s try cropping the height:

xvfb-run –auto-servernum –server-num=1 wkhtmltoimage –disable-javascript –use-xserver -f png –crop-h 6000 -n ‘http://www.musjidnoor.za.net/index.html’ /var/www/docprogress_temp/1365305896.png
Loading page (1/2)
Rendering (2/2)
Done

Wallah, that seems to fix it. I gradually increase mine to 6000 which is more sufficient in my case. Suggestion, try adding –crop-h {a height}, and see if this fixes it.

How to bring your mouse back to life in Ubuntu

Posted on the February 2nd, 2011 under Linux,Software and Technology by

Occasionally, I encounter the issue where my mouse moves around the screen, but I can’t left click. Right click does work. Instead of rebooting tonight, thought I’d try to find a solution tabbing away on the keyboard whilst I still had a browser open.

Solution:

  • Press Ctrl+F1 to go to a terminal screen
  • Login with your username and password
  • sudo mobprobe -r psmouse
  • sudo modprobe psmouse
  • Ctrl+F7

This removes the mouse ‘driver’ from the kernel, and re-adds it. Wallaa!

Installing Zend Server CE on Ubuntu Maverick (10.10)

Posted on the January 24th, 2011 under Internet,Linux by

Spent the day trying to install Zend Server on Ubuntu (10.10), but ran into so much blockers, thought it would be worth a blog!

After following all the steps, I got hit with:

W: Failed to fetch http://repos.zend.com/deb/ce/dists/ce/Release
Unable to find expected entry  non-free/source/Sources in Meta-index file (malformed Release file?)

Kept trying sudo-apt-get update whilst cursing Zend, and still the same.

Solution: Disable the sources repository in /etc/apt/sources.list.

#deb-src http://repos.zend.com/deb/ce ce non-free

Next, trying to install, and keep getting dependencies issues. There are two (old files) that need to be downloaded, and then everything works fine:

They were in older distributions, but no longer are!

Once those two files are manually installed (sudo dpkg -i), the rest is plain sailing.

Thunderbird + Correct Indentity Plugin

Posted on the January 5th, 2011 under Linux,Productivity,Software and Technology,Usability by

On both Ubuntu (and Windows if I ever had to use it), I prefer Thunderbird as my email client over Evolution or MS Outlook purely due to two reasons:

  1. I love the way it allows one to show an inbox for each account. I do not need to filter them, or create labels.
  2. The ability to set a limit on incoming mail. Once activated, it only downloads the first 50kb of each email giving an idea of what the email contains, and it saves the frustration of downloading emails with large attachments, particularly from people I don’t know.

However, the one mistake I often make is clicking “Write”, type in the email, and clicking send, without checking that I’m sending it from the right email address. Fortunately, another great thing with Firefox and Thunderbird is extensions, and there is one that fixes that called Correct Identity.

It allow one to set an alternative default email address for writing an email. Eg. The account is support@…, but whenever you send out email from that account, it should be from tohir@…, that’s the issue it solves!

Why CSS gets confusing and why you should use SASS

Posted on the September 30th, 2010 under HTML, CSS,Internet by

Take the following HTML file with CSS. How will div2 look?

<html lang="en">
<head>

<title>SASS Test</title>

<style type="text/css">
    div.div1 div {
        border: 4px solid yellow;
        background: yellow;
    }
    div.div1 {
        background: red;
        border: 4px solid blue;
    }
    div.div1 div.div2 {
        background: green;
    }
    div.div2 {
        border: 10px solid orange;
        padding: 10px;
    }
</style>
</head>
<body>
    <div class="div1">
        Div 1
        <div class="div2">
           Div 2
        </div>
    </div>
</body>
</html>

Based on the last definitions, you will expect div2 to have:

  • a green background color
  • a 10 pixel solid orange border
  • a padding of 10 pixels between the border and the text

Actually it will appear like this:

It does NOT have a 10 pixel solid orange border, but instead a four pixel solid yellow border. Even though CSS is cascading, it cascades by CSS rules, not by definitions. Even though an alternate definition is last, if it doesn’t cascade over an existing rule, it will not be applied.