connect

How to have a NodeJS/connect middleware execute after responde.end() has been invoked?

徘徊边缘 提交于 2019-11-30 05:03:24
I would like to achieve something like this: var c = require('connect'); var app = c(); app.use("/api", function(req, res, next){ console.log("request filter 1"); next(); }); app.use("/api", function(req, res, next){ console.log("request filter 2"); next(); }); app.use("/api", function(req, res, next){ console.log("request handler"); res.end("hello"); next(); }); app.use("/api", function(req, res, next){ console.log("response post processor"); next(); }); app.listen(3000); When I curl for the address, I get an exception to the console complaining about headers cannot be bothered after being

Debugging JConsole Connection Failed

荒凉一梦 提交于 2019-11-30 04:43:51
I have a web application deployed to a remote resin server, and it has JMX turned on. I can telnet to the remote server i.e franz@see:/tmp$ telnet <remote-ip> 5555 Trying <remote-ip>... Connected to <remote-ip>. Escape character is '^]'. ��sr5javax.management.remote.message.HandshakeBeginMessage�,���6profilestLjava/lang/String;Lversionq~xppt1.0^] telnet> q Connection closed. But I cannot connect to it using my JConsole $JAVA_HOME/bin/java -cp $JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/lib/tools.jar:pm-common/lib/jmxremote_optional-1_0_1_3.jar sun.tools.jconsole.JConsole service:jmx:jmxmp://<remote

Global Variable - database connection?

心不动则不痛 提交于 2019-11-30 03:55:22
问题 I am trying to connect to a database (MySQLi) just once, but am having problems doing so. How do I make a connection global for the entire script? There are multiple files (index.php, /classes/config.class.php, /classes/admin.class.php, etc). I've tried the following: In: config.class.php public static $config = array(); public static $sql; function __construct() { // database db::$config['host'] = 'localhost'; db::$config['user'] = '_'; db::$config['pass'] = '_'; db::$config['db'] = '_'; //

Can't connect to localhost using Python's MySQLdb

限于喜欢 提交于 2019-11-30 03:21:10
I'm new to this so probably have the wrong terminology but when I run the following script: import MySQLdb conn = MySQLdb.connect (host = 'localhost', user = 'erin', passwd = 'erin', db = 'sec') I get the error: File "/Library/Python/2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg/MySQLdb/__init__.py", line 81, in Connect return Connection(*args, **kwargs) File "/Library/Python/2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg/MySQLdb/connections.py", line 187, in __init__ super(Connection, self).__init__(*args, **kwargs2) _mysql_exceptions

Node.js : How to do something on all HTTP requests in Express?

我只是一个虾纸丫 提交于 2019-11-30 02:53:26
So I would like to do something like: app.On_All_Incomeing_Request(function(req, res){ console.log('request received from a client.'); }); the current app.all() requires a path, and if I give for example this / then it only works when I'm on the homepage, so it's not really all.. In plain node.js it is as simple as writing anything after we create the http server, and before we do the page routing. So how to do this with express, and what is the best way to do it? Express is based on the Connect middleware. The routing capabilities of Express are provided by the router of your app and you are

Authentication Fails with Facebook App Installed (iOS)

坚强是说给别人听的谎言 提交于 2019-11-30 01:37:17
问题 I've just started seeing a problem with Facebook Connect authentication. If I have version 3.4.4 of the iOS app installed, my delegate's fbDidNotLogin method gets called with an error message of "The user denied your request". When I uninstall the FB app, the authentication works fine. Is anyone else seeing this? Does anyone know how I can route around this bug? Here's my call to the Facebook object: [[app facebook] authorize:[NSArray arrayWithObjects: @"publish_stream", @"offline_access",

SQLPLUS error:ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

时光怂恿深爱的人放手 提交于 2019-11-30 00:42:23
问题 I downloaded SQLPLUS from Oracle: http://www.oracle.com/technetwork/topics/winx64soft-089540.html Basic Lite and SQL*Plus I then fired up SQL*Plus: c:\Program Files\Oracle\instantclient_12_1>sqlplus /nolog SQL*Plus: Release 12.1.0.2.0 Production on Wed Apr 15 15:25:36 2015 Copyright (c) 1982, 2014, Oracle. All rights reserved. and tried to connect to a database: connect user\password@hostname and received the error message: ERROR: ORA-12504: TNS:listener was not given the SERVICE_NAME in

in express.js, any way to capture request to both json and html in one function?

房东的猫 提交于 2019-11-29 21:30:28
Does anybody know a way in express.js to capture requests in a single function for both html and json? Essentially I want a single route for both /users and /users.json - like rails does with its routes -> controller. That way, I can encapsulate the logic in a single function and decide to render either html or json. Something like: app.get('/users[.json]', function(req, res, next, json){ if (json) res.send(JSON.stringfy(...)); else res.render(...); //jade template }); Could I use a param perhaps? A route is simple a string which is compiled to a RegExp internally, as the manual says, so you

What is the session's “secret” option?

时光怂恿深爱的人放手 提交于 2019-11-29 20:13:27
I don't know anything about cryptography. I'm wondering what the session secret is. I see code like this: app.use(express.session({ store: mongoStore({ url: app.set('db-uri') }), secret: 'topsecret' })); What is the secret and should I change it? Hacknightly Yes, you should change it. A session secret in connect is simply used to compute the hash . Without the string, access to the session would essentially be "denied". Take a look at the connect docs , that should help a little bit. The secret is used to hash the session with HMAC: https://github.com/senchalabs/connect/blob/master/lib

How to use re-write module of Apache web server 2.2.3 on FC6 with new or refurbi

馋奶兔 提交于 2019-11-29 20:06:50
http://www.dharwadkar.com/weblog/apache_fc6_01 I finished upgrading my web server to better hardware and latest OS and web server just yesterday. Whether you get better hardware after you buy refurbished laptops or brand new PCs, upgrading will help your computer run better. Installation of FC6 was seamless once I found out that I could not run XEN on my computer because of CPU limitations. My CPU does not have PAE on which XEN requires to operate. So finally I figured out that not installing virt-manager solves my problem by installing a non-XEN kernel (Duh!!). So once that problem was out of