All Questions
Tagged with python-2.6 or python-2.x
50 questions with no upvoted or accepted answers
6
votes
0
answers
464
views
Simple AR Tag classifier
I have been working on creating a simple AR Tag classifier, for detecting a simple AR Tag glyph. Spitting out an image that looks like this:
With the red circle indicating the corner closest to the ...
5
votes
0
answers
232
views
Speeding up the implementation of Stochastic Gradient Ascent in Python
I am implementing a time-dependent Recommender System which applies BPR (Bayesian Personalized Ranking), where Stochastic Gradient Ascent is used to learn the parameters of the model. Such that, one ...
5
votes
0
answers
205
views
Code for training machine learning linear regression and SVM
Ok , for my final year project I've wrote this piece of code to train my machine learning model on a this dataset , here the code i used
...
4
votes
0
answers
291
views
Simple chat server in Python
I'm new to both Python and socket programming and figured setting up a simple chat server would be good practice. In addition to general critiques of the code, I have specific questions:
What are the ...
4
votes
0
answers
57
views
Combining CSV files of simulation results
This script is a subset of a larger script where I have the output of many test simulations in the form of CSVs. Each file starts with the model name and includes the number of elements in my file. ...
4
votes
0
answers
92
views
Improving SVM fitting accuracy
I have this attempt on classifying CIFAR10 images.
I'm curently training my SVM only on 1 of 5 sets, and decided on using polynomial kernel(degree=3,C=0.1 [changes have no effect],gamma=2 [changes ...
4
votes
0
answers
2k
views
subprocess with logging module: tee with StringIO
I've got a long-running process. Once it finishes I need the output. But the user should be informed while it's running. With the logging module I get timestamps ...
4
votes
0
answers
882
views
Script that reads data over usb from Arduino to RaspberryPi, cleans it up and publishes to an MQTT broker
This is a continuation from this question:
Reading analog moisture signal from Arduino over USB to RPi3 and publishing via paho MQTT
I made the advised changes, and added a bunch of new stuff, I'd ...
3
votes
0
answers
54
views
Python script that getting list of all files with specific ext starting from the current folder. Using timer for reporting about the process
I am using a function that returns a list of all files (full path for each of them) with the given extension in the given folder and all subfolders.
As the process is quite long and user can get ...
3
votes
0
answers
294
views
Store special deals, like 3 for 2
I have to apply two deals on the cart.
Buy 3 (equal) items and pay for 2
Buy 3 (in a set of items) and the cheapest is free
Items in cart:
...
3
votes
0
answers
342
views
Animation of an incremental rotary encoder
While reworking my teaching materials for an exercise of an introductory course on mobile robotics, I recently created a animation/simulation of an incremental rotary encoder, e.g. often used for ...
3
votes
0
answers
66
views
Pygame : processing speed independant image loop displayer
I made this in order to teach myself pygame.
This displays an images loop at the same speed on any computer (It will lag on a slow computer).
Is my time management good or do my datetime call could ...
3
votes
0
answers
309
views
OLED display application for Raspberry Pi
Python script to output status information to a small OLED screen connected to a Raspberry Pi.
I'm relatively new at writing python so although the app works and outputs correct information it is far ...
3
votes
0
answers
118
views
code for changing from old copyright to a new one in python
This code needs to get two inputs:
one is the full address of a directory
and another the file extension that it will be changed.
These inputs cab be added in the default section of ...
3
votes
0
answers
369
views
Python2.7 Some xor fun
After doing the Cryptopals challanges, which I found scrolling through codereview, and finally being able to solve set1 challenge 6. I decided to have a little xor fun, and make an automated xor ...
3
votes
0
answers
117
views
Quick select - shuffle to make sorting faster
I'm trying to use shuffle to improve worse case scenario of quick select (e.g. every time, selected pivot value is the largest, so each iteration, only one elements could be removed from judgement).
...
3
votes
0
answers
721
views
Thread-safe RLockedList
I have written a thread-safe list which can be used as a drop-in replacement for a regular list. This has been tested and used internally without issue, but "The absence of evidence is not evidence of ...
3
votes
0
answers
742
views
Counting squares in a grid that is subdivided by line segments
Problem:
Given a picture of square with a bunch of horizontal and vertical lines in it (lines are not necessarily spanning the full square length, in other words think of a fine grid with many ...
3
votes
0
answers
600
views
Touchscreen Right Click
I have built a small script that provides touch screen right click context menu with long touch press in my ELAN touchscreen.
There is no need to remove your finger in order context menu to pop up.
...
3
votes
0
answers
959
views
RC Plane Radio using the Raspberry Pi
This python code is for a homemade RC plane radio using the Raspberry Pi and a USB joystick. It sends values over serial to DSM2/X module for RC planes and other RC vehicles. This Python code is ...
3
votes
0
answers
711
views
Sliding window of entire length of the file
I have a tab delimited file which contains about 2207 rows with 4 columns of floats or int types:
...
2
votes
0
answers
43
views
Interactive, real-time bikeshare web application with Bokeh
As a side project, I'm working on a Bokeh web application to display public bikeshare data on a map. The data is updated every 2 minutes using a periodic callback. Below is the full implementation. I'...
2
votes
0
answers
142
views
Find the available squares for rooks in empty board using boolean arrays
I will describe two techniques, then the question will be how I can make an algorithm that is more efficient, if possible.
I want to find an efficient way to determine the squares where the pieces on ...
2
votes
0
answers
122
views
Extract cell values from multiband rasters
I have the following function and code snippet to extract cell values for multiple years, format it, and save to a list. Each raster has 365 bands — one for each day. A separate operation is performed ...
2
votes
0
answers
383
views
Fully Constrained Least Squares (FCLS) Linear Spectral Mixture Analysis Method
I have written code using Python for Fully Constrained Least Squares (FCLS) Linear Spectral Mixture Analysis, which could be applied for unmixing multispectral image successfully.
However, the ...
2
votes
0
answers
1k
views
PyQt frame which changes color with child focus
I am working on an application that has various "panels" contained within splitters. I wanted the panel border to change color when one of it's children gained focus. Here is a simple example of the ...
2
votes
0
answers
63
views
Using zip to process widgets flagged as enabled
This code returns a list of widgets from spreadsheet ranges that are enabled for processing. The code works but it is poorly implemented, especially in terms of proper use of zip and layout.
The code ...
2
votes
0
answers
1k
views
Recursively scrape links from web pages and check them
I'm new to programming and especially new to object oriented programming. I have built a web scraper using functional programming and am trying to build another using OOP principles.
The overall idea ...
2
votes
0
answers
1k
views
UK Tax Calculator - First Python program
This is my first Python program and while it's not quite finished I would like to know how I could improve in general as a programmer. This project has be a lot of fun but it has felt more like ...
2
votes
0
answers
256
views
Convert python's strftime directives to user-friendly format examples
I'm converting python's very un user-friendly strftime date time directives to user-friendly formats so that users of an API will know how to format a date if they send an invalid format.
My thinking ...
2
votes
0
answers
874
views
Python scapy subnet mapper
This a follow-up question of Python scapy - TCP port scan of subnet
I've decided to make an all powerful subnet mapper in Scapy to better understand how tools like ...
2
votes
0
answers
904
views
Optimization Resource File for Robot Framework
I'm looking for optimization between these files, and simplification. If something already exists to do what I have a keyword do, I'd like to know about it. Loops.py is located in one of my other ...
2
votes
0
answers
46
views
Algorithm for point distribution of traversal between 2 points on a line in time
Not sure if this is best SO forum to post at, please suggest/move to more appropriate place otherwise. A synopsis of the problem 1st:
Given a scenario where we have messages with data that define a ...
2
votes
0
answers
147
views
Parse path string
Suppose path string are encoded in this way:
2T3T5: means move 2 steps, turn right, move 3 steps, turn right, and move 5 steps
32T: which better read as 3(2T), and it means do the following operation ...
2
votes
0
answers
147
views
Finding vtkCells in the vicinity of or coinciding with vtkPixels
I am looking to optimize this code. In its current state it is working, however, I am looking to improve it.
To represent the situation. I have a vtkPixel (...
2
votes
0
answers
164
views
First basic API using Flask with authentication
I've created my first basic API using Flask, that has the ability to create new tasks, delete tasks, update tasks, handles error pages, and has authentication required.
What I would like to know is ...
2
votes
0
answers
562
views
Second degree connection ranking
Problem
Find 2nd degree connections ( friends’ friends), output these 2nd
degree connections ranked by number of common friends (i.e 1st degree
connections) with you, (example: if 2nd degree ...
2
votes
0
answers
468
views
Tarjan's strongly connected component finding algorithm
Here is my code for Tarjan's strongly connected component algorithm. Please point out any bugs, performance/space (algorithm time/space complexity) optimization or code style issues.
...
2
votes
0
answers
622
views
Vertical sum in a given binary tree
I'm working on this problem,
Problem statement,
Given a Binary Tree, find vertical sum of the nodes that are in same vertical line. Print all sums through different vertical lines.
Examples:
...
2
votes
0
answers
732
views
Counting numbers in an array that are divisible by any 2 numbers
While solving one question I got stuck with a time limit error. The main objective in question is to count numbers in an array \$A\$ that are either divisible by \$P\$, \$Q\$ or both.
Input format:
...
2
votes
0
answers
1k
views
Find k nearest points
I'm working on a problem to select k nearest points for a given point. Any advice for bugs, improvements are appreciated, including general advice to implement find nearest k points.
My major idea is ...
2
votes
0
answers
542
views
format any mail into readable text
Scope is to throw any mail, html or plain or multipart into this and receive a readable formatted text that deals with special characters and html issues. Field of usage: System that imports mails ...
2
votes
0
answers
71
views
Memcached load generation
This is working but right now it is not giving me the throughput that I want. The main function has the load generation loop (where it is putting work in Queue). I ...
2
votes
0
answers
2k
views
Optimize QuadTree to find K Nearest Neighbors
I'm looking a way to make my k nearest neighbors search more efficient. The context of the question is that I'm given a list of topics that have a unique ID (integer) and a (x,y) coordinate (floats) ...
2
votes
0
answers
64
views
Microcast algorithm
Following is the main file in the project (executing tasks). It uses the mpi4py module, and multiple processes execute the same code. Please review the code and ...
1
vote
0
answers
214
views
Script to check a web service
I'm a Python novice. The system I'm using is called IBM Maximo Asset Management. In Maximo, we can write Python scripts that utilize Maximo's Java API/methods. So the script is technically a Jython ...
1
vote
0
answers
83
views
Reading attachment data from a PostgreSQL table with python
I have developed this script to find the counts of attachment records stored in a table in PostgreSQL for different other tables. I check if the res_id field of <...
1
vote
0
answers
855
views
Huffman encoding implementation
Here is my implementation of Huffman encoding using min-heap approach mentioned in this Wikipedia page. I'm looking for advice, using Python 2.7.
...
1
vote
0
answers
1k
views
Simple program that copies just new files from one directory to another
I'm doing a Python course for beginners, and the last assignment was to create a program using shutil and wxpython that can copy new files (created in the last 24 hours) from one folder into another, ...
1
vote
0
answers
955
views
Optimize Python script for memory which opens and reads multiple times the same files
I have code that works perfectly, but it uses too much memory.
Essentially this code takes an input file (lets call it an index, that is 2 column tab-separated) that searches in a second input file (...