'Ldapjs can't connect with a server
So I just want to create a connection to my LDAP server:
var ldap = require('ldapjs');
var client = ldap.createClient({
url: 'ldap://192.168.200.35:389'
});
But no matter what I'll input for the url:
TypeError: ldap://192.168.200.35:389 is an invalid LDAP url (scope)
Connecting with the Apache Direct Studio is working fine. I'll also receive a runtime warning:
Module not found: Error: Can't resolve './src/build' in 'C:\...\node_modules\dtrace-provider'
Has anyone a fix for this error?
Solution 1:[1]
In node_modules/ldapjs/lib/url.js we need to do the following changes, after the changes it working fine.
Error:
parsedURL = new url.URL(urlStr)
Solution:
parsedURL = new url.parse(urlStr)
Solution 2:[2]
I might not use the second while loop:
while running:
# keep loop running at the right speed
clock.tick(30) // Frame per second
screen.fill(BLACK) // never forget this line of code, especially when you work with animation
pos = pygame.mouse.get_pos()
# Process input (events)
for event in pygame.event.get():
# check for closing window
if event.type == pygame.QUIT:
running = False
if event.type == pygame.MOUSEBUTTONDOWN:
click = True
if click:
show_new_screen()
click = False
Solution 3:[3]
Solved with adding all events into one event loop as mentioned above. I still wanted the second box to be closed when clicking anywher on the screen. Solved by adding another event check, for MOUSEBUTTONDOWN. It did not work to have another MOUSEBUTTONUP event.
running = True
newscreen = False
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
pygame.quit()
running = False
# If user is clicking (on release of click) on the rectangle area update newscreen to true
if event.type == pygame.MOUSEBUTTONUP:
if event.button == 1: # Left mouse button.
if rect.collidepoint(event.pos):
newscreen = True
print("Clicking area")
if event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1: # Left mouse button.
newscreen = False
print("now you clicked again")
screen.fill(NOTGREY)
pygame.draw.rect(screen, RED, rect)
if newscreen:
pygame.draw.rect(screen, RED, rect2)
pygame.display.flip()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Heang Sok |
| Solution 3 | sebsee |
