Sunday, September 18, 2011

ffmpeg: Convert mp4 to mov

To convert mp4 movie into mov movie the following command can be used:ffmpeg -i input_file.mp4 -acodec copy -vcodec copy -f mov output_file.mov

Thursday, August 18, 2011

CentOS 5: Mount samba share in read-write mode

To mount a windows share on centos with read-write mode, I used the following command as a root
/sbin/mount.cifs //ip_address/windows_sharename/ /home/w/my_folder_on_centos/ -o rw,user=windows_username,password=windows_password,uid=linux_usernameI noticed, that without uid=linux_username, the command will mount the share in read-only mode.

Tuesday, July 26, 2011

Git: change commit editor to vim

This command can be used:git config --global core.editor "vim"or one can setup environment variable GIT_EDITOR:export GIT_EDITOR="vim"

Sunday, June 26, 2011

Git: last commit date

To obtain date and time of the last commit in a current branch one can use git log command: git log -1 --format="%cd"

Tuesday, May 03, 2011

IELTS preparation: useful vocabulary

Recently, I was preparing myself for IELTS (International English Language Testing System) test (general module). As part of this preparation I composed a list of useful words and expressions for this test. The list also contains words that spelling was difficult for me to remember.

If you are curious, my overall IELTS score was 8.0 with the lowest band of 7.0. Hope that the list will be useful to you also.

Saturday, April 30, 2011

Ubuntu 11.04 (Natty Narwhal): Use 'normal' GNOME instead of Unity

Ubuntu 11.04 uses Unit as its default desktop environment. However, it is very easy to switch back to 'normal/traditional' GNOME desktop environment. Just select 'Ubuntu classic' option in your login window:

Ubuntu 11.04 (Natty Narwhal): How to remove chat and mail icons (indicators) from system tray

Just like for Ubuntu 10.04, the two following icons (notifiers):
can be removed by removing two packages: indicator-me and indicator-messages:sudo apt-get remove indicator-me indicator-messages

Wednesday, March 30, 2011

ImageMagick: Make thumbs of images

For example to make jpg thumbs of all tiff images in a current director one can use:for f in *.tiff; do bname=`basename $f .tiff` ; convert -resize 256x256 $f ./thumbs/$bname.jpg; done

Thursday, March 17, 2011

ImageMagick: Flatten and convert an image to grayscale

In short, to flatten and convert to grayscale all images in current director one can use: mogrify -flatten -type Grayscale *or mogrify -flatten -alpha remove *.tiff

Tuesday, March 08, 2011

An example file upload progress monitoring in Zend Framework 1.11

An example web application demonstrating usage of Zend_ProgressBar and jquery progressbar for monitoring progress of file uploads in Zend Framework 1.11.3.

Since file uploads are done to the folder APPLICATION_PATH/uploads, the application tries to create this folder if it does not exists. For this reason APPLICATION_PATH should be writable, or uploads folder created manually with necessary rights. The application also requires 'uploadprogress' PECL package since it uses 'uploadprogress_get_info' function for getting the information about upload progress.



The source code is at GitHub. Most action happens in indexController.php and index.phtml.

Sunday, February 27, 2011

An example of OpenID, Facebook and Twitter authentication in Zend Framework 1.11

This is an example Zend Framework 1.11.3 application that uses OpenID (Google,
Yahoo, MyOpenId, AOL, OpenId) as well as Facebook Connect and Twitter Oauth for
authentication of users.

During authentication, information about a user (e.g. an email or a country) is fetched from the authentication provider.

Zend Framework 1.11 does not have a very good support for OpenID, not mentioning Facebook Connect and Twitter Oauth. Thus, to make it all work the following elements were used:
In some cases slight modifications to the above elements were made.

The demo of this application is here , while the source code is at GitHub. The user authentication is performed in a loginAction in UserController.php.

Hopefully, this example application will be useful to others as it was for me.

Sunday, February 06, 2011

Drupal 7: Add last update date to the footer of the page

I needed to add a date of last modification of the website made in Drupal 7. I did it by enable core module PHP Filter and creating a block located a footer block region. The body of the block was as follows:
<?php
// get date of most most recent change to a node
$result = db_query('SELECT title, changed FROM {node} WHERE status=1 ORDER BY changed DESC LIMIT 1');
$node = $result->fetchObject();
$date = date('d-M-Y g:i a', $node->changed);
echo "Last update: $date";
?>

Saturday, January 22, 2011

Pear run-tests: Setting --cgi option to test file uploads using phpt

In PHP, file uploads can be tested using phpt files as explained here. However, when I wanted to execute phpt test with --POST_RAW-- or --POST-- sections, pear run-tests was giving an error that: --cgi option needed for this test, type 'pear help run-tests' My phpt file was as follows: The layout of phpt files is explained here. To overcome this problem I installed php5-cgi package for ubuntusudo apt-get install php5-cgiThis allowed for correct execution of the testpear run-tests --cgi=/usr/lib/cgi-bin/php5 example-upload.phpt
Running 1 tests
PASS Example test emulating a file upload[example-upload.phpt]
TOTAL TIME: 00:00
1 PASSED TESTS
0 SKIPPED TESTS

Sunday, January 02, 2011

Ubuntu 10.10: Change grub menu timeout

Default grub menu timeout is 10 seconds. To change it just edit the grub filesudo vim /etc/default/grub and change GRUB_TIMEOUT value from 10 to e.g. 2. Then update grubsudo update-grubAfter the restart the time before boot your default operating system be 2 seconds.

Alternatively, one can install GUI grub editor called StartUp-Manager sudo apt-get install startupmanager