Category Archives: opensource

Drupal Interview Questions


So while working with Drupal Projects in my previous company. Me and my team prepared some Drupal Interview Question. This does not have everything but this will be for 1st round for sure. If you know these many question then I think you know Drupal For Sure.

Here is the list which is basic Drupal Questions.

  • Drupal Basics – Node, Module, Teaser, theme, Path, taxonomy, Patch, Region, Block, Menu
  • Installation of Drupal, steps and how to upload it on the live site from the local Machine.
  • Core Module in Drupal, their Names and their Functionalities.
  • Hook, Node Concepts
  • Functions and their Functionalities for – t() Function, l() function, Watchdog functions etc
  • Theme System in Drupal.
  • Themes and Theme Templates.
  • Theme Engines (Interface between the Drupal Core and the theme template).
  • Theme Hooks (Provide a way of interaction between the Modules and theme)
  • Theme Template structure and different sections as Page.tpl.php, node.tpl.php, block.tpl.php, box.tpl.php, etc
  • Derivative themes or Sub themes or Theme inheritance concepts that came into existence in Drupal 6, about it and its functionalities.
  • Steps to create a derivative theme and how to move for creating the theme from Derivative themes to a new theme right from scratch.
  • Theme function.
  • Where the Drupal theme functions are defined?
  • How the Drupal Theme functions can be overridden.
  • How to Implement the AJAX Effects on the Block modules in Drupal 6
  • Theme registration and the concepts in Drupal 6.
  • CCK modules and its importance with major functionalities.
  • How to create a Module.
  • How to insert the database table schema from the Modules when they are installed and remove the table scheme when they are un-installed (modules.)
  • User, Permission, Role in Drupal
  • How the Drupal database works?

Please give comments for more Drupal Questions.

Long back I have shard my PHP Interview Questions also.

Happy Programming.

Advertisements

how to delete space between characters or number in a openoffice cell


How to delete space between characters or number in a openoffice cell.
Searched a lot and finally got the answer like this ..

Suppose you have these kind of requirement then

  • A1 cell 111 222 333 will be 111222333
  • A1 cell Hey whats up will be Heywhatsup

For TEXT Use :
=SUBSTITUTE(A9," ","")

For NUMBERS Use :
=–SUBSTITUTE(A9," ","")

Happy Calc.

Quick Tutorial – How to zip and unzip files under unix environment


Linux support zip and unzip facility.
All you need to install zip and unzip via apt-get in your debian/ubuntu linux.
The same is available via yum or zypper.

Some examples for zip and unzip.

1. Creates the zip archive and put all the files of the current directory in the compressed form.

ankur@ankur:~> cd test/
ankur@ankur:~/test> ll
total 0
-rw-r--r-- 1 ankur users 0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users 0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users 0 2010-10-20 10:03 3.txt
ankur@ankur:~/test> zip zipthis *
 adding: 1.txt (stored 0%)
 adding: 2.txt (stored 0%)
 adding: 3.txt (stored 0%)
ankur@ankur:~/test> ll
total 4
-rw-r--r-- 1 ankur users   0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users   0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users   0 2010-10-20 10:03 3.txt
-rw-r--r-- 1 ankur users 382 2010-10-20 10:05 zipthis.zip
ankur@ankur:~/test>

This command will automatically put the zip extension when the process will done.

2. Now try for zipping the subdirectory also..
Here I have created the subdirector as “subtest”.

ankur@ankur:~/test> ll
total 8
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 3.txt
drwxr-xr-x 2 ankur users 4096 2010-10-20 10:14 subtest
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip
ankur@ankur:~/test> zip -r subzipthis *
 adding: 1.txt (stored 0%)
 adding: 2.txt (stored 0%)
 adding: 3.txt (stored 0%)
 adding: subtest/ (stored 0%)
 adding: subtest/sub1.txt (stored 0%)
 adding: subtest/sub2.txt (stored 0%)
 adding: zipthis.zip (stored 0%)
ankur@ankur:~/test> ll
total 12
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 3.txt
drwxr-xr-x 2 ankur users 4096 2010-10-20 10:14 subtest
-rw-r--r-- 1 ankur users 1306 2010-10-20 10:15 subzipthis.zip
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip
ankur@ankur:~/test>

To use unzip to extract all files of the archive pics.zip into the current directory & subdirectories:

3. Listing of your files from a zip folder.

