The Journey to Drupal Conference SF

28 04 2010
The Journey, Ha it is very long journey I had in my life. I did not forget the feeling of first take of the flight. The sound is too horrible for my ears. I got much pain at the begining.

My Journey is 3 parts from Hyderabad to Kaulalampur, From Kaulalampur to Hong Kong and from Hong Kong to San Francisco.

At Hyderabad I was very nurvous and very excited about the entire process to board into flight.

My Family came to give send off at the Hyderabad, I finished taking boarding pass easily, after that talked with my family for 1 hours then at the Imigration, the guy was asking another person about the business trip, I was like what’s wrong, but the problem is he don’t know clearly.

After finishing Imigration check went to waiting hall to board into flight. There I waited for long time more than 1 hour. Finally they announced to board in to fligh. First time getting into flight, when I am walking into the flight, I was excited, I am getting into flight. Wow I am travelling in the plain. When I saw the seats, I was not so surpriced, it is bit similar to air bus. After getting in found the seat very easily. Because it is first time listened carefully about all the security things said by the airhostes.

I was waiting for the flight to take off. I am excited to experience it. Finally flight started moving, it took some time to take position then started going fast with big sound. My ears started paining and like feeling bit odd. I did not feel good until take of finshed.

I was getting too much sleep, I had the snacks and slept. If I get any doubt I asked the next seat guy, he was very helpful but did not ask his name. It is just 3 and half hours of journey. I slept, but it is not good sleep. When I woke up my watch is saying it is 4:00 am but when I look at out side it is already morning. It was 7:00am at Kaula lampur. After some time I get down from that flight.

Now I have to catch the next flight which goes to Hong Kong. I don’t know how to find the gate, looking for some of the air port people to help me to which gate I have to take to board into next flight. I could not see any one until walk for around 15 minutes. Finally I found a display where they are showing all the flight details, with the help of another guy I found the gate. How to go to that gate is my next problem. I looked around for help desk, after walking straight for 5 mintes, I found help desk, she said I have to catch a train to reach that Gate. OK I followed her instructions and safely reached the gate without much problem. At Kaula lampur I did not find much indian faces, most of them looks like chinees and Japanees.

There are no seats to sit at the outside of the gate, I was standing. Then called for the boarding, after finishing the checking process, asked to wait for some time, there I found wifi, then opened laptop and sent some mails to home and the people who receive me. At Kaulalampur the people getting into flight looks like from same family, every body talking each other but their language is not english. I got into flight, in my next seat one japanies lady sat. Looks like she don’t know speaking engligh.

Because I did not sleep well in the previous flight, I got full sleep, I did not observe sorrounding and slept without knowingly. After I wake up I saw video for some time. It was just 3 hours journey to Hong Kong. But the flight reached the destination 1 hour late. I have to board into the San Francisco flight, which is having the same boarding time. I wanted to get ou
t from the flight first. So before finishing the landing I removed seat belt and woke up to take my cabin bag, then one of the crew told me to sit till the landing, then I sit back. After few minutes, flight landed and every body woke up and standing to get out from the flight, it took more than 15 minutes to come out from the flight. I was tensed a lot.

After I came out from the flight, I first searched for display to show the boarding time of the San Francisco flight. I found the display after walking for 5 minutes. The display is showing last call. First I though what to do, the display is not showing the Gate number that I have to take, I was searching for some one to help me, I went to check in counter and asked she said the Gate number and she said some way but I did not understand and went to exit side, then came back and asked some japanees family, they show me path to the escalator and told me to go down and catch train, I took escalator and run into the train before the doors close.

The train reached the destination in 2 minutes, then I am seeing all shops not Gates, then searching for some one to help me, then I found a girl who wear red suite, looks like she works at airport, when I ask her, she also hurried and talked with some other people and sent me through one door and told me that don’t worry mam, have 20 minutes time to take off. Then when I go into that door, I have to went through another escalator and walk for some time, finally found my Gate, When I am walking towards it, another girl asked are you for San Francisco flight? I said yes, then she took ticket and doing the scan of the ticket, another girl came and asked me to sit at another place, I said ok, what ever seat will we be ok for me, I just need to get into flight. Then asusal checking process and went to the flight and searching for the seat.

