I receive a stack overflow error without any repeating pattern when calling a wrapper for a native method
here's my adapter
import 'dart:js';
import 'package:share_place/users/user.dart';
import 'package:logging/logging.dart';
class MixPanel {
Logger log = new Logger("MixPanel");
JsObject mixpanel;
init(User user) {
mixpanel = context["mixpanel"];
if( user != null ) {
mixpanel.callMethod("identify", [user.id]);
mixpanel['people'].callMethod("set", [new JsObject.jsify({
"\$email": user.mainMail,
"\$first_name": user.displayName,
"name": user.displayName,
"skype": user.skype,
"photoId": "/auth/gridfs/file/${user.photoIdM}/picture.x"
})]);
}
}
void track(String action, {Map data:null}) {
log.fine("calling mixpanel with action '$action', $mixpanel");
assert(mixpanel != null, "mixpanel must be initialized before calling this method");
mixpanel.callMethod("track", [action, data != null ? new JsObject.jsify(data) : ""]);
}
}
here's the stack of my call, notice there's no repeating pattern, is it possible that we really reached to max allowed sequential calls?:
html_dart2js.dart:3558 SEVERE - Environment : mix panel call failed Stack Overflow
dart.alh.$1 # html_dart2js.dart:3558
dart.Fj.func # zone.dart:1132
o3 # zone.dart:1309
aN # stream_impl.dart:330
dart.eu.cS # stream_impl.dart:257
aN # broadcast_stream_controller.dart:379
zU # broadcast_stream_controller.dart:254
R3 # logging.dart:195
lC # main.dart.js:33122
FM # logging.dart:226
fk # main.dart.js:33135
dL # environment.dart:344
J.cE # main.dart.js:54489
(anonymous) # info_popup.dart:57
(anonymous) # async_patch.dart:213
dart.acx.$2 # async_patch.dart:237
dart.aby.$1 # async_patch.dart:187
dart.Fj.func # zone.dart:1128
Ed # zone.dart:685
dart.cJ.Wm # ng_zone.dart:184
(anonymous) # VM5236:2
jp # zone.dart:1012
PX # future_impl.dart:129
$0 # future_impl.dart:636
iN # future_impl.dart:665
du # future_impl.dart:468
(anonymous) # future_impl.dart:51
J.Nd # main.dart.js:54209
K # async_patch.dart:164
(anonymous) # place_service.dart:602
(anonymous) # async_patch.dart:213
dart.acx.$2 # async_patch.dart:237
dart.aby.$1 # async_patch.dart:187
dart.Fj.func # zone.dart:1128
Ed # zone.dart:685
dart.cJ.Wm # ng_zone.dart:184
(anonymous) # VM5236:2
jp # zone.dart:1012
PX # future_impl.dart:129
$0 # future_impl.dart:636
iN # future_impl.dart:665
du # future_impl.dart:468
(anonymous) # future_impl.dart:51
J.Nd # main.dart.js:54209
K # async_patch.dart:164
(anonymous) # place_service.dart:108
(anonymous) # async_patch.dart:213
dart.acx.$2 # async_patch.dart:237
dart.aby.$1 # async_patch.dart:187
dart.Fj.func # zone.dart:1128
Ed # zone.dart:685
dart.cJ.Wm # ng_zone.dart:184
(anonymous) # VM5236:2
jp # zone.dart:1012
PX # future_impl.dart:129
$0 # future_impl.dart:636
iN # future_impl.dart:665
tc # future_impl.dart:478
dart.a7C.$0 # future_impl.dart:510
dart.Wc.$0 # ng_zone.dart:161
dart.Fh.func # zone.dart:1120
E8 # zone.dart:675
dart.cJ.Wi # ng_zone.dart:175
(anonymous) # VM5234:2
cz # zone.dart:1001
hU # zone.dart:901
dart.a7e.$0 # zone.dart:926
acj # schedule_microtask.dart:41
dart.auX # schedule_microtask.dart:50
dart.a6A.$1 # async_patch.dart:51
$0 # js_helper.dart:2456
nl # isolate_helper.dart:474
lK # isolate_helper.dart:59
dart.al3 # js_helper.dart:2456
(anonymous) # js_helper.dart:2476
childList (async)
$1 # async_patch.dart:67
Fm # async_patch.dart:28
dart.u8 # zone.dart:1176
wW # zone.dart:743
dart.cJ.VY # ng_zone.dart:169
(anonymous) # VM5240:2
hY # zone.dart:1076
b3 # future_impl.dart:509
(anonymous) # future_impl.dart:40
dart.Q2.$1 # browser_client.dart:62
dart.Fj.func # zone.dart:1128
Ed # zone.dart:685
dart.cJ.Wm # ng_zone.dart:184
(anonymous) # VM5236:2
jp # zone.dart:1012
PX # future_impl.dart:129
$0 # future_impl.dart:636
iN # future_impl.dart:665
du # future_impl.dart:468
k0 # stream_pipe.dart:63
dart.a_s.$1 # stream.dart:997
dart.a7v.$1 # html_dart2js.dart:42920
dart.Fj.func # zone.dart:1132
Ed # zone.dart:685
dart.cJ.Wm # ng_zone.dart:184
(anonymous) # VM5236:2
jp # zone.dart:1012
o3 # zone.dart:909
dart.a7g.$1 # zone.dart:936
$0 # js_helper.dart:2456
nl # isolate_helper.dart:474
lK # isolate_helper.dart:59
dart.al3 # js_helper.dart:2456
(anonymous) # js_helper.dart:2476
FileReader (async)
dart.Q4.$1 # browser_client.dart:77
dart.Fj.func # zone.dart:1128
Ed # zone.dart:685
dart.cJ.Wm # ng_zone.dart:184
(anonymous) # VM5236:2
jp # zone.dart:1012
PX # future_impl.dart:129
$0 # future_impl.dart:636
iN # future_impl.dart:665
du # future_impl.dart:468
k0 # stream_pipe.dart:63
dart.a_s.$1 # stream.dart:997
dart.a7v.$1 # html_dart2js.dart:42920
dart.Fj.func # zone.dart:1132
Ed # zone.dart:685
dart.cJ.Wm # ng_zone.dart:184
(anonymous) # VM5236:2
jp # zone.dart:1012
o3 # zone.dart:909
dart.a7g.$1 # zone.dart:936
$0 # js_helper.dart:2456
nl # isolate_helper.dart:474
lK # isolate_helper.dart:59
dart.al3 # js_helper.dart:2456
(anonymous) # js_helper.dart:2476
XMLHttpRequest.send (async)
(anonymous) # html_dart2js.dart:20547
J.ha # main.dart.js:54426
(anonymous) # browser_client.dart:88
(anonymous) # async_patch.dart:213
dart.acx.$2 # async_patch.dart:237
dart.aby.$1 # async_patch.dart:187
dart.Fj.func # zone.dart:1128
Ed # zone.dart:685
dart.cJ.Wm # ng_zone.dart:184
(anonymous) # VM5236:2
jp # zone.dart:1012
PX # future_impl.dart:129
$0 # future_impl.dart:636
iN # future_impl.dart:665
tc # future_impl.dart:478
dart.a7C.$0 # future_impl.dart:510
dart.Wc.$0 # ng_zone.dart:161
dart.Fh.func # zone.dart:1120
E8 # zone.dart:675
dart.cJ.Wi # ng_zone.dart:175
(anonymous) # VM5234:2
cz # zone.dart:1001
hU # zone.dart:901
dart.a7e.$0 # zone.dart:926
acj # schedule_microtask.dart:41
dart.auX # schedule_microtask.dart:50
dart.a6A.$1 # async_patch.dart:51
$0 # js_helper.dart:2456
nl # isolate_helper.dart:474
lK # isolate_helper.dart:59
dart.al3 # js_helper.dart:2456
(anonymous) # js_helper.dart:2476
childList (async)
$1 # async_patch.dart:67
Fm # async_patch.dart:28
dart.u8 # zone.dart:1176
wW # zone.dart:743
dart.cJ.VY # ng_zone.dart:169
(anonymous) # VM5240:2
hY # zone.dart:1076
kH # future_impl.dart:342
um # future_impl.dart:251
tQ # async_patch.dart:206
L # async_patch.dart:142
U # info_popup.dart:59
n # files_comp.template.dart:1397
w # app_view.dart:341
I # view_container.dart:57
n # files_comp.template.dart:1222
w # app_view.dart:341
I # view_container.dart:57
n # files_comp.template.dart:677
w # app_view.dart:341
I # view_container.dart:57
n # files_comp.template.dart:532
w # app_view.dart:341
I # view_container.dart:57
n # files_comp.template.dart:488
w # app_view.dart:341
I # view_container.dart:57
n # files_comp.template.dart:337
w # app_view.dart:341
I # view_container.dart:57
n # files_comp.template.dart:173
w # app_view.dart:341
n # app_component.template.dart:761
w # app_view.dart:341
n # app_component.template.dart:1980
w # app_view.dart:341
MO # view_ref.dart:104
wu # application_ref.dart:422
dart.Pl.$0 # application_ref.dart:278
dart.Fh.func # zone.dart:1120
E8 # zone.dart:675
dart.cJ.Wi # ng_zone.dart:175
(anonymous) # VM5234:2
cz # zone.dart:1001
hU # zone.dart:901
hU # ng_zone.dart:310
dart.Ps.$1 # application_ref.dart:277
o3 # zone.dart:1307
aN # stream_impl.dart:330
dart.eu.cS # stream_impl.dart:257
$1 # broadcast_stream_controller.dart:387
tq # broadcast_stream_controller.dart:328
aN # broadcast_stream_controller.dart:386
mv # broadcast_stream_controller.dart:254
dart.cJ.Wi # ng_zone.dart:213
(anonymous) # VM5234:2
cz # zone.dart:1001
hU # zone.dart:901
hU # ng_zone.dart:310
dart.Ph.$1 # app_view.dart:566
$0 # js_helper.dart:2456
nl # isolate_helper.dart:474
lK # isolate_helper.dart:59
dart.al3 # js_helper.dart:2456
(anonymous) # js_helper.dart:2476
js_primitives.dart:30 popup init
I cannot find where to start to solve this issue.
Just for SF I must add this text so there's not too much code for too few text.
Just for SF I must add this text so there's not too much code for too few text.
Just for SF I must add this text so there's not too much code for too few text.
Just for SF I must add this text so there's not too much code for too few text.
Just for SF I must add this text so there's not too much code for too few text.
Just for SF I must add this text so there's not too much code for too few text.
Just for SF I must add this text so there's not too much code for too few text.
Just for SF I must add this text so there's not too much code for too few text.
Just for SF I must add this text so there's not too much code for too few text.
The error was due to an argument I was passing to the method that was badly serialized.
Sorry I can't give any more details, removing an argument from the call made it ok (I took out the data I wanted from the argument to pass as independent parameters)
Related
Okta is timing out for some of our users when they are logging into our application which uses Okta as an IDP. Does anyone know what could be causing this?
OAuthUtil-okta.js:45 Error authenticating client AuthSdkError: OAuth flow timed out
(anonymous) # OAuthUtil-okta.js:45
Promise.catch (async)
(anonymous) # OAuthUtil-okta.js:44
Promise.then (async)
(anonymous) # OAuthUtil-okta.js:25
Promise.then (async)
requestAccessToken # OAuthUtil-okta.js:22
apply # lodash.js:474
wrapper # lodash.js:5337
testForOAuthToken # AuthenticationUtil-okta.js:56
loginWithCurrentCookies # AuthenticationUtil-okta.js:62
apply # lodash.js:475
wrapper # lodash.js:5337
(anonymous) # module-okta.js:105
invoke # angular.js:5208
(anonymous) # angular.js:5007
forEach # angular.js:388
createInjector # angular.js:5007
doBootstrap # angular.js:1963
bootstrap # angular.js:1984
__webpack_exports__.default # auth-initial.js:102
./common/webpack.entry.js # webpack.entry.js:57
__webpack_require__ # bootstrap:19
(anonymous) # bootstrap:68
(anonymous) # bootstrap:68
I have a Rails application with GraphQL API which works fine when running in development. After I deployed the app to Heroku, visiting the GraphiQL interface at /graphiql I get this error below:
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
https://yarnpkg.com/en/docs/selective-version-resolutions
Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.
at n.default (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:597)
at u (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807)
at o (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807)
at M (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807)
at R (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807)
at new P (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807)
at P (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807)
at Object.129.../jsutils/isInvalid (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:815)
at i (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12)
at application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
n.default # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:597
u # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807
o # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807
M # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807
R # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807
P # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807
P # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807
129.../jsutils/isInvalid # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:815
i # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
132.../error/GraphQLError # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:831
i # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
96../execution/execute # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:588
i # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
97../error # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:588
i # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:84
12.../utility/CodeMirrorSizer # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:84
i # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
22../components/GraphiQL # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:139
i # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
t # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
Meanwhile, here's my routes file:
Rails.application.routes.draw do
mount GraphiQL::Rails::Engine, at: '/graphiql', graphql_path: '/graphql'
get 'home/index'
post '/graphql', to: 'graphql#execute'
root 'home#index'
end
And I am using these versions of graphql and graphiql-rails respectively:
graphql (1.10.8)
graphiql-rails (1.7.0)
I have this leak in Indy 10.5.7 (under Delphi 7).
5 - 12 bytes: TIdThreadSafeInteger x 1
21 - 36 bytes: TIdCriticalSection x 2
I use Indy like this:
function getWeb(a,b:Integer):Integer;
var url: string;
H: TIdHttp;
SS: TStringStream;
begin
url := 'http://blabla';
H := TIdHttp.Create(nil);
try
SS := TStringStream.Create('');
try
H.Get(url, SS);
Result := StrToInt(SS.DataString);
FINALLY
SS.Free;
END;
finally H.Free;
end;
The leak itself doesn't bother me since is on app shutdown. That makes my melon explode is the error message I see every time I shut down the app.
Why this leak appear?
I have checked the Indy web site but it barely makes sense. Anyway, it looks this bug cannot be fixed: the latest version of Indy cannot be compiled with Delphi 7. The only solution might be Indy 9.
Update: it looks like what on the web site calls v10.203 is is actually v10.2.3.
This is a problem that occurs with FastMM memory manager and has been around for a while and there is a lot of information available on fixes. The solution I use in Delphi 2010 is:
Make the changes below to the file IdGlobal.pas
Add the path "C:\Program Files\Embarcadero\RAD Studio\7.0\source\Indy\Indy10\System" (without quotes) to the library.
Changes:
{$IFNDEF DOTNET}
{$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
function IndyRegisterExpectedMemoryLeak(AAddress: Pointer): Boolean;
{$IFDEF USEINLINE}inline;{$ENDIF}
begin
// ===== My modification begins =====================
Result := FastMM4.RegisterExpectedMemoryLeak(AAddress);
Exit;
// ===== My modification ends =====================
Hope this helps.
There is a IdStack validation file which does not pass through the cleaning function.
Open the file IdStack.pas
At the end of the file, look for this:
{$ IFNDEF DOTNET}
{$ IFDEF} REGISTER_EXPECTED_MEMORY_LEAK
IndyRegisterExpectedMemoryLeak (GStackCriticalSection);
{$ ENDIF}
{$ ENDIF}
finalization
// Dont Free. If shutdown is from another Init section, it can cause GPF When stack
// Tries to access it. App will kill it off anyways, so just let it leak
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
// THIS LINE AND INCLUDE A COMMENT LINE DOWN
if GStackCriticalSection <> nil then FreeAndNil (GStackCriticalSection);
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
{$ IFDEF} FREE_ON_FINAL
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
// FreeAndNil (GStackCriticalSection); // DISABLE THIS LINE
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
{$ ENDIF}
end.
I'm using version 10.515 from Indy, you can find this version for download at http://indy.fulgan.com/ZIP/
to remove other message includes this command in the main DPR
Application.terminate;
if GThreadCount <> Nil then GThreadCount.Free;
Add IdThread uses.
Even more!
I have been trying to run a lua script in lighttpd. I am running gentoo and I installed lighttpd with the lua use flag. mod_magnet.so is where it is supposed to be. When I try to start the server I get this error:
2011-06-03 15:55:32: (configfile.c.912) source: /etc/lighttpd/lighttpd.conf line: 43 pos: 68 parser failed somehow near here: (
Here is my config file:
###############################################################################
# Default lighttpd.conf for Gentoo.
# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/conf/lighttpd.conf,v 1.5 2010/11/18 15:13:47 hwoarang Exp $
###############################################################################
# {{{ variables
var.basedir = "/var/www/localhost"
var.logdir = "/var/log/lighttpd"
var.statedir = "/var/lib/lighttpd"
# }}}
# {{{ modules
# At the very least, mod_access and mod_accesslog should be enabled.
# All other modules should only be loaded if necessary.
# NOTE: the order of modules is important.
server.modules = (
# "mod_rewrite",
# "mod_redirect",
# "mod_alias",
"mod_access",
"mod_magnet",
# "mod_cml",
# "mod_trigger_b4_dl",
# "mod_auth",
# "mod_status",
# "mod_setenv",
# "mod_proxy",
# "mod_simple_vhost",
# "mod_evhost",
# "mod_userdir",
# "mod_compress",
# "mod_ssi",
# "mod_usertrack",
# "mod_expire",
# "mod_secdownload",
# "mod_rrdtool",
# "mod_webdav",
"mod_accesslog"
)
# }}}
##########################################Magnet URL##########################################
magnet.attract-raw-url-to( "/var/www/localhost/scripts/redirect.lua" )
###############################################################################################
# {{{ includes
include "mime-types.conf"
# fcgi and cgi are included below
# }}}
# {{{ server settings
server.username = "lighttpd"
server.groupname = "lighttpd"
server.document-root = var.basedir + "/htdocs"
server.pid-file = "/var/run/lighttpd.pid"
server.errorlog = var.logdir + "/error.log"
# log errors to syslog instead
# server.errorlog-use-syslog = "enable"
server.indexfiles = ("index.php", "index.html",
"index.htm", "default.htm")
# server.tag = "lighttpd"
server.follow-symlink = "enable"
# event handler (defaults to "poll")
# see performance.txt
#
# for >= linux-2.4
# server.event-handler = "linux-rtsig"
# for >= linux-2.6
# server.event-handler = "linux-sysepoll"
# for FreeBSD
# server.event-handler = "freebsd-kqueue"
# chroot to directory (defaults to no chroot)
# server.chroot = "/"
# bind to port (defaults to 80)
# server.port = 81
# bind to name (defaults to all interfaces)
# server.bind = "grisu.home.kneschke.de"
# error-handler for status 404
# server.error-handler-404 = "/error-handler.html"
# server.error-handler-404 = "/error-handler.php"
# Format: <errorfile-prefix><status-code>.html
# -> ..../status-404.html for 'File not found'
# server.errorfile-prefix = var.basedir + "/error/status-"
# FAM support for caching stat() calls
# requires that lighttpd be built with USE=fam
server.stat-cache-engine = "fam"
# If lighttpd was build with IPv6 support, and you would like to listen on IPv6,
# uncomment the following:
server.use-ipv6 = "enable"
# }}}
# {{{ mod_staticfile
# which extensions should not be handled via static-file transfer
# (extensions that are usually handled by mod_cgi, mod_fastcgi, etc).
static-file.exclude-extensions = (".php", ".pl", ".cgi", ".fcgi")
# }}}
# {{{ mod_accesslog
accesslog.filename = var.logdir + "/access.log"
# }}}
# {{{ mod_dirlisting
# enable directory listings
# dir-listing.activate = "enable"
#
# don't list hidden files/directories
# dir-listing.hide-dotfiles = "enable"
#
# use a different css for directory listings
# dir-listing.external-css = "/path/to/dir-listing.css"
#
# list of regular expressions. files that match any of the
# specified regular expressions will be excluded from directory
# listings.
# dir-listing.exclude = ("^\.", "~$")
# }}}
# {{{ mod_access
# see access.txt
url.access-deny = ("~", ".inc")
# }}}
# {{{ mod_userdir
# see userdir.txt
#
# userdir.path = "public_html"
# userdir.exclude-user = ("root")
# }}}
# {{{ mod_ssi
# see ssi.txt
#
# ssi.extension = (".shtml")
# }
# {{{ mod_ssl
# see ssl.txt
#
# ssl.engine = "enable"
# ssl.pemfile = "server.pem"
# }}}
# {{{ mod_status
# see status.txt
#
# status.status-url = "/server-status"
# status.config-url = "/server-config"
# }}}
# {{{ mod_simple_vhost
# see simple-vhost.txt
#
# If you want name-based virtual hosting add the next three settings and load
# mod_simple_vhost
#
# document-root =
# virtual-server-root + virtual-server-default-host + virtual-server-docroot
# or
# virtual-server-root + http-host + virtual-server-docroot
#
# simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
# simple-vhost.default-host = "grisu.home.kneschke.de"
# simple-vhost.document-root = "/pages/"
# }}}
# {{{ mod_compress
# see compress.txt
#
# compress.cache-dir = var.statedir + "/cache/compress"
# compress.filetype = ("text/plain", "text/html")
# }}}
# {{{ mod_proxy
# see proxy.txt
#
# proxy.server = ( ".php" =>
# ( "localhost" =>
# (
# "host" => "192.168.0.101",
# "port" => 80
# )
# )
# )
# }}}
# {{{ mod_auth
# see authentication.txt
#
# auth.backend = "plain"
# auth.backend.plain.userfile = "lighttpd.user"
# auth.backend.plain.groupfile = "lighttpd.group"
# auth.backend.ldap.hostname = "localhost"
# auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
# auth.backend.ldap.filter = "(uid=$)"
# auth.require = ( "/server-status" =>
# (
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "user=jan"
# ),
# "/server-info" =>
# (
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "valid-user"
# )
# )
# }}}
# {{{ mod_rewrite
# see rewrite.txt
#
# url.rewrite = (
# "^/$" => "/server-status"
# )
# }}}
# {{{ mod_redirect
# see redirect.txt
#
# url.redirect = (
# "^/wishlist/(.+)" => "http://www.123.org/$1"
# )
# }}}
# {{{ mod_evhost
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#
# evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/"
# }}}
# {{{ mod_expire
# expire.url = (
# "/buggy/" => "access 2 hours",
# "/asdhas/" => "access plus 1 seconds 2 minutes"
# )
# }}}
# {{{ mod_rrdtool
# see rrdtool.txt
#
# rrdtool.binary = "/usr/bin/rrdtool"
# rrdtool.db-name = var.statedir + "/lighttpd.rrd"
# }}}
# {{{ mod_setenv
# see setenv.txt
#
# setenv.add-request-header = ( "TRAV_ENV" => "mysql://user#host/db" )
# setenv.add-response-header = ( "X-Secret-Message" => "42" )
# }}}
# {{{ mod_trigger_b4_dl
# see trigger_b4_dl.txt
#
# trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db"
# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
# trigger-before-download.trigger-url = "^/trigger/"
# trigger-before-download.download-url = "^/download/"
# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
# trigger-before-download.trigger-timeout = 10
# }}}
# {{{ mod_cml
# see cml.txt
#
# don't forget to add index.cml to server.indexfiles
# cml.extension = ".cml"
# cml.memcache-hosts = ( "127.0.0.1:11211" )
# }}}
# {{{ mod_webdav
# see webdav.txt
#
# $HTTP["url"] =~ "^/dav($|/)" {
# webdav.activate = "enable"
# webdav.is-readonly = "enable"
# }
# }}}
# {{{ extra rules
#
# set Content-Encoding and reset Content-Type for browsers that
# support decompressing on-thy-fly (requires mod_setenv)
# $HTTP["url"] =~ "\.gz$" {
# setenv.add-response-header = ("Content-Encoding" => "x-gzip")
# mimetype.assign = (".gz" => "text/plain")
# }
# $HTTP["url"] =~ "\.bz2$" {
# setenv.add-response-header = ("Content-Encoding" => "x-bzip2")
# mimetype.assign = (".bz2" => "text/plain")
# }
#
# }}}
# {{{ debug
# debug.log-request-header = "enable"
# debug.log-response-header = "enable"
# debug.log-request-handling = "enable"
# debug.log-file-not-found = "enable"
# }}}
# {{{ cgi includes
# uncomment for cgi support
# include "mod_cgi.conf"
# uncomment for php/fastcgi support
include "mod_fastcgi.conf"
# }}}
# vim: set ft=conf foldmethod=marker et :
If I comment out "mod_magnet", I still get the same error. If I comment out the line
magnet.attract-raw-url-to( "/var/www/localhost/scripts/redirect.lua" )
The problem goes away but of course I then can't use my script for testing reasons I commented out my script just to reduce complexities. My guess is the problem is that the mod_magnet isn't loading. Any ideas?
You're missing an equals sign (hence the parser failed somehow near here: ( message stating the parser doesn't understand your open-paren). Try this:
magnet.attract-raw-url-to = ( "/var/www/localhost/scripts/redirect.lua" )
I am trying to get the ASIN number from amazon html page using nokogiri but I am having no luck using xpath. I have tried it with firepath and I am still getting nothing. Would it be better to just get the URL and then run a ruby REGEX to get the ASIN out? If so how would the regex look like?
#!/usr/bin/env ruby -w
require 'nokogiri'
require 'open-uri'
url = "http://www.amazon.com/gp/new-releases/books/3839/ref=zg_bsnr_nav"
doc = Nokogiri::HTML(open(url))
puts doc.xpath('//zg_list').each do | node|
p node['asin']
end
This is what I have when it prints out the url.
#!/usr/bin/env ruby -w
require 'nokogiri'
require 'open-uri'
url = "http://www.amazon.com/gp/new-releases/books/3839/ref=zg_bsnr_nav"
doc = Nokogiri::HTML(open(url))
l = doc.css('div.zg_image a').map { |link|
link['href']
}
puts l # => /Introducing-ZBrush-4-Eric-Keller/dp/0470527641/ref=zg_bsnr_3839_20/183-0702383-0095048
For me the css method in Nokogiri is much easier to work with than XPath. Given the HTML at the URL you posted, the following should retrieve the “asin” property for each item:
doc.css("div.zg_item").map { |e| e["asin"] }
I think the correct XPath would be something like:
doc.xpath("//div[contains(#class, 'zg_item') and #asin]")
You can use either CSS accessors or XPath:
#!/usr/bin/env ruby -w
require 'nokogiri'
require 'open-uri'
url = "http://www.amazon.com/gp/new-releases/books/3839/ref=zg_bsnr_nav"
doc = Nokogiri::HTML(open(url))
# CSS
# puts doc.search('div[class="zg_item zg_sparseListItem"]').each { |n| p n['asin'] }
# XPath
puts doc.search('//div[#class="zg_item zg_sparseListItem"]').each { |n| p n['asin'] }
# >> "1934356549"
# >> "0596802471"
# >> "B004M8T01Q"
# >> "0596809158"
# >> "0470943327"
# >> "B004MMEJ36"
# >> "1935182641"
# >> "B004RDOPJI"
# >> "1449390501"
# >> "1449389716"
# >> "B004IWRH4I"
# >> "0470527641"
# >> "0735650926"
# >> "1430231475"
# >> "0321751043"
# >> "B004NBZ65G"
# >> "B004TMNSJK"
# >> "0132091518"
# >> "144030842X"
# >> "1430234040"
# >> 0