instruction
stringlengths
71
71.9k
I am trying to make a scrolling game in Tkinter. However, with all my for loops and functions it is extremely slow. I am reading the tutorial from Khan Academy's advanced JS. In their JS game everything is fine, so is it just a problem of python is slow or am I doing things inefficiently. import tkinter as tk import r...
I wrote this program, which purpose is to visit the 18th link on the list of links and then on the new page visit the 18th link again. This program works as intended, but it's a little repetitive and inelegant. I was wondering if you have any ideas on how to make it simpler, without using any functions. If I wanted to ...
Challenge Given a test case print out a FizzBuzz Series. Specifications The first argument is a path to a file. Each line includes a test case. Each test case is comprised of three spaced delimited integers. The first two integers are the dividers X and Y. The third integer, N is how far to count. Print out the ser...
This is a Windows Presentation Foundation application that queries active directory and can display lists of users, users by group, groups, and users by manager (direct reports). It operates on whatever active directory server the host computer belongs to, and dynamically builds a TreeView of all the Organizational Uni...
Novice coder here. I have the following code to perform a few actions like clearing filters, copying a range, and then pasting a formula down a row till the last line. It works perfectly, but it takes longer than a minute to complete since I am addressing each in my for next loop individually. Would anyone know how to ...
I have the following script that reads JSONified data from within a DIV, generates HTML with values using JavaScript, then sends them to another DIV. What I'd like to improve is to remove HTML from JavaScript. Namely, not have HTML inside the JavaScript. I am not 100% on how to do this. I want "minimal work" but "...
This is good practice, to make square image? Side of the square container is equal to its width. public class SquareImageView extends ImageView{ public SquareImageView(Context context) { super(context); } public SquareImageView(Context context, AttributeSet attrs) { super(context, attrs); ...
I am swapping structure lexicographically by name. Is there any way to improve the code when the structure entries are heavy. Here is the code #include<stdio.h> #include<string.h> struct College { char name[100]; char city[100]; int yearOfEstablishment; float passPercentage; }; void displayCollegeDetail...
I have not written very many stored procedures before, and this is the first one I have written to be used in a real business application to write new data into the database, so I would like to get advice to improve it from more experienced SQL developers. In short it is meant to insert a new person along with their c...
This is basically my school homework and I want to know what to improve, and what not to do. The homework basically is this: You will get a input in seconds, which is supposed to be shown as H:MM:SS where H is hours M is minutes and S is seconds. The formatting is supposed to look like in my example. ( note: In output,...
Is this efficient? """ merge sort algorithm in python """ def merge_sort(array): if len(array) == 1 or len(array) < 1: # base case return array int_mid = len(array) / 2 left = merge_sort(array[:int_mid]) right = merge_sort(array[int_mid:]) return merge_arrays(left, right) def merge_a...
Is this the best way to implement a genetic algorithm framework? I'm just a student and wanted to know if I can improve the code that I have done. Some of the code I copied from the framework documentation: namespace xx.xx.xx { class Program { static GrafoDistrito grafo; static int total; ...
This is question #10 from Project Euler: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. I just started programming and read that a Sieve of Eratosthenes is the fastest way to find primes however this code is taking forever to run. How can I make this go faster?...
I would like to optimize a snippet of code, which uses a multiple nested if statements. I am looking for a formula to make it as a combination of multiple arrays logical operations. Please, I need just a hint to start. Can you please help me review the loop and vectorize it? The I is an input image (any): I = 5*rand(4,...
I'm making a hotkey program to aid me using PC faster. By saying hotkey here, I mean any combination of two or more keys in the keyboard. For example, if I press G, hold it then press M, I have hotkey GM. Then I can launch Gmail from the default browser. The idea is same with the famous AutoHotkey software, but with a ...
I had already put up code for review a small poker program but I have rewrote it utilizing a more appropriate data structure. How would I compare Poker hands accordingly? Full source repo enum poker_hands check_hand(vector *hand) /* check what kind of poker hand player has and return a score from 1 to 10 */ { sort_...
I solved this exercise of displaying a table of numbers from 1 to 256 in binary, octal and hexadecimal. I made this program to convert from decimal to binary and took that binary number to convert to octal and hexadecimal to made a table of binary, octal and hexadecimal. You might see that the way I found out which was...
Here I want to improve the code in addListofEmployees and mainMethod. How can I do so? import java.util.LinkedList; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; public class AddEmployees extends Employee { public static List<Employee> addListOfEmployees(long upperLimit) { ...
I've written the second iteration of my math expression parser, utilising what I learned from the first attempt to make a more reliable, maintainable piece of code. If anybody wants to see the first iteration to see my progress, see here. With the first version, I tried to evaluate the expression string directly, witho...
I wrote the java method to answer this question : Write a Program to sort String on their length in Java? Your method should accept an array of String and return a sorted array based upon the length of String So my questions: 1. Is my method efficient enough? 2. Can it be improved somehow? private static String[] sor...
One way to write a client which uses a specific protocol, eg http like in this case, is to create a base class with the basic socket handling functionality with virtual functions which can be overridden with an inheriting derived class. But it is more flexible I think to be able to get the socket handling class to cal...
The below code returns an array filled with the number of users last seen for each day for $dayCount number of days that is specified via a parameter into the function. It does this by executing a database query for each day from the previous day going back $dayCount amount of days, and another function produces from t...
I completed the following exercise on HackerRank. My program is fed a list of commands, such as: 12 insert 0 5 insert 1 10 insert 0 6 print remove 6 append 9 append 1 sort print pop reverse print Where the first line of the input is the number of commands, the rest of the lines commands and parameters. Here is my ...
The problem I have lately been working Project Euler: 231: The prime factorisation of binomial coefficients The binomial coefficient \$ ^{10}C_3 = 120 \$. \$ 120 = 2^3 × 3 × 5 = 2 × 2 × 2 × 3 × 5 \$, and \$ 2 + 2 + 2 + 3 + 5 = 14 \$. So the sum of the terms in the prime factorisation of \$^{10}C_3\$ is 14. Find th...
I'm working on a minecraft plugin for my Spigot Minecraft server. I have a class which works as expected. I've done my best to hammer every single bug out (famous last words, I know) and am now taking a look at the way it's written. I've noticed that documentation definitely is not lacking, and looks over documented, t...
I made a prefix notation calculator. Prefix notation, aka Polish notation, is a form of notation for logic, arithmetic and algebra, like infix and postfix (reverse Polish) notation. The expression '+ 3 4' in prefix notation is as valid as '3 + 4' in infix notation, as well as '3 4 +' in postfix notation. The calculator...
The "Save Humanity" problem on Hackerrank asks us to: ... find all substrings in the patient DNA that either exactly matches the virus DNA, or has at most one mismatch. For example: "aa" and "aa" are matching, "ab" and "aa" are matching, while "ab" and "ba" are not. Input Format The first line contains the number of t...
I am making a Pacman Player vs Player game in Java, and I am wondering if I am implementing movement in the game in a good manner. Anything that will reduce the code size or make the program faster is wanted. Note that the game is not complete, and I have only worked on player one (Pacman). I have not started on player...
I have an array of strings and on click of the "NEXT" button it displays the next array item in a <p> tag while on click of the "PREV" button it displays the previous one. When it reaches to the end (beginning) it continues from the first (last) item. I have had some hard time to find a way to get the right item index ...
In fact, this is a group assignment for our C programming lesson, but seeking help from others is not considered cheating. The goal of the following code is to: Sort the data in start.txt by destination, and then by month if two trip routes share one destination. Count how many trip routes each month and destination h...
I'm building a simple iOS app using Swift that calculates the One Rep Max weight a user can theoretically lift. User inputs a weight lifted, the number of repetitions and the app uses one of several formulas to calculate the maximum weight they should be able to lift one time. I'm skeptical about the way I'm implementi...
I wrote a module to simulate physics of 2D elastic balls and the community helped me to improve it on this post. Now I implemented a GUI using Tkinter to display the simulation in a window. I'm a beginner in programming GUI and I don't know if my script can be more efficient and/or simpler. Indeed, I'm not really sati...
I have just received feedback regarding a junior dev test that I submitted. It was unfortunately not great, and the recruiter could not articulate the issues, I tried to show that I was thinking about the problem in a deeper way, but the feedback was that the solution was "over complicated". This is the challenge: // C...
I wrote this program to implement a shopping cart. It supports adding/removing items to the cart, viewing the current order, and completing the checkout process. import java.util.Scanner; public class Keychains1 { public static Scanner keyboard = new Scanner(System.in); public static boolean stay = true; ...
This code is Express NodeJS code that handles post registration .post action where the user must select a custom username. The username is validated, and if valid, the database is updated. If not, the user is redirected to the page with an error message so he/she can try again. I would like to know if you would refacto...
I've created my first complete JS app, which lets you add tasks and control how much time you spend on them. I posted this to get some ideas how to improve readability, efficiency and the speed of my code. The first table shows tasks that you add via input box. Every time you press the "Add task" button, the generateRo...
I find the default Exception.ToString() formattig very difficult to read especially if there are inner exceptions involved. I guess everyone knows how it looks: System.ArgumentException: This is a message. ---> UserQuery+TestException: You need to specify a valid id. at UserQuery.foo(Int32 id) in C:\[...]\LINQPad5\_...
I'm writing a Ruby extension in C. It's a string processing module working on UTF-8 encoded strings only. One method, full_width_to_ascii!, converts full width characters to ASCII equivalents (https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms). Essentially, it subtracts an offset of 0xfee0 from any full width...
This is the script I wrote to make an automated POC baby-sitter in 5 lines. I first found this on a GIF or meme site and thought of making a POC script that does the same. #How Linux users babysit while : do eject eject -t done I don't know aything about bash. So, I want improvements. You can find the origin...
I have the following task: Implement a simple command line Java application for booking bus seats. For simplicity suppose there is only one bus, initially all seats (lets say 50) are free. Users can book one seat at time through the application API, the application itself should try to take the first available...
Precursor for this revision here in code-review: Recursive spinlock for C using ASM Improvements have been made thanks to forsvarir. Now I am trying to optimize this lock so it becomes more practical. The code in question. #define gate_Gate volatile int #define gate_Pass volatile int extern inline void gate_Enter (g...
I am working on a problem that simply calculates and prints the credit card balance. I hope this code can be improved/optimized a lot. I am from a Java background. If it was Java code, I would have pulled all the code lines inside the for loop and place it at the beginning of the method and inside for loop I would call...
I have some of my code that I have tried to improve on to make it cleaner and efficient and I would like some feedback to see if I am going in the right direction with what I am trying to do. I have a page with a menu, and when you click on menu item it displays the appropriate fieldset. HTML: <!-- dashboard_container ...
I am trying to perform a loop and then stop the loop when the last line of code in the if statement is printed to screen saving on CPU cycles. I want to start a while loop and then kill the loop after it is complete, but not breaking out of the loop so I can re-initiate the loop once again by pressing a GPIO button "B1...
I am writing a search indexer for a site I built. It counts the number of times a word is used in a given story allowing one use of the word per chapter. I have also attempt to weight words in the titles and the descriptions more heavily by including them in every chapter that is indexed. I would like to know if I am h...
Using SCSS and React, I have made a little table (not an HTML table), which is responsive based on variable-width cells. That is to say, each cell whose width is not variable has a flex-basis value, whereas variable width cells have a flex-grow value of 1 and no flex-basis. The example I have used is for match odds for...
Currently, I'm working on gamification platform and I have the following rules for achieving a new level: Level 0: When user registers Level 1: When user confirms account Level 2: When user completes a quiz Level 3: When user completes a mission and publish more than 5 comments in the blog Level 4: When user completes...
I'm learning concurrency and asynchronous programming in C#. For a better grasp on the matter I'm trying to create an OLX Crawler. My issue here is the performance: It takes roughly 159 minutes to crawl 17.901 links. The method which crawls each item is this: public async Task FetchItemsData() { var itemsTa...
This question began as an off-topic answer to this question, but the code here serves a different goal. I wrote the following class for the purpose of populating a dict on demand from an iterator. The intent of the iterator passed to the constructor is that it could alternatively be passed to dict, which would consume ...
I'm trying to come up with a system to populate my item images on demand, this is what I have so far. One obvious bug is that an item image could be downloaded multiple time since the _image will remain nil until the first download has completed. I could work around this with a loading property. My main issue is about ...
I'm trying to let users log in with multiple columns (e.g. ID, email, phone). If one fails, it checks the next column. I would like to minimise my if and else statements. Is there better way of doing it? $email = $request->only('email', 'password'); $ssn='';$badgenumber='';$ophone='';$fphone='';$pager=''; ...
I made a simple, semi-playable command line Chess game for my class exercise. At this point, this game can do the following things: Print out the updated board representation after every move Players can take turns Players can actually move pieces The code is pretty long so I don't really expect people to read all o...
Here is a Java collection puzzle I found online. I was wondering if anyone can provide me with suggestions on how Appearance and tests can be improved. Suggestions of any kind and scope are very welcomed. it would be even better if reasons can be provided along with the suggestions. Problem: Appearance class: package ...
Found this problem somewhere online and wanted to try this out with my beginner skills. I was able to solve this problem but how can I make my code better? We need to print a pattern like this (each line has one more character in length): E my iyt hTri bbiann i Here is the solution I have written, and I wa...
PHP program which extracts attribute list from the custom tag. It also strips out the single and double quote if it exists around attribute value. <?php function parseAnswerTag($tag) { // input => <answer scale="10" points="7"> // ouput => ["scale"=>10, "points"=>7] // get the answer tag and parse out the...
I have to implement an image-Carousel. Because I'll reuse the snippet within other projects which might contain all kinds of external libraries I used an immediately invoked function expression. Could my code be improved? All Hints appreciated. (function (imgPaths, imgTag, prevButton, nextButton) { var length = im...
There's a csv file with format: x0, y0, v00 x0, y1, v01 ... x1, y0 v10 ... And what I want to do is to plot a heat map, in which at location (x, y) the value v is plotted with corresponding color. Below is my current implementation. import random import numpy as np import matplotlib.pyplot as plt def create_test_csv...
I have written a function diff that takes two nested dictionaries and it computes a difference of their content (what is inside the list) returning a new dictionary. To better explain what I mean by difference here is an example of two input dictionaries: dep={'cl1': {'to_do': ['bill', 'ann 46.0.1']}, 'cl2': {'to_...
So I have doubts about my code and if it is any good. I have a parent class Spell: using UnityEngine; using System.Collections; public class Spell : MonoBehaviour { public enum SpellType { AttackType, AreaType, BuffType, DebuffType }; public float damage; public float speed; public float cooldowntime...
I'd like to suggest the following implementation: // Find an instance of substr in an array of characters // the array of characters does not have to be null terminated // the search is limited to the first n characters in the array. char *strnstr(char *str, const char *substr, size_t n) { char *p = str, *pEnd = st...
This macro pulls in two workbooks, one being a template with saved formulas already, and the other containing data with thousands of rows...I need to increase the speed because the process takes more than 15 minutes. Sub WbtoWb4() Dim Wb1 As Workbook Dim Wb2 As Workbook With Application .ScreenUpdating = False .Enabl...
I have a mock_Data: structure(list(Sample = structure(c(29L, 31L, 21L, 25L, 15L, 17L, 13L, 27L, 23L), .Label = c("109d0", "109d2", "116d0", "116d2", "125d0", "125d2", "136d0", "136d2", "138d0", "138d2", "141d0", "141d2", "144d0", "144d2", "18d0", "18d2", "28d0", "28d2", "30d0", "30d2", "39d0", "39d2", "4d0", "4d2",...
I'm writing a Rails service in which a series of operations are performed on a record: class RecordBaseAmountService self.build new end def call(record, subrecord) record = calculate_base_amount(record, subrecord) record = adjust_base_amount(record, subrecord) record = pro_rate_record...
This is my first program using a class that I personally designed. Please pay special attention to the design of the class and I would love pointers and advice on how to better improve logical design of classes (what should be grouped with them, better ways of creating classes to interact with each other, etc). I am a...
I am using a WordPress multisite network and want to pull information from options pages in Advanced Custom Fields to create a json file. I currently have this code running whenever an options field is updated on a subsite. The json file lives on the main site. The code works and runs successfully, however, it takes fo...
My code calculates \$e^x\$ with series expansion. Is there any way to make it shorter and cleaner? #lang racket ; evaluate e^x with series expansion, use first 10 terms. (define (exp x) (letrec ([f1 (lambda (n cx cn) ;(writeln (list n cx cn)) (if (>= n 10) 0 ...
So, given a file with the following format: [header] line of data line of data line of data line of data [header 2] line of data line of data line of data ... I add a line of data to a specific header so the result would be: ... [target header] line of data ... new line inserted The program ...
I'm trying to implement the repository pattern in the following manner: Interface: public interface ISurveyRepository { Survey Add(Survey survey); IEnumerable<Survey> GetAll(); Survey GetById(int id); bool Update(Survey survey); bool Delete(int id); } Implementation: public class SurveyRepository ...
I have dollar amounts sorted by month that I want to transfer from sheet entry to sheet actuals. I only want to do it for a specified month prompted from user. Each dollar amount has a corresponding cost center/ID and description in separate columns. I want to copy the amounts and description from entry to the row in a...
Concise Problem Specification Given an integer \$n\$ and a function \$f : X \to X \$ where \$X = \{1,2,3,..,n\}\$ Determine whether the given function is a bijective function or not. Definition: According to Wikipedia: In mathematics, a bijection, bijective function or one-to-one correspondence is a function between t...
I wrote the following function which takes in a window and returns all nested windows on a webpage (I can get all the windows by calling the function with window.top). Is there a more elegant/efficient way to grab a reference to all the windows and child windows on the page? The function works, but I was having a hard ...
I have a function that finds the most frequent level of string and factor variables. This is used in a data.table aggregation on Big Data, for non-numeric columns. Right now the overall aggregation runs extremely slow. I'm trying to make improvements in other aspects as well (reducing observations and columns, etc) and...
Code class Anagram(anagram: String) { def matches(candidates: Seq[String]) = { candidates.filter(isPermutation) } def isPermutation(candidate: String) = { (candidate.toLowerCase != anagram.toLowerCase) && (candidate.toLowerCase.sortWith(_>_) == anagram.toLowerCase.sortWith(_>_)) } }...
I am trying to optimize my code and make it as fast as it can be, I have researched as much as I can and am now asking the community for any tips because there are definitely people more experienced than me :). As of now it is pretty slow for what I am trying to do. The innermost loop will basically loop choices^6 num...
This is a simple implementation of a generic binary tree that holds elements of type T. I was wondering if there was something that could be done better (especially in the EnumerateNodes methods). using System.Collections.Generic; namespace DataStructures.Node { /// <summary> /// Implements a generic binary tr...
In various projects, I have to evaluate the mean and/or the variance of relatively large samples. I wrote the following, to help me evaluate these quantities with a constant footprint. Basically, it adds elements one per one and updates the variables. namespace DataStructures { /// <summary> /// Holds a "ghost ...
I am saving company information in a database, and if repeat information is found, I want to update the overlapping rows. Some of the supported fields are emails, phone numbers, organization names, and latitude/longitude positions. One of the obvious issues I've had to deal with, however, is knowing whether or not an o...
I made a small(ish) image editor for a client that is supposed to be able to do the following: initially scale image to preset size to avoid tiny/huge images initially center image in canvas resize uploaded image (while always maintaining original aspect ratio) prevent image from going outside the canvas bounds preven...
This is my attempt to write a data-bindable, platform independent property that doesn't require any literal strings. The basic idea is to basically have the same functionality as IObservable, but with a value which has a getter (and a setter in a derived interface). The core interface only has a getter: public interfac...
I have to create a project in Python 3 for a university exam. The project involves the use of object-oriented programming and the use of multithreading. My project is based on the simulation of booking a hotel room. I then created a Stay class with its instance variables and its methods. For multithreading I tried to i...
Main Purpose This script allows two players to play chess on a virtual chessboard printed on the screen by making use of the Unicode chess characters. Visual appearence The chessboard looks like this: 8 ♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜ 7 ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟ 6 5 4 3 ...
I've decided to implement my own custom authentication and authorisation in JSF. I am using Java's BCrypt to check the users' passwords. The view side of things I can handle; I'm just implementing PrimeFaces validation tags later on. I use ManagedBean to validate the backend of things (if username is the right length, ...
The following is my implementation of the absolute value function in the MIPS assembly language. I would very much like to hear constructive criticism of my code from you as well as any words of wisdom you want to pass my way. The code is heavily commented. ##############################################################...
The classic Chutes and Ladders game has a grid of 100 squares with various "chutes" (which send a player backwards) and "ladders" (which promote a player forward). The goal here was to randomly create a series of these chutes and ladders such that the net effect is that there are 50 more squares that may be lost than ...
This is a function that converts an integer value to a null-terminated string using the specified base and stores the result in a char array that I must allocate (with malloc). I have decided not to use malloc. Allowed functions: malloc. Loops: while Please review my code. char *itoa_base(int value, int base) { sta...
I currently have a system which loops through a bunch of my website domains and checks their status and sends me a notification letting me know if they are up or down. The stripped down version of the relay code is below, I've removed the email/DB update code etc. It pings a transponder (a file on the client website se...
I made a simple bare bones Tab component, i'm a beginner when it comes to ReactJS so any advice regarding the codes functionality is greatly appreciated. Tab.js Component import React from 'react'; class Tabs extends React.Component { constructor() { super(); this.state = { activeInd...
Please help me improve this code. Move snake using : a w s d. (My compiler doesn't support initialization of index variables inside loops, so please ignore this part) #include <stdio.h> #include <string.h> #include <termios.h> #include <unistd.h> #include <fcntl.h> #include <ncurses.h> #define vertical 40 #define hori...
After the last post had some minor improvements for me and the beta release was actually used for some things, I decided that the GUI was too ugly to continue like this and rewrote the whole GUI in JavaFX. The Matrjoshka - Usage This posed some challenges for MVC / MVP, because of some peculiarities with JavaFX Views a...
I am working on an endless tower defense game in Unity. To keep track of money, damage, hitpoints and stuff like that I will be using BigInteger, which can represent arbitrarily large integer values. Unfortunately, Unity does not come with a BigInteger implementation, but I managed to find one online. For displaying a ...
I currently have a method that checks if the store is open. It's working nicely, however on the main page I have quite a few stores. Whom again have different locations. Each of these locations again have opening hours. Now I'm not particularly good with SQL and DB querying and Skylight is complaining and telling me th...
There is a quiz-game with simple rules. You have to guess one of three options. Each option has a particular weight, for example: Option 1: 20 points Option 2: 30 points Option 3: 50 points If player guesses the right option, he gets all amount of points. If not, he gets a part of those points: User choice || Righ...
As an exercise to learn Rust I've decided to write a Bit Vector library, furthermore I also intend to use it later because my version can share slices of the bit vector between threads whereas the existing bit_vec library cannot do that and development does not seem to be active anymore. The library has the following f...
I really like flac files, but my phone can't store them all. So I made a script for converting them, that slowly became a full featured flac organizer. I'd like to improve my programming skills, as well as the commenting. How can I improve? The program is made out of 3 scripts: config.sh #!/bin/bash #Script made for s...
This method removes n elements starting from a given index, from an array of a given type. If n is positive it removes elements forwards, if it is negative it removes them backwards (e.g. for an array {1,2,3,4,5} Remove(2,2) results in {1,2,5}; Remove (2,-2) results in {1,4,5}) It there a better way to do it? public st...
The normal dictiory separates the key from the value... but what if the key is a part of the item it stores? It then forces you to enter the same things twice, once for the key and agian for the item. I never liked it so I thought I write really simple class that takes this unecessary step away a makes life easier agai...
I am starting to learn Haskell, and following Dr. Erik Meijer lectures online, he suggests as an exercise to implement the game of Nim in Haskell, so I implemented a really basic game for two players (no computer player). I can imagine that this code is far from being good Haskell, and I accept all possible criticism a...
I am working with C++ and SDL, hoping to create a game later. I am implementing the collision detection between rectangles and segments. I found this (NateS user's solution) about line-rectangle collision detection on Stack Overflow. I'm working in C++ and not in Java; and though it isn't that hard to reimplement in C+...
I've come up with a hackish approach to get my XSL function to only return the first 2 initials of a person. I think there should be a more efficient way to do this though. The replace specifically is what I think I should be able to get rid of, looking through docs though I can't figure out how to correctly iterate wi...
After validation my errors list returns [(False, {u'first_name': u'First name is too short'}), (False, {u'last_name': u'Last name is too short'}), (False, {u'confirm_password': u'Password is too short'}), (False, {u'email': u'Please enter a valid email'})] I use a for loop to create a new list and only add the one ind...