My seat is in the middle, 2 sides of my seat are men, then I asked one guy who sit at the corner to sit in the middle, he accepted and sat in the middle but called crews and telling them that he was sitting there and telling them to bring his food at his seat. His name is Jayesh. I thought ok in the beginning then talked with him as he is Indian and he said about him and asked about me. After some time, food was served to me, and asked are you Indian Vegitarian, I said yes and started eating food. He asked me are you Vegitarian? I said yes then after I finish my food also he did not get food, the another guy who sit at the window also got the food, he was waiting waiting and asked crew. The crew served his food to me. He became angry and did not eat another food. He waited for 2 and half hours but did not get food. I felt bad about that. He helped me to fill up the form of I 94. It was 14 hours journey so watched movies and opened laptop but did not sleep well. After getting out from the flight, he waited till I finish the imigration process. At the checkin, the airport officer asked me about my trip and conference, then checked my return flight tickets and put stamp and sent me out. Then I went to luggage section, checking for my bag, I am not seeing my bag, I was there for more than 30 minutes, but did not find my bag. Jayesh came and asked me about bad, I said I could not find my bag, then he helped me to inform the concerned person and finished formalities. I called to the peopele I need to inform at San Francisco from his mobile said thanks and waiting outside.

I took change by buying something at the airport and called the person who pick me up. He was there and I came out and got into the car and reached home of the family I know.





Drupal: CSS compression breaks layout if we use @import url

21 03 2010

Recently we faced a unique issue in one of the drupal project. The layout used to break completly in IE. But it used to work well in firefox. Later we figured out that IE is unable to load more than 31 css files. If the css files exceed 31 files it does not load after 31 files.

If we compress the css this number of css files problem does not occur. So we enabled css compression for the performance settings page. Then the layout was completly breaking.

When we compress css, layout breaking means there are some css syntax errors which are causing css to render properly. We started fixing all the W3c css validation errors. One of the error which we are seeing is for one of the selector the background property was causing the issue. The original css is like this


#header div.drigg input-sumbit {
backgroud: transparent url('../img/image1.png');
color: #333;
}

After compress the css became


#header div.drigg input-submit {backgroung: transparent url(css/color:#333)}

The above statement telling that when we compress the url was changed. When I digg further why this is happening only this selector, then I realised that this css was written in a another css file and this was imported in style.css using @import url.

Then removed this @import statements and added these file paths in my theme .info file. Then when I compress css, layout did not break. Now it was working well in IE and other browsers.

Finally I realised that we should not use @import url, instead we can load all css files by placing them in the theme .info file.





Linux like development environment in Windows

6 11 2009

I am a fan of Linux based OS. I love Ubuntu a lot. In fact I started my programming in Redhat. So from the beginning I am comfortable using Linux than Windows. The only reason I use windows is to check IE browser compatability.

Recently I attended Drupal Sprint India 2009. I want to attend the sprint, so I need one Laptop to go there and work. My company provided me Laptop with Windows. So I need to work on drupal core issues in windows. Hmm it looks very hard for me to work in Windows. I want to have following things in my Windows machine.

  1. Cygwin to get the linux like terminal, so that I can see paths with forward slash.
  2. Xampp Lite to get Apache, Mysql, PHP.
  3. cvs, I am going to work on drupal core so I need it
  4. I should able to create patches, apply patches.
  5. I want to use Drupal Drush module, which provides some command line utilities
  6. Emacs. I am more comfortable with this editor. It is very hard to work with other editors once we are comfortable with Emacs

First I installed the things I know like Cygwin, Xampp Lite.

Installing Emacs

I Installed Emacs by following instructions at http://www.claremontmckenna.edu/math/ALee/emacs/emacs.html .

Installing UnxUtils

To be able create patches and apply patches I installed unxutils from http://sourceforge.net/projects/unxutils/ . With this unxutils I got most of the Linux commands. The commands like ls, mkdir, wget, diff, patch, tar, zip etc… are working. I am very happy after installing unixutils.
Installing UnxUtils is nothing but setting the path variable in Windows. I extracted the unixutils directory in C folder and Add C:\unixutils\usr\local\wbin path to the Path variable. In Windows XP we can set the Path variable by going to control panel > System > Advanced > Environment Variables. Select the Path and click Edit and add your path to the existing path.

Installing Drush

There is a documentation about installing Drush in Windows http://drupal.org/node/594744 . This document explain Drush installation by using GnuWin32. But I already installed UnxUtils so I don’t require GnuWin32. So first 3 steps in the http://drupal.org/node/594744 can be ignored. I extracted drush in C folder. As specified in the step 4 of http://drupal.org/node/594744 I edited drush.bat with the path of php.exe and path of drush.php. I added following statement in drush.bat file
@E:\xampplite\php\php.exe C:\drush\drush.php %1 %2 %3 %4 %5 %6 %7 %8 %9

