My mistakes

MySQL GROUP_CONCAT headache

Posted by: pvibeesh on: September 27, 2011

create table test_table(id integer unsigned,cName varchar(50));

insert into test_table values(1,’test1′);
insert into test_table values(2,’test2′);
insert into test_table values(3,’test3′);

select group_concat(cName separator ‘,’)
from test_table

+———————————-+
| group_concat(cName separator ‘,’) |
+———————————-+
| test1,test2,test3 |
+———————————-+

But now,I want to limit the group_concat to the first two rows of the result:

+———————————-+
| group_concat(name separator ‘,’) |
+———————————-+
| test1,test2 |
+———————————-+

Solution :
We cannot use the limit with the group_concat so the better solution is to go for SUBSTRING_INDEX like

SELECT
SUBSTRING_INDEX(group_CONCAT(cName) , ‘,’, 2) as cName from test_table

Tags:

Eclipse ” editor does not contain a main type”

Posted by: pvibeesh on: February 16, 2011

This issue is mainly related to the source path setting . To solve this issue ensure the source path is setup correctly.

For verifying the source path use
Project(Menu)
=> Properties
=> Java Build Path
=> Source (select the appropriate src files)

After setting up the src
1) While running select the type of the application
2) Select the appropriate file with the main function

Firefox DOM – whitespace and newline

Posted by: pvibeesh on: March 22, 2010

Refer this post

http://www.agavegroup.com/?p=32

php emil non-ascii subject encoding

Posted by: pvibeesh on: March 12, 2010

Quick fix
$subject= mb_encode_mimeheader($subject,”UTF-8″, “B”, “\n”);

Tags:

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 initialize function manually.

Follow

Get every new post delivered to your Inbox.