Data dodania Pytanie
2017-07-15 23:07 DDoS protection for Django Channels »
Is there anything specific that can be done to ensure a Django Channels server is not susceptible to DDoS (attack or accident) from websocket clients?...
(1) odpowiedzi
2017-07-15 21:07 List with duplicated values and suffix »
I have a list, a: a = ['a','b','c'] and need to duplicate some values with the suffix _ind added this way (order is important): ['a', 'a_ind', 'b'...
(5) odpowiedzi
2017-07-15 13:07 How does str.startswith really work? »
I've been playing for a bit with startswith() and I've discovered something interesting: >>> tup = ('1', '2', '3') >>> lis = ['1', ...
(3) odpowiedzi
2017-07-15 12:07 Can this function be optimized for speed? »
I am writing a long piece of code, which is taking way too long to execute. I used cProfile on the code, I found that the following function is calle...
(4) odpowiedzi
2017-07-15 12:07 How to render all the data associated with one entry through link Using Django ? »
I am learning Django and created an app "myapp", having defferent components as per given bellow: Models looks like this: Model.py: from __futur...
(1) odpowiedzi
2017-07-15 11:07 Control/space characters not allowed using MD5 in Django cache backend »
I am using caching for my site using using. This is giving the following error: "Control/space characters not allowed (key="\xebw\x1b}\xae\xa3\xb8\x1...
(1) odpowiedzi
2017-07-15 06:07 How to handle functions return value in Python »
The function multiply_by_ten takes a numeric argument, multiplies it by ten and returns the result back. Before this function performs its multiplicat...
(6) odpowiedzi
2017-07-15 05:07 Please explain the working of the following code in Python 2. What is the use of end? Also __future__ library »
from __future__ import print_function if __name__ == '__main__': n = int(raw_input()) for n in range(n): print(((n)+1),end='') Also ...
(1) odpowiedzi
2017-07-14 23:07 Why is this usage of python F-string interpolation wrapping with quotes? »
Code in question: a = 'test' # 1) print(f'{a}') # test # 2) print(f'{ {a} }') # {'test'} # 3) print(f'{{ {a} }}') # {test} My question is, why d...
(1) odpowiedzi
2017-07-14 19:07 How to get refresh tokens on Facebook using Python? »
I am currently using the following code for accessing the refresh tokens. Bare in mind that the config variable is frequently updated with the new acc...
(0) odpowiedzi
2017-07-14 18:07 Using Django Channels to send info to all connected clients »
I'm creating a system where the Twitter Live Streaming API gets a live stream of tweet data through given keywords. Whenever a tweet comes in, I want ...
(1) odpowiedzi
2017-07-14 16:07 Moving numpy arrays from VBA to Python and back »
I have a VBA script in Microsoft Access. The VBA script is part of a large project with multiple people, and so it is not possible to leave the VBA e...
(1) odpowiedzi
2017-07-14 16:07 Is it possible to run a unit test on a celery periodic task? »
I'm trying to run a unit test on a celery task that I have set to run daily. I have tried importing the function and calling it in my test but this do...
(2) odpowiedzi
2017-07-14 12:07 converting Python to Delphi code »
Next python code from urllib.request import Request, urlopen import urllib import json #ID access to API TOKEN = "{YOUR_API_TOKEN}" # e.g.: "f03c3c7...
(1) odpowiedzi
2017-07-14 02:07 speed up this for loop - python »
From my profiling, I could see this function takes more time to process. How do I speed up this code? My dataset has more than million records and thi...
(2) odpowiedzi
2017-07-13 16:07 When I use Django Celery apply_async with eta, it does the job immediately »
i looked at celery documentation and trying something from it but it not work like the example. maybe i'm wrong at some point, please give me some poi...
(2) odpowiedzi
2017-07-13 14:07 Django Crispy forms not showing bootstrap/css or button »
I got crispy forms working with my model, though the form looks plain and bootstrap not showing up, also there seems to be no button. Even when adding...
(1) odpowiedzi
2017-07-13 13:07 struct pack return is too long »
I'm trying to use the struct.pack function import struct values = (0, 44) s = struct.Struct('HI') b = s.pack(*values) print(b) print(str(len(b))) a...
(3) odpowiedzi
2017-07-13 12:07 Why doesnt my cartesian product function work? »
Consider the following function, whose output is supposed to be the cartesian product of a sequence of iterables: def cart(*iterables): out = ((e...
(1) odpowiedzi
2017-07-13 10:07 Iterating and Updating the list in python »
I am not able to understand why the following code goes in indefinite loop(when i am not using the copy list) list = ["Mohit","kumar","sffsfshf...
(6) odpowiedzi
2017-07-13 07:07 Array handling - Python »
I am a beginner in Python. I try to store the max value of two array in an another array. The length of array is known so I used c=[]*len(a) a=[3,4,...
(4) odpowiedzi
2017-07-12 19:07 Create indicator matrix from two arrays in Python Numpy »
Given two vectors, I would like to create an indicator matrix. For example, given a=np.array([5,5,3,4,4,4]), and b=np.array([5,4,3]), the result shoul...
(1) odpowiedzi
2017-07-12 18:07 Data extraction from a list? »
I have data in the following format: ResultSet({'(u'maxbotix_depth', None)': [{u'value': 7681, u'time': u'2017-07-12T12:15:54.107488923Z'}, {u'value'...
(1) odpowiedzi
2017-07-12 16:07 Django/Python Unit Testing: Let exceptions rise »
I'm debugging a unit test failure whereby an exception is raised from the guts of some libraries; many exceptions. I'm using ipdb from the commandline...
(1) odpowiedzi
2017-07-12 12:07 Python follow up on yield as a function argument »
I was reading this question How does this lambda/yield/generator comprehension work? I would like to understand the language constructs in a bit mo...
(0) odpowiedzi
2017-07-12 11:07 What happens when you assign the value of one variable to another variable in Python? »
This is my second day of learning python (I know the basics of C++ and some OOP.), and I have some slight confusion regarding variables in python. He...
(9) odpowiedzi
2017-07-12 06:07 Speed up angle calculation for each x,y point in a matrix »
I have a 3-d Numpy array flow as follows: flow = np.random.uniform(low=-1.0, high=1.0, size=(720,1280,2)) # Suppose flow[0] are x-coordinates. flow[1...
(2) odpowiedzi
2017-07-12 02:07 Any limitation on HTML <li>? »
I have the following code with Python: <div id="sidebar-wrapper" class="container-fluid" style="background-color: lightgray"> <nav id="spy...
(1) odpowiedzi
2017-07-12 00:07 How to configure Django Rest Framework + React »
I have an application backend in Django-rest-framework, and I have a reactjs app. How can I do to they work together ? For development I open 2 term...
(2) odpowiedzi
2017-07-11 22:07 Django "Manager isn't accessible via UserProfile instances" »
Here is my views.py if request.user.is_authenticated(): changepass = request.user.userprofile.objects.get(user=request.user) ...
(3) odpowiedzi
2017-07-11 21:07 Printing from 1 to 99 using a print and for loop function »
I tried the following in the IDLE of Python 3.6 print(value for value in range(1,100)) A message is produced in the IDLE which says <generator...
(3) odpowiedzi
2017-07-11 15:07 python variable reference unexpectedly changing behaviour »
I'd like to understand what's the cause of this totally unexpected change of behaviour and how it could be implemented. I come from JS world and this ...
(2) odpowiedzi
2017-07-11 11:07 TensorFlow Object Detection API Weird Behaviour »
I was playing with TensorFlow's brand new Object Detection API and decided to train it on some other publicly available datasets. I happened to stumb...
(3) odpowiedzi
2017-07-11 07:07 How to determine the uncertainty of fit parameters with Python? »
I have the following data for x and y: x y 1.71 0.0 1.76 5.0 1.81 10.0 1.86 15.0 1.93 20.0 2.01 25.0 2.09 30.0 2.20 35.0 2....
(0) odpowiedzi
2017-07-11 06:07 PyPy: Severe performance penalty when using None in a list with integers »
Because an algorithm I want to implement uses indices 1..n and because it's very error prone to shift every index by one, I decided to get smart and i...
(1) odpowiedzi