Because I used xampplite to install php, php is there at path E:\xampplite\php\php.exe.Now I executed drush command from the windows terminal by specifying -r and -l attributes.
After that I got an idea why can’t I keep this php, drush paths also in path so that I can directly drush.bat file as it is. Yes I added php, drush, mysql paths in Windows Path variable. The everything works file.

Installing cvs

I downloaded TortoiseCVS from http://www.tortoisecvs.org/download.shtml. This is a exe file, I can simple double click and execute.

That’s it, Now I installed all the things necessary to work on drupal with a linux like environment. Now I am happy to work on windows.





Drupal:Displaying sub menus of primary link

23 10 2009

I want to display the sub menus of the currently accessing primary link as a block. Drupal provides Primary links, Secondary links blocks but does not display sub menus of currently accessing primary link.

When I search, I got following code snippet which lists the sub menus of currently accessing primary link. I directly created block using Add block by adding this php code snippet. It works a charm.

$tree = menu_tree_page_data('primary-links'); //substitute your menu name for primary-links
foreach($tree as $key => $mi) {
if ($mi['link']['in_active_trail'] && $tree[$key]['below']) {
$menu = menu_tree_output($tree[$key]['below']);
}
}
print $menu;

I hope this will help others to find easily.





Drupal – Advertisement module

21 07 2009

Today I got a chance to work on advertisements feature in one of our project. I found Advertisement module. This module is having lot of features, I just need a way to add advertisement with the banner and need to show the ads in a block. I did following steps to get what I need.

1. Download and place Advertisement module in modules directory. I use drush

drush dl ad

2. Enable the ad, ad_image module through admin build modules page. I used drush

drush enable ad

drush enable ad_image

3. Go to admin/content/ad/configure/image page and set the maximum image size for the default group and checked Allow remote hosted images. Here I used default group. If we want we can create groups and assign ads to different groups. When we create a group, the specific group block will be created automatically.

4. Enable the default ad group: default block. Enable respective group block if create groups

5. Create advertisement by going to node/add/ad page. Specify the title and group details

6. Select the Add type in the Select Ad type section and click select then one new section will add at the bottom of Select Ad type section.

7. Specify the destination url and specify Romote Image path if the image is from remote path. We can also upload the image at the bottom of the page in file attachment section.

8. We can set the ad activation, expiration settings at scheduling section.

9. Set the status of the ad and save. Choose the active status if you want to display ad in the block. Save the advertisement.

10. Repeat the steps from 5-9 to add more ads.

11. Now the block will display the ad image that we created now.

12. By default block display 1 ad. we can configure the number of ads to be displayed in the block in block configuration page.

That’s it. I can able to create ads with image and displaying them in a block. Hope this might be helpful for others(I used drupal 6)





Drupal – Restrict access to menu item per role

20 07 2009

When I am working on one project, I created some content types. The view permissions for some of the content types should be restricted only for some roles. There is no view access peromission specific to content type. There are  add, edit, delete permissions for the specific content type.

Any how I am using only one node of that content type. So I used menu_per_role module. Through this module we can restrict the access of a particular menu item. I did following steps to restrict access to one menu item for some roles.

1. install menu_per_role module

2. enable the module

3. Go to menu item edit page, you can see Restrict access permission section. Select the roles which you want to give permission for this menu and save.

That’s it. It worked for me for now, but I need to find out how to restrict view access of particular node type. If some one know please send me comment.





Drupal – Custom filter type for content type

20 07 2009

In one of the project that I am working, there is a requirement to enable full html filter type for one content type. The rest of the content types should have the default filter type configurations set in the admin/settings/filters/list.

I did with the Filter by node type module. Which solved my problem. I followed bellow steps to enable full html filter type for one content type.

1. Install the module

2. Enable module

3. Go to content type edit page.  Path will be admin/content/node-type/<node type>

4. Expand Submission form settings section. Check the allowed input filters for this content type and save.

5. Select the proper roles who can use this filter format. We can set this by going to the corresponding filter configuration page. If we do not set this role even if we set the default filter type it does not effect.

That’s it. I used drupal 6. Hope this might be helpful for others.
update: I found another better module to do this. It is Better Formats module . I did not try this but It looks it works better than filterbynodetype module.