kanenas.net

SQL

SQL error - Out of range value adjusted for column OR Duplicate entry xxx for key 1

by kanenas.net on May.23, 2009, under MySQL, SQL

Senario:
CREATE TABLE test_table (test_id TINYINT, test_text VARCHAR(20));
INSERT INTO test_table (test_id, test_text) VALUES ('', 'This is a test');

Errors:
SQL error “Out of range value adjusted for column…”

if you have removed STRICT_TRANS_TABLES from my.ini (Windows) or my.cnf (Linux)
Server SQL Modes

You will get this error…
Duplicate entry xxx for key 1

ATTENTION:
If you want to remove STRICT_TRANS_TABLES
1. You need to have access and restart MySQL Server! A production server !?!?
2. Not everybody has root access or admin rights to change the sql mode.
3. Maybe, you need the server to run in strict mode for some reason.
4. NOT RECOMMENDED!

Solution:
Check the field type (e.g test_id TINYINT -128 to 127 )
So if you are trying to insert into a table value 128 it won’t insert !

MySQL 5.1 Reference Manual :: 10 Data Types :: 10.2 Numeric Types

;)

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
  • Share/Bookmark
Leave a Comment :, , , , , more...

Joomla/Mambo - PDF Indexer Module

by kanenas.net on May.06, 2009, under Linux, MySQL, PHP, Programming, SQL

PDF Indexer

Allow PDFs to be searched via the Joomla/Mambo search module.

This Joomla/Mambo Component allows you to index PDFs located within your Joomla directory and the corresponding mosbot allows that index to be searched using the Joomla search component. This allows the text of PDFs to be viewed when searching a Joomla site.

Version 2.4

New Features:
* Joomla 1.5 legacy support
* More bug fixes

Also Featuring:
* Indexes new pdfs only so indexing is much faster.
* PDF file version changes.  It will automatically detect if a PDF has changed and index it on the next pass.
* Delete indexes to PDFs that have been removed from your file structure.
* Password Protected PDF indexing!
* Ability to edit past indexes (For those image based pdfs, add keywords, phrases)
* Improved MosBot
* Other Various Bug Fixes

Does not work on servers in SafeMode or when Popen is off.

Great work! Really!
But i run into a big problem…

I have tested PDF Indexer with Joomla 1.5 and works PERFECT with “small” pdf files.
With “Small” pdf files I mean up to 1 MB.
When I tried a “bigger” pdf file like 10 MB or even worst 40MB or 80MB, although it seemed that it was working (that is, no errors found) when I tried to see it in “Modify Indexes” from the Administration Menu… it wasn’t there.
:(

Solution:

1. Edit the file…
/administrator/components/com_file_index/admin.file_index.php

Lines 366,445:
Change this…
$contents .= fread($handle2, 8192);
to this…
$contents .= fread($handle2, $fileSize);

then add the following line…
ini_set("memory_limit","128M");
in the first lines of the file.

Alternative: If you have access, change the memory_limit = 32M to  memory_limit = 128M in your /etc/php.ini file. Restart apache !!!

2. Edit the file…
/etc/my.cnf
set-variable = max_allowed_packet=xM
where xM the needed MB (for example 5MB)!

Fire up phpMyAdmin or open your favorite MySQL Manager.
Go to the Joomla DATABASE and in the TABLE that stores the data for indexing edit the FIELD Description to LONGTEXT.
Restart mysql !!!

That’s all!

The results were great. In a few seconds a 78MB pdf file was indexed !
;)

  • Share/Bookmark
5 Comments :, , , , , , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!