is_dir not working

The is_dir() function in PHP allows users to check whether a file is a directory. It returns true if the file is a directory. However, the addresses provided must be RELATIVE TO THE CURRENT DIRECTORY. Suppose we have a directory structure as follows:

cwd
|-- dir1
  |-- dir2
     |-- dir3

where cwd is the current working directory

is_dir(dir1);  // returns true
is_dir(dir2);  // returns false
is_dir(dir1/dir2);  // returns true

Java stack

Stack is a LIFO ADT (Last in first out abstract data type) and a linear data structure. In a jar the items on top (i.e. items that went in last) come our first. In a LIFO ADT, items that go in last come our first.

Stacks are a very useful data structure. Although you have the possibility of creating your own stack data structure from Java code, it is a better idea to simply use the stack provided by Java.

Code Following code shows how to use Java's stack:

Displaying multiple fields in a single line in drupal7 views

Suppose you have three fields (Title, field_city, field_country) to display in your view. By default they will display in three separate lines as follows:

Benjamin Franklin
Philadelphia 
USA

To display this information in a single line, you need to edit the third field. Expand Rewrite Results, then type in the following:

[Title], [field_city], [field_country]

This will result in the following:

Benjamin Franklin, Philadelphia, USA 

Checking disk space in Linux

To check disk space, you can use one the following commands:

$ df

This command would list the amount of space used and available on each partition of the system.

$ du 

du commands lists disk space usage file by file. Read du man pages before using du.

$ vmstat

vmstat outputs virtual memory statistics

$ ls -l

Outputs file names and sizes.

Fatal error: Allowed memory size exhausted

Drupal can be very memory intensive CMS, especially if you have lots of menus, blocks and modules. If you exhaust the allowed memory size, you would get an error such as the following

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 41 bytes) in somefile

To fix this problem, you need to allocate more memory.

1. Open you php.ini file If you don't know where this file is, run locate php.ini. Mine is located at /etc/php.ini. Make sure you back up this file before editing it.

Pages