ankur@ankur:~/test> ll
total 8
-rw-r--r-- 1 ankur users 1306 2010-10-20 10:15 subzipthis.zip
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip
ankur@ankur:~/test> unzip -l subzipthis.zip
Archive:  subzipthis.zip
 Length     Date   Time    Name
 --------    ----   ----    ----
 0  10-20-10 10:03   1.txt
 0  10-20-10 10:03   2.txt
 0  10-20-10 10:03   3.txt
 0  10-20-10 10:14   subtest/
 0  10-20-10 10:14   subtest/sub1.txt
 0  10-20-10 10:14   subtest/sub2.txt
 382  10-20-10 10:05   zipthis.zip
 --------                   -------
 382                   7 files
ankur@ankur:~/test>

4. To test about your zip archive that archive is OK or not:

ankur@ankur:~/test> unzip -tq subzipthis.zip
No errors detected in compressed data of subzipthis.zip.
ankur@ankur:~/test> unzip -tq zipthis.zip
No errors detected in compressed data of zipthis.zip.

5. Unzip your data

ankur@ankur:~/test> unzip zipthis.zip
Archive:  zipthis.zip
 extracting: 1.txt
 extracting: 2.txt
 extracting: 3.txt
ankur@ankur:~/test> ll
total 8
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 3.txt
-rw-r--r-- 1 ankur users 1306 2010-10-20 10:15 subzipthis.zip
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip

6. Now you want to extract only the specific files from your zip folder. You can use like this…

ankur@ankur:~/test> unzip zipthis.zip 1.txt
Archive:  zipthis.zip
 extracting: 1.txt
ankur@ankur:~/test> ll
total 8
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users 1306 2010-10-20 10:15 subzipthis.zip
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip

7. To extract all files to some specified directory.

ankur@ankur:~/test> unzip zipthis.zip -d /home/ankur/test/
Archive:  zipthis.zip
 extracting: /home/ankur/test/1.txt
 extracting: /home/ankur/test/2.txt
 extracting: /home/ankur/test/3.txt
ankur@ankur:~/test> ll
total 8
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 3.txt
-rw-r--r-- 1 ankur users 1306 2010-10-20 10:15 subzipthis.zip
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip

8. Unzip files one by one with confirmation.

ankur@ankur:~/test> unzip -q subzipthis.zip
replace 1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
replace 2.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
replace 3.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
replace zipthis.zip? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
ankur@ankur:~/test> ll
total 12
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 1.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 2.txt
-rw-r--r-- 1 ankur users    0 2010-10-20 10:03 3.txt
drwxr-xr-x 2 ankur users 4096 2010-10-20 10:14 subtest
-rw-r--r-- 1 ankur users 1306 2010-10-20 10:15 subzipthis.zip
-rw-r--r-- 1 ankur users  382 2010-10-20 10:05 zipthis.zip

9. Zip and Unzip version and liceance.

zip -v
zip -L
unzip -v

10. Help from zip and unzip

zip -h
unzip -h

Perl CPAN Reconfigure urllist


Perl CPAN Reconfigure urllist

To push multiple URL to use CPAN :

conf urllist push url1 url2 url3

To remove first in urllist :

conf urllist shift

To remove last in urllist :

conf urllist pop

To commit your changes :

conf commit

happy programming.

POST a Multipart request in Perl via LWP


Today I wrote good script which called the 3rd party API and for that I need to send a wav file via multipart.
I worte the code in Perl, which read my keyword via (param) and then I call my API and send the file via multipart.

#!/usr/bin/perl
print "Content-type: text/html\n\n";

use HTTP::Request::Common;
use LWP::UserAgent;
use CGI qw(:standard);
use strict;
use warnings;

my $file, $result, $message;
my $filePath = '/srv/www/cgi-bin/files';

$file = $filePath.'/'.$keyword.".wav";

my $ua = LWP::UserAgent->new;
my $req = $ua->request(POST 'http://www.yourURL',
	      Content_Type => 'form-data',
	      Content => [
		foo => "$foo",
		bar => "$bar",
		Upload => ["$file"]
	      ]
);

print "\nRESPONSE -- \n" . $req->as_string;

# Check the outcome of the response
if ($req->is_success) {
    print $req->content;
}
else {
  print "\n in else not success\n";
}

More links to read :
http://www.perlmonks.org/index.pl?node_id=186591
http://search.cpan.org/~gaas/libwww-perl/lib/HTTP/Request/Common.pm

Happy Programming.

gnome lost bottom taskbar: Ubuntu 10.04


Hey,

I know its very simple solution, but first time when I got this issue I was surprised and I got no solution.

Mistake : I was about to remove some extra panel from my task bar. But I deleted the panel.

Outcome : I lost my bottom taskbar, whatever window I open I can not see I always need to go Alt+Tab for that.

