Hi.
This error occurs when your message does not has the terminator of message.
Use “.” terminator.
For working doing this:
var
slMail : TStringList;
mMsg : TIdMessage;
begin
slMail := TStringList.Create;
//slMail.Text := STRING OF THE YOUR EMAIL MESSAGE
slMail.Add('.');
slMail.SaveToFile(sFileName);
mMsg := TIdMessage.Create(nil);
mMsg.LoadFromFile(sFileName);
end;
Bom dia.
Este post vai em português somente serve para os brasileiros.
Se você alguma vez desenvolveu algo no Tomcat no Windows em Português teve problema com acentuação ao colocar em produção em um servidor Linux em Inglês.
Todas as acentuações saem com “?”.
Para resolver para basta você setar duas variáveis de ambiente no Linux antes de iniciar o tomcat.
export LC_ALL=pt_BR
export LANG=pt_BR
Até mais, sucesso.
Hi..
If you use PHP and using pg_unescape_bytea function using the new version of PostgreSQL you have the surprise. The function don’t return your files.
PostgreSQL 9.0 introduced “hex” as the new default format for encoding binary data. Because “pg_unescape_bytea” only works with the old “escape” format.
Solution is simple:
Works!!..
Bye.
Hi,
This command remove all “.svn” folder’s and files recursive in your directory.
Enter in folder with you want remove and:
find ./ -name ".svn" | xargs rm -Rf
See..
Hi.
For use SSL in Lighttpd, you first need create the .pem file.
The .pem file is the .key file and the .crt file, together.
For create you can use this command on your terminal.
cat ssl.key ssl.crt > ssl.pem
Now you need config the Lighttpd for use SSL in lighttpd.conf.
$SERVER["socket"] == "your_ip_address:443" {
ssl.engine = "enable"
ssl.ca-file = "/your_path/ca.txt"
ssl.pemfile = "/your_path/ssl.pem"
}
Restart you server, and done…
See you…
Hi.
In my case i needed use alias and rewrite together.
My problem is ever Lighttpd call rewrite, and ignore the alias rules.
My solution for that is (In my case), in lighttpd.conf:
alias.url = (
"/alias1" => "/var/www/alias1",
"/alias2" => "/var/www/alias2"
)
url.rewrite-once = (
"^/([a-z][^(alias1|alias2)][^\.*]*)$"=> "index.php?path=$1"
)
Where in the regular expression used in rewrite rule, verify if the url don’t use alias1 or alias2.
For me worked.
Hi.
Recently i changed my webserver of Apache to Lighttpd.
And has some problems for migrate ReWrite of Apache to Lighttpd;
For solution Rewrite need in permalink the WordPress, you need these line in your lighttpd.conf
url.rewrite = (
"^/(wp-.+).*/?" => "$0",
"^/(sitemap.xml)" => "$0",
"^/(xmlrpc.php)" => "$0",
"^/(.+)/?$" => "/index.php/$1"
)
Hi..
Today i going to show for you how install Lighttpd using Php on ubuntu.
Is very simple because lighttpd has on Ubuntu packages.
sudo apt-get install lighttpd php5-cgi
After install enable fastcgi module in Lighttpd.
sudo lighty-enable-mod fastcgi
Done!!!, your lighttpd is now runnig.
Open you browser in http://localhost
If you use mysql with php:
sudo apt-get install php5-mysql
Or if you use Postgresql with php:
sudo apt-get install php5-pgsql
The lighttpd configuration is /etc/lighttpd/lighttpd.conf, and the PHP config file is /etc/php5/cgi/php5.ini.
For default the document root of lighttpd is /var/www.
Works very well, for me lighttpd is more fast than apache.
Bye.
Hi…
Recently i needed take pictures using webcam in my web software, for one store.
My software is developed in PHP, and i used flash for take the picture.
The swf you can download here.
For use that swf, i created some params in Javascript.
You can use that:
Add div in your html:
And add Javascript command:
var mainswf = new SWFObject("picture.swf", "main", "640", "480", "9");
mainswf.addVariable("sSaveUrl", "yourServerSide.php");
mainswf.addVariable("iJpegQuality", 50);
mainswf.write("flashArea");
I used swfobject, you can seen here.
In variable sSaveUrl you pass the url for saving you image.
You can use PHP, ASP, CGI, ….
The variable iJpegQuality you pass in range of 0 for 100, the JPEG quality.
Now you need take the picture, right ?
Use that javascript command:
document.getElementById("main").startCapture();
The actionscript take the picture and send for your url.
If you use php, you can use that (Very simple sample):
if(isset($GLOBALS["HTTP_RAW_POST_DATA"])){
$jpg = $GLOBALS["HTTP_RAW_POST_DATA"];
file_put_contents("/images/save/image.jpg", $jpg);
}
Work for me. If you need the fla, send me e-mail, to@edgardksb.com.
Bye.
Hi.
Today i explain how install audit log in PostgreSQL in Ubuntu.
Audit log, is the trigger’s function’s and one lib in C, with create table log’s of all update’s in table’s with audit enabled.
I recomend you create one schema where will created the log table’s.
Now we will install.
First, download the audit log in http://pgfoundry.org/projects/tablelog/.
In my case i have PostgreSQL installed with Synapctics.
You need to, the PostgreSQL dev librarys and the pg_config installed.
Case you need install use this commands:
sudo apt-get install postgresql-server-dev-8.3
sudo apt-get install libpq-dev
Now extract files of the audit log, and compiling and install the librarys.
sudo make USE_PGXS=1
sudo make USE_PGXS=1 install
Run the this SQL script’s:
CREATE FUNCTION "table_log" ()
RETURNS trigger
AS '$libdir/table_log', 'table_log' LANGUAGE 'C';
CREATE FUNCTION "table_log_restore_table" (VARCHAR, VARCHAR, CHAR, CHAR, CHAR, TIMESTAMPTZ, CHAR, INT, INT)
RETURNS VARCHAR
AS '$libdir/table_log', 'table_log_restore_table' LANGUAGE 'C';
CREATE FUNCTION "table_log_restore_table" (VARCHAR, VARCHAR, CHAR, CHAR, CHAR, TIMESTAMPTZ, CHAR, INT)
RETURNS VARCHAR
AS '$libdir/table_log', 'table_log_restore_table' LANGUAGE 'C';
CREATE FUNCTION "table_log_restore_table" (VARCHAR, VARCHAR, CHAR, CHAR, CHAR, TIMESTAMPTZ, CHAR)
RETURNS VARCHAR
AS '$libdir/table_log', 'table_log_restore_table' LANGUAGE 'C';
CREATE FUNCTION "table_log_restore_table" (VARCHAR, VARCHAR, CHAR, CHAR, CHAR, TIMESTAMPTZ)
RETURNS VARCHAR
AS '$libdir/table_log', 'table_log_restore_table' LANGUAGE 'C';
SQL Script’s for create trigger function’s:
CREATE OR REPLACE FUNCTION table_log_init(int, text, text, text, text) RETURNS void AS '
DECLARE
level ALIAS FOR $1;
orig_schema ALIAS FOR $2;
orig_name ALIAS FOR $3;
log_schema ALIAS FOR $4;
log_name ALIAS FOR $5;
do_log_user int = 0;
level_create text = '''';
orig_qq text;
log_qq text;
BEGIN
-- Quoted qualified names
orig_qq := quote_ident(orig_schema)||''.''||quote_ident(orig_name);
log_qq := quote_ident(log_schema)||''.''||quote_ident(log_name);
IF level <> 3 THEN
level_create := level_create
||'', trigger_id BIGSERIAL NOT NULL PRIMARY KEY'';
IF level <> 4 THEN
level_create := level_create
||'', trigger_user VARCHAR(32) NOT NULL'';
do_log_user := 1;
IF level <> 5 THEN
RAISE EXCEPTION ''table_log_init: First arg has to be 3, 4 or 5.'';
END IF;
END IF;
END IF;
EXECUTE ''CREATE TABLE ''||log_qq
||''(LIKE ''||orig_qq
||'', trigger_mode VARCHAR(10) NOT NULL''
||'', trigger_tuple VARCHAR(5) NOT NULL''
||'', trigger_changed TIMESTAMPTZ NOT NULL''
||level_create
||'')'';
EXECUTE ''CREATE TRIGGER "table_log_trigger" AFTER UPDATE OR INSERT OR DELETE ON ''
||orig_qq||'' FOR EACH ROW EXECUTE PROCEDURE table_log(''
||quote_literal(log_name)||'',''
||do_log_user||'',''
||quote_literal(log_schema)||'')'';
RETURN;
END;
' LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION table_log_init(int, text) RETURNS void AS '
DECLARE
level ALIAS FOR $1;
orig_name ALIAS FOR $2;
BEGIN
PERFORM table_log_init(level, orig_name, current_schema());
RETURN;
END;
' LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION table_log_init(int, text, text) RETURNS void AS '
DECLARE
level ALIAS FOR $1;
orig_name ALIAS FOR $2;
log_schema ALIAS FOR $3;
BEGIN
PERFORM table_log_init(level, current_schema(), orig_name, log_schema);
RETURN;
END;
' LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION table_log_init(int, text, text, text) RETURNS void AS '
DECLARE
level ALIAS FOR $1;
orig_schema ALIAS FOR $2;
orig_name ALIAS FOR $3;
log_schema ALIAS FOR $4;
BEGIN
PERFORM table_log_init(level, orig_schema, orig_name, log_schema,
CASE WHEN orig_schema=log_schema
THEN orig_name||''_log'' ELSE orig_name END);
RETURN;
END;
' LANGUAGE plpgsql;
In files of the Audit log have the file table_log_init.sql with the SQL script’s.
Now for you enable the audit log, is simple. Just:
table_log_init(5, 'TABLE_NAME', 'LOG')
The commands for enabled audit log:
/* create the log table as tablename_log */
table_log_init(ncols, tablename):
/* create the log table with the same name as the original table,
but in the schema logschema. */
table_log_init(ncols, tablename, logschema):
/* log the changes in table tableschema.tablename into the log table
logschema.logname. */
table_log_init(ncols, tableschema, tablename, logschema, logname):
Bye.