qid
int64
46k
74.7M
question
stringlengths
54
37.8k
date
stringlengths
10
10
metadata
listlengths
3
3
response_j
stringlengths
17
26k
response_k
stringlengths
26
26k
9,002,569
I am using python 2.7 and I would like to do some web2py stuff. I am trying to run web2py from eclipse and I am getting the following error trying to run web2py.py script: WARNING:web2py:GUI not available because Tk library is not installed I am running on Windows 7 (64 bit). Any suggestions? Thank you
2012/01/25
[ "https://Stackoverflow.com/questions/9002569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/945446/" ]
Simplest solution: The Oracle client is not installed on the remote server where the SSIS package is being executed. Slightly less simple solution: The Oracle client is installed on the remote server, but in the wrong bit-count for the SSIS installation. For example, if the 64-bit Oracle client is installed but SSIS i...
After you install Oracle Client components on the remote server, restart SQL Server Agent from the PC Management Console or directly from Sql Server Management Studio. This will allow the service to load correctly the path to the Oracle components. Otherwise your package will work on design time but fail on run time.
9,002,569
I am using python 2.7 and I would like to do some web2py stuff. I am trying to run web2py from eclipse and I am getting the following error trying to run web2py.py script: WARNING:web2py:GUI not available because Tk library is not installed I am running on Windows 7 (64 bit). Any suggestions? Thank you
2012/01/25
[ "https://Stackoverflow.com/questions/9002569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/945446/" ]
Simplest solution: The Oracle client is not installed on the remote server where the SSIS package is being executed. Slightly less simple solution: The Oracle client is installed on the remote server, but in the wrong bit-count for the SSIS installation. For example, if the 64-bit Oracle client is installed but SSIS i...
In my case this was because a file named **ociw32.dll** had been placed in **c:\windows\system32**. This is however only allowed to exist in **c:\oracle\11.2.0.3\bin**. Deleting the file from system32, which had been placed there by an installation of Crystal Reports, fixed this issue
9,002,569
I am using python 2.7 and I would like to do some web2py stuff. I am trying to run web2py from eclipse and I am getting the following error trying to run web2py.py script: WARNING:web2py:GUI not available because Tk library is not installed I am running on Windows 7 (64 bit). Any suggestions? Thank you
2012/01/25
[ "https://Stackoverflow.com/questions/9002569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/945446/" ]
Simplest solution: The Oracle client is not installed on the remote server where the SSIS package is being executed. Slightly less simple solution: The Oracle client is installed on the remote server, but in the wrong bit-count for the SSIS installation. For example, if the 64-bit Oracle client is installed but SSIS i...
Technology used: Windows 7, UFT 32 bit, Data Source ODBC pointing out to 32 bit `C:\Windows\System32\odbcad32.exe`, Oracle client with both versions installed 32 bit and 64 bit. What worked for me: 1.Start -> search for `Edit the system environment variables` 2.System Variables -> `Edit Path` 3.Place the path f...
9,002,569
I am using python 2.7 and I would like to do some web2py stuff. I am trying to run web2py from eclipse and I am getting the following error trying to run web2py.py script: WARNING:web2py:GUI not available because Tk library is not installed I am running on Windows 7 (64 bit). Any suggestions? Thank you
2012/01/25
[ "https://Stackoverflow.com/questions/9002569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/945446/" ]
Technology used: Windows 7, UFT 32 bit, Data Source ODBC pointing out to 32 bit `C:\Windows\System32\odbcad32.exe`, Oracle client with both versions installed 32 bit and 64 bit. What worked for me: 1.Start -> search for `Edit the system environment variables` 2.System Variables -> `Edit Path` 3.Place the path f...
1.Go to My Computer Properties 2.Then click on Advance setting. 3.Go to Environment variable 4.Set the path to ``` F:\oracle\product\10.2.0\db_2\perl\5.8.3\lib\MSWin32-x86;F:\oracle\product\10.2.0\db_2\perl\5.8.3\lib;F:\oracle\product\10.2.0\db_2\perl\5.8.3\lib\MSWin32-x86;F:\oracle\product\10.2.0\db_2...
9,002,569
I am using python 2.7 and I would like to do some web2py stuff. I am trying to run web2py from eclipse and I am getting the following error trying to run web2py.py script: WARNING:web2py:GUI not available because Tk library is not installed I am running on Windows 7 (64 bit). Any suggestions? Thank you
2012/01/25
[ "https://Stackoverflow.com/questions/9002569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/945446/" ]
Technology used: Windows 7, UFT 32 bit, Data Source ODBC pointing out to 32 bit `C:\Windows\System32\odbcad32.exe`, Oracle client with both versions installed 32 bit and 64 bit. What worked for me: 1.Start -> search for `Edit the system environment variables` 2.System Variables -> `Edit Path` 3.Place the path f...
After you install Oracle Client components on the remote server, restart SQL Server Agent from the PC Management Console or directly from Sql Server Management Studio. This will allow the service to load correctly the path to the Oracle components. Otherwise your package will work on design time but fail on run time.
9,002,569
I am using python 2.7 and I would like to do some web2py stuff. I am trying to run web2py from eclipse and I am getting the following error trying to run web2py.py script: WARNING:web2py:GUI not available because Tk library is not installed I am running on Windows 7 (64 bit). Any suggestions? Thank you
2012/01/25
[ "https://Stackoverflow.com/questions/9002569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/945446/" ]
Technology used: Windows 7, UFT 32 bit, Data Source ODBC pointing out to 32 bit `C:\Windows\System32\odbcad32.exe`, Oracle client with both versions installed 32 bit and 64 bit. What worked for me: 1.Start -> search for `Edit the system environment variables` 2.System Variables -> `Edit Path` 3.Place the path f...
In my case this was because a file named **ociw32.dll** had been placed in **c:\windows\system32**. This is however only allowed to exist in **c:\oracle\11.2.0.3\bin**. Deleting the file from system32, which had been placed there by an installation of Crystal Reports, fixed this issue
72,539,738
``` import RPi.GPIO as GPIO import paho.mqtt.client as mqtt import time def privacyfunc(): # Pin Definitions: led_pin_1 = 7 led_pin_2 = 21 but_pin = 18 # blink LED 2 quickly 5 times when button pressed def blink(channel): x=GPIO.input(18) print("blinked") for i in range(1): GPIO.o...
2022/06/08
[ "https://Stackoverflow.com/questions/72539738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19295287/" ]
For the function call you happened to post, the following regex seems to work: ``` (?:\w+ \w+|\w+\(\w*\)) ``` This pattern matches, alternatively, a type followed by variable name, or a function name, with optional parameters. Here is a working [demo](https://regex101.com/r/IAep1Z/1).
You can use ```none (?:\G(?!^)\s*,\s*|\()\K\w+(?:\s+\w+|\s*\([^()]*\)) ``` See the [regex demo](https://regex101.com/r/OZZi09/1). *Details*: * `(?:\G(?!^)\s*,\s*|\()` - either the end of the preceding match and then a comma enclosed with zero or more whitespaces, or a `(` char * `\K` - omit the text matched so far ...
72,539,738
``` import RPi.GPIO as GPIO import paho.mqtt.client as mqtt import time def privacyfunc(): # Pin Definitions: led_pin_1 = 7 led_pin_2 = 21 but_pin = 18 # blink LED 2 quickly 5 times when button pressed def blink(channel): x=GPIO.input(18) print("blinked") for i in range(1): GPIO.o...
2022/06/08
[ "https://Stackoverflow.com/questions/72539738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19295287/" ]
For the function call you happened to post, the following regex seems to work: ``` (?:\w+ \w+|\w+\(\w*\)) ``` This pattern matches, alternatively, a type followed by variable name, or a function name, with optional parameters. Here is a working [demo](https://regex101.com/r/IAep1Z/1).
Try this one ``` ((?<=\(|,\s)((\w+\s)+\w+)|(\w+\((\w+(\,\s){0,1})*\))) ``` Check demo <https://regex101.com/r/Bv1Y5L/1>
4,574,605
I wrote a simple python script using the SocketServer, it works well on Windows, but when I execute it on a remote Linux machine(Ubuntu), it doesn't work at all.. The script is like below: ``` #-*-coding:utf-8-*- import SocketServer class MyHandler(SocketServer.BaseRequestHandler): def handle(self): dat...
2011/01/01
[ "https://Stackoverflow.com/questions/4574605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/325241/" ]
You are binding to 127.0.0.1:7777 but then trying to access it through the servers external IP (I'll use your placeholder - xxx.xxx.xxx.xxx). 127.0.0.1:7777 and xxx.xxx.xxx.xxx:7777 are *different ports* and can be bound by different processes IIRC. If that doesn't fix it, check your firewall, many hosts set up firewa...
Try with telnet or nc first, telnet to your public ip with your port and see what response you get. Also, why are accessing /test from the browser? I don't see that part in the code. I hope you have taken care of that.
4,574,605
I wrote a simple python script using the SocketServer, it works well on Windows, but when I execute it on a remote Linux machine(Ubuntu), it doesn't work at all.. The script is like below: ``` #-*-coding:utf-8-*- import SocketServer class MyHandler(SocketServer.BaseRequestHandler): def handle(self): dat...
2011/01/01
[ "https://Stackoverflow.com/questions/4574605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/325241/" ]
You are binding the server to `127.0.0.1`, the IP address for localhost. This means the server will only accept connections originating from the same machine; it won't recognize ones coming from another machine. You need to either bind to your external IP address, or bind to a wildcard address (i.e. don't bind to any ...
Try with telnet or nc first, telnet to your public ip with your port and see what response you get. Also, why are accessing /test from the browser? I don't see that part in the code. I hope you have taken care of that.
4,574,605
I wrote a simple python script using the SocketServer, it works well on Windows, but when I execute it on a remote Linux machine(Ubuntu), it doesn't work at all.. The script is like below: ``` #-*-coding:utf-8-*- import SocketServer class MyHandler(SocketServer.BaseRequestHandler): def handle(self): dat...
2011/01/01
[ "https://Stackoverflow.com/questions/4574605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/325241/" ]
You are binding the server to `127.0.0.1`, the IP address for localhost. This means the server will only accept connections originating from the same machine; it won't recognize ones coming from another machine. You need to either bind to your external IP address, or bind to a wildcard address (i.e. don't bind to any ...
You are binding to 127.0.0.1:7777 but then trying to access it through the servers external IP (I'll use your placeholder - xxx.xxx.xxx.xxx). 127.0.0.1:7777 and xxx.xxx.xxx.xxx:7777 are *different ports* and can be bound by different processes IIRC. If that doesn't fix it, check your firewall, many hosts set up firewa...
17,548,865
I followed this link : "<https://pypi.python.org/pypi/bottle-mysql/0.1.1>" and "<http://bottlepy.org/docs/dev/>" this is my py file: ``` import bottle from bottle import route, run, template import bottle_mysql app = bottle.Bottle() # # dbhost is optional, default is localhost plugin = bottle_mysql.Plugin(dbuser='r...
2013/07/09
[ "https://Stackoverflow.com/questions/17548865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2049591/" ]
Here is the complete behavior you wanted Use `$(document)` instead `$('body')` ``` $(document).not('#menu, #menu-trigger').click(function(event) { event.preventDefault(); if (menu.is(":visible")) { menu.slideUp(400); } }); ``` [### Updated Fiddle](http://jsfiddle.net/yGMZt/6/) And also use ...
You need to add `event.stopPropagation();` [demo](http://jsfiddle.net/ruddog2003/yGMZt/3/) > > Description: Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. > [more](http://api.jquery.com/event.stopPropagation/) > > >
17,548,865
I followed this link : "<https://pypi.python.org/pypi/bottle-mysql/0.1.1>" and "<http://bottlepy.org/docs/dev/>" this is my py file: ``` import bottle from bottle import route, run, template import bottle_mysql app = bottle.Bottle() # # dbhost is optional, default is localhost plugin = bottle_mysql.Plugin(dbuser='r...
2013/07/09
[ "https://Stackoverflow.com/questions/17548865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2049591/" ]
Found a very good answer by Frederik in [Document click not in elements jQuery](https://stackoverflow.com/questions/10851312/document-click-not-in-elements-jquery/10851375#10851375) Modified a bit to support elements not yet present in document for example elements fetched by ajax calls. ``` $(document).on('click',fu...
You need to add `event.stopPropagation();` [demo](http://jsfiddle.net/ruddog2003/yGMZt/3/) > > Description: Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. > [more](http://api.jquery.com/event.stopPropagation/) > > >
17,548,865
I followed this link : "<https://pypi.python.org/pypi/bottle-mysql/0.1.1>" and "<http://bottlepy.org/docs/dev/>" this is my py file: ``` import bottle from bottle import route, run, template import bottle_mysql app = bottle.Bottle() # # dbhost is optional, default is localhost plugin = bottle_mysql.Plugin(dbuser='r...
2013/07/09
[ "https://Stackoverflow.com/questions/17548865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2049591/" ]
Here is the complete behavior you wanted Use `$(document)` instead `$('body')` ``` $(document).not('#menu, #menu-trigger').click(function(event) { event.preventDefault(); if (menu.is(":visible")) { menu.slideUp(400); } }); ``` [### Updated Fiddle](http://jsfiddle.net/yGMZt/6/) And also use ...
event.stopPropagation() to stop propagation default browser <http://api.jquery.com/event.stopPropagation/>
17,548,865
I followed this link : "<https://pypi.python.org/pypi/bottle-mysql/0.1.1>" and "<http://bottlepy.org/docs/dev/>" this is my py file: ``` import bottle from bottle import route, run, template import bottle_mysql app = bottle.Bottle() # # dbhost is optional, default is localhost plugin = bottle_mysql.Plugin(dbuser='r...
2013/07/09
[ "https://Stackoverflow.com/questions/17548865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2049591/" ]
Found a very good answer by Frederik in [Document click not in elements jQuery](https://stackoverflow.com/questions/10851312/document-click-not-in-elements-jquery/10851375#10851375) Modified a bit to support elements not yet present in document for example elements fetched by ajax calls. ``` $(document).on('click',fu...
event.stopPropagation() to stop propagation default browser <http://api.jquery.com/event.stopPropagation/>
17,548,865
I followed this link : "<https://pypi.python.org/pypi/bottle-mysql/0.1.1>" and "<http://bottlepy.org/docs/dev/>" this is my py file: ``` import bottle from bottle import route, run, template import bottle_mysql app = bottle.Bottle() # # dbhost is optional, default is localhost plugin = bottle_mysql.Plugin(dbuser='r...
2013/07/09
[ "https://Stackoverflow.com/questions/17548865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2049591/" ]
Here is the complete behavior you wanted Use `$(document)` instead `$('body')` ``` $(document).not('#menu, #menu-trigger').click(function(event) { event.preventDefault(); if (menu.is(":visible")) { menu.slideUp(400); } }); ``` [### Updated Fiddle](http://jsfiddle.net/yGMZt/6/) And also use ...
Found a very good answer by Frederik in [Document click not in elements jQuery](https://stackoverflow.com/questions/10851312/document-click-not-in-elements-jquery/10851375#10851375) Modified a bit to support elements not yet present in document for example elements fetched by ajax calls. ``` $(document).on('click',fu...
17,548,865
I followed this link : "<https://pypi.python.org/pypi/bottle-mysql/0.1.1>" and "<http://bottlepy.org/docs/dev/>" this is my py file: ``` import bottle from bottle import route, run, template import bottle_mysql app = bottle.Bottle() # # dbhost is optional, default is localhost plugin = bottle_mysql.Plugin(dbuser='r...
2013/07/09
[ "https://Stackoverflow.com/questions/17548865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2049591/" ]
Here is the complete behavior you wanted Use `$(document)` instead `$('body')` ``` $(document).not('#menu, #menu-trigger').click(function(event) { event.preventDefault(); if (menu.is(":visible")) { menu.slideUp(400); } }); ``` [### Updated Fiddle](http://jsfiddle.net/yGMZt/6/) And also use ...
This is what you want: ``` $(document).ready( function() { var expanded = false; // When clicked on the menu-trigger $("#menu-trigger").click( function(event) { // Slide down menu if hidden if (!expanded) { event.stopPropagati...
17,548,865
I followed this link : "<https://pypi.python.org/pypi/bottle-mysql/0.1.1>" and "<http://bottlepy.org/docs/dev/>" this is my py file: ``` import bottle from bottle import route, run, template import bottle_mysql app = bottle.Bottle() # # dbhost is optional, default is localhost plugin = bottle_mysql.Plugin(dbuser='r...
2013/07/09
[ "https://Stackoverflow.com/questions/17548865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2049591/" ]
Found a very good answer by Frederik in [Document click not in elements jQuery](https://stackoverflow.com/questions/10851312/document-click-not-in-elements-jquery/10851375#10851375) Modified a bit to support elements not yet present in document for example elements fetched by ajax calls. ``` $(document).on('click',fu...
This is what you want: ``` $(document).ready( function() { var expanded = false; // When clicked on the menu-trigger $("#menu-trigger").click( function(event) { // Slide down menu if hidden if (!expanded) { event.stopPropagati...
46,647,167
I am working on a simple chat app in python 3.6.1 for personal use. I get this error with select.select: ``` Traceback (most recent call last): File "C:\Users\Nathan Glover\Google Drive\MAGENTA Chat\chat_server.py", line 27, in <module> ready_to_read,ready_to_write,in_error = select.select(SOCKET_LIST,[],[],0) ...
2017/10/09
[ "https://Stackoverflow.com/questions/46647167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8099482/" ]
I know it's been a long time since this question was asked. But I wanted to let OP and others know about the problem here. The problem here is that the SOCKET\_LIST must be containing a non-existing socket connection which may have been disconnected earlier. If you pass such connection to select it gives this error ``...
I happened to have this problem too, and I have solved it. I hope this answer will help everyone. The fileno of the closed socket will become -1. So it is most likely because there is a closed socket in the input parameter list of slelect. That is to say, in the select cycle, when your judgment logic is added to rlist,...
46,647,167
I am working on a simple chat app in python 3.6.1 for personal use. I get this error with select.select: ``` Traceback (most recent call last): File "C:\Users\Nathan Glover\Google Drive\MAGENTA Chat\chat_server.py", line 27, in <module> ready_to_read,ready_to_write,in_error = select.select(SOCKET_LIST,[],[],0) ...
2017/10/09
[ "https://Stackoverflow.com/questions/46647167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8099482/" ]
I know it's been a long time since this question was asked. But I wanted to let OP and others know about the problem here. The problem here is that the SOCKET\_LIST must be containing a non-existing socket connection which may have been disconnected earlier. If you pass such connection to select it gives this error ``...
It might not work if you did not properly initialize your server socket. Try this code: ``` HOST = '127.0.0.1' # '' = all available interfaces PORT = 9009 # Arbitrary non-privileged port sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.se...
46,647,167
I am working on a simple chat app in python 3.6.1 for personal use. I get this error with select.select: ``` Traceback (most recent call last): File "C:\Users\Nathan Glover\Google Drive\MAGENTA Chat\chat_server.py", line 27, in <module> ready_to_read,ready_to_write,in_error = select.select(SOCKET_LIST,[],[],0) ...
2017/10/09
[ "https://Stackoverflow.com/questions/46647167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8099482/" ]
I know it's been a long time since this question was asked. But I wanted to let OP and others know about the problem here. The problem here is that the SOCKET\_LIST must be containing a non-existing socket connection which may have been disconnected earlier. If you pass such connection to select it gives this error ``...
I know I am late to the party, but this problem seems to be caused by a closed file descriptor in the `SOCKET_LIST` which is being passed to `select`, another solution would be removing closed file in `SOCKET_LIST` before calling `select`. **this solution is O(n^2)**, but it's les hacky than try and catch. ```py for s...
46,647,167
I am working on a simple chat app in python 3.6.1 for personal use. I get this error with select.select: ``` Traceback (most recent call last): File "C:\Users\Nathan Glover\Google Drive\MAGENTA Chat\chat_server.py", line 27, in <module> ready_to_read,ready_to_write,in_error = select.select(SOCKET_LIST,[],[],0) ...
2017/10/09
[ "https://Stackoverflow.com/questions/46647167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8099482/" ]
I happened to have this problem too, and I have solved it. I hope this answer will help everyone. The fileno of the closed socket will become -1. So it is most likely because there is a closed socket in the input parameter list of slelect. That is to say, in the select cycle, when your judgment logic is added to rlist,...
It might not work if you did not properly initialize your server socket. Try this code: ``` HOST = '127.0.0.1' # '' = all available interfaces PORT = 9009 # Arbitrary non-privileged port sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.se...
46,647,167
I am working on a simple chat app in python 3.6.1 for personal use. I get this error with select.select: ``` Traceback (most recent call last): File "C:\Users\Nathan Glover\Google Drive\MAGENTA Chat\chat_server.py", line 27, in <module> ready_to_read,ready_to_write,in_error = select.select(SOCKET_LIST,[],[],0) ...
2017/10/09
[ "https://Stackoverflow.com/questions/46647167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8099482/" ]
I happened to have this problem too, and I have solved it. I hope this answer will help everyone. The fileno of the closed socket will become -1. So it is most likely because there is a closed socket in the input parameter list of slelect. That is to say, in the select cycle, when your judgment logic is added to rlist,...
I know I am late to the party, but this problem seems to be caused by a closed file descriptor in the `SOCKET_LIST` which is being passed to `select`, another solution would be removing closed file in `SOCKET_LIST` before calling `select`. **this solution is O(n^2)**, but it's les hacky than try and catch. ```py for s...
63,182,541
I am trying to send message from Raspberry Pi (Ubuntu 20) to Laptop (Virtualbox Ubuntu 20) via UDP socket. So I am using simple code from <https://wiki.python.org/moin/UdpCommunication> Sending (from Raspberry Pi) ``` import socket UDP_IP = "127.0.0.1" UDP_PORT = 5005 MESSAGE = b"Hello, World!" print("UDP target IP...
2020/07/30
[ "https://Stackoverflow.com/questions/63182541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13118262/" ]
The problem may be in the IP address because you are using the IP '127.0.0.1' (localhost) to reach an outside device. Please find out the IPs of your devices, try using ifconfig Linux command. Also, check that nothing is blocking your connection. Consider that for socket.bind(address) you can use '0.0.0.0' and for soc...
If you are using a static IP on the RPi, you need to add a static route: ``` sudo ip route add 236.0.0.0/8 dev eth0 ```
63,182,541
I am trying to send message from Raspberry Pi (Ubuntu 20) to Laptop (Virtualbox Ubuntu 20) via UDP socket. So I am using simple code from <https://wiki.python.org/moin/UdpCommunication> Sending (from Raspberry Pi) ``` import socket UDP_IP = "127.0.0.1" UDP_PORT = 5005 MESSAGE = b"Hello, World!" print("UDP target IP...
2020/07/30
[ "https://Stackoverflow.com/questions/63182541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13118262/" ]
The problem may be in the IP address because you are using the IP '127.0.0.1' (localhost) to reach an outside device. Please find out the IPs of your devices, try using ifconfig Linux command. Also, check that nothing is blocking your connection. Consider that for socket.bind(address) you can use '0.0.0.0' and for soc...
**Make sure the port you are using have UDP enabled in windows 10.** To open any UDP ports, you can do the following: 1. Go to Control Panel> System and Security and Windows Firewall. 2. Advanced settings > right-click Inbound Rules and select New Rule. 3. Add the port(s) you want to open and click Next. 4. Select UD...
7,213,965
I am using Windows 7, Apache 2.28 and Web Developer Server Suite for my server. All files are stored under C:/www/vhosts I downloaded Portable Python 2.7 from <http://www.portablepython.com/> and have installed it to C:/www/portablepython I'm trying to find mod\_wsgi to get it to work with 2.7 - but how can I do t...
2011/08/27
[ "https://Stackoverflow.com/questions/7213965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847047/" ]
The script you have at C:/www/vhosts/localhost/testing.py is a CGI script and not a WSGI script. Follow the instructions for configuring mod\_wsgi and what a WSGI script file for hello world should look like at: <http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide>
also, you should look into using a system install of python from python.org and pip+distribute+virtualenv to keep contained python environments for your different sites. This will give you maximum portability.
7,213,965
I am using Windows 7, Apache 2.28 and Web Developer Server Suite for my server. All files are stored under C:/www/vhosts I downloaded Portable Python 2.7 from <http://www.portablepython.com/> and have installed it to C:/www/portablepython I'm trying to find mod\_wsgi to get it to work with 2.7 - but how can I do t...
2011/08/27
[ "https://Stackoverflow.com/questions/7213965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847047/" ]
The script you have at C:/www/vhosts/localhost/testing.py is a CGI script and not a WSGI script. Follow the instructions for configuring mod\_wsgi and what a WSGI script file for hello world should look like at: <http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide>
Here is a sample - [PortableWinPy](https://github.com/yn-coder/PortableWinPy) - how to get Django work with Apache and `mod_wsgi`, in portale way.
28,097,471
**Update**: Here is a more specific example Suppose I want to compile some statistical data from a sizable set of files: I can make a generator `(line for line in fileinput.input(files))` and some processor: ``` from collections import defaultdict scores = defaultdict(int) def process(line): if 'Result' in...
2015/01/22
[ "https://Stackoverflow.com/questions/28097471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3467349/" ]
So you basically create a histogram. This is can easily be parallelized, because histograms can be merged without complication. One might want to say that this problem is trivially parallelizable or ["embarrassingly parallel"](http://en.wikipedia.org/wiki/Embarrassingly_parallel). That is, you do not need to worry abou...
I had to modify the original pool.py (the trouble was worker is defined as a method without any inheritance) to get what I want but it's not so bad, and probably better than writing a new pool entirely. ``` class worker(object): def __init__(self, inqueue, outqueue, initializer=None, initargs=(), maxtasks=None, ...
13,335,679
I want to run a system command in the background using python 2.7, this is what I have: ``` import commands path = '/fioverify.fio' cmd= "/usr/local/bin/fio" + path + " "+ " &" print cmd handle = commands.getstatusoutput(cmd) ``` This fails. If I remove the ampersand `&` it works. I need to run a command (`/usr/loc...
2012/11/11
[ "https://Stackoverflow.com/questions/13335679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1618238/" ]
Don't use `commands`; it's deprecated and not actually useful for your purposes. Use `subprocess` instead. ``` fio = subprocess.Popen(["/usr/local/bin/fio", path]) ``` runs the `fio` command in parallel with your process and binds the variable `fio` to a handle to the process. You can then call `fio.wait()` to wait ...
Use the [subprocess](http://docs.python.org/2/library/subprocess.html) module, [`subprocess.Popen`](http://docs.python.org/2/library/subprocess.html#subprocess.Popen) allows you to run a command as a subprocess (in the background) and check its status.
13,335,679
I want to run a system command in the background using python 2.7, this is what I have: ``` import commands path = '/fioverify.fio' cmd= "/usr/local/bin/fio" + path + " "+ " &" print cmd handle = commands.getstatusoutput(cmd) ``` This fails. If I remove the ampersand `&` it works. I need to run a command (`/usr/loc...
2012/11/11
[ "https://Stackoverflow.com/questions/13335679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1618238/" ]
Don't use `commands`; it's deprecated and not actually useful for your purposes. Use `subprocess` instead. ``` fio = subprocess.Popen(["/usr/local/bin/fio", path]) ``` runs the `fio` command in parallel with your process and binds the variable `fio` to a handle to the process. You can then call `fio.wait()` to wait ...
You can also try [sh.py](http://amoffat.github.com/sh/), it has support for background commands: ``` import sh bin = sh.Command("/usr/local/bin/fio/fioverify.fio") handle = bin(_bg=True) # ... do other code ... handle.wait() ```
13,335,679
I want to run a system command in the background using python 2.7, this is what I have: ``` import commands path = '/fioverify.fio' cmd= "/usr/local/bin/fio" + path + " "+ " &" print cmd handle = commands.getstatusoutput(cmd) ``` This fails. If I remove the ampersand `&` it works. I need to run a command (`/usr/loc...
2012/11/11
[ "https://Stackoverflow.com/questions/13335679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1618238/" ]
Don't use `commands`; it's deprecated and not actually useful for your purposes. Use `subprocess` instead. ``` fio = subprocess.Popen(["/usr/local/bin/fio", path]) ``` runs the `fio` command in parallel with your process and binds the variable `fio` to a handle to the process. You can then call `fio.wait()` to wait ...
Running processes in the background using Python 2.7 ---------------------------------------------------- `commands.getstatusoutput(...)` isn't smart enough to handle background processes, use `subprocess.Popen` or `os.system`. **Reproducing the error of how `commands.getstatusoutput` fails on background processes:**...
53,055,671
How do you run the command line in order to read and write a csv file in python on a MacBook?
2018/10/30
[ "https://Stackoverflow.com/questions/53055671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10387703/" ]
The first APK you linked to isn't a valid APK. It's just a plain text file, with the following text repeated over and over: ``` HTTP/1.1 200 OK Date: Sat, 27 Oct 2018 17:35:36 GMT Strict-Transport-Security: max-age=31536000;includeSubDomains; preload Last-Modified: Sat, 28 Jul 2018 11:40:03 GMT ETag: "23b1fe5-5720db06...
That's encryption java classes feature (Like dexgaurd or Bangcle kh); and also that's protected with Native Library Encryption (NLE) + JNI Obfuscation (JNI) From Something like dexprotector (i found that in dynamic analysis tools) and many tanks to semanticscholar for [This](https://pdfs.semanticscholar.org/2b02/44a29...
61,861,185
Let's say I have the following class. ```py class A: def __init__(self, x=0, y=0): self.x = x self.y = y obj_A = A(y=2) # Dynamically pass the parameters ``` My question is, how can I dynamically create an object of a certain class by passing only one (perhaps multiple but not all) parameters? A...
2020/05/18
[ "https://Stackoverflow.com/questions/61861185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1474204/" ]
There is `asSequence()` function for iterator, but it returns sequence that can be iterated only once. The point is to use the same iterator for each iteration. ``` // I don't know how to name the function... public fun <T> Iterable<T>.asIteratorSequence(): Sequence<T> { val iterator = this.iterator() return S...
I figured out we can use iterators for this: ``` fun main() { val seq = listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9).asSequence().iterator() println(seq.asSequence().take(4).toList().toString()); println(seq.asSequence().toList().toString()) } ``` This way the sequences advance the inner iterator. If the sequenc...
61,861,185
Let's say I have the following class. ```py class A: def __init__(self, x=0, y=0): self.x = x self.y = y obj_A = A(y=2) # Dynamically pass the parameters ``` My question is, how can I dynamically create an object of a certain class by passing only one (perhaps multiple but not all) parameters? A...
2020/05/18
[ "https://Stackoverflow.com/questions/61861185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1474204/" ]
You can create two subsequences from the original: ``` val seq = listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9).asSequence() val firstCount = 4 val first = seq.take(firstCount) val second = seq.drop(firstCount) println(first.toList()) println(second.toList()) ```
I figured out we can use iterators for this: ``` fun main() { val seq = listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9).asSequence().iterator() println(seq.asSequence().take(4).toList().toString()); println(seq.asSequence().toList().toString()) } ``` This way the sequences advance the inner iterator. If the sequenc...
40,946,211
I've installed my Django app on an Ubuntu server with Apache2.4.7 and configured it to use py3.5.2 from a virtual environment. However, from what I can see in the errors, it's starting at 3.5 and defaulting to 3.4. Please explain why this is happening: ``` /var/www/venv/lib/python3.5/site-packages /usr/lib/python3.4...
2016/12/03
[ "https://Stackoverflow.com/questions/40946211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2591242/" ]
The mod\_wsgi module for Apache is compiled for a specific Python version. You cannot make it run using a different Python version by pointing it at a Python virtual environment for a different Python version. This is cleared mentioned in the mod\_wsgi documentation about use of Python virtual environments at: * <http...
The source of the problem was Graham Dumpleton's answer. I just want to give some more information in case it helps someone facing the same problem as me. There's no official repo for Python 3.5.2 in Ubuntu server 14.04. Rather than using some unsupported repo like [this one](https://launchpad.net/~fkrull/+archive/ubu...
42,621,190
I am following a tutorial on using python v3.6 to do decision tree with machine learning using scikit-learn. Here is the code; ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import mglearn import graphviz from sklearn.datasets import load_breast_cancer from sklearn.model_selection import ...
2017/03/06
[ "https://Stackoverflow.com/questions/42621190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848207/" ]
`graphviz.Source(dot_graph)` returns a [`graphviz.files.Source`](http://graphviz.readthedocs.io/en/latest/api.html#source) object. ``` g = graphviz.Source(dot_graph) ``` use [`g.render()`](http://graphviz.readthedocs.io/en/latest/api.html#graphviz.Source.render) to create an image file. When I ran it on your code wi...
You can use display from IPython.display. Here is an example: ``` from sklearn.tree import DecisionTreeClassifier from sklearn import tree model = DecisionTreeClassifier() model.fit(X, y) from IPython.display import display display(graphviz.Source(tree.export_graphviz(model))) ```
42,621,190
I am following a tutorial on using python v3.6 to do decision tree with machine learning using scikit-learn. Here is the code; ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import mglearn import graphviz from sklearn.datasets import load_breast_cancer from sklearn.model_selection import ...
2017/03/06
[ "https://Stackoverflow.com/questions/42621190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848207/" ]
`graphviz.Source(dot_graph)` returns a [`graphviz.files.Source`](http://graphviz.readthedocs.io/en/latest/api.html#source) object. ``` g = graphviz.Source(dot_graph) ``` use [`g.render()`](http://graphviz.readthedocs.io/en/latest/api.html#graphviz.Source.render) to create an image file. When I ran it on your code wi...
I'm working in Windows 10. I solved this by adding to the 'path' environment variable. I added the wrong path, I added Drive:\Users\User.Name\AppData\Local\Continuum\anaconda3\envs\MyVirtualEnv\lib\site-packages\graphviz should have used Drive:\Users\User.Name\AppData\Local\Continuum\anaconda3\envs\MyVirtualEnv\Librar...
42,621,190
I am following a tutorial on using python v3.6 to do decision tree with machine learning using scikit-learn. Here is the code; ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import mglearn import graphviz from sklearn.datasets import load_breast_cancer from sklearn.model_selection import ...
2017/03/06
[ "https://Stackoverflow.com/questions/42621190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848207/" ]
`graphviz.Source(dot_graph)` returns a [`graphviz.files.Source`](http://graphviz.readthedocs.io/en/latest/api.html#source) object. ``` g = graphviz.Source(dot_graph) ``` use [`g.render()`](http://graphviz.readthedocs.io/en/latest/api.html#graphviz.Source.render) to create an image file. When I ran it on your code wi...
Jupyter will show the graph as is, but if you want to zoom in more you can try to save the file and inspect further : ``` # Draw graph graph = pydotplus.graph_from_dot_data(dot_data) # Show graph Image(graph.create_png()) ```
42,621,190
I am following a tutorial on using python v3.6 to do decision tree with machine learning using scikit-learn. Here is the code; ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import mglearn import graphviz from sklearn.datasets import load_breast_cancer from sklearn.model_selection import ...
2017/03/06
[ "https://Stackoverflow.com/questions/42621190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848207/" ]
You can use display from IPython.display. Here is an example: ``` from sklearn.tree import DecisionTreeClassifier from sklearn import tree model = DecisionTreeClassifier() model.fit(X, y) from IPython.display import display display(graphviz.Source(tree.export_graphviz(model))) ```
I'm working in Windows 10. I solved this by adding to the 'path' environment variable. I added the wrong path, I added Drive:\Users\User.Name\AppData\Local\Continuum\anaconda3\envs\MyVirtualEnv\lib\site-packages\graphviz should have used Drive:\Users\User.Name\AppData\Local\Continuum\anaconda3\envs\MyVirtualEnv\Librar...
42,621,190
I am following a tutorial on using python v3.6 to do decision tree with machine learning using scikit-learn. Here is the code; ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import mglearn import graphviz from sklearn.datasets import load_breast_cancer from sklearn.model_selection import ...
2017/03/06
[ "https://Stackoverflow.com/questions/42621190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848207/" ]
In jupyter notebook the following plots the decision tree: ```py from sklearn.tree import DecisionTreeClassifier from sklearn import tree model = DecisionTreeClassifier() model.fit(X, y) dot_data = tree.export_graphviz(model, feature_names=feature_names, class_names=class_names,...
You can use display from IPython.display. Here is an example: ``` from sklearn.tree import DecisionTreeClassifier from sklearn import tree model = DecisionTreeClassifier() model.fit(X, y) from IPython.display import display display(graphviz.Source(tree.export_graphviz(model))) ```
42,621,190
I am following a tutorial on using python v3.6 to do decision tree with machine learning using scikit-learn. Here is the code; ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import mglearn import graphviz from sklearn.datasets import load_breast_cancer from sklearn.model_selection import ...
2017/03/06
[ "https://Stackoverflow.com/questions/42621190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848207/" ]
You can use display from IPython.display. Here is an example: ``` from sklearn.tree import DecisionTreeClassifier from sklearn import tree model = DecisionTreeClassifier() model.fit(X, y) from IPython.display import display display(graphviz.Source(tree.export_graphviz(model))) ```
Jupyter will show the graph as is, but if you want to zoom in more you can try to save the file and inspect further : ``` # Draw graph graph = pydotplus.graph_from_dot_data(dot_data) # Show graph Image(graph.create_png()) ```
42,621,190
I am following a tutorial on using python v3.6 to do decision tree with machine learning using scikit-learn. Here is the code; ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import mglearn import graphviz from sklearn.datasets import load_breast_cancer from sklearn.model_selection import ...
2017/03/06
[ "https://Stackoverflow.com/questions/42621190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848207/" ]
In jupyter notebook the following plots the decision tree: ```py from sklearn.tree import DecisionTreeClassifier from sklearn import tree model = DecisionTreeClassifier() model.fit(X, y) dot_data = tree.export_graphviz(model, feature_names=feature_names, class_names=class_names,...
I'm working in Windows 10. I solved this by adding to the 'path' environment variable. I added the wrong path, I added Drive:\Users\User.Name\AppData\Local\Continuum\anaconda3\envs\MyVirtualEnv\lib\site-packages\graphviz should have used Drive:\Users\User.Name\AppData\Local\Continuum\anaconda3\envs\MyVirtualEnv\Librar...
42,621,190
I am following a tutorial on using python v3.6 to do decision tree with machine learning using scikit-learn. Here is the code; ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import mglearn import graphviz from sklearn.datasets import load_breast_cancer from sklearn.model_selection import ...
2017/03/06
[ "https://Stackoverflow.com/questions/42621190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848207/" ]
In jupyter notebook the following plots the decision tree: ```py from sklearn.tree import DecisionTreeClassifier from sklearn import tree model = DecisionTreeClassifier() model.fit(X, y) dot_data = tree.export_graphviz(model, feature_names=feature_names, class_names=class_names,...
Jupyter will show the graph as is, but if you want to zoom in more you can try to save the file and inspect further : ``` # Draw graph graph = pydotplus.graph_from_dot_data(dot_data) # Show graph Image(graph.create_png()) ```
30,560,266
I have a router configuration file. The router has thousands of "Interfaces", and I'm trying to make sure it DOES have *two* certain lines in EACH Interface configuration section. The typical router configuration file would look like this: ``` <whitespaces> Interface_1 <whitespaces> description Interface_1 <whitesp...
2015/05/31
[ "https://Stackoverflow.com/questions/30560266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4958929/" ]
I solved this issue using [collection.distinct](https://mongodb.github.io/node-mongodb-native/api-generated/collection.html#distinct): ``` collection.distinct("DataFields",(function(err, docs){ console.log(docs); assert.equal(null, err); db.close(); })) ```
You could also do this by way of **[aggregation framework](http://docs.mongodb.org/manual/core/aggregation-introduction/)**. The suitable aggregation pipeline would consist of the [**`$group`**](http://docs.mongodb.org/manual/reference/operator/aggregation/group/#pipe._S_group) operator stage which groups the document ...
10,839,302
I have a django application that requires PIL and I have been getting errors so I decided to play around with PIL on my hosting server. PIL is installed in my virtual environment. However, when running the following I get an error, and when I run it outside the virtual environment it works. ``` Python 2.7.3 (defaul...
2012/05/31
[ "https://Stackoverflow.com/questions/10839302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/269106/" ]
Most likely the Python you are using in your virtualenv has been built by yourself, not the system Python - is that right? If so your problem is that the header (.h) files for zlib are not installed in your system when building Python itself. You have to have the "ziplib-devel" (or equivalent) package in Linux when bu...
You could try [Pillow](http://pypi.python.org/pypi/Pillow) which is a repackaged PIL which plays much nicer with virtualenv.
46,423,582
I'm attempting to install cvxopt using Conda (which comes with the Anaconda python distribution), and I received the error message below. Apparently my Anaconda installation is using python 3.6, whereas cvxopt wants python 3.5\*. How can I fix this and install cvxopt using Conda? After typing conda install cvxopt at t...
2017/09/26
[ "https://Stackoverflow.com/questions/46423582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1854748/" ]
It would appear that `cvxopt` requires Python 3.5. Easiest solution would be to use `conda` to create a separate environment for python 3.5 and then install cvxopt (and any other desired python packages). For example... ``` conda create -n cvxopt-env python=3.5 cvxopt numpy scipy matplotlib jupyter ``` ...depending ...
try ``` conda install cvxopt=1.1.8 ``` its the new version and only version having support for python3.6
55,358,337
How can we apply conditions for a Dataset in python, specially applying those and want to fetch the column name as an output? let's say the below one is the dataframe so my question is how can we retrieve a colname(let's say "name") as an output by applying conditions on this dataframe ``` name salary ...
2019/03/26
[ "https://Stackoverflow.com/questions/55358337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11260410/" ]
(edit: slightly simplified non-recursive solution) You can do it like this, just for each iteration consider if the item should be included or excluded. ``` def f(maxK,K, N, L, S): if L == 0 or not N or K == 0: return S #either element is included included = f(maxK,maxK, N[1:], L-1, S + N[0] ) ...
Extending the code for `itertools.combinations` shown at the [docs](https://docs.python.org/3/library/itertools.html#itertools.combinations), I built a version that includes an argument for the maximum index distance (`K`) between two values. It only needed an additional `and indices[i] - indices[i-1] < K` check in the...
55,358,337
How can we apply conditions for a Dataset in python, specially applying those and want to fetch the column name as an output? let's say the below one is the dataframe so my question is how can we retrieve a colname(let's say "name") as an output by applying conditions on this dataframe ``` name salary ...
2019/03/26
[ "https://Stackoverflow.com/questions/55358337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11260410/" ]
(edit: slightly simplified non-recursive solution) You can do it like this, just for each iteration consider if the item should be included or excluded. ``` def f(maxK,K, N, L, S): if L == 0 or not N or K == 0: return S #either element is included included = f(maxK,maxK, N[1:], L-1, S + N[0] ) ...
--- Algorithm --------- **Basic idea:** * **Iteration** on input array, choose each index as the first taken element. * Then **Recursion** on each first taken element, mark the index as `firstIdx`. + The next possible index would be in range `[firstIdx + 1, firstIdx + K]`, both inclusive. + Loop on the range to c...
55,358,337
How can we apply conditions for a Dataset in python, specially applying those and want to fetch the column name as an output? let's say the below one is the dataframe so my question is how can we retrieve a colname(let's say "name") as an output by applying conditions on this dataframe ``` name salary ...
2019/03/26
[ "https://Stackoverflow.com/questions/55358337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11260410/" ]
Extending the code for `itertools.combinations` shown at the [docs](https://docs.python.org/3/library/itertools.html#itertools.combinations), I built a version that includes an argument for the maximum index distance (`K`) between two values. It only needed an additional `and indices[i] - indices[i-1] < K` check in the...
--- Algorithm --------- **Basic idea:** * **Iteration** on input array, choose each index as the first taken element. * Then **Recursion** on each first taken element, mark the index as `firstIdx`. + The next possible index would be in range `[firstIdx + 1, firstIdx + K]`, both inclusive. + Loop on the range to c...
55,358,337
How can we apply conditions for a Dataset in python, specially applying those and want to fetch the column name as an output? let's say the below one is the dataframe so my question is how can we retrieve a colname(let's say "name") as an output by applying conditions on this dataframe ``` name salary ...
2019/03/26
[ "https://Stackoverflow.com/questions/55358337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11260410/" ]
Here is a bottom up (ie no recursion) dynamic solution in Python. It takes memory `O(l * n)` and time `O(l * n * k)`. ``` def max_subseq_sum(k, l, values): # table[i][j] will be the highest value from a sequence of length j # ending at position i table = [] for i in range(len(values)): # We hav...
Extending the code for `itertools.combinations` shown at the [docs](https://docs.python.org/3/library/itertools.html#itertools.combinations), I built a version that includes an argument for the maximum index distance (`K`) between two values. It only needed an additional `and indices[i] - indices[i-1] < K` check in the...
55,358,337
How can we apply conditions for a Dataset in python, specially applying those and want to fetch the column name as an output? let's say the below one is the dataframe so my question is how can we retrieve a colname(let's say "name") as an output by applying conditions on this dataframe ``` name salary ...
2019/03/26
[ "https://Stackoverflow.com/questions/55358337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11260410/" ]
Here is a bottom up (ie no recursion) dynamic solution in Python. It takes memory `O(l * n)` and time `O(l * n * k)`. ``` def max_subseq_sum(k, l, values): # table[i][j] will be the highest value from a sequence of length j # ending at position i table = [] for i in range(len(values)): # We hav...
--- Algorithm --------- **Basic idea:** * **Iteration** on input array, choose each index as the first taken element. * Then **Recursion** on each first taken element, mark the index as `firstIdx`. + The next possible index would be in range `[firstIdx + 1, firstIdx + K]`, both inclusive. + Loop on the range to c...
71,737,316
So, I'm having the classic trouble install lxml. Initially I was just pip installing, but when I tried to free up memory using `Element.clear()` I was getting the following error: ``` Python(58695,0x1001b4580) malloc: *** error for object 0x600000bc3f60: pointer being freed was not allocated ``` I thought this must...
2022/04/04
[ "https://Stackoverflow.com/questions/71737316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/311220/" ]
One solution that works - build it from source: ``` git clone https://github.com/lxml/lxml cd lxml git checkout tags/lxml-4.9.1 python3 setup.py bdist_wheel cd dist/ sudo pip3 install lxml-4.9.1-cp310-cp310-macosx_12_0_arm64.whl ``` For additional resources: <https://lxml.de/installation.html>
It turned out that installing lxml with a simple `pip install` *was* working fine. The reason for my malloc error was the fact that I was trying to clear the element before the end tag had been seen. Turns out this isn't possible and you need to wait for the end tag even if you already know you aren't interested in th...
4,944,331
I wonder about the best/easiest way to authenticate the user for the Google Data API in a desktop app. I read through the [docs](http://code.google.com/intl/de/apis/contacts/docs/3.0/developers_guide_python.html) and it seems that my options are ClientLogin or OAuth. For ClientLogin, it seems I have to implement the ...
2011/02/09
[ "https://Stackoverflow.com/questions/4944331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133374/" ]
You can use the file streaming ability available on the MediaPlayer class to do the above. I have not tested the following code, but it should be something on these lines: ``` MediaPlayer mp = new MediaPlayer(); mp.setDataSource(http://somedomain/some.pls); mp.prepare(); mp.start(); ``` But remember to do th...
You can try download pls file, parse the urls that are in there, and put them in MediaPlayer.
4,944,331
I wonder about the best/easiest way to authenticate the user for the Google Data API in a desktop app. I read through the [docs](http://code.google.com/intl/de/apis/contacts/docs/3.0/developers_guide_python.html) and it seems that my options are ClientLogin or OAuth. For ClientLogin, it seems I have to implement the ...
2011/02/09
[ "https://Stackoverflow.com/questions/4944331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133374/" ]
Mediaplayer api from android supports streaming a .pls file, but the API is not best option & the documentation is not well. The life cycle diagram given in the official documentation gives valuable information but may be confusing at a first glance. A sample code snippet: ``` MediaPlayer mp; mp=MediaPlayer.create(ge...
You can try download pls file, parse the urls that are in there, and put them in MediaPlayer.
4,944,331
I wonder about the best/easiest way to authenticate the user for the Google Data API in a desktop app. I read through the [docs](http://code.google.com/intl/de/apis/contacts/docs/3.0/developers_guide_python.html) and it seems that my options are ClientLogin or OAuth. For ClientLogin, it seems I have to implement the ...
2011/02/09
[ "https://Stackoverflow.com/questions/4944331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133374/" ]
You can use the file streaming ability available on the MediaPlayer class to do the above. I have not tested the following code, but it should be something on these lines: ``` MediaPlayer mp = new MediaPlayer(); mp.setDataSource(http://somedomain/some.pls); mp.prepare(); mp.start(); ``` But remember to do th...
Man, try this two things: **1: the code** ``` mediaPlayer = MediaPlayer.create(this, Uri.parse("http://vprbbc.streamguys.net:80/vprbbc24.mp3")); mediaPlayer.start(); ``` **2: the .pls file** This URL is from BBC just as an example. It was an .pls file that on linux i downloaded with ``` wget http://foo.bar/file.p...
4,944,331
I wonder about the best/easiest way to authenticate the user for the Google Data API in a desktop app. I read through the [docs](http://code.google.com/intl/de/apis/contacts/docs/3.0/developers_guide_python.html) and it seems that my options are ClientLogin or OAuth. For ClientLogin, it seems I have to implement the ...
2011/02/09
[ "https://Stackoverflow.com/questions/4944331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133374/" ]
Mediaplayer api from android supports streaming a .pls file, but the API is not best option & the documentation is not well. The life cycle diagram given in the official documentation gives valuable information but may be confusing at a first glance. A sample code snippet: ``` MediaPlayer mp; mp=MediaPlayer.create(ge...
Man, try this two things: **1: the code** ``` mediaPlayer = MediaPlayer.create(this, Uri.parse("http://vprbbc.streamguys.net:80/vprbbc24.mp3")); mediaPlayer.start(); ``` **2: the .pls file** This URL is from BBC just as an example. It was an .pls file that on linux i downloaded with ``` wget http://foo.bar/file.p...
48,013,074
So I am trying to use cffi to access a c library quickly in pypy. I am using my macpro with command line tools 9.1 specifically I am comparing a pure python priority queue, with heapq, with a cffi, and ctypes for a project. I have got code from roman10's website for a C implementation of a priority queue. I am fol...
2017/12/28
[ "https://Stackoverflow.com/questions/48013074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5062570/" ]
You must tell ffi.set\_source() about `heap.c`. The easiest way is `with open('heap.c', 'r') as fid: ffi.set_source(fid.read())` like in [this example](http://cffi.readthedocs.io/en/latest/overview.html#purely-for-performance-api-level-out-of-line). The way it works is: * declarations of functions, structs, enums, ...
Your ffi.cdef() does not have any function declaration, so the resulting \_heap\_i library doesn't export any function. Try to copy-paste the function declaration from the .h file.
71,395,163
I have a txt file of hundreds of thousands of words. I need to get into some format (I think dictionary is the right thing?) where I can put into my script something along the lines of; ``` for i in word_list: word_length = len(i) print("Length of " + i + word_length, file=open("LengthOutput.txt", "a")) ``` Currentl...
2022/03/08
[ "https://Stackoverflow.com/questions/71395163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15604077/" ]
A list would be the correct way to store the words. A dictionary requires a key-value pair and you don't need it in this case. ``` with open('filename.txt', 'r') as file: x = [word.strip('\n') for word in file.readlines()] ```
What you are trying to do is to read a file. An `import` statement is used when you want to, loosely speaking, use python code from another file. The [docs](https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files) have a good introduction on reading and writing files - To read a file, you first ...
11,729,120
I am having a problem reading specific lines. It's similar to the question answered here: [python - Read file from and to specific lines of text](https://stackoverflow.com/questions/7559397/python-read-file-from-and-to-specific-lines-of-text) The difference, I don't have a fixed end mark. Let me show an example: ``` -...
2012/07/30
[ "https://Stackoverflow.com/questions/11729120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1443368/" ]
Take a look at [this file](https://github.com/void256/nifty-gui/blob/1.3/nifty-renderer-lwjgl/src/main/java/de/lessvoid/nifty/renderer/lwjgl/input/LwjglKeyboardInputEventCreator.java) of the source code of [NiftyGUI](https://github.com/void256/nifty-gui), which should contain this text handling code.
Just delete your shift handling line and add: ``` if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) shift=true; ``` before the beginning of the While loop.
39,142,168
I just started learning python a few days ago and I have been using Grok Learning. For the challenge I have everything working as far as i can see but when i submit it i am told "Testing yet another case that starts with a vowel. Your submission raised an exception of type IndexError. This occurred on line 8 of your su...
2016/08/25
[ "https://Stackoverflow.com/questions/39142168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
use the below query.. ``` WITH cte_data AS ( SELECT cost,(cost*round(rand()+rand(),2)origCost FROM [dbo].[x]) UPDATE a SET a.cost=a.origCost FROM cte_data a ``` if you need different numbers for calculation use the below script ``` WITH cte_data AS ( SELECT cost,ROW_NUMBER()OVER(ORDER BY cost)*(cost)origCost FRO...
To get random decimal within 0..2 use `CAST (ABS(CHECKSUM(NewId())) % 200 /100. AS DECIMAL(3,2))` instead of `round(rand()+rand(),2)`
39,142,168
I just started learning python a few days ago and I have been using Grok Learning. For the challenge I have everything working as far as i can see but when i submit it i am told "Testing yet another case that starts with a vowel. Your submission raised an exception of type IndexError. This occurred on line 8 of your su...
2016/08/25
[ "https://Stackoverflow.com/questions/39142168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
use the below query.. ``` WITH cte_data AS ( SELECT cost,(cost*round(rand()+rand(),2)origCost FROM [dbo].[x]) UPDATE a SET a.cost=a.origCost FROM cte_data a ``` if you need different numbers for calculation use the below script ``` WITH cte_data AS ( SELECT cost,ROW_NUMBER()OVER(ORDER BY cost)*(cost)origCost FRO...
``` declare @origCost float declare table_cursor cursor for select cost from [dbo].[x]where cost is not null open table_cursor; Fetch next from table_cursor into @origCost while @@FETCH_STATUS = 0 BEGIN update [dbo].[x] set cost=@origCost* round(rand()+rand(),2) where cost is not null Fetch Next from table_curs...
39,142,168
I just started learning python a few days ago and I have been using Grok Learning. For the challenge I have everything working as far as i can see but when i submit it i am told "Testing yet another case that starts with a vowel. Your submission raised an exception of type IndexError. This occurred on line 8 of your su...
2016/08/25
[ "https://Stackoverflow.com/questions/39142168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
To get random decimal within 0..2 use `CAST (ABS(CHECKSUM(NewId())) % 200 /100. AS DECIMAL(3,2))` instead of `round(rand()+rand(),2)`
``` declare @origCost float declare table_cursor cursor for select cost from [dbo].[x]where cost is not null open table_cursor; Fetch next from table_cursor into @origCost while @@FETCH_STATUS = 0 BEGIN update [dbo].[x] set cost=@origCost* round(rand()+rand(),2) where cost is not null Fetch Next from table_curs...
72,010,560
I am running [a model from github](https://github.com/wentaoyuan/pcn) and I already encountered several errors with pathing etc. After fixing this, I think the main error for now is tensorflow. This repo was probably done when TF 1.x, and now with the change to TF 2, I might need to migrate everything. Mainly, I get t...
2022/04/26
[ "https://Stackoverflow.com/questions/72010560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7396613/" ]
**Disclaimer**: Unless no other choice, I would strongly recommend sticking to TensorFlow 1.x. Migrating code from TF 1.x to 2.x can be incredibly time consuming. --- Registering a shape is done in c++ using `SetShapeFn` and not in python since TF 1.0. However, the private python API was kept in TF 1.x (I presume for...
according to tensorflow's release log, `RegisterShape` is deprecated, and you should use `SetShapeFn` to define the shape when registering your operator in c++ source file.
29,570,085
I am using a Makefile to provide consistent single commands for setting up a virtualenv, running tests, etc. I have configured my Jenkins instance to pull from a mercurial repo and then run "make virtualenv", which does this: ``` virtualenv --python=/usr/bin/python2.7 --no-site-packages . && . ./bin/activate && pip in...
2015/04/10
[ "https://Stackoverflow.com/questions/29570085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1332304/" ]
Jenkins pipelines can be made to run with virtual environments but there are multiple things to consider. * The default shell that Jenkins uses is `/bin/sh` - this is configurable in **Manage Jenkins -> Configure System -> Shell -> Shell executable**. Setting this to `/bin/bash` will make `source` work. * An activated...
[@hardbyte](https://stackoverflow.com/users/809692/hardbyte)'s answer *The default shell that Jenkins uses is /bin/sh - this is configurable in Manage Jenkins -> Configure System -> Shell -> Shell executable. Setting this to /bin/bash will make source work.* plus: * <https://stackoverflow.com/a/70812248/1497139> * [...
29,570,085
I am using a Makefile to provide consistent single commands for setting up a virtualenv, running tests, etc. I have configured my Jenkins instance to pull from a mercurial repo and then run "make virtualenv", which does this: ``` virtualenv --python=/usr/bin/python2.7 --no-site-packages . && . ./bin/activate && pip in...
2015/04/10
[ "https://Stackoverflow.com/questions/29570085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1332304/" ]
I have being using python virtualenvs with Jenkins every day in the last two years, at multiple companies and for small side projects and cannot say I found "THE" answer. Still, I hope that sharing my experience would help others save time. Hopefully I will get further feedback in order to make the decision easier. * ...
I've got same problem. As I can see - you project named 'Run Tests'. So, this name contain space. That was the problem for me. I just renamed project, like RunTests - and venv working now! Attention - jenkins ask you about confirmation renaming project.
29,570,085
I am using a Makefile to provide consistent single commands for setting up a virtualenv, running tests, etc. I have configured my Jenkins instance to pull from a mercurial repo and then run "make virtualenv", which does this: ``` virtualenv --python=/usr/bin/python2.7 --no-site-packages . && . ./bin/activate && pip in...
2015/04/10
[ "https://Stackoverflow.com/questions/29570085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1332304/" ]
Jenkins pipelines can be made to run with virtual environments but there are multiple things to consider. * The default shell that Jenkins uses is `/bin/sh` - this is configurable in **Manage Jenkins -> Configure System -> Shell -> Shell executable**. Setting this to `/bin/bash` will make `source` work. * An activated...
I've got same problem. As I can see - you project named 'Run Tests'. So, this name contain space. That was the problem for me. I just renamed project, like RunTests - and venv working now! Attention - jenkins ask you about confirmation renaming project.
29,570,085
I am using a Makefile to provide consistent single commands for setting up a virtualenv, running tests, etc. I have configured my Jenkins instance to pull from a mercurial repo and then run "make virtualenv", which does this: ``` virtualenv --python=/usr/bin/python2.7 --no-site-packages . && . ./bin/activate && pip in...
2015/04/10
[ "https://Stackoverflow.com/questions/29570085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1332304/" ]
I have being using python virtualenvs with Jenkins every day in the last two years, at multiple companies and for small side projects and cannot say I found "THE" answer. Still, I hope that sharing my experience would help others save time. Hopefully I will get further feedback in order to make the decision easier. * ...
[@hardbyte](https://stackoverflow.com/users/809692/hardbyte)'s answer *The default shell that Jenkins uses is /bin/sh - this is configurable in Manage Jenkins -> Configure System -> Shell -> Shell executable. Setting this to /bin/bash will make source work.* plus: * <https://stackoverflow.com/a/70812248/1497139> * [...
29,570,085
I am using a Makefile to provide consistent single commands for setting up a virtualenv, running tests, etc. I have configured my Jenkins instance to pull from a mercurial repo and then run "make virtualenv", which does this: ``` virtualenv --python=/usr/bin/python2.7 --no-site-packages . && . ./bin/activate && pip in...
2015/04/10
[ "https://Stackoverflow.com/questions/29570085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1332304/" ]
I'd recommend avoiding ShiningPanda. I set up my virtual environments with [Anaconda](https://docs.continuum.io/anaconda/install)/[Miniconda](https://conda.io/miniconda.html). When installing conda make sure you're running as jenkins user. ``` your_user@$ sudo -u jenkins sh jenkins@$ wget https://repo.continuum.io/mi...
[@hardbyte](https://stackoverflow.com/users/809692/hardbyte)'s answer *The default shell that Jenkins uses is /bin/sh - this is configurable in Manage Jenkins -> Configure System -> Shell -> Shell executable. Setting this to /bin/bash will make source work.* plus: * <https://stackoverflow.com/a/70812248/1497139> * [...
29,570,085
I am using a Makefile to provide consistent single commands for setting up a virtualenv, running tests, etc. I have configured my Jenkins instance to pull from a mercurial repo and then run "make virtualenv", which does this: ``` virtualenv --python=/usr/bin/python2.7 --no-site-packages . && . ./bin/activate && pip in...
2015/04/10
[ "https://Stackoverflow.com/questions/29570085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1332304/" ]
I have being using python virtualenvs with Jenkins every day in the last two years, at multiple companies and for small side projects and cannot say I found "THE" answer. Still, I hope that sharing my experience would help others save time. Hopefully I will get further feedback in order to make the decision easier. * ...
There are some issues with venv-python plugin with different OS environments. Here is how I call python method manually. Not best practice but it work. ```html // Put this stage on top of pipeline stage('Prepare venv') { steps { script { if (isUnix()) { env.ISUNIX = "TRUE" // c...
29,570,085
I am using a Makefile to provide consistent single commands for setting up a virtualenv, running tests, etc. I have configured my Jenkins instance to pull from a mercurial repo and then run "make virtualenv", which does this: ``` virtualenv --python=/usr/bin/python2.7 --no-site-packages . && . ./bin/activate && pip in...
2015/04/10
[ "https://Stackoverflow.com/questions/29570085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1332304/" ]
I'd recommend avoiding ShiningPanda. I set up my virtual environments with [Anaconda](https://docs.continuum.io/anaconda/install)/[Miniconda](https://conda.io/miniconda.html). When installing conda make sure you're running as jenkins user. ``` your_user@$ sudo -u jenkins sh jenkins@$ wget https://repo.continuum.io/mi...
I've got same problem. As I can see - you project named 'Run Tests'. So, this name contain space. That was the problem for me. I just renamed project, like RunTests - and venv working now! Attention - jenkins ask you about confirmation renaming project.
29,570,085
I am using a Makefile to provide consistent single commands for setting up a virtualenv, running tests, etc. I have configured my Jenkins instance to pull from a mercurial repo and then run "make virtualenv", which does this: ``` virtualenv --python=/usr/bin/python2.7 --no-site-packages . && . ./bin/activate && pip in...
2015/04/10
[ "https://Stackoverflow.com/questions/29570085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1332304/" ]
There are some issues with venv-python plugin with different OS environments. Here is how I call python method manually. Not best practice but it work. ```html // Put this stage on top of pipeline stage('Prepare venv') { steps { script { if (isUnix()) { env.ISUNIX = "TRUE" // c...
[@hardbyte](https://stackoverflow.com/users/809692/hardbyte)'s answer *The default shell that Jenkins uses is /bin/sh - this is configurable in Manage Jenkins -> Configure System -> Shell -> Shell executable. Setting this to /bin/bash will make source work.* plus: * <https://stackoverflow.com/a/70812248/1497139> * [...
29,570,085
I am using a Makefile to provide consistent single commands for setting up a virtualenv, running tests, etc. I have configured my Jenkins instance to pull from a mercurial repo and then run "make virtualenv", which does this: ``` virtualenv --python=/usr/bin/python2.7 --no-site-packages . && . ./bin/activate && pip in...
2015/04/10
[ "https://Stackoverflow.com/questions/29570085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1332304/" ]
I'd recommend avoiding ShiningPanda. I set up my virtual environments with [Anaconda](https://docs.continuum.io/anaconda/install)/[Miniconda](https://conda.io/miniconda.html). When installing conda make sure you're running as jenkins user. ``` your_user@$ sudo -u jenkins sh jenkins@$ wget https://repo.continuum.io/mi...
There are some issues with venv-python plugin with different OS environments. Here is how I call python method manually. Not best practice but it work. ```html // Put this stage on top of pipeline stage('Prepare venv') { steps { script { if (isUnix()) { env.ISUNIX = "TRUE" // c...
29,570,085
I am using a Makefile to provide consistent single commands for setting up a virtualenv, running tests, etc. I have configured my Jenkins instance to pull from a mercurial repo and then run "make virtualenv", which does this: ``` virtualenv --python=/usr/bin/python2.7 --no-site-packages . && . ./bin/activate && pip in...
2015/04/10
[ "https://Stackoverflow.com/questions/29570085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1332304/" ]
I'd recommend avoiding ShiningPanda. I set up my virtual environments with [Anaconda](https://docs.continuum.io/anaconda/install)/[Miniconda](https://conda.io/miniconda.html). When installing conda make sure you're running as jenkins user. ``` your_user@$ sudo -u jenkins sh jenkins@$ wget https://repo.continuum.io/mi...
After acticating the virtualenv, try to run pip as a module: ``` python -m pip install ... ``` **`python -m pip` vs `pip`** * `python -m pip`: executes python interpreter binary that reads module `pip.py` from site packages directory * `pip`: executes `pip` binary / script picked up from `$PATH` I have found that ...
55,980,027
I need to add to a .csv file based on user input. Other portions of the code add to the file but I can't figure out how to have it add user input. I'm new to python and coding in general. I have other portions of the code that can merge or draw the data from a .csv database and write it to the separate file, but can't...
2019/05/04
[ "https://Stackoverflow.com/questions/55980027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11450864/" ]
Trying to output a SimpleXMLElement using `var_dump()` isn't a good idea and as you have seen - doesn't give much. If you just want to see the XML it has loaded, instead use... ``` echo $xml->asXML(); ``` which will show you the XML has loaded OK, so then to output the field your after is just ``` $xml = simplexm...
Using the `XPath` query ``` $xml = new SimpleXMLElement($xmlData); echo $xml->xpath('//AsyncReplyFlag')[0]; ``` OR You can use `xml_parser_create` ``` $p = xml_parser_create(); xml_parse_into_struct($p, $xml, $values, $indexes);// $xml containing the XML xml_parser_free($p); echo $values[12]['value']; ``` For o...
55,980,027
I need to add to a .csv file based on user input. Other portions of the code add to the file but I can't figure out how to have it add user input. I'm new to python and coding in general. I have other portions of the code that can merge or draw the data from a .csv database and write it to the separate file, but can't...
2019/05/04
[ "https://Stackoverflow.com/questions/55980027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11450864/" ]
DOMDocument should have no problem extracting it, as a quick one-liner: ``` echo (@DOMDocument::loadXML($response))->getElementsByTagName("AsyncReplyFlag")->item(0)->textContent; ``` ... or if you want to meticulously check for errors every step of the way, ``` $xml_errors=[]; set_error_handler(function(int $errno,...
Trying to output a SimpleXMLElement using `var_dump()` isn't a good idea and as you have seen - doesn't give much. If you just want to see the XML it has loaded, instead use... ``` echo $xml->asXML(); ``` which will show you the XML has loaded OK, so then to output the field your after is just ``` $xml = simplexm...
55,980,027
I need to add to a .csv file based on user input. Other portions of the code add to the file but I can't figure out how to have it add user input. I'm new to python and coding in general. I have other portions of the code that can merge or draw the data from a .csv database and write it to the separate file, but can't...
2019/05/04
[ "https://Stackoverflow.com/questions/55980027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11450864/" ]
DOMDocument should have no problem extracting it, as a quick one-liner: ``` echo (@DOMDocument::loadXML($response))->getElementsByTagName("AsyncReplyFlag")->item(0)->textContent; ``` ... or if you want to meticulously check for errors every step of the way, ``` $xml_errors=[]; set_error_handler(function(int $errno,...
Using the `XPath` query ``` $xml = new SimpleXMLElement($xmlData); echo $xml->xpath('//AsyncReplyFlag')[0]; ``` OR You can use `xml_parser_create` ``` $p = xml_parser_create(); xml_parse_into_struct($p, $xml, $values, $indexes);// $xml containing the XML xml_parser_free($p); echo $values[12]['value']; ``` For o...
419,698
**Overall Plan** Get my class information to automatically optimize and select my uni class timetable Overall Algorithm 1. Logon to the website using its Enterprise Sign On Engine login 2. Find my current semester and its related subjects (pre setup) 3. Navigate to the right page and get the data from each related s...
2009/01/07
[ "https://Stackoverflow.com/questions/419698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45211/" ]
Depending on how far you plan on taking #6, and how big the dataset is, it may be non-trivial; it certainly smacks of NP-hard global optimisation to me... Still, if you're talking about tens (rather than hundreds) of nodes, a fairly dumb algorithm should give good enough performance. So, you have two constraints: 1....
[BeautifulSoup](http://www.crummy.com/software/BeautifulSoup/) was mentioned here a few times, e.g [get-list-of-xml-attribute-values-in-python](https://stackoverflow.com/questions/87317/get-list-of-xml-attribute-values-in-python). > > Beautiful Soup is a Python HTML/XML parser designed for quick turnaround projects l...
419,698
**Overall Plan** Get my class information to automatically optimize and select my uni class timetable Overall Algorithm 1. Logon to the website using its Enterprise Sign On Engine login 2. Find my current semester and its related subjects (pre setup) 3. Navigate to the right page and get the data from each related s...
2009/01/07
[ "https://Stackoverflow.com/questions/419698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45211/" ]
Depending on how far you plan on taking #6, and how big the dataset is, it may be non-trivial; it certainly smacks of NP-hard global optimisation to me... Still, if you're talking about tens (rather than hundreds) of nodes, a fairly dumb algorithm should give good enough performance. So, you have two constraints: 1....
There are waaay too many questions here. Please break this down into subject areas and ask specific questions on each subject. Please focus on one of these with specific questions. Please define your terms: "best" doesn't mean anything without some specific measurement to optimize. Here's what I think I see in your l...
5,997,027
I don't know if this is an obvious bug, but while running a Python script for varying the parameters of a simulation, I realized the results with delta = 0.29 and delta = 0.58 were missing. On investigation, I noticed that the following Python code: ``` for i_delta in range(0, 101, 1): delta = float(i_delta) / 100 ...
2011/05/13
[ "https://Stackoverflow.com/questions/5997027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/752910/" ]
Any number that can't be built from exact powers of two can't be represented exactly as a floating point number; it needs to be approximated. Sometimes the closest approximation will be less than the actual number. Read [What Every Computer Scientist Should Know About Floating-Point Arithmetic](http://download.oracle....
Its very well known due to the nature of [floating point numbers](http://download.oracle.com/docs/cd/E19957-01/806-3568/ncg_goldberg.html). If you want to do decimal arithmetic not floating point arithmatic there are [libraries](http://docs.python.org/library/decimal.html) to do this. E.g., ``` >>> from decimal imp...
25,288,927
I have a dict and behind each key is a list stored. Looks like this: ``` dict with values: { u'New_York': [(u'New_York', u'NY', datetime.datetime(2014, 8, 13, 0, 0), 10), (u'New_York', u'NY', datetime.datetime(2014, 8, 13, 0, 0), 4), (u'New_York', u'NY', datetime.datetime(2014, 8, 13, 0, 0), 3)], u'Jersy': [(u'Jersy...
2014/08/13
[ "https://Stackoverflow.com/questions/25288927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3935035/" ]
[`max()`](https://docs.python.org/2/library/functions.html#max) takes a second parameter, a callable `key` that lets you specify how to calculate the maximum. It is called for each entry in the input iterable and its return value is used to find the highest value. You need to apply this against each *value* in your dic...
Can you have a look at : <https://wiki.python.org/moin/HowTo/Sorting#Sorting_Mini-HOW_TO> The answer may be : ``` In [2]: import datetime In [3]: d = { u'New_York': [(u'New_York', u'NY', datetime.datetime(2014, 8, 13, 0, 0), 10), (u'New_York', u'NY', datetime.datetime(2014, 8, 13, 0, 0), 4), (u'New_York', u'N...
1,027,990
I'm trying to build my first facebook app, and it seems that the python facebook ([pyfacebook](http://code.google.com/p/pyfacebook/)) wrapper is really out of date, and the most relevant functions, like stream functions, are not implemented. Are there any mature python frontends for facebook? If not, what's the best l...
2009/06/22
[ "https://Stackoverflow.com/questions/1027990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51197/" ]
The updated location of pyfacebook is [on github](http://github.com/sciyoshi/pyfacebook/tree/master). Plus, as [arstechnica](http://arstechnica.com/open-source/news/2009/04/how-to-using-the-new-facebook-stream-api-in-a-desktop-app.ars) well explains: > > PyFacebook is also very easy to extend > when new Facebook API...
Try [this site](http://github.com/sciyoshi/pyfacebook/tree/master) instead. It's pyfacebooks site on GitHub. The one you have is outdated.
1,027,990
I'm trying to build my first facebook app, and it seems that the python facebook ([pyfacebook](http://code.google.com/p/pyfacebook/)) wrapper is really out of date, and the most relevant functions, like stream functions, are not implemented. Are there any mature python frontends for facebook? If not, what's the best l...
2009/06/22
[ "https://Stackoverflow.com/questions/1027990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51197/" ]
The updated location of pyfacebook is [on github](http://github.com/sciyoshi/pyfacebook/tree/master). Plus, as [arstechnica](http://arstechnica.com/open-source/news/2009/04/how-to-using-the-new-facebook-stream-api-in-a-desktop-app.ars) well explains: > > PyFacebook is also very easy to extend > when new Facebook API...
If you're a facebook newbie, I'd suggest doing your first couple of apps in PHP. Facebook is written in PHP, the APIs are really designed around PHP (although they are language-neutral, theoretically.) The latest API support and most of the sample code is always in PHP. Once you get the hang of it, you can definitely ...
1,027,990
I'm trying to build my first facebook app, and it seems that the python facebook ([pyfacebook](http://code.google.com/p/pyfacebook/)) wrapper is really out of date, and the most relevant functions, like stream functions, are not implemented. Are there any mature python frontends for facebook? If not, what's the best l...
2009/06/22
[ "https://Stackoverflow.com/questions/1027990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51197/" ]
The updated location of pyfacebook is [on github](http://github.com/sciyoshi/pyfacebook/tree/master). Plus, as [arstechnica](http://arstechnica.com/open-source/news/2009/04/how-to-using-the-new-facebook-stream-api-in-a-desktop-app.ars) well explains: > > PyFacebook is also very easy to extend > when new Facebook API...
Facebook's own Python-SDK covers the newer Graph API now: <http://github.com/facebook/python-sdk/>
1,027,990
I'm trying to build my first facebook app, and it seems that the python facebook ([pyfacebook](http://code.google.com/p/pyfacebook/)) wrapper is really out of date, and the most relevant functions, like stream functions, are not implemented. Are there any mature python frontends for facebook? If not, what's the best l...
2009/06/22
[ "https://Stackoverflow.com/questions/1027990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51197/" ]
Facebook's own Python-SDK covers the newer Graph API now: <http://github.com/facebook/python-sdk/>
Try [this site](http://github.com/sciyoshi/pyfacebook/tree/master) instead. It's pyfacebooks site on GitHub. The one you have is outdated.
1,027,990
I'm trying to build my first facebook app, and it seems that the python facebook ([pyfacebook](http://code.google.com/p/pyfacebook/)) wrapper is really out of date, and the most relevant functions, like stream functions, are not implemented. Are there any mature python frontends for facebook? If not, what's the best l...
2009/06/22
[ "https://Stackoverflow.com/questions/1027990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51197/" ]
Facebook's own Python-SDK covers the newer Graph API now: <http://github.com/facebook/python-sdk/>
If you're a facebook newbie, I'd suggest doing your first couple of apps in PHP. Facebook is written in PHP, the APIs are really designed around PHP (although they are language-neutral, theoretically.) The latest API support and most of the sample code is always in PHP. Once you get the hang of it, you can definitely ...
42,802,194
Hi I am really new to JSON and Python, here is my dilemma, it's been bugging me for two days. Here is the sample json that I want to parse. ``` { "Tag1":"{ "TagX": [ { "TagA": "A", "TagB": 1.6, "TagC": 1.4, "TagD": 3.5, "TagE": "01", "TagF": null }, { "TagA": "A", "TagB": 1.6,...
2017/03/15
[ "https://Stackoverflow.com/questions/42802194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7672271/" ]
In the returned JSON, the value of `Tag1` is a string, not more JSON. It does appear to be JSON encoded as a string though, so convert that to json once more: ``` jaysonData = json.load(urllib2.urlopen('URL')) tag1JaysonData = json.load(jaysonData['Tag1']) print tag1JaysonData["TagX"] ``` Also note that `TagX` is a ...
`TagX` is a `list` consisting of 2 dictionaries and `TagB` is a `dictionary`. ``` print jaysonData["Tag1"]["TagX"][0]["TagB"] ``` You need to remove double quotations before and after the curly braces of `Tag1`. ``` { "Tag1":{ "TagX": [ { "TagA": "A", "TagB": 1.6, "TagC": 1.4, "TagD": 3.5, ...
42,802,194
Hi I am really new to JSON and Python, here is my dilemma, it's been bugging me for two days. Here is the sample json that I want to parse. ``` { "Tag1":"{ "TagX": [ { "TagA": "A", "TagB": 1.6, "TagC": 1.4, "TagD": 3.5, "TagE": "01", "TagF": null }, { "TagA": "A", "TagB": 1.6,...
2017/03/15
[ "https://Stackoverflow.com/questions/42802194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7672271/" ]
In the returned JSON, the value of `Tag1` is a string, not more JSON. It does appear to be JSON encoded as a string though, so convert that to json once more: ``` jaysonData = json.load(urllib2.urlopen('URL')) tag1JaysonData = json.load(jaysonData['Tag1']) print tag1JaysonData["TagX"] ``` Also note that `TagX` is a ...
``` { "Tag1":{ "TagX": [ { "TagA": "A", "TagB": 1.6, "TagC": 1.4, "TagD": 3.5, "TagE": "01", "TagF": null }, { "TagA": "A", "TagB": 1.6, "TagC": 1.4, "TagD": 3.5, "TagE": "02", "TagF": null } ], "date": "10.03.2017 21:00:00" } } ``` You have to remove ...
42,802,194
Hi I am really new to JSON and Python, here is my dilemma, it's been bugging me for two days. Here is the sample json that I want to parse. ``` { "Tag1":"{ "TagX": [ { "TagA": "A", "TagB": 1.6, "TagC": 1.4, "TagD": 3.5, "TagE": "01", "TagF": null }, { "TagA": "A", "TagB": 1.6,...
2017/03/15
[ "https://Stackoverflow.com/questions/42802194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7672271/" ]
In the returned JSON, the value of `Tag1` is a string, not more JSON. It does appear to be JSON encoded as a string though, so convert that to json once more: ``` jaysonData = json.load(urllib2.urlopen('URL')) tag1JaysonData = json.load(jaysonData['Tag1']) print tag1JaysonData["TagX"] ``` Also note that `TagX` is a ...
You need to consider what values your about to access e.g a dict or list ? You always access dict element by key and list element by index. to remove the quotes you can do after reading data from url. ``` import ast JsonData = ast.literal_eval(jaysonData["Tag1"]) JsonData["Tagx"][0]["TagB"] ```
19,868,457
I have renamed a css class name in a number of (python-django) templates. The css files however are wide-spread across multiple files in multiple directories. I have a python snippet to start renaming from the root dir and then recursively rename all the css files. ``` from os import walk, curdir import subprocess CO...
2013/11/08
[ "https://Stackoverflow.com/questions/19868457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/860421/" ]
You're not trying to run a single command, but a shell pipeline of multiple commands, and you're trying to do it without invoking the shell. That can't possibly work. The way you're doing this, `|` is just one of the arguments to `find`, which is why `find` is telling you that it doesn't understand that argument with t...
The problem is the pipe. To use a pipe with the subprocess module, you have to pass `shell=True`.
28,125,214
I'm very new to python and I'm trying to print the url of an open websitein Chrome. Here is what I could gather from this page and googeling a bit: ``` import win32gui, win32con def getWindowText(hwnd): buf_size = 1 + win32gui.SendMessage(hwnd, win32con.WM_GETTEXTLENGTH, 0, 0) buf = win32gui.PyMakeBuffer(buf_siz...
2015/01/24
[ "https://Stackoverflow.com/questions/28125214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4489629/" ]
You are exactly right because at that time view will not be drawn so for that you have to use viewtreeobserver: like this: ``` final ViewTreeObserver treeObserver = viewToMesure .getViewTreeObserver(); treeObserver .addOnGlobalLayoutListener(new OnGlobalLayoutListener(...
You can use a custom view to set the view's height to be tha same as its width by overriding onMeasure: ``` public class SquareButton extends Button { public SquareButton (Context context) { super(context); } public SquareButton (Context context, AttributeSet attrs) { super(context, attrs...
28,125,214
I'm very new to python and I'm trying to print the url of an open websitein Chrome. Here is what I could gather from this page and googeling a bit: ``` import win32gui, win32con def getWindowText(hwnd): buf_size = 1 + win32gui.SendMessage(hwnd, win32con.WM_GETTEXTLENGTH, 0, 0) buf = win32gui.PyMakeBuffer(buf_siz...
2015/01/24
[ "https://Stackoverflow.com/questions/28125214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4489629/" ]
There are many ways to achieve this. If you need to find the real width of an element, you can: 1) attach an [`OnGlobalLayoutListener`](http://developer.android.com/reference/android/view/ViewTreeObserver.OnGlobalLayoutListener.html) to the view's [`ViewTreeObserver`](http://developer.android.com/reference/android/vie...
You are exactly right because at that time view will not be drawn so for that you have to use viewtreeobserver: like this: ``` final ViewTreeObserver treeObserver = viewToMesure .getViewTreeObserver(); treeObserver .addOnGlobalLayoutListener(new OnGlobalLayoutListener(...
28,125,214
I'm very new to python and I'm trying to print the url of an open websitein Chrome. Here is what I could gather from this page and googeling a bit: ``` import win32gui, win32con def getWindowText(hwnd): buf_size = 1 + win32gui.SendMessage(hwnd, win32con.WM_GETTEXTLENGTH, 0, 0) buf = win32gui.PyMakeBuffer(buf_siz...
2015/01/24
[ "https://Stackoverflow.com/questions/28125214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4489629/" ]
There are many ways to achieve this. If you need to find the real width of an element, you can: 1) attach an [`OnGlobalLayoutListener`](http://developer.android.com/reference/android/view/ViewTreeObserver.OnGlobalLayoutListener.html) to the view's [`ViewTreeObserver`](http://developer.android.com/reference/android/vie...
You can use a custom view to set the view's height to be tha same as its width by overriding onMeasure: ``` public class SquareButton extends Button { public SquareButton (Context context) { super(context); } public SquareButton (Context context, AttributeSet attrs) { super(context, attrs...
70,945,717
I have Snowflake tasks that runs every 30 minutes. Currently, when the task fails due to underlying data issue in the stored procedure that the Task calls, there is no way to notify the users on the failure. ``` SELECT * FROM TABLE(INFORMATION_SCHEMA.TASK_HISTORY()); ``` How can notifications be setup for a Snowflak...
2022/02/01
[ "https://Stackoverflow.com/questions/70945717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11252662/" ]
I think currently a python script would the best way to address this. You can use this SQL to query last runs, read into a data frame and filter out errors ``` select * from table(information_schema.task_history(scheduled_time_range_start=>dateadd(minutes, -30,current_timestamp()))) ```
It is possible to create Notification Integration and send message when error occurs. As of May 2022 this feature is in preview, supported by accounts on Amazon Web Servives. #### [Enabling Error Notifications for Tasks](https://docs.snowflake.com/en/user-guide/tasks-errors.html#enabling-error-notifications-for-tasks)...
70,945,717
I have Snowflake tasks that runs every 30 minutes. Currently, when the task fails due to underlying data issue in the stored procedure that the Task calls, there is no way to notify the users on the failure. ``` SELECT * FROM TABLE(INFORMATION_SCHEMA.TASK_HISTORY()); ``` How can notifications be setup for a Snowflak...
2022/02/01
[ "https://Stackoverflow.com/questions/70945717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11252662/" ]
I think currently a python script would the best way to address this. You can use this SQL to query last runs, read into a data frame and filter out errors ``` select * from table(information_schema.task_history(scheduled_time_range_start=>dateadd(minutes, -30,current_timestamp()))) ```
A new Snowflake feature was announced for Task Error Notifications on AWS via SNS. This doc walks though how to set this up for task failures. <https://docs.snowflake.com/en/user-guide/tasks-errors.html>
70,945,717
I have Snowflake tasks that runs every 30 minutes. Currently, when the task fails due to underlying data issue in the stored procedure that the Task calls, there is no way to notify the users on the failure. ``` SELECT * FROM TABLE(INFORMATION_SCHEMA.TASK_HISTORY()); ``` How can notifications be setup for a Snowflak...
2022/02/01
[ "https://Stackoverflow.com/questions/70945717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11252662/" ]
It is possible to create Notification Integration and send message when error occurs. As of May 2022 this feature is in preview, supported by accounts on Amazon Web Servives. #### [Enabling Error Notifications for Tasks](https://docs.snowflake.com/en/user-guide/tasks-errors.html#enabling-error-notifications-for-tasks)...
A new Snowflake feature was announced for Task Error Notifications on AWS via SNS. This doc walks though how to set this up for task failures. <https://docs.snowflake.com/en/user-guide/tasks-errors.html>
67,030,593
**Problem** When trying to access and purchase a specific item from store X, which releases limited quantities randomly throughout the week, trying to load the page via the browser is essentially pointless. 99 out of 100 requests time out. By the time 1 page loads, the stock is sold out. **Question** What would be the...
2021/04/10
[ "https://Stackoverflow.com/questions/67030593", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15596095/" ]
You don't need to `JSON.stringify` your 'params'. Change it into: ```js const params = { email: "[email protected]", name: "Some Name", password: "123qwe!!" } ```
use this one- axios.post('http://localhost:8080/users', params, { headers: { 'Content-Type': 'application/json' } }
67,030,593
**Problem** When trying to access and purchase a specific item from store X, which releases limited quantities randomly throughout the week, trying to load the page via the browser is essentially pointless. 99 out of 100 requests time out. By the time 1 page loads, the stock is sold out. **Question** What would be the...
2021/04/10
[ "https://Stackoverflow.com/questions/67030593", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15596095/" ]
You don't need to `JSON.stringify` your 'params'. Change it into: ```js const params = { email: "[email protected]", name: "Some Name", password: "123qwe!!" } ```
axios signature for post is `axios.post(url[, data[, config]])`. so your code must be like this: ``` const loginData= { "email": "[email protected]", "name": "Some Name", "password": "123qwe!!" } axios.post('localhost:8080/users', null, { params:loginData, headers: { 'Conte...
4,135,261
I am having a problem connecting to a device with a Paramiko (version 1.7.6-2) ssh client: ``` $ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import paramiko >>> ssh = paramiko.SSHClient() >>> ssh.set_missing_h...
2010/11/09
[ "https://Stackoverflow.com/questions/4135261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197108/" ]
As a very late follow-up on this matter, I believe I was running into the same issue as waffleman, in a context of a confined network. The hint about using `auth_none` on the `Transport` object turned out quite helpful, but I found myself a little puzzled as to how to implement that. Thing is, as of today at least, I ...
[paramiko's SSHClient](http://www.lag.net/paramiko/docs/paramiko.SSHClient-class.html) has [`load_system_host_keys`](http://www.lag.net/paramiko/docs/paramiko.SSHClient-class.html#load_system_host_keys) method which you could use to load user specific set of keys. As example in the docs explain, it needs to be run befo...
4,135,261
I am having a problem connecting to a device with a Paramiko (version 1.7.6-2) ssh client: ``` $ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import paramiko >>> ssh = paramiko.SSHClient() >>> ssh.set_missing_h...
2010/11/09
[ "https://Stackoverflow.com/questions/4135261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197108/" ]
The ssh server on the remote device denied your authentication. Make sure you're using the correct key, the public key is present in `authorized_keys`, `.ssh` directory permissions are correct, `authorized_keys` permissions are correct, and the device doesn't have any other access restrictions. It hard to say what's go...
Make sure that the permissions on the public and private key files (and possibly the containing folder) are set to very restrictive (i.e. chmod 600 id\_rsa). It turns out this is required (by the Operating System?) to use the files as ssh keys. Found this out from my helpful colleague :) Also make sure that you are usi...
4,135,261
I am having a problem connecting to a device with a Paramiko (version 1.7.6-2) ssh client: ``` $ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import paramiko >>> ssh = paramiko.SSHClient() >>> ssh.set_missing_h...
2010/11/09
[ "https://Stackoverflow.com/questions/4135261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197108/" ]
The ssh server on the remote device denied your authentication. Make sure you're using the correct key, the public key is present in `authorized_keys`, `.ssh` directory permissions are correct, `authorized_keys` permissions are correct, and the device doesn't have any other access restrictions. It hard to say what's go...
I get similar error, when the server uses AD authentication. I think this is a bug of paramiko. I have learned that I have to set ssh keys before use paramiko.