Solution :
In top panel right click on your panel and left click on “New Panel” Make sure new panel is at bottom – if not click and drag it to the bottom.

Once your panel is at the bottom – right click on the panel and say “add to panel”. A menu will open and from the menu select “Window List”. Left click on the “add button”.

Now when you minimize the window it will appear at the bottom panel.

Hope this will help.

Happy Opensource.

install Picasa 3.0 on Ubuntu 10.4


Quick Update.

I am a flickr Guy but I use Picasa also for my personal fotos.
Now i have upgreaded to Ubuntu 10.4 So I installed Picasa 3.0 to my Ubuntu. Its very easy.

Get the approprate .deb file for that.
Download the deb file from http://picasa.google.com/linux/download.html#picasa30

I downloaded picasa_3.0-current_i386.deb

Once this is copied
use

dpkg -e picasa_3.0-current_i386.deb

Here you go. Picasa is up and ready to use.

Happy Photography.

Start working with symfony 1.4


My colleague Subedar has started using Symfony 1.4. Today he shared me this list that how to install symfony 1.4 into your machine.

This is tested in windows, I have not tried in my ubuntu lappy. I will try and setup in my linux lappy and buzz you will more updates. I have some idea with 1.4 let see… Stay tuned…

Step for symfony 1.4 installation

  1. create a folder for your project on your local machine
    Ex project name  “testproject”
  2. Create “lib” folder in  project folder and create “vendor” in lib folder
    now the directory structure become  projectname/lib/vendor
  3. Now put symfony1.4 file in vendor folder and rename it as symfony
  4. Now execute the following command
    if  you want project with propel then execute

    php lib\vendor\symfony\data\bin\symfony generate:project testproject --orm=Propel

    if you want project in doctrine

    php lib\vendor\symfony\data\bin\symfony generate:project testproject --orm=none
  5. Now set database and password
    php symfony configure:database "mysql:host=localhost;dbname=dbname"  root rootPassword
  6. you can directly change in the file database.yml and propel.ini
  7. Now create application by executing
    php symfony generate:app frontend
  8. Create module
    php symfony generate:module frontend default
  9. Check php.ini if extension=php_pdo.dll not open then open it also check extension=php_pdo_mysql.dll

Hope this will be helpfull. Happy Programming.

How to Play DVD in Ubuntu 9.10 Karmic Koala


Today I got the little problem where I was not able to run the DVD to my this laptop.

I searched and found the tips to run it in my 9.10 karmic KoalaUbuntu.
First, I have read that why this is happening… and I got this link
https://help.ubuntu.com/community/RestrictedFormats
It says why some of the formats are not suitable sometime.

Second, then I installed Ubuntu-restricted-extra package to my system. Somewhre it says that these packages are by default installed but I installed again.

Third, still there is no sign of my work, so then you need to run this shell file…

apt-get install ubuntu-restricted-extras
cd /usr/share/doc/libdvdread4/
sudo ./install-css.sh

Thats it, now the DVD is running in my laptop.

quick ffmpeg audio-video encoding usage help


o from last 2-3 days I spent my so much time on file conversion with ffmpeg and mencoder.

After work done, I got some good links to follow for my future help and for all other readers.

The command what I tried for my use is like this

For High Quality and FFMPEG and libx264 vcodec i used this.

/usr/bin/ffmpeg -i /home/ganu/public_html/video/316.mp4
-b 1M -bt 4M -vcodec libx264 -pass 2 -vpre hq -acodec libfaac
-ac 2 -ar 44100 -ab 192k -threads 0 -s 552x311 -bufsize 200000000
-f flv -y /home/ganu/public_html/flvideo/316x.flv

Finally I used this this is working fine.

/usr/bin/ffmpeg -i /home/ganu/public_html/video/316.mp4
-r 30000/1001 -b 2M -bt 4M -acodec libfaac -ac 2 
-ar 44100 -ab 192k -s 552x311 -f flv -y /home/ganu/public_html/flvideo/316x.flv
/usr/bin/ffmpeg -i /home/ganu/public_html/video/316.mp4
-f image2 -ss 00:00:1 -s 120x90 -vframes 2
-y /home/ganu/public_html/tmp/thumbs/316/%08d.jpg

For metadata injection i used like this.

/usr/bin/flvtool2 -Uv
/home/ganu/public_html/flvideo/316x.flv
/home/ganu/public_html/flvideo/316.flv

So first say the file 316.mp4 is converted to 316x.flv. And after flvtool2 the meta information is injected and final file will be 316.flv

So this is how, the flv conversion is done.

Happy Programming. 🙂

Symfony Criteria for table alias with join of same table


Symfony Criteria for table alias and join a quick example.

