My mistakes

ghostscript pdf to image conversion error

Posted by: pvibeesh on: February 10, 2010

When we convert a pdf to an image using ghostscript like

convert mam.pdf document.png

you may get an error like this :
ERROR: /undefined in –get–
Operand stack:
–dict:6/6(L)–   F1   14   –dict:9/14(L)–   –dict:9/14(L)–   275   –dict:9/14(L)–   –dict:11/12(L)–   glyf
Execution stack:
%interp_exit   .runexec2   –nostringval–   –nostringval–   –nostringval–   2   %stopped_push   –nostringval–   –nostringval–   –nostringval–   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   1   3   %oparray_pop   –nostringval–   –nostringval–   2   1   6   –nostringval–   %for_pos_int_continue   –nostringval–   –nostringval–   –nostringval–   –nostringval–   %array_continue   –nostringval–   false   1   %stopped_push   –nostringval–   %loop_continue   –nostringval–   –nostringval–   –nostringval–   –nostringval–   –nostringval–   –nostringval–   –nostringval–
Dictionary stack:
–dict:1127/1686(ro)(G)–   –dict:0/20(G)–   –dict:107/200(L)–   –dict:107/200(L)–   –dict:104/127(ro)(G)–   –dict:241/347(ro)(G)–   –dict:20/24(L)–   –dict:4/6(L)–   –dict:20/20(L)–   –dict:3/5(L)–   –dict:10/14(L)–   –dict:33/50(ro)(G)–   –dict:21/40(L)–
Current allocation mode is local
Last OS error: 2
ESP Ghostscript 815.02: Unrecoverable error, exit code 1
convert: Postscript delegate failed `mam.pdf’.
convert: missing an image filename `document.png’.
[manu@rc-170 imagemagic]$ /usr/lib/openoffice.org/program/soffice -invisible -headless -norestore -accept=”socket,host=127.0.0.1,port=8100;urp;” -nofirststartwizard & > /dev/null 2>&1
[1] 29233

Solution :

Upgrade the ghostscript to a newer version greater than 8.60

cakephp Loops and save()

Posted by: pvibeesh on: December 29, 2009

Loops and save()

You must reset the Model on every loop iteration.
$this->{ Model Name } ->create();

Place the above line at the beginning of the loop for eg:

foreach() {
$this->{ Model Name } ->create();
/* actual code */
}

Replace the { Model Name } with the corresponding model name

Tags:

XML Error: XML declaration not finished at line 1

Posted by: pvibeesh on: December 29, 2009

XML Error: XML declaration not finished at line 1

This error can occur in either one of these two situations…

1. Your server does not support UTF-8 encoding;
OR
2. You have incorrect magic_quotes settings on your server.

To check your server settings
Create a php file and place the below lines in it

For working with the second problem magic_quote settings should be:

magic_quotes_gpc ON
magic_quotes_runtime OFF (same as the PHP default setting)
magic_quotes_sybase OFF (same as the PHP default setting)

Tags:

Codeigniter Lost session on redirect

Posted by: pvibeesh on: April 22, 2009

Please have a try

Check the encoding of your ci_sessions database table field

change it to utf8_general_ci

TinyMCE Editor How to set the content Using javascript

Posted by: pvibeesh on: March 18, 2009

tinyMCE.activeEditor.setContent(content);

$this->load->library(“image_lib/”,$config);

for loop:

$this->image_lib->initialize($config);

end for loop

When using this library repeatedly it will initialize the image properties at once only.

It uses the existing instance for the remaining calls

To solve this problem call the initalize fucnction manually.

when someone trying to or two conditions using active record database library in codeigniter

Eg:

$this->db->from('posts');

$this->db->where('id', $id);

$this->db->like('title', $title);

$this->db->like('body', $body);
$this->db->or_like('author', $author);

You can do it like this

$this->db->from('posts');

$this->db->where('id', $id);
$this->db->where('(`title` LIKE \'%'.$title.'%\' OR `body` LIKE \'%'.$body.'%\' OR `author` LIKE \'%'.$author.'%\')', NULL, FALSE);

// Query:

// SELECT * FROM (`posts`) WHERE (`title` LIKE '%ach%' OR `text` LIKE '%ach%' OR `author` LIKE '%ach%') AND `id` = '12'


A. First make sure PostgreSQL server has been started to remote server.

# /etc/init.d/postgresql start

If it is running and you get above error, you need to add enable TCP/IP support. By default, the PostgreSQL server only allows connections to the database from the local machine or localhost. This is a security feature.

Step # 1: Allow remote IP address to access PostgreSQL

You need to open file called /var/lib/pgsql/data/pg_hba.conf. Login as postgres user using su command:
$ su - postgres
$ vi /var/lib/pgsql/data/pg_hba.conf

Now append following line. Let us say you would like to give access to 192.168.0.0/24 network:
host all all 192.168.0.0/24 trust
Please replace 192.168.0.0 and 255.255.255.0 to reflect the actual network IP address range of the clients system in your own network.

Save close the file.

Step # 2: Allow communication over TCP/IP

You need to open PostgreSQL configuration file /var/lib/pgsql/data/postgresql.conf
$ vi /var/lib/pgsql/data/postgresql.conf
Now bind and open TCP/IP port by setting tcpip_socket to true:
tcpip_socket = true

Save and close the file.

Step # 3: Restart PostgreSQL server

Restart the PostgreSQL server with the following command
# /etc/init.d/postgresql restart

This will open default port 5432.

Step # 4: Test your setup

Use psql command from client system as follows:
psql -h PostgreSQL-IP-ADDRESS -U USERNAME -d DATABASENAME

Connect to remote server by IP address 192.168.0.3 and login using testuser to connect to testdb database, use:
$ psql -h 192.168.0.3 -U testuser -d testdb
Where,

  • -h 192.168.0.3 : Specifies the host name of the machine or IP address (192.168.0.3) on which the server is running.
  • -U testuser : Connect to the database as the testuser username instead of the default. You must have account and permission to connect as testuser.
  • -d testdb : Specifies the name of the database (testdb) to connect to.

When your are trying to connect a remote pgsql db on a Suse Linux 9 or others, It did not have the tcpip_socket parameter in postgresql.conf

To overcome this, I had to uncomment the following settings:

#—————————————————————————
# CONNECTIONS AND AUTHENTICATION
#—————————————————————————

# – Connection Settings -

listen_addresses = ‘*’
port = 5432

15 Tips For a Better Linux Experience

Posted by: pvibeesh on: October 15, 2008

http://www.linuxhaxor.net/2008/10/14/15-tips-for-a-better-linux-experience/

Linux Recovering data from damaged media

Posted by: pvibeesh on: October 15, 2008

Recovering data from damaged media can be handled by several Linux tools including some LiveCD, specifically built to help recover data. Parted Magic, Ubuntu Rescue Remix, SystemRescueCd, Foremost (data recovery), Ddrescue.