Skip to content

Instantly share code, notes, and snippets.

View netdesign's full-sized avatar

Netdesign netdesign

View GitHub Profile
@netdesign
netdesign / gist:1166779
Created August 23, 2011 22:27
node.js problem with object
exports.sayhello = (function(){return "hello";});
M = memory used in the past
m = memory used now
MaxMemFree = max value for M-m without freeing it...
so if:
MaxMemFree = 1024;
and M-m = 1025.... apache will call free()
msgText = "Benvenuto in Netdesign {!s}, il tuo codice sconto è {!s}, contattaci subito puoi usufruire del 10% di sconto su tutti i prodotti.\nScarica la presentazione da questa pagina http://somedomain.com\n\nCordiali Saluti\nNetdesign Mail Team\ninfo@domain.com\n+39 338 000000".format(name, code)
//TRACEBACK
SyntaxError: Non-ASCII character '\xc3' in file program.py on line 120, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
RewriteCond %{REQUEST_URI} !^/stk/(.*)
RewriteCond %{REQUEST_URI} !^/app/(.*)
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^/(.*)$ /index.php?p=$1 [QSA,L]
in .htaccess
Redirect 301 "/index.php?page=websites" http://mydomain.com/siti_web
this redirect doesn't redirect to mydomain.com/siti_web but shows the home page... as I was getting mydomain.com
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/tornado/web.py", line 810, in _stack_context
yield
File "/usr/local/lib/python2.7/site-packages/tornado/stack_context.py", line 77, in StackContext
yield
File "/usr/local/lib/python2.7/site-packages/tornado/web.py", line 827, in _execute
getattr(self, self.request.method.lower())(*args, **kwargs)
File "myDB1.py", line 600, in get
curs.execute("UPDATE discs SET title=?, abstract=?, gen=?, code=?, cover=? WHERE uid=? and owner=?", (title, description, genre, code, cover, uid, owner))
File "cursor.pyx", line 122, in oursql.Cursor.execute (oursqlx/oursql.c:15820)
CollatedWarningsError: (None, 'query caused warnings', [(<class 'oursql.Warning'>, (u"Incorrect string value: '\\xE2\\x80\\x8B\\xE2\\x80\\x8B...' for column 'abstract' at row 6", 1366L))])
# -*- coding: utf-8 -*-
string = "http://www.youtube.com/watch?v=uCEeAn6_QJo YouTube - Tool - Ænema [uncut version - hq - fullscreen]"
#connection to mysql
query.execute("INSERT INTO bookmarks (uid, url, title) VALUES(?, ?, ?)", (myUid, link.attrib['href'], link.text_content()))
TRACEBACK:
# -*- coding: utf-8 -*-
import lxml.html as jq
import uuid
import hashlib
import oursql
db = oursql.connect(host="127.0.0.1", user="user", passwd="pwd", db="mydata", charset='utf8')
query = db.cursor(plain_query=True)
http = tornado.httpclient.AsyncHTTPClient()
http.fetch(str(urlink), callback=self.on_response, headers={"Accept-Language":lang,"X-Forwarded-For":realIp,"Accept-Encoding":"gzip,deflate", "Referer":""})
@netdesign
netdesign / Traceback
Created September 19, 2011 18:20
Python LXML
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/usr/local/lib/python2.7/site-packages/lxml-2.3-py2.7-linux-x86_64.egg/lxml/html/__init__.py", line 249, in text_content
return _collect_string_content(self)
File "xpath.pxi", line 469, in lxml.etree.XPath.__call__ (src/lxml/lxml.etree.c:115236)
File "xpath.pxi", line 245, in lxml.etree._XPathEvaluatorBase._handle_result (src/lxml/lxml.etree.c:113088)
File "extensions.pxi", line 550, in lxml.etree._unwrapXPathObject (src/lxml/lxml.etree.c:108774)
File "apihelpers.pxi", line 1344, in lxml.etree.funicode (src/lxml/lxml.etree.c:22016)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x83 in position 28: invalid start byte