text
stringlengths
226
34.5k
Convert any JSON to name/value pairs Question: I have a source JSON that can be in any potential format. For storage & processing purposes, I'd like to save this data in 2 column format. For example, I'd like the following JSON: "record" { "name1": "value1", "name2": "value2", "paramet...
Python callback issue with GPIO on raspberry Question: I'm an absolute python newbie and this is my first raspberry project. I try to build a simple music player in which every input button loads a different album (8 albums) and 3 buttons to control playback (next, pause, last). To load the music I use a USB drive whi...
Progress dots with a Thread in Python Question: I am trying to create a thread in Python that will poll some server as long as it won't get proper answer (HTTP GET). In order to provide convenient text UI I want to print progress dots. Another dot with every connection attempt until it finish (or just another dot with ...
Caffe install getting ImportError: DLL load failed: The specified module could not be found Question: I am trying to compile and run the snippets posted [here](http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/00-classification.ipynb), which basically is going to let me visualize the network internals(...
Decorate class that has no self in method signature in Python Question: I am trying to apply decorator dynamically to classes. It works if I have a class method including self in method signature. **Working example:** from functools import wraps def debug(func): @wraps(func) def...
Cannot import cv2 in python in OSX Question: I have installed OpenCV 3.1 in my Mac, cv2 is also installed through `pip install cv2`. vinllen@ $ pip install cv2 You are using pip version 7.1.0, however version 7.1.2 is available. You should consider upgrading via the 'pip install --upgrade pip' co...
Why doesn't this code work? *Complete Noob* Question: I recently started learning Python, and I wanted to create a program that will show me all the new releases from AllMusic, but it doesn't work. I'm sorry, but I'm a complete noob. At first I want to just see the artist: import requests from bs4 im...
Python unittest on PyCharm sometimes passes without changing any code in SUT Question: The problem is the first of it's kind which I have come across. I have a class and the corresponding unit test. The test passes/fails randomly without any change on the class under test. I mean I press **shift+F10** and immediately p...
sending ethernet data along with ARP protocol to automobile gateway in Python Question: I have programmed in python, where an Array of Bytes will be send to activate a a protocol feature in the automobile Gateway. Basically I am building a lower Level ISO-OSI structure which sends a packet of Ethernet layer along with ...
Problems crawling wordreference Question: I am trying to crawl `wordreference`, but I am not succeding. The first problem I have encountered is, that a big part is loaded via `JavaScript`, but that shouldn't be much problem because I can see what I need in the source code. So, for example, I want to extract for a giv...
Django - RuntimeError: populate() isn't reentrant Question: I'm trying to move my Django project to a production server(virtual machine running ubuntu server 14.04 LTS X64) freshly installed. All I did so far is installing the project requirements.txt (no apache server installed nor mysql server) When I try to run `m...
Python time.sleep() not sleeping Question: I'm coding a game, and the fight function seems to be tripping me up. Here's the combat snippet of my code: def combat(player, enemy, dun): print("\n"*100 + "A " + enemy.name + " has attacked you!") while player.health > 0 and enemy.health > 0: ...
How can I use raw_input to receive input from stdin in python 2.7? Question: To receive input from stdin in python 2.7, I typically `import sys` and use `sys.stdin`. However, I have seen examples where `raw_input` is used to receive input from stdin, including multi-line input. How exactly can I use raw_input in place ...
Parallel Port access through python Question: I am trying to run "parallel" package on my 64 bit system. Import parallel But I am getting this Error. I think this is some DLL problem, but don't know which DLL I need and where to keep them. My_Work\Signal_Generator_GUI\with_parallel.p...
Storing code inside a dictionary Question: I'm getting into Python, and though of writing my own script which allows me to check arguments provided when a program is run. An example below of what I'm trying to achieve: `python file.py -v -h anotherfile.py` or `./file.py -v -h anotherfile.py` In these two cases, t...
Python DateTime if statement behaves different in Azure.(Django WebApp) Question: So i'm writing a little Django webApp. It uses JSON data from a API to render everything. In localhost, everything runs fine. But in Azure it does not. The is somewhere in this code: for appointment in appointmentsMaan...
If x is between y and z, print, no output with python csv Question: I'm trying to get the first row of a csv to print when the condition is between the second and third row. Here is my current code: from libnmap.parser import NmapParser import csv from netaddr import * ip = raw_inp...
How to extract raw html from a Scrapy selector? Question: I'm extracting js data using response.xpath('//*')re_first() and later converting it to python native data. The problem is extract/re methods don't seem to provide a way to not unquote html i.e. original html: {my_fields:['O'Connor Park'], } ...
Python UnicodeDecodeError exception Question: txt = input("vilken textfil vill du använda?") fil = open(txt,"r") spelare=[] resultat=[] bästnamn=None bästkast=0 for line in fil: kolumn=line.split() kolumn1=len(kolumn[1]) kolumn2=len(kolumn[2]) if len(kolumn)<5...
Django redirect() truncating URLs to domain name on production server using HTTPS Question: I'm running Django 1.8, Python 2.7. I have noticed a problem on my site with redirects which seems only to affect my production server using HTTPS protocol, but not staging or dev servers running plain HTTP. As examples, I've i...
Writing dataReceived (from Twisted) to a tkinter texxtbox Question: Okay, so I'm sure this should be more simple than it is, but... Basically, I have a twisted reactor listening on a specific port. I also have a tkinter form containing a textbox. What I want to do is simply write the data received to that textbox. Bel...
Python access to Parent Directory Question: I have a file in the directory app a Ulil.py b main.py I want to import Ulil.py (at app\a) into main.py (at app\b). How do i go about doing this. I need to move the file around as well so I don't want to put the entire pat...
Why is this loop runs gradually slowly? Question: The flowing code is a simple python loop. def getBestWeightsByRandomGradientAscent(featureDatasList, classTypes, maxCycles=1): """ :param featureDatasList: :param classTypes: :param maxCycles: the loop time :return:...
django foreign key quotes error Question: I have two models in two files that import one another. One of them is connected to another by foreign key. To avoid circular import, I am trying to define the foreign key in quotes: from pubscout.models import Campaign class RuleSuite(models.Model): ...
Difficulty serializing Geography column type using sqlalchemy marshmallow Question: I an trying to use Marshmallow to do do deserialize and serialise SQLAlchemy objects but run into a problem when dealing with Geography fields in the ORM. Firstly the model: class Address(db.Model, TableColumnsBase): ...
Whats the simplest and safest method to generate a API KEY and SECRET in Python Question: I need to generate a API key and Secret that would be stored in a Redis server. What would be the best way to generate a key and secret? I am develop a Django-tastypie framework based app. Answer: EDIT: for a very secure way of...
Why python numpy.delete does not raise indexError when out-of-bounds index is in np array Question: When using np.delete an indexError is raise when an out-of-bounds index is used. When an out-of-bounds index is in a np.array used and the array is used as the argument in np.delete, why doesnt this then raise an indexEr...
Python matplotlib histogram: edit x-axis based on maximum frequency in bin Question: I am trying to make a series of histograms by looping through a series of arrays containing values. For each array my script is producing a separate histogram. Using the default settings, this results in histograms in which the bar wit...
Unable to Save Arabic Decoded Unicode to CSV File Using Python Question: I am working with a twitter streaming package for python. I am currently using a keyword that is written in unicode to search for tweets containing that word. I am then using python to create a database csv file of the tweets. However, I want to c...
Adding new headers and splitting column Question: I have a large `csv` with data that I have imported to python with pandas. The first 3 rows of the `csv` look like the following. “PATIENT”,"MD",“REFMD”,“DIAGNOSIS_HISTORY”,“AVAILABLE_STUDIES” “patient1\nPID1\npAge1”,“MDname1\nMDname3”,” RefDoctorName...
Removing not used resources in Android Question: Android has recently added `Unused resource remover` functionality into Android Studio but for some reasons it doesn't work (I asked a question regard that [here](http://stackoverflow.com/q/34866226/513413)). I found [android-resource-remover](https://github.com/KeepSaf...
Redshift: Serializable isolation violation on table Question: I have a very large Redshift database that contains billions of rows of HTTP request data. I have a table called `requests` which has a few important fields: * `ip_address` * `city` * `state` * `country` I have a Python process running once per da...
Custom Django field does not return Enum instances from query Question: I have a simple custom field implemented to utilize Python 3 Enum instances. Assigning enum instances to my model attribute, and saving to the database works correctly. However, fetching model instances using a QuerySet results in the enum attribut...
Upgrading to latest pip caused ValueError Question: The latest upgrade to `pip` (using Python 3.5) causes the following error to occur for any `pip` command: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/bin/pip3.5", line 7, in <module> from pip ...
Find the indices of the lowest closest neighbors between two lists in python Question: Given 2 numpy arrays of unequal size: A (a presorted dataset) and B (a list of query values). I want to find the closest "lower" neighbor in array A to each element of array B. Example code below: import numpy as np ...
get all unique value from a sparse matrix[python/scipy] Question: I am trying to make a machine learning lib work together with scipy sparse matrix. Below code is to detect if there are more than 1 class in `y` or not.Because it doesn't make sense if there is only 1 class when doing classification. impo...
ImportError: cannot import name 'PrintTable' in Python 3.5.1 by pyenv Question: I installed pyenv to manage different versions of Python, and use `pip install printtable` to download and install `printtable`. But when I import this module in interactive shell, it doesn't work and shows `ImportError`. $ ...
Plotting 3D random walk in Python Question: I want to plot 3-D random walk in Python. Something that is similar to picture given below. Can you suggest me a tool for that. I am trying to use matplotlib for it but getting confused on how to do it. For now I have a `lattice` array of zeros which basically is `X*Y*Z` di...
Python & BS4: Exclude blank and Grand Total Row Question: Below is my code to extract data out of an HTML document and place it into variables. I need to exclude the blank lines, as well as the "grand total" line. I've added the HTML input of those segments beneath my code. I'm not sure how to make it work. I can't use...
Different datetime.strftime output with same locale settings Question: I use python 2.7 and it turned out that datetime.strftime produces different output on different environments (both unix-based) with the same locale settings. locale.setlocale(locale.LC_ALL, ('RU', 'utf-8')) print locale.getlocale...
python virtualenv scipy import error undefined name Question: I just started using virtualenv for my existing python project and ran into some trouble... When I try to import the following from scipy.sparse.linalg import spsolve it causes an import error if a virtualenv is activated ...
Django1.7 'RemovedInDjango19Warning' when using apache with mod_wsgi Question: i am using Django version 1.7 for an application, everything was running good in my developpement PC (i was runnin it using `manage.py runserver` command. now i am trying to move it to a production server. in the production server, everythi...
Windows Python2.7 path parsing error Question: I'm attempting to use the python 010 editor template [parser](http://d0cs4vage.blogspot.com/2015/08/pfp-python-interpreter- for-010-templates.html) The doc specifically states (to get started): import pfp pfp.parse(data_file="C:\path2File\file.SWF",temp...
Python class can't find attribute Question: Basically, I want to run the connect function but I keep getting the CMD error message 'class StraussBot has no attribute 'connectSock' but I can obviously see it does. I've tried searching on here and I can't find any resolutions to this issue. SO it will be greatly apprecia...
What is the proper technique for creating and managing complex data models in Django? Question: I've got a relational database background, know a bit of Python, and am a complete Django newbie / wannabe. I've been considering doing some projects in Django. One thing I've noticed, however, is that, in Django, you create...
Execute a command with JSON string in python Question: How do we execute a shell command with a JSON string in python? The command is like: tool --options '{"oldTool" : "yes"}' Thanks! Answer: I would import call from subprocess (`from subprocess import call`) and then use the call command: `cal...
Installing Python Fancy Impute Module for K-Nearest Neighbors Imputation of Null Values Question: I am using a 64bit Windows 10 machine. I am trying to install the [fancy impute module](https://github.com/hammerlab/fancyimpute) to do K-Nearest Neighbors Imputation of null values in a data set. I have had to separatel...
Monitor two(2) serial ports at the same time asynchronously in Python Question: I have two serial ports feeding data into Python. One is feeding GPS strings (about 4 lines per second) and the other feeding data strings from a gas monitor (about 1 line every second) I would like to monitor both gps and gas feeds at the...
Sympy seems to break down with higher numbers Question: I've been playing around with sympy and decided to make an arbitrary equations solver since my finance class was getting a little dreary. I wrote a basic framework and started playing with some examples, but some work and some don't for some reason. ...
How to set regression intercept to 0 in Orange Question: I wrote the bellow regression code in python using orange library but import Orange data = Orange.data.Table("lenses") learner = Orange.regression.LinearRegressionLearner() model = learner(data) print (model.coefficients) I ne...
cannot import matlab file to python code Question: I am on a project on machine learning. trained the data in matlab R2015a and obtained a file abc.m . I get the expected result from matlab file while giving input from the matlab command window. i have developed the interface in pyqt5 and got the file in python . Want ...
Counting and grouping in Python Question: I was working on a problem in which I had to write a program that will count the number of each item needed for the chefs to prepare. The items that a customer can order are: salad, hamburger, and water. `salad:[# salad] hamburger:[# hamburger] water:[# water]` for example `If ...
Problems with a function and odeint in python Question: For a few months I started working with python, considering the great advantages it has. But recently, i used odeint from scipy to solve a system of differential equations. But during the integration process the implemented function doesn't work as expected. In ...
Python3 Trying to execute sql query with dynamic column names Question: I am using `sqlite3` and I am trying to dynamically return specific columns from database using SELECT query, problem is I keep getting the column names back instead of the actual rows. Here is an example code import sqlite3 conn...
How to select all data in pymongo? Question: I want to select all data or select with conditional in table `random` but I can't find any guide in MongoDB in python to do this. And I can't show all data was select. Here my code: def mongoSelectStatement(result_queue): client = MongoClient('mongo...
Looping a Selenium Python script Question: I have the following script that opens a browser and logs in then closes the browser: from selenium import webdriver browser=webdriver.Ie() import time x=4 for i in range(x): browser.get("http://localhost:8080/customercareweb-pro...
Robust endless loop for server written in Python Question: I write a server which handles events and uncaught exceptions during handling the event must not terminate the server. The server is a single non-threaded python process. I want to terminate on these errors types: * KeyboardInterrupt * MemoryError * .....
Importing from parent directory gets error Question: The project structure on my local machine is setup like this: python/ __init__.py readText.py testing/ __init__.py removeDuplicates.py In removeDuplicates.py I am trying to import as follows: ...
Chapter 7, Automate the boring stuff with Python, practice project: regex version of strip() Question: I am reading the book "Automate the boring stuff with Python'. In Chapter 7, in the project practice: the regex version of strip(), here is my code (I use Python 3.x): def stripRegex(x,string): impo...
Cross class variable only initialized once Question: I'm having some troubles with the scope in Python. I initialize a variable (`basePrice`) in a class (`STATIC`). The value is static and the initialization takes some work, so I only want to do it once. Another class `Item`, is a class that is created a lot. An `Item`...
python oauth2 client issues when trying to get authorization token Question: I am trying to use OAuth2 to get an authorization token using Python to a REST API. I am successful doing so using CURL but not with python. I am using the examples provided at the following docs: <https://requests- oauthlib.readthedocs.org/en...
.Convert String into a 2Bytearray(U32)- python Question: I have a string `text="0000001011001100"` I want to convert this string into a 2 byte array something like this **(b'\x00\x02')** byte_array=(socket.htons(text)).to_bytes(2,sys.byteorder) But this is not working and giving an error that **int...
How to get garbage values in python Question: This question may not have any practical value, this is just out of curiosity. In C/C++ when you declare a variable like below: int c; variable `c` will have some garbage value in it. As per my understanding python doesn't have variables as in C/C++ but...
regex works on pythex but not python2.7, finding unicode representations by regex Question: I am having a strange regex issue where my regex works on pythex, but not in python itself. I am using 2.7 right now. I want to remove all unicode instances like `\x92`, of which there are many (like `'Thomas Bradley \x93Brad\x9...
For loop outputting one character per line Question: I'm writing a quick python script wrapper to query our crashplan server so I can gather data from multiple sites then convert that to json for a migration and I've got most of it done. It's probably a bit ugly, but I'm one step away from getting the data I need to pa...
nosetests does another output (ImportError) then simple unittest (No Error) Why? Question: When i make a simple Test with unittest only it does not show any error. But when i try to nosetests my test files it does a ImportError. Here are the nessesary Informations. # Project Structure: -rwxrwxr-x __init...
open a browser page and take screenshot every n hour in python 3 Question: I want to open a web page then take a screenshot every 2 hours via python. here is my code to open a page at every 2 hour interval import time import webbrowser total_breaks = 12 break_count = 0 while(break_co...
Vlfeat for Ipython Question: I've been trying to set up vlfeat library for Jupyter which comes with anaconda. I've installed from this <https://anaconda.org/menpo/vlfeat> but cant import the library in the notebook. Can someone Guide on how to set it up? Answer: Try: from cyvlfeat import sift Tha...
python pandas and matplotlib installation conflict Question: I am using a Mac OSX Yosemite 10.10.5 and I am trying to practice data science with python on my laptop. I am using python 3.5.1 on a virtualenv however when I install pandas and matplotlib seems like both of them are having a conflict when trying to be impor...
text extraction line splitting across multiple lines with python Question: I have the following code: f = open('./dat.txt', 'r') array = [] for line in f: # if "1\t\"Overall evaluation" in line: # words = line.split("1\t\"Overall evaluation") # print words[0] n...
flask app only shows list of files with apache2 Question: Im trying to host a flask app with an apache2 server. The server works but I'm only seeing a list of files, the wonderful "index of" page. My code is pretty simple. This is my hello.py file in /var/www/flask_dev: from flask import Flask app = ...
Python daemon starts correctly with init-script but fails on startup Question: I have some python daemons for raspberry pi applications running on startup with init-scripts. The init script runs fine from the console, starts and ends the background process correctly. The script was made autostart with sudo insserv Ga...
Python 3.4: Unknown format code 'x' Question: I have issue about packet sniffer in Python3. version of python: 3.4 I followed some tutorial that works, but not on my computer. This code has to get mac address, convert it to string and in main() method should print to me destination mac, source mac and protocol. code...
NetBeans complains, but the code runs Question: I am new to python. I am writing programs in NetBeans. * NetBeans 8.1 * Python Plugin for NetBeans * Python 3.5.1 * Plugin is set up for 3.5.1, instead of the default 2.7 NetBeans complains when I write the statement print ("_ ", end='') The...
Kivy does not detect OpenGL 2.0 Question: I have decided to do some programming in Kivy cross platform and installed Kivy on my computer successfully. The problem is that when I run my code, I get this error: [INFO ] [Kivy ] v1.9.1 [INFO ] [Python ] v3.4.4 (v3.4....
Travis throws Python syntax error from a print statement in node-sass when using pytest Question: I'm having a strange problem with Travis when testing a Django app with [pytest-django](https://pypi.python.org/pypi/pytest-django). All my tests pass locally and apparently on travis as well but no matter what I do, I get...
Replace multiple text values in a single file Question: Python 3 - attempt at Cisco Router deployment script. I am attempting to replace multiple text values in a input value of 'router-input.txt'. Unfortunately, I can't figure out how to replace multiple values in a single file. At the end of running the below code, o...
How to install and use rpy2 on Ubuntu Question: I am trying to use Python to call R through rpy2. I am working on Ubuntu 15.10. I have installed Python 3.5.1 as part of Anaconda 2.4.1 (64bit), R and rpy2 version 2.7.6. When I tried $ python -m 'rpy2.tests' on the terminal, I am getting the following error: ...
Python: With Scrapy Script- Is this the best way to scrape urls from forums? Question: What I want to do: * Scrape all urls from this website: <http://www.captainluffy.net/> (my friends website, who I have permission to scrape urls from) * However, I can't just brute everything, as I'll end up with lots of duplica...
Can't seem to rid of the error message no matter what I've tried. From "Hello! Python" book Question: Here's the error I'm getting when I try to run the code below: Traceback (most recent call last): File "/Users/JPagz95/Documents/Hunt_the_Wumpus_3.py", line 76, in <module> visit_cave(0) ...
Convert Json Dictionary Objects to Python dicitonary Question: I have a Json file with dictionary like objects {"d1a": 91, "d1b": 2, "d1c": 1, "d1d": 5, "d1e": 7, "d1f": 77, "d1e": 999} {"d2a": 1, "d2b": 2, "d2c": 3, "d2d": 4, "d2e": 5, "d2f": 6, "d2e": 7} {"d3a": 1, "d3b": 2, "d3c": 3, "d3d": 4,...
Check type existence in Python module Question: What would be the most Pythonic way of determining if an object's type is contained in a specific module? For example, let's say I want to match date, time, and datetime classes from the datetime module. import datetime mylist = [obj1, obj2, obj3, ...]...
How can i animate text by character in Tkinter? Question: So i know that in the python window you can use this.. for char in introstring: sleep(0.2) sys.stdout.write(char) sys.stdout.flush() and it will display the text in the window, character by character at the speed of 0...
Python - CSV to Matrix Question: Can you help me with this problem? I`m new in programming and want to find out how to create a matrix, which looks like this: matrix = {"hello":["one","two","three"], "world": ["five","six","seven"], "goodbye":["one","two","three"]} I wa...
scrapy "Missing scheme in request url" Question: Here's my code below- import scrapy from scrapy.http import Request class lyricsFetch(scrapy.Spider): name = "lyricsFetch" allowed_domains = ["metrolyrics.com"] print "\nEnter the name of the ARTIST of the song fo...
Fitting a curve python Question: I am trying to fit a curve in python with this function def func(x,a,c,d,e): return a*((x/45)**c)*((1+(x/45)**d)/2)**((e-c)/d) but I get this error: TypeError: unsupported operand type(s) for /: 'list' and 'int' What should I do? Answer: You have to cast ...
Django, AttributeError: 'module' object has no attribute Question: Excuse me for my english. I start Django Project (I'm beginner on Django & Python) with Django Rest Framework. My project : # tree -I 'env' . ├── api │   ├── admin.py │   ├── admin.pyc │   ├── apps.py │   ├── apps...
Pants includes OS X specific Python wheels Question: **TLDR** : Pants fetches OS X specific wheels bc I'm developing on Mac. How can I avoid this, or specify that I will deploy to Ubuntu? **Full story** : Trying to package a Python application with Pants. Going great so far, but ran into a problem which I've been stu...
How to Make Tkinter Canvas Transparent Question: In my program, I am trying to overlay different canvas geometries on top of an image. However, my problem is that the canvas itself has a color that blocks most of the image. How can I make this canvas transparent, so that only the geometries that I draw are visible? Her...
how to predict unique list in lists? Question: This is list of tile placements. Each integer stands for an id of a tile. Each time an integer is added to a new list it means that a new tile is placed. When a tile is removed, the last integer is removed from a new list. I want that every time a tile is placed the list t...
Storing JSON data in Aerospike in Python Question: I'm trying to retrieve response from ip-api.com for most IP ranges. But I want to store that data in Aerospike but I'm having some errors. Here is the Python script # import the module from __future__ import print_function import aerospike i...
How do I take a Python List of Dictionary Values and display in Kivy UI as a table (Using ListView Widget)? Question: **Background:** I am working in Python 2.7.10 on Red Hat Linux 6. I have Kivy 1.9.2 installed and I am developing an app that will display some data from Oracle Database tables. I am using cx_Oracle to ...
Where to save python modules Question: I'm just learning about modules in python 3.5. While I can usually install and import packages using sudo pip install {package}, I can't seem to figure out how to import my own files. I made a test.py file with a single definition to test. I saved it to the site-packages folder. ...
How to create a new data object in memory, rather than pointing to one? (in Python 3) Question: As an illustration of my question, say I want to swap two elements in an array: # Array Integer Integer -> Array # I want to swap the values at locations i1 and i2. # I want to return the array with v...
Python/Kivy Attribute Error Question: I'm working on some code to create a UI for a touchscreen in Python/Kivy. I'm new to both, and am having a bit of trouble with it. I'm getting an AttributeError raised on `return PtWidg()`, but the console isn't giving me anything super helpful to work off of: Traceb...
List into json format using Python Question: I have a list like below... lst = ['dosa','idly','sambar'] i need to convert the above data to below format by using Python. [{'menuitem': 'idly'}, {'menuitem': 'dosa'}, {'menuitem': 'sambar'}, ] Thanks. Answer: Using...
Python unittest failing to resolve import statements Question: I have a file structure that looks like the following project src __init__.py main.py module.py secondary.py test test_module.py ## module.py ...
Python 3.4 can't find OpenSSL Question: I trying to use WebSockets in Python 3.4 (Windows 7) This is a test code: from twisted.internet import reactor from autobahn.twisted.websocket import WebSocketClientFactory, WebSocketClientProtocol, connectWS import json class ClientProtocol(WebSoc...
Python replace / with \ Question: I write some simple Python script and I want to replace all characters `/` with `\` in text variable. I have problem with character `\`, because it is escape character. When I use `replace()` method: unix_path='/path/to/some/directory' unix_path.replace('/','\\') ...
how to connect spark streaming with cassandra? Question: I'm using Cassandra v2.1.12 Spark v1.4.1 Scala 2.10 and cassandra is listening on rpc_address:127.0.1.1 rpc_port:9160 For example, to connect kafka and spark-streaming, while listening to kafka every 4 seconds...