Yesterday got a good situation, A kind of join with same table and with table alias.
I need to use the first query with symfony criteria.

I got this, hope this will be usefull to you too.

SELECT u1.USR_FNAME AS a, u1.USR_LNAME AS b, u2.USR_FNAME AS c, u2.USR_LNAME AS d, u3.USR_FNAME AS e, u3.USR_LNAME AS f
FROM tbl_test
LEFT JOIN tbl_users u1 ON ( tbl_test.TEST_USER1_ID = u1.USR_ID )
LEFT JOIN tbl_users u2 ON ( tbl_test.TEST_USER2_ID = u2.USR_ID )
LEFT JOIN tbl_users u3 ON ( tbl_test.TEST_USER3_ID = u3.USR_ID )
ORDER BY tbl_test.TST_ID ASC
LIMIT 10
$c = new Criteria();
   	$c->clearSelectColumns();
   	$c->addAlias('u1','tbl_users');
   	$c->addAlias('u2','tbl_users');
    $c->addAlias('u3','tbl_users');
   	$c->addSelectColumn(TblProjectPeer::TST_NAME);
   	$c->addAsColumn('a','u1.USR_FNAME');
   	$c->addAsColumn('b','u1.USR_LNAME');
    $c->addAsColumn('c','u2.USR_FNAME');
    $c->addAsColumn('d','u2.USR_LNAME');
  	$c->addAsColumn('e','u3.USR_FNAME');
   	$c->addAsColumn('f','u3.USR_LNAME');
   	$c->addJoin(TblTestPeer::TEST_USER1_ID,'u1.USR_ID',Criteria::LEFT_JOIN);
   	$c->addJoin(TblTestPeer::TEST_USER2_ID,'u2.USR_ID',Criteria::LEFT_JOIN);
  	$c->addJoin(TblTestPeer::TEST_USER3_ID,'u3.USR_ID',Criteria::LEFT_JOIN);

Or take another example

SELECT a.id FROM article a RIGHT JOIN article b ON a.article_id = b.id ORDER BY a.name DESC, b.date DESC
$c=new Criteria();
$c->addAlias('a', 'article');
$c->addAlias('b', 'article');
$c->addSelectColumn('b.id');
$c->addSelectColumn('a.article_id');
$c->addDescendingOrderByColumn('a.name');
$c->addDescendingOrderByColumn('b.date');
$c->addJoin('a.arcticle_id','b.id','RIGHT JOIN');
$rs = ArticlePeer::doSelectRS($c);  

Happy Programming. 😎

gnome-blog for wordpress.com blogs


This post will prove that, what I am writing from gnome-blog is successfully updated and uploaded.

editing again to say its success, and some more changes.

Directly this will not support ???.wordpress.com blogs. So for that in the preferences set

Blog Type : Self-Run Other
Blog Protocol : MetaWeblog
XML-RPC URL : http://{blogname}.wordpress.com/xmlrpc.php

Actually I am talking about this – gnome-blog

Happy Quick Blogging. 😀

barcamp mumbai 5


बार – केम्प , अरे ये वो नही है जैसा आप सोच रहे है….

ओहो! यह तो एक ही वाक्य है — बारकैम्प

जानिए ज्यादा के बारे मैं —-

BarCamp is an ad-hoc gathering born from the desire for people to share and learn in an open environment. It is an intense event with discussions, demos and interaction from participants.

तो फ़िर मैंने भी अपना रुख कर लिया मुंबई ५ की तरफ़….

देखिये सभी चित्र यंहा – Edition barcampMumbai5

Wow, this was nice event again.

<?php
$arrFunUnlimited = array();
$intGeekFriendsCount++;
$floatLearningCurve++;
$intEnergyDrinksFlavourOrange++;
?>

बस यार मजा आ गया

PHP & MySQL quick search bookmarklets


If you want to quick search to MySQL, here is the fast quick bookmarklet

javascript:q=document.getSelection();
if(!q)void(q=prompt('MySQL%20Keyword:',''));
if(q)location.href='http://search.mysql.com/search?q='+escape(q)

And the same goes for PHP too same like above…

javascript:term=document.getSelection();
if(!term)void(term=prompt('PHP%20Keyword:',''));
if(term)location.href='http://in2.php.net/'+escape(term)

Happy Programming. 😀

updates with my GPG key and IRC nick-name


As a open-source lover every one should be habitual with IRC and GPG key stuffs. And there are more and more stuffs related to FOSS.

Yday I create my GPG key
I got this pair “B411BE3C” – Ankur Dave

And I am registered user on IRC with nickname – “ullu_”

Hail Open Source.

%d bloggers like this: