Near the soul's profile - activity

8 years ago received badge Notable Question (source)
8 years ago received badge Popular Question (source)
8 years ago received badge Notable Question (source)
10 years ago received badge Popular Question (source)
11 years ago received badge Notable Question (source)
11 years ago received badge Popular Question (source)
11 years ago received badge Famous Question (source)
12 years ago received badge Famous Question (source)
13 years ago received badge Famous Question (source)
13 years ago received badge Famous Question (source)
13 years ago received badge Notable Question (source)
13 years ago received badge Popular Question (source)
13 years ago received badge Supporter ( source )
13 years ago asked a question Best way to customize the MathJax settings in Askbot

The MathJax/config/default.js file is used for customize the MathJax settings. To use it i modify this original code in bottom_scripts.html

{% if settings.ENABLE_MATHJAX %}
    <script type='text/javascript' src="{{settings.MATHJAX_BASE_URL}}/MathJax.js">
        MathJax.Hub.Config({
            extensions: ["tex2jax.js"],
            jax: ["input/TeX","output/HTML-CSS"],
            tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
        });
    </script>
{% endif %}

in this other code

{% if settings.ENABLE_MATHJAX %}
    <script type='text/javascript' src="{{settings.MATHJAX_BASE_URL}}/MathJax.js?config=default">
        MathJax.Hub.Config({
            extensions: ["tex2jax.js"],
            jax: ["input/TeX","output/HTML-CSS"],
            tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
        });
    </script>
{% endif %}

With this change i can customize the MathJax settings through MathJax/config/default.js. Can this change compromise some askbot functionality?

Remark. Also i notice that changing the original code in this more simply code

{% if settings.ENABLE_MATHJAX %}
    <script type='text/javascript' src="{{settings.MATHJAX_BASE_URL}}/MathJax.js?config=default">
    </script>
{% endif %}

the body of the question is rendered by MathJax but the title not!

Thanks in advance.

13 years ago commented question Installation under Apache/mod_wsgi: "ImportError: No module named site"

I don't know :(! i simply copy the log. Anyway change WSGIPythonHome to /usr and adding <Directory "/home/relax/Temp/askmath/"> Order allow,deny Allow from all </Directory> after WSGIScriptAlias / /home/relax/Temp/askmath/django.wsgi resolve partially the problem ;). Now i can see the site on my browser but without static content (css, image, etc). Any suggestion? Thanks

13 years ago commented question Installation under Apache/mod_wsgi: "ImportError: No module named site"

I add a debugging statements into the wsgi script and run it with python. I list all paths in the main question. I hope this can be helpful to find a solution. I'm going crazy ;)

13 years ago received badge Commentator
13 years ago commented answer Installation under Apache/mod_wsgi: "ImportError: No module named site"

I can't find something usefull in the system, apache and virtual host logs :(! I update my question with my configuration file for apache. @Evgeny, can you look at my configuration file please? I think that the problem is it.

13 years ago commented answer Installation under Apache/mod_wsgi: "ImportError: No module named site"

Seems that mod_wsgi works well because i try the test at https://wiki.archlinux.org/index.php/Mod_wsgi#Test_mod_wsgi and everything works fine. Where can i put the statements you mentioned?

13 years ago asked a question Installation under Apache/mod_wsgi: "ImportError: No module named site"

I try to setting apache webserver for running askbot in my local machine but i get this error in /var/log/httpd/error_log:

[Mon Mar 12 16:21:24 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Mar 12 16:21:24 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Mar 12 16:21:24 2012] [notice] Digest: generating secret for digest authentication ...
[Mon Mar 12 16:21:24 2012] [notice] Digest: done
[Mon Mar 12 16:21:25 2012] [notice] Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0g DAV/2 mod_wsgi/3.3 Python/2.7.2 configured -- resuming normal operations
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site

This is my configuration for apache

#NOTE: the directory paths used here may be adjusted

#the following two directories must be both readable and writable by apache
WSGISocketPrefix /var/run/wsgi
#WSGIPythonEggs /usr/lib/python2.7/site-packages/

#the following directory must be readable by apache
WSGIPythonHome /usr/lib/python2.7

#NOTE: all urs below will need to be adjusted if
#settings.FORUM_SCRIPT_ALIAS is anything other than empty string (e.g. = 'forum/')
#this allows "rooting" forum at http://example.com/forum, if you like

#replace with 127.0.0.1 with real IP address
<VirtualHost 127.0.0.1:80>
    ServerAdmin you@example.com
    DocumentRoot /home/relax/Temp/askmath/
    ServerName example.come

    #aliases to serve static media directly
    #will probably need adjustment
    Alias /static/ /home/relax/Temp/askmath/static/
    Alias /upfiles/ /home/relax/Temp/askmath/askbot/upfiles/
    <DirectoryMatch "/home/relax/Temp/askmath/askbot/skins/([^/]+)/media">
    Order deny,allow
    Allow from all
    </DirectoryMatch>
    <Directory "/home/relax/Temp/askmath/askbot/upfiles">
    Order deny,allow
    Allow from all
    </Directory>
    #must be a distinct name within your apache configuration
    WSGIDaemonProcess askbot2
    WSGIProcessGroup askbot2
    WSGIScriptAlias / /home/relax/Temp/askmath/django.wsgi
    #make all admin stuff except media go through secure connection
    <LocationMatch "/admin(?!/media)">
    RewriteEngine on
    RewriteRule /admin(.*)$ https://example.com/admin$1 [L,R=301]
    </LocationMatch>
    CustomLog /home/relax/Temp/askmath/log/access_log common
    ErrorLog /home/relax/Temp/askmath/log/error_log
    LogLevel debug
</VirtualHost>
#again, replace the IP address
<VirtualHost 127.0.0.1:443>
    ServerAdmin you@example.com
    DocumentRoot /home/relax/Temp/askmath
    ServerName example.com
    <LocationMatch "^(?!/admin)">
    RewriteEngine on
    RewriteRule django.wsgi(.*)$ http://example.com$1 [L,R=301]
    </LocationMatch>
    SSLEngine on
    #your SSL keys
    SSLCertificateFile /etc/httpd/conf/server.crt
    SSLCertificateKeyFile /etc/httpd/conf/server.key
    Alias /admin/media/ /usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/contrib/admin/media
    WSGIScriptAlias / /home/relax/Temp/askmath/django.wsgi
    CustomLog /home/relax/Temp/askmath/log/access_log common
    ErrorLog /home/relax/Temp/askmath/log/error_log
</VirtualHost>

Adding

import sys
sys.stderr.write('\n'.join(sys.path))

at the end of the django.wsgi and running "python2 django.wsgi" i get this paths

/home/relax/Temp ...
(more)
13 years ago commented answer Migration problem with Postgresql 9

I try the new version from repository and works for me too (with Postgresql 9.1.3) ;)!

13 years ago received badge Self-Learner ( source )
13 years ago received badge Teacher ( source )
13 years ago received badge Student (source)
13 years ago received badge Editor ( source )
13 years ago answered a question Migration problem with Postgresql 9

This is the code of file

askbot/search/postgresql/thread_and_post_models_01162012.plsql

that works for me on Postgresql 9.1.3 to succesfull run migration:

/* function testing for existence of a column in a table
  if table does not exists, function will return "false" */
DROP FUNCTION IF EXISTS column_exists(colname text, tablename text);
CREATE OR REPLACE FUNCTION column_exists(colname text, tablename text)
RETURNS boolean AS 
$$
DECLARE
    q text;
    onerow record;
BEGIN

    q = 'SELECT attname FROM pg_attribute WHERE attrelid = ( SELECT oid FROM pg_class WHERE relname = '''||tablename||''') AND attname = '''||colname||''''; 

    FOR onerow IN EXECUTE q LOOP
    RETURN true;
    END LOOP;

    RETURN false;
END;
$$ LANGUAGE plpgsql;

/* function adding tsvector column to table if it does not exists */
DROP FUNCTION IF EXISTS add_tsvector_column(colname text, tablename text);
CREATE OR REPLACE FUNCTION add_tsvector_column(colname text, tablename text)
RETURNS boolean AS
$$
DECLARE
    q text;
BEGIN
    IF NOT column_exists(colname, tablename) THEN
    q = 'ALTER TABLE ' || tablename || ' ADD COLUMN ' || colname || ' tsvector';
    EXECUTE q;
    RETURN true;
    ELSE
    q = 'UPDATE ' || tablename || ' SET ' || colname || '=NULL';
    EXECUTE q;
    RETURN false;
    END IF;
END;
$$ LANGUAGE plpgsql;

/* aggregate function that concatenates tsvectors */
CREATE OR REPLACE FUNCTION tsv_add(tsv1 tsvector, tsv2 tsvector)
RETURNS tsvector AS
$$
BEGIN
    RETURN tsv1 || tsv2;
END;
$$ LANGUAGE plpgsql;

DROP FUNCTION IF EXISTS setup_aggregates();
CREATE OR REPLACE FUNCTION setup_aggregates() RETURNS boolean AS
$$
DECLARE
    onerow record;
BEGIN
    FOR onerow IN SELECT * FROM pg_proc WHERE proname = 'concat_tsvectors' AND proisagg LOOP
    DROP AGGREGATE concat_tsvectors(tsvector);
    END LOOP;
    CREATE AGGREGATE concat_tsvectors (
    BASETYPE = tsvector,
    SFUNC = tsv_add,
    STYPE = tsvector,
    INITCOND = ''
    );
    RETURN true;
END;
$$ LANGUAGE plpgsql;

SELECT setup_aggregates();

/* calculates text search vector for the individual thread row
DOES not include question body post, answers or comments */
DROP FUNCTION IF EXISTS get_thread_tsv(title text, tagnames text);
CREATE OR REPLACE FUNCTION get_thread_tsv(title text, tagnames text)
RETURNS tsvector AS
$$
BEGIN
    /* todo add weight depending on votes */
    RETURN  setweight(to_tsvector('english', coalesce(title, '')), 'A') ||
        setweight(to_tsvector('english', coalesce(tagnames, '')), 'A');
END;
$$ LANGUAGE plpgsql;

/* calculates text seanch vector for the individual question row */
DROP FUNCTION IF EXISTS get_post_tsv(text text, post_type text);
CREATE FUNCTION get_post_tsv(text text, post_type text)
RETURNS tsvector AS
$$
BEGIN
    /* todo adjust weights to reflect votes */
    IF post_type='question' THEN
    RETURN setweight(to_tsvector('english', coalesce(text, '')), 'B');
    ELSIF post_type='answer' THEN
    /* todo reflect whether the answer acepted or not */
    RETURN setweight(to_tsvector('english', coalesce(text, '')), 'B');
    ELSIF post_type='comment' THEN
    RETURN setweight(to_tsvector('english', coalesce(text, '')), 'C');
    ELSE
    RETURN to_tsvector('');
    END IF;
END;
$$ LANGUAGE plpgsql;

/* calculates text search vector for the question body part by thread id
here we extract question title and the text by thread_id and then
calculate the text search vector. In the future question
title will be moved to the askbot_thread table and this function
will be simpler.
*/
DROP FUNCTION IF EXISTS get_thread_question_tsv(thread_id integer);
CREATE OR REPLACE FUNCTION get_thread_question_tsv(thread_id integer)
RETURNS tsvector AS
$$
DECLARE
    query text;
    onerow record;
BEGIN
    query = 'SELECT text FROM askbot_post WHERE thread_id=' || thread_id ||
        ' AND post_type=''question'' AND deleted=false';
    FOR onerow in EXECUTE query LOOP
    RETURN get_post_tsv(onerow.text, 'question');
    END LOOP;
    RETURN to_tsvector('');
END;
$$ LANGUAGE plpgsql;

DROP FUNCTION IF EXISTS ...
(more)
13 years ago commented answer Migration problem with Postgresql 9

GREAT! With your guide i solved the problem. I drop all function except "tsv_add(tsv1 tsvector, tsv2 tsvector)". Thanks!

13 years ago commented answer Migration problem with Postgresql 9

Ok ;)! Whit the new change i get this error "django.db.utils.DatabaseError: cannot drop function tsv_add(tsvector,tsvector) because other objects depend on it DETAIL: function concat_tsvectors(tsvector) depends on function tsv_add(tsvector,tsvector) HINT: Use DROP ... CASCADE to drop the dependent objects too. "

13 years ago commented answer Migration problem with Postgresql 9

I'm using archlinux. I try to modify the file askbot/search/postgresql/thread_and_post_models_01162012.plsql but i get this error "django.db.utils.DatabaseError: syntax error at or near "IF" LINE 107: DROP FUNCTION get_thread_question_tsv IF EXISTS; CREATE OR R..."

13 years ago asked a question Migration problem with Postgresql 9

In the installation process, when i run

python manage.py migrate askbot

i get this error

- Migrating forwards to 0111_populate__thread__added_at.
> askbot:0106_update_postgres_full_text_setup
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.7/site-packages/South-0.7.3-py2.7.egg/south/management/commands/migrate.py", line 105, in handle
    ignore_ghosts = ignore_ghosts,
  File "/usr/lib/python2.7/site-packages/South-0.7.3-py2.7.egg/south/migration/__init__.py", line 191, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/usr/lib/python2.7/site-packages/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 221, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/usr/lib/python2.7/site-packages/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 292, in migrate_many
    result = self.migrate(migration, database)
  File "/usr/lib/python2.7/site-packages/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 125, in migrate
    result = self.run(migration)
  File "/usr/lib/python2.7/site-packages/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 99, in run
    return self.run_migration(migration)
  File "/usr/lib/python2.7/site-packages/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 81, in run_migration
    migration_function()
  File "/usr/lib/python2.7/site-packages/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 57, in <lambda>
    return (lambda: direction(orm))
  File "/home/relax/Temp/askmath/askbot/migrations/0106_update_postgres_full_text_setup.py", line 26, in forwards
    setup_full_text_search(script_path)
  File "/home/relax/Temp/askmath/askbot/search/postgresql/__init__.py", line 19, in setup_full_text_search
    cursor.execute(fts_init_query)
  File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/db/backends/util.py", line 34, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: cannot change name of input parameter "question_id"
HINT:  Use DROP FUNCTION first.

My postgresql version is 9.1.3 and my django version is 1.3.1. Thanks in advance.

13 years ago received badge Scholar ( source )
13 years ago commented answer Installation problem with Python 3

Great :D! You solved my problem! Sorry for the trivial question!

13 years ago commented answer Installation problem with Python 3

I have Python 3.2.2 and i don't edited setup.py

13 years ago commented answer Installation problem with Python 3

I try more than one time to rename the directory of installation (in "myaskbot", in "workplease", etc, etc.) but i get always the same error. What can i do? My system is archlinux.

13 years ago asked a question Installation problem with Python 3

Following the documentation i run

git clone git://github.com/ASKBOT/askbot-devel.git test
cd test

and after i run

python setup.py develop

i get this error

  File "setup.py", line 131
    **************************************************************"""
                                                                    ^
SyntaxError: invalid syntax

The problem seems very easy. How can i fix it? Thanks in advance.