instruction
stringlengths
71
71.9k
I have been writing a compiler. While profiling the compiler, one method takes 5 seconds to compile 2k lines of code, my profiler tells me that this is the bottleneck. def toLLVMHelp(self, tree= None, isGlobal= True): if tree == None: tree = self.tree #tree is the Ast for i in tree: #iterate throug...
Task to accomplish: Made a function which counts the amount of words in a sentence. Please don't put attention to the HTML. Is just for testing-purposes. var sentence = document.querySelector('#sentence'); var exec = document.querySelector('#exec'); var result = document.querySelector('#result'); // ## THE ACTUAL FU...
The following code should prove to offer sufficient security for public API so my main concern is about design flaws in process. It is meant to describe the process and eventually get included in client side of API. Full code is available at github GitHub. As for time of publishing the question, it's in sync with code ...
I need to wrap httpClient because I'm using a custom token provider. I will use this code with asp.net mvc to communicate with our webApi2 server. ( Using webApi2 with directly from ui with angularjs etc. off the case. ) I shared this code and asking your opinions because; I don't want any deadlock to occur. I see c...
I need to parse logs and have got following code. I can see two problems: map().filter() may induce some performance penalties and copy-paste block parser.py: class Info(object): a = "" j = "" z = "" infoline = "" def __init__(self, a, j, z, infoline): self.a = a self.j = j ...
I'm very new to VBA and have put together a macro that currently does exactly what I want: copy cells from one worksheet to another, clear the cells copied, refresh my pivot tables and save the file. Here is what I am using for it: Sub Copyinfo() On Error GoTo Err_Execute Sheet1.Range("A17:R17").Copy Shee...
I wrote a NodeJS HTTP server specifically for serving static files. I didn't bother much about security since the server is going to be used locally in my Electron application. function buildStaticServer() { const fs = require("fs"); const urlModule = require("url"); return require("http").createServer(func...
For a post-graduate subject that I present, I maintain a repository of examples (on GitHub) from the textbook which is contributed and edited by my students, who are not very Python literate. I have written this code to run all the programs associated with figures, examples and exercises in the book and use it to alert...
Here is what I have to do: Write a function scramble(str1,str2) that returns true if a portion of str1 characters can be rearranged to match str2, otherwise returns false. For example: str1 is 'rkqodlw' and str2 is 'world' the output should return true. str1 is 'cedewaraaossoqqyt' and str2 is 'codewars' should retur...
The following code is part of a game I am making using the Phaser framework; the game is in the style of a top-down RPG, with the player moving their character in four possible directions using the arrow keys. This code appears in my update() method. I like the user experience provided by this code a lot: the character...
My assignment was to develop a REST service that will provide Airport information. This service is assumed to be used by multiple users, therefore data consistency (thread safety) and responding fast are the main concerns. Following you can see implementation details. AirportData is the core data object of this servic...
I have login page that looks like: It has a ViewModelBase and a ViewModel as: public abstract class UserViewModelBase { private string userId; private LdapDirectory ldapDir; private XXXPerson userDetails; public UserViewModelBase() { ldapDir = new LdapDirectory(); if (HttpContex...
My experience with autolayout tells me that it's very difficult to make app look good on whole variety of devices (from iPhone 4s to 6s especially). Size classes are useful with device position and distinguishing between iPhone and iPad. To make my app look right on each iPhone size, I connected contraints to my viewCo...
not too experienced with SQL, wondering if I can make this better... I am trying to check if a row exists and then add one to the frequency column if it does, if it does not exist it should return false... The table is indexed by the column in the first select statement I know about the risks of using formatting with p...
I've recently stared learning C++ so I'm new to all of it. I've got my fourth "software" under development. Could someone have a look through and give me some constructive criticism on what should I change or keep the same? #include <iostream> #include <string> #include <stdlib.h> #include <fstream> using namespace st...
I Have written this program to add workers into a list and print them. I'd like a review of this. I'm especially concerned if the method Addworker should be inside the class or in the main program. Person: class Person { public uint NumberId; public string Name; public string LastName; public uint Age; ...
This post builds on my post about quickly evaluating analytic Jacobian in Matlab. The key difference is that I am now working with the Hessian and I have to evaluate close to 700 matlabFunctions (instead of one matlabFunction like I did for the Jacobian) each time the hessian is evaluated. So there is an opportunity to...
I have made a Priority Queue implemented as a Binary Search Tree. I would appreciate comments related to optimization and proper functionality, but any comments/critiques are welcome. PQ.h: #ifndef PQ_H #define PQ_H #include <iostream> struct Node { int value; Node * left; Node * right; Node(int value...
I have created a common C file for a basic client server. It works fine on my Linux setup. Please provide your comments/suggestions on how the code can be optimized/enhanced. After compiling we need to give parameters "s" or "c" to executable from the command line to run it as a server or client respectively. The clien...
I have the following structure returned from MongoDB: [Class] 0:Class // -> this.data.userInfo as seen below in the code _id: "ksihHTAjdhsA9" createdAt:Tue Mar 29 2016 13:03:45 GMT-0400 (EDT) weightData: Array[3] 0: Class name: "my name 1" value: "...
The following function calculates temperature based off of a given suction pressure, where different regression coefficients are assigned depending on the value of the pressure. The regression equation is fairly standard, of the form: $$ax^2 + bx + c$$ where \$x\$ is the pressure, and \$a\$, \$b\$, and \$c\$ are the co...
I have a query that works as intended, kind of pulling from multiple records in a table, and flattening the data into one row. I am wondering if there is a faster/more semantically correct way to do this than multiple derived tables? ID Name Relationship Amount -------------------------------------------...
The program needs to find all contiguous sublists of numbers where the number of occurrences of every member in the contiguous sublist is divisible by 2. The first line of input is N (the number of ai, where N ≤ 353535). The second line of input contains the ai, delimited by spaces (where each ai < 109). Here is an ex...
This program generates 6 random numbers between 0 and 45 and the numbers cannot be repeated. Can this code be improved? $numbers = []; $i = 1; while($i <= 6) { $number = mt_rand(0, 45); if(!in_array($number, $numbers)) { array_push($numbers, $number); $i++; } } sort($numbers); echo ...
I am implementing a simulation of colliding disks (ideal 2D billiard balls) in JavaScript. I follow an event-driven algorithm that avoids discretizing time; the algorithm goes as follows at each step: Compute the moment of the next collision (with walls or between two disks) Translate the spheres during that time inte...
For a class, I was given an assignment to code a simple TCP connection between a server and a client. Once the TCP handshake is done, the client sends inquiries to the server. It's a 2 second conversation, if that. I need some feedback on my code. Please keep in mind that I am new to Python. The prof kinda threw the cl...
I have an Ajax request which in turn on completion make another Ajax request: $.ajax({ url: '<?php echo BASE_URL.'Dashboard/GetMyTrackList' ?>', type: 'GET', success: function (response) { var list = JSON.parse(response); $.each(list, function (k, v) { ...
There is a code that takes all files from input of multiple files, gets base64 for each of them, packs to array and jsonifies it. How to simplify and improve quality of code? text = $('#input-' + id).val(); var files = document.querySelector('#files' + id + ' > input[type=file]').files; if (text != '' || files.length >...
I have made the algorithm that split text into n-grams (collocations) and it counts probabilities and other statistics of this collocations. When file is more then 50 megabytes it takes long time to count maybe some one will help to improve it. import math import re import csv from itertools import zip_longest from dat...
My goal was to use the NHibernate Session and to create a UnitOfWork class that I could use thoughout my project. My goals are: Calling Commit should commit everything including un-flushed state (was mostly out of the box I believe) Rollback should roll back everything including whatever was not flushed from the scop...
My Scenario: #TmpDistinctFolderIds table contains one or many FolderId. fnGetAllParentFolderIds function receives the input as FolderId and return it's all possible parent folder ids (a parent folder can have N number of sub folders). I'm using the below block to get each folder's all possible hierarchy parent folder ...
Part of my standard modules deal with my company's employees and linking them to/from various data sets. The following are a series of enums/functions to handle peoples' names, namely an Enum for advisers and functions to: Provide a collection of names associated to each adviser (e.g. their name before/after getting m...
The method below converts an array of TheatreListData objects to an array of TheatreListDataWrapper. It also loads additional attributes such as patientIdentifierNumber and requestText to enrich the converted data. This method is called by many EJBs, and so I'm especially looking for ways to improve performance. /** *...
I have UserSignatures, a table with clientIPs, some of which have CountryIds that are null and need to be filled in. A second table, IpLookups, stores IPs, and a third table Country has the needed CountryId. This is workaround at the moment, because we don't fill CountryIp yet. declare @var1 int,@var2 int,@var3 int,@in...
I am currently working on a method, that can search based on a value and an operator. Currently I check which operator was supplied to the the method in a switch, and do operations accordingly to it. This is the current code: switch (enumOperator) { case Operator.Equal: tmpResult = tmpResult.Where(a => a.NU...
I'd like to have neater URLs, no more and no less — I'd like to be able to write /page/subpage instead of something like ?p=page&s=subpage. I've looked at various PHP frameworks and routing classes to see how they did it. Since most of them come with features I don't need, I wanted to try making my own system using onl...
I'm trying to write my first "complex" program in Java. So far, I created a local H2 database but I'm not sure about the quality of my code (I'm newbie in Java) because I don't know how I can deal with exceptions and I don't feel comfortable with the JDBC code. public boolean create(Project project) { String id = UU...
I want to check if some line ends with any substring defined in some list. Is there a better way than following one? endsA = ['foo', 'bar', 'fur', 'beer'] endsB = ['door', ... ] def checkEnds(line, ends): for end in ends: if line.endswith(end): return True .... if checkEnds(line, endsA): ...
I'm trying to create a class to connect to Redis in Express. I don't think my code is good enough as I got variable db hanging out. 'use strict'; var redis = require('redis'); var bluebird = require('bluebird'); bluebird.promisifyAll(redis.RedisClient.prototype); bluebird.promisifyAll(redis.Multi.prototype); var debu...
The scenario is as follows. The API of my program will allow the user to perform some method on a particular element (let's say a tuple from a database). If this parameter is not passed to the function, then the "default" behavior is to look for a list of elements (from a database query, for example) and to act on all ...
I wrote a Simon clone in JavaScript, HTML, and CSS. It's extremely simple, but turned out fairly well. I'm looking for general feedback, as well as these things specifically: I opted to try to do any required animation manually, instead of relying on jQuery. I wanted to see what went into animations. The only animatio...
The script works but I know that it can be improved. Please note that my scripting skills are very basic :) (as it can be seen in my Frankenstein script – I took bits and pieces of the code from different tutorials). I would appreciated if someone could review this script and identify some major flaws. Some other quest...
This is the question from Oracle docs: Write a generic method to find the maximal element in the range [begin, end) of a list. I had my implementation like this: public static <T extends Comparable> T maximalElement (List<T> list, int from, int to) { T max = list.get(from); for (int i = from + 1...
I'm just trying to understand and use unit tests, which from what I can tell is exposing the issues with my code. A lot of what I do is MVC/WebAPI. One of the big issues I come across is that my methods end up too long, doing too much, which makes it very difficult to test them. Description of what the code is for: ...
A while back this question proposed a constexpr compile-time Sieve of Eratosthenes. It also linked to another SO question about compile-time computation of CRCs. I've found a place where I'd like to precompute the hash of a few C-strings, so I used those previous questions as a base. I'm implementing the one-at-a-time ...
I've started to use extension methods to provide data layer functionality in our project. Our project is an MVC website using Code First Entity Framework. So, I've done things like this: namespace OurProject.Models { public class Project { public int ProjectId {get; set;} public string ProjectNa...
I've created my first ReactiveUI app in WPF. Simply, the user enters their full name in one textbox, and then the name gets split into its parts and displayed in the other textboxes. This is just an example ... I realise parsing names is often futile! MainWindow.xaml: <Window x:Class="TestHumanName.MainWindow" ...
I'm a beginner and like to experiment new things so today I tried to implement sorting method for an array without using any Sort and the actual challenge was to do it without using the bubble sort algorithm. I created my own but I feel that there are some things that can be shorten because it's quite long. My main ide...
I am filtering array of objects with object properties provided by the user. The goal is to return an object property 'label' by matching the property 'value'. 'input' provided to the function can be either array of one element or many elements or not an array. I'm using lot of loops to accomplish this. Any suggestions...
Reviewing code doesn't necessarily require actually building it, but it's often helpful to do so in order to evaluate fully. I usually create a CMake project and build from there. Since we're all about code here, naturally, I decided to automate part of the process. Specifically, here's how to use this code: Hit...
What is the cleanest way to use dictionaries and protect against an unhandled ArgumentException if the key already exists in the dictionary? I'd like to say that I can always guarantee uniqueness upstream, but I'm dealing with legacy code and mildly corrupt data from an old bug in the system. I find myself using this p...
I would like someone to review my code and maybe give me some advice to maintain it because I'm still a beginner. public static boolean NewTerrainCamPos = false; public static String textVal; public static String textVal2; public static String resiveTex = "1"; public static String resiveTex2; public static final int ...
Is this a bad solution to the FizzBuzz thing? I decided to make it print "Fizz Buzz" for the numbers divisible by 3 and 5 just for practice/understanding. for (var n = 1; n <= 100; n++) { var output = ""; if (n % 3 == 0) output += "fizz"; if (n % 5 == 0) output += "buzz"; if (n % 5 == 0 && n % 3 == 0) o...
Including the full module, but the method I'm interested in is createIndex, feels more complicated than I think it should be. Still new at both node and elasticsearch /*jslint node: true */ 'use strict'; var EsConnect = require('./EsConnect'); var inet = require('inet'); function NetFlowStorage(es, logger, config) ...
I'm a bit of a neophyte when it comes to C++, and so I'd like some feedback regarding a recent project. The code sits on a Raspberry Pi and streams camera data over TCP on a specified port. The MJPGWriter class: #include <unistd.h> #include <sys/time.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> ...
I made a basic website to practice HTML and CSS that will display 3 fruits with their given scores in an Olympic podium sort of way. Have I used any bad practices and what I should do instead? What can I do to fully optimize and shorten my code? How readable is my code? How can I make it more readable? <html> <head>...
The goal is to show message for users that are less 25 years old. The personal ID consists of 081010333333, where 08year, 10month, 10date. I made code and it's very messy. So the question is: how to make it "right"? any advices and solutions are welcome. One on codepen and the code itself: $('input').on('change keyup...
In an effort to create ever-improving code, I've written a DelegateCommand that takes a generic type parameter to be acted upon. It's pretty trivial, so it should hopefully be easy to review. In order to do this, I had to create two interfaces: IGenericCommand and IWindowsUniversalCommand. /// <summary> /// Requires th...
I have an url and need to check whether it has some second-level domain (SLD) from a list. For example for SLD foo.com I need to approve hosts foo.com, some.foo.com and reject host kungfoo.com. There is some solution: domains_a = ['foo.com', 'bar.com', 'fur.net', 'beer.org'] domains_dot_a = ['.foo.com', '.bar.com', '.f...
Apart from merging the 2 get methods, what else can I do to optimise this? Both input and output cannot be changed. Is there a way to iterate a map while writing to it? // String condition - "cust" for customer group, "item" for itemGroup public HashMap<String, ArrayList<PriceTable>> getPromoForViewGroup( S...
I need to do a card for showing some data. I had some problems with the blue left box on the left side, and to add custom paddings. It think I can add padding with a more simple way, but I don't know how. I don't want to use nth-child because it's not supported on old IE. I want an opinion about my code : html <table c...
I am working on a source line parser using PPI. After working a while, I realized that it would be nice if the PPI API had included such and such functionality. As a very simple example, the PPI::Element contains a class method that returns the class name of the current element. This method must be called quite often ...
I have a file with more than 100k rows, but the structure is simple: Date _|_Name-Position-Color_|_Summ 17.11.2015 |"Name1 | 8813,52 | Position1 | _|_Color1" _|_ 19.08.2015 |"Name2 | 3587,86 | Position3 | _|_Color5...
I'm using dapper-dot-net for data access in my ASP.NET MVC application. So in order to supply a connection string I've came up with the following pattern: public static class ConnectionStringManager { private static readonly SqlConnection conn; static ConnectionStringManager() { //initialize the co...
Activity public class StopWatchActivity extends AppCompatActivity { int seconds; boolean running; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_stop_watch); runTimer(); } public void ...
This code sets and shows an image file on a QGraphicsView. I'm interested in seeing how to improve readability and reduce redundancy. void QtReader::addPadding(const int& querybase, const int& answerbase, QString &target){ if (padding){ if (querybase >= 10){ target = "0" + QString::number(answe...
I would like to use the following routines in my submission script for GAMESS calculations. Before I do, I would like to get some input if I can improve it somehow. The three messaging routines (message,warning,fatal) are taken from my earlier review request, although I have chosen a more verbose name. Since I am not ...
This is a C++ program which outputs a Mandelbrot fractal image in a graphics window and lets the user zoom and pan around the image, generating a new image each time the user does so. I'm using SFML for the graphics part. Because it generates a new image after every zoom or pan, it is pretty slow, especially with a 100...
I read a lot of articles recently concerning XAML, WPF, data binding and MVVM. I also watched some MVVM tutorials and downloaded some MVVM samples. I finally got my first MVVM sample to work, but there seem to be different "flavors" of MVVM, or maybe there are just many people who get the whole thing totally wrong, I d...
I'm a PHP Developer. I'm trying to learn Python. So I tried to create a simple game, a Number Guesser. I tried to comment out as much as possible without making super obvious comments. I also made the attempts message color to be red. Here's my code. # 1. Print a message about the game # 2. Tell the user that the ra...
I have a big Python dictionary with more then 150,000 keys every key has list value. This dictionary contains infinitive words as key and all grammatical forms of these words as values: {"конфузити": ["конфузить", "конфужу", "конфузиш", "конфузить", "конфузим", "конфузимо", "конфузите", "конфузять", "конфузитиму", "ко...
I have the following code that takes a Point and a given tolerance value and looks for all other Points that fall within the tolerance from a Point array. Now this code is quite slow, does anyone know a faster way of doing this? Also if you have any tips on how I can improve my coding style, if needed, that would be gr...
It's been a year or two since I last dabbled in jQuery and have attempted to write a simple "on key press move to the next element" script. However my first attempt has a lot a repetition. I just know there is a more elegant way to write this, probably using a dictionary of elements or such. $("#DialFirst").keypres...
I am trying to create pagination with pure PHP and jquery. I have done this and it works exactly how I want it to work. Essentially I get all products from my database using PHP. I then populate the whole page with the products and hide every row after the first 6 products. Then using jquery I create the pagination but...
I have the following code that takes input of Line arrays and attempts to find the intersections on the end points between them. The value _nConrerTolerance is an int of a value of around 10% of the average Line length to allow the lines to not need to be exactly on each other. Now obvisouly this code will be quite slo...
I have written this program to deal 7 cards to one player. #include <iostream> #include <string> #include <cstdlib> //for rand and srand #include <cstdio> #include <vector> using namespace std; string suit[] = {"Diamonds", "Hearts", "Spades", "Clubs"}; string facevalue[] = {"Two", "Three", "Four", "Five", "Six", "Seve...
I've made a data structure for mathematical expressions. I want to parse mathematical expressions like: \$x = 3\$ \$y = 4\$ \$z = x + y :\$ into an evaluated document like: \$x = 3\$ \$y = 4\$ \$z = x + y : 7\$ where \$=\$ is assignment and \$:\$ is evaluation. The data structure must handle errors: Invalid input ...
I have the following code which inserts a new element of the same type over and over again to the parent element. I am new to JavaScript so was wondering if there was a better way of doing this. I apologise for the variable names, I'll get around to changing those later, just allows me to see the flow better. I'm tryin...
I have refactored the version of the previous (and initial) iteration according to the answer by alexwlchan. As a reminder, this snippet compares breadth-first search against its bidirectional variant. See what I have: #! /usr/bin/env python3.4 import time import random from collections import deque __author__ = 'Rod...
I have written a 2 player chess game in C++. Things I have accomplished so far: Legal moves validation Bit board generation Things I look forward to (would appreciate advice on them): Move generation Move ordering (based on move values for each square) Pruning Reading data from opening books Here is the model break...
I wrote a small header-only C++11 header for converting between various C++ time formats: // time_utils/time_cast.hpp #ifndef TIME_CAST_HPP #define TIME_CAST_HPP #include <chrono> #include <ctime> #include <sstream> #include <iomanip> #include <string> namespace time_utils { using chrono_time = std::chrono::time_poi...
This will be my third post of this program, I have received a lot of great feedback and have learned a lot from the community. I have edited this program a lot, and am here for another review to see if I got it correctly. I had a hard time implementing one minor fix with output stream delimiter which was suggested in a...
The goal is to have a helper class to wrap the concept of a resolution safely, encapsulating the range check into the class, since otherwise it can get lost by a client not so cautious. I think this is all the context that's required, but an additional bit of info that may be helpful is that this looks a bit like what ...
I have written a function that I want to protect from spam bots. I have used two techniques the first being filter after submit. After reading around I obtained the foreach loop from here and I have also written a piece of code that uses the spam honeypot protection technique. However what I need to be checked over is...
This code makes summaries from larger texts. I have searched around for an algorithm and found the following: Associate words with their grammatical counterparts. (e.g. "city" and "cities") Calculate the occurrence of each word in the text. Assign each word with points depending on their popularity. Detect which p...
I have two dictionaries that I need the keys to match and if they match i will get the value of the first dictionary and then get the value of 2nd dictionary and build a new dictionary out of those. dic1 = {u'ShutterHours': 732, u'ShieldHours': 732, u'MaskHours': 28, u'TargetHours': 790, u'GndRingHours': 25} dic2 = {u...
I just wrote a simple script cmd to hide private folders by combining several scripts from the Internet. Can anyone give me suggestions for improvement? This batch file uses a password hidden by powershell script. Then I create a shortcut and run attrib -s -h, so it is not easy to find. It works just gave attrib -s -...
I am trying to implement the MVC pattern in C++ & QT, similar to the question here: Other MVC Questions The program has 2 line edits: mHexLineEdit mDecLineEdit 3 buttons mConvertToHexButton mConvertoDecButton mClearButton and just modifies strings. The difference with the other question is that I am trying to impl...
I'm trying to achieve, for lack of a better term, a "view" pattern in C++. It's probably most comparable to "views" in the Database world, where one can make a query, and then perhaps aggregate the data, or turn otherwise interact with it without actually duplicating the data. I've tried to reduce it down to a simple e...
This code outputs the smallest number with more divisors than the input: from operator import mul from math import sqrt, ceil def next_prime_factor(n): if n % 2 == 0: return 2 for x in range(3, int(ceil(sqrt(n)) + 1), 2): if n % x == 0: return x return int(n) def factor(n): ...
I have a sliding panel that I want to show content in. The content that I want to appear depends on the button that triggers the sliding panel. My project is growing rapidly and I would like to reusable jQuery code or perhaps a plugin. My code works, for example sake I have 6 buttons and 6 hidden divs in side of a slid...
Code from my last project, that has to work on Python 2.7 and Python 3. I want to get a path as a unicode string from argparse: parser = argparse.ArgumentParser( description='Organize your movie collection using symbolic links') parser.add_argument('media_src', metavar='FILE|DIR', help='Media fi...
Let's pretend the following: <?php // Functions to validate/sanitize user input function validateUsername() { // If accepted, return true, else return false } function validatePassword() { // If accepted, return true, else return false } function validateEmail() { // If accepted, return true, else re...
I implemented the lightweight cipher Twine described here but it seems to me that this is not sufficiently optimized. For example, below I have the key expansion for 80 bits: private void expand80Key(byte[] key) { short len_x = 20; short key_size = 10; short iterator = 0,iterator2=0;; byte temp_v...
I have written my first program in go. It's rewritten from python. Program takes csv file, emulates query SELECT X, Y, SUM(Conc), SUM(ToxConc) FROM very_big_table GROUP BY X, Y. And runs on terabytes of data. It's written messy, but runs 100x faster than same program written in python. Here is full code. As you can...
I have this simplistic Python class for representing directed weighted graphs (digraphs for short): Digraph.py #! /usr/bin/env python __author__ = 'Rodion "rodde" Efremov' class Digraph: """This class implements a directed, weighted graph with nodes represented by integers. """ def __init__(self): "...
I have been using NLog for logging purposes in my web applications, but it was not injectable. More precisely, each class using logging declared the logger like this: private static Logger logger = LogManager.GetCurrentClassLogger(); Since my logging is very simple, I have defined some extension methods to easily log ...
Here is a nodejs code that copies values from one object (submitted from a firm) to a model object. Model: var directory_model = { "link_title": { "value": 1, // This needs to be filled with object data "validation": null }, "link_desc": { "value": 2, // This needs to be filled wit...
I have a Python script that runs three compiled programs and makes them communicate via standard I/O. This is my first time using pexpect. My program runs very slowly. Is there anything that I can do to speed up the program? If not, I can try to do it with C/C++ pipe/fork. import pexpect import os Checker = pexpect.sp...
I have translated Dijkstra's algorithms (uni- and bidirectional variants) from Java to Python, eventually coming up with this: Dijkstra.py import heapq from Digraph import Digraph from random import choice from random import uniform from time import time __author__ = 'Rodion "rodde" Efremov' class HeapEntry: def...