instruction stringlengths 71 71.9k |
|---|
I'm thinking of making a little strategic game using tkinter (player should interact with it using buttons). But my code is very repetitive. This is a mock-up of my program:
import tkinter as tk
import random
def multi(*args):
for func in args:
func()
def show_hide():
if not button["text"]:
... |
I am working on creating a scheduler which will connect to cassandra database and extract data from few tables and store it in few variables. Then from my main thread I will be using those variables by calling getters on them from CassUtil class. Basically, I will cache the result in memory and then from a single backg... |
Basically, this code does multiplication of chosen operations.
public static String[] gen8String(String[] pattern1, String[] pattern2){
String[] combinedSubset = new String[90]; //emty array for the subset of 90 strings
String combinedString = ""; //string holder for each combined string
int index = 0; //u... |
I have posted my solution to the jolly jumpers programming challenge(detailed here) for your review:
A sequence of n > 0 integers is called a jolly jumper if the absolute
values of the differences between successive elements take on all
possible values 1 through n - 1. For instance,
1 4 2 3
is a jolly jumper, bec... |
Is my implementation correct (it is matching this result)? How can I improve this code?
public class Parzen
{
public static double Variance(IEnumerable<double> source)
{
double avg = source.Average();
double d = source.Aggregate(0.0, (total, next) => total += Math.Pow(next - avg, 2));
... |
As a programming exercise, I decided to make a prime factoring function using recursion:
static bool isPrime(int n)
{
if (n < 2)
return false;
if (n % 2 == 0)
return (n == 2);
int root = (int)Math.Sqrt((double)n);
for (int i = 3; i <= root; i += 2)
... |
I am trying to come up with a minimal example of what is known as callback hell in JavaScript (so this would be a bad code review I guess). This is what I have so far, and I would like it to also run without making external requests. I'm not sure if that's possible or if this example is hellish enough (do I need to int... |
I was told the function "hompage" was too clunky to conveniently make a tableview. The cells will have the information in "PHOTO ALBUM ICONS" and "BUTTON ON TOP OF PHOTO ALBUM ICONS".
import UIKit
import Cartography
import ChameleonFramework
class ViewController: UIViewController, UITableViewDelegate, UITableViewData... |
I'm sure this game gets put up here all the time but I'd appreciate it if you could have a look over my code and give me some suggestions on how to improve it.
Here is a live example so you can play the game and here is the code on GitHub if you want to fork it and tinker with it.
(function(){
/*
* Rock, paper, sciss... |
The purpose of this code is to create a GoogleMap using PHP, add markers to it according to Place objects from database, add infoWindows for these markers. While reading about Factory pattern I came up with the following solution. What are the parts that can be improved. Thank you.
Factory for creating markers:
class M... |
My code is attempting to implement FP in an efficient / readable manner into some of my video games. I realize this may be a bit subjective, but I feel there is enough merit / objectivity to be of benefit to the community.
Why I'm asking for a review:
I'm not sure that my code is executing FP / procedural principles in... |
In this post, I asked a question regarding how to create a matrix of integers where elements in each row satisfy a particular property.
The notation in the original post is a bit cumbersome so I will try to explain the question in a nutshell. I have a vector of integers cvec, which has length l-1, and I enumerate all ... |
I'm calculating the GS1 SSCC codes that are 18-digit barcodes. The 18th digit is a check digit which is used to validate the rest of that code and check that it is correct. the check digit is a number between 0-9 and is calculated using a specific algorithm on the preceding 17 digits which are the input for this code. ... |
Hopefully the final chapter of my ForEachAsync code review. The original question was the starting point and the second question contained modifications suggested in the original trying to ensure I was handling cancellation and exceptions correctly. The second question also contained my test scenarios (in pseudo code... |
So the program will take input of a series of 9 integers which indicate which square was played on each move. Player 1 is always X and player 2 is always O. Player 1 plays first. Move 1 is first and Move 9 is last, sequentially.
The board looks like this
1 | 2 | 3
---+---+---
4 | 5 | 6
---+---+---
7 | 8 | 9
Winni... |
This seems to work for me, but I want to make it more secure. I want to see how far I can go without pre-built packages/bundles, so please don't suggest any.
How secure is this? What are some steps I can take to improve it?
In a controller:
public function loginUser($request, $response) {
if (Security::isUser()) { ... |
After seeing this post on StackOverflow, I thought I'd try it out. What I have now is a diamond shape with numbers like this:
1
212
32123
4321234
543212345
4321234
32123
212
1
My code looks like this:
int i, j, k, n = 6, l = 3, o = 2;
for (i = 1; i <= 5; i++)
{
for (k = n; k >= 1; k--)
{
... |
I'm currently trying to find a way to get my program to run more efficiently. If anyone has any ideas on how to optimize my program, i would appreciate it a lot. Also, the output has to display in alphabetic order without any duplicates.
package Palindrome;
import java.io.*;
import java.util.*;
public class Palindrome ... |
Motivation
I have worked extensively with JavaScript and have grown fond of some of its functional aspects. This got me wondering how one could implement the canonical example of a bank account - and a small application using it - in a purely functional manner in ES6.
Code
I introduce three types Account, Shop and Cust... |
In the process of learning Swift, I'm building a lotto numbers generator that generates a random number and appends it into an array, if the number already exists then it should re-generate a random numbers and append that one to the array.
I've come up with this. I want to be able to have a reusable class where I can ... |
I've created the following implementation of a trie in F# as an effort to learn the language. I would like to know what could be done to make it more idiomatic. Any other pointers are welcome as well.
Of particular interest are:
Are my tests sufficient? Is there a better way to construct the tests?
Can the logic for ... |
I'm solving Problem 3 in Project Euler:
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143?
Most answers I found made use of array to store the prime factors and iterate over them to find the greatest one which doesn't seem good.
I'm recently learning js and th... |
I have the following javascript es6 class (along with some functions) that generates an area where you can draw in a page.
class Painter {
constructor(selector, cols, rows, style) {
this.looper = null;
if (!selector)
throw new TypeError("Provide a valid table selector");
this.col... |
I am trying to decide between two designs of a class. The basic difference is the one calculates properties when they are called, and the other when the object is instantiated.
I would usually just take the first one, but the calculations call each other, so when calling all of them, they get recalculated multiple time... |
This Bash program extracts the 20 first lines of each man page present on a system and uses grep to remove lines matching a list of selected terms.
How can I improve the grep part? (something less repetitive, with less pipe but that do the same job)
#!/bin/bash
# generate the list
compgen -c > man
# extract each man ... |
I wrote an x86 assembly function using MASM that tests for whether or not an array is continuous. That is to say, if an array with length n that starts with the value k, all the subsequent entries in the array are k+1, k+2, ... k+n.
I am interested in becoming better at x86 and x86-64 assembly and I'm wondering if I c... |
This is a classic problem with a classic solution and I've seen it a number of times on this site, but I wanted to know what people thought of this C# implementation, as opposed to the numerous C implementations.
Below you'll find the source code, the output of the code and then a link to repl.it, so you can run the co... |
I'd like to form an algorithmic connections between a particular string and and a particular color, in such that each unique string is always the same color.
My particular use case is for a kiosk where each user should immediately notice if someone else is logged in, so my strings are employee first names. Reinforcin... |
Here is some code I wrote as a solution to Programming Exercise 15.3 in Stephen Prata's C Primer Plus, 6th Edition. It is probably worth pointing out that the title of the chapter is Bit Fiddling. The question asks:
Write a function that takes an int argument and returns the number
of "on" bits in the argument. Test... |
I just finished my first Python GUI project, a simple four function calculator. I think I've tested it pretty thoroughly. I'm learning python and OOP, so any critiques would be welcome.
In general, I was wondering if there is a more automated way to generate the number buttons and their actions - it was a lot of copy... |
I wrote a Python script to scan my music library, randomly select 50 songs, and play them in VLC media player. It works great, just a little slow (takes several seconds to launch).
I know that walking through my entire music library (thousands of songs) is a brute force (slow) way to do it. What would be a faster appro... |
I've written a red-black tree in C as an exercise. The tree works and it is not bad, but it is about 10% slower than std::multimap from libstdc++ which I'm comparing it against.
Full code of my implementation is here. libstdc++'s red-black tree written in C++ is here and here.
I'm using the following code to compare im... |
It is my second day into software testing and I am currently testing my database, handlers, and functions. I am wondering if I am taking the right approach as this is the first time testing my web app. I'd love to get some advice or feedback to improve my tests!
Below is the code for data model.
class Post(ndb.Model):
... |
I just implemented the balanced parentheses problem in JavaScript. For those of you who are new to this problem, a statement of it would be:
Give a string of parentheses (including braces and square brackets),
check to see if they are opened and closed in order. The last opened
parens should be closed first befor... |
In short, the input is an ordered list of numbers, and we have to sum the numbers from index a to b quickly. For example, assume array[] = {1, 2, 3}. Please sum from array[0] to array[2] (1 + 2 + 3).
Because the input array can have as much as 200,000 elements, I used a Fenwick tree to save time, but the time limit is ... |
The question is that in a given integer n you have to sum its digits. For example, the sum for 111 would be 3.
Though I managed to solve the problem, I have a good feeling that this algorithm can still be improved.
public static int digit(int n){
String numbers = n+"";
int sum = 0;
for(int x = 0; x < number... |
During an interview, I was given this Hackerrank question to solve within 15 minutes but at that time I was interested in solving this without performance in my mind. I know a similar question has been asked Hackerrank Insertion Sort - Java and probably a lot in CR.
Problem Statement
Given a sorted list with an unsort... |
Here is the code I'm working on. I'm trying to find the optimum alpha value to get the minimum MAE/MAD. With scipy.optimize, it works quite well. However, when scipy.optimize achieves the optimum alpha, it also achieves the forecast values that essentially I'm trying to get to. Is there a way to return or access and st... |
This is a calculator for F = MA. (Force = Mass * Acceleration)
I would like a review of my code. I believe that I have gotten better since my last time.
package ufvnik;
import java.util.Scanner;
/*
* @author: Sean
*/
public class tfci {
private static Scanner keyboard;
public static void main(String args[]){
//ca... |
This file handles the player "stopping" in space, trying to find whoever is ahead or behind (also stopped) and joining everyone into each others stopping -rooms. I'm not too sure about the whole "each others rooms" - but I can't think of a sane way to have these N players sit in the same room that's created at differen... |
I am currently developing a web app that lets users submit posts and replies, and they can have their own profile which lists all the submitted posts and replies. I am also using X-AppEngine to fetch the location of users and I'm storing the information into the database. Posts, replies, and user information are stored... |
I am creating my first android app. It is going to be a quiz.
There are 40 different question categories and each category has its own database table.
I am writing all questions into a sqlite database like this:
private void addQuestions() {
// Category 1 (ACE) Questions
// First Question
String aceQuestion... |
This is a tool I needed for some other things (it's incomplete, but almost done) which is essentially just a text-editor that has two text-boxes: the left being the binary view / raw bytes, the right being the text when the bytes are decoded with the specified Encoding.
The only features it doesn't yet have that I need... |
I wrote this code a while ago, which is an excerpt of a payment service library:
# recover a transaction details from the Wirecard API
module Wirecard
module Elastic
class Request
class Transaction < Base
attr_reader :merchant_id, :transaction_id, :payment_method
def initialize(merchant_id... |
I created an OAuth 1.0 signature generator using Ramda based on this.
I'm just getting to grips with it, so was wondering if someone more familiar with Ramda and functional programming would give me review.
const R = require('ramda')
const hmacsha1 = require('hmacsha1');
// For RFC 3986 Compliant URI Encoding.
let enc... |
This program is based on as old retired Google interview question where you're supposed to create a program that will split a string into space-separated words, if the string is composed of valid words.
I've implemented two approaches, one that uses a normal array as the dictionary, making the implementation pretty si... |
List.h
#pragma once
#ifndef GUARD_LIST_H
#define GUARD_LIST_H
#include "List.h"
#include <stdexcept>
#include <iostream>
template<typename T>
class List
{
struct Node
{
Node* prev;
T key;
Node* next;
Node(Node* p, T k, Node* n): prev{p}, key{k}, next{n} {}
};
public:
/... |
User has number in head, the program must guess the number.
public class GuessingGame extends JFrame{
JButton newGameButton, highButton, lowButton, correctButton, exitButton;
JLabel initialTextLabel, enterLabel;
JTextArea commentTextArea;
JScrollPane scroll;
private int guess, high = 101, low = 0,... |
I have written a Boggle board solver in Python 3. I would like comments on readability and structure. Thank you!
Boggle
Boggle is a board game with a 4x4 board of squares, each of which has a letter, in which you score points by finding words on the board. This is an example Boggle board:
c a t c
a t c a
t c a t
c a t ... |
Check me:
Model should do everything. That's where all functionalities and features are accommodated. It has some properties, that I can access and use. Theoretically, it could work as a standalone app (used via command prompt).
View does nothing but looks (like a monitor: you always look at it, whereas the real work d... |
I'm trying to replicate the attributes text that appears in File Explorer, for files and directories.
I can't just use the enum names, as the summary text uses a single character for each set flag, and that character isn't always the first character of the enum member. I'm also not using the reserved FileAttribute.Devi... |
The purpose of this function is to turn a 2D array of sorts into a single-dimensional array by reading it in a spiral fashion.
In the array:
1 2 3
4 5 6
7 8 9
if it's a clockwise spiral it will read 1,2,3,6,9,8,7,4,5first going right, then down, then left and then up repeatedly until it's at a dead end.
The code I wro... |
This was my C# implementation of Parzen Window Density Estimation.
The following is my implementation of the same in Matlab:
parzen.m
function [retval] = parzen (matrix, dataPoint, variance)
[r c] = size(matrix);
A = ones(r, c).*dataPoint;
sub = matrix - A;
up = sub.^2;
dw = 2 * variance;
firstP... |
I created a directive that solves my immediate problem, but I'm trying to find ways to make it more reusable.
My immediate problem was, I have a table and needed to fill in one of the columns with data from an http request. I passed an object (dir.provider.resource) and a string (attr) into the directive, made a GET r... |
I'm a scientific C programmer moving my way over to using Modern C++. I found myself needing a HyperLogLog implementation, and I wanted to use this for practice.
I plan to move a number of these functions over into an accompanying header file, but I do find it convenient at the moment to only need to include it (esp. i... |
I've written a program that calculates all of the palindrome numbers in the given range, but the code is slightly slower than needed. I've tried to improve algorithmic complexity to the best of my abilities, but still overhead over passing solution (1 second). Is it possible to improve the runtime performance (in time... |
I am studying the book Realm of Racket.
On chapter 5, there is a challenge:
Find an image of a locomotive. Create an animation that runs the locomotive
from just past the left margin to just past the right margin of the screen. Next, modify your program so the locomotive wraps around to the left side of the screen afte... |
The original question is to write a Fortran program to compute the sum of the first 20 terms in the exponential equation (for x=1,2,3,4,5):
$$\sum_{n=0}^\infty \frac{x^n}{n!} = 1 + \frac{x^1}{1!} + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \frac{x^5}{5!} + \ldots$$
My original approach was:
PROGRAM Exponentia... |
I have a list of objects where one of the properties on the object class is an enum.
The program below simply loops through each item in the list, checks an int value, then checks the enum value for that item, then adds the item to another list when the condition is met.
I am using if-else statements, I attempted to us... |
I am working through Chapter 10 of Haskell Programming from First Principles.
I've gotten the code to work, but I am uneasy about the fact that a few of my functions - namely, extractUTCTime and extractInteger - are not total functions. There is valid input for which those functions are bottom. I've added the code bel... |
I've just started learning C# using Rob Miles' C# Programming Yellow Book and some related lab exercises from his website. I did one of them and produced a solution that works. In Miles' book, he says that nesting if and else brackets is clumsy and introduces the switch. But switch apparently doesn't work with Boolean ... |
What can be improved?
#!/usr/bin/python
import random
def board():
board_size = int(raw_input("Board size: "))
board = []
for i in range(0,board_size):
board.append(list(range(board_size)))
for parent in board:
for child in parent:
parent[child] = 0
return board
def che... |
I am still in the process of learning modern C++, and decided to write this dummy program for actually benchmarking copy semantics vs. move semantics:
#include <chrono>
#include <iostream>
#include <cstdint>
using std::cout;
using std::endl;
class List {
public:
void push_back();
List() : sz{0}, head{nullptr}... |
There are already many other TicTacToe implementations but most of them are missing some features like if duplicate input is entered exception and immediate termination of the program occurs board is not updated and so on I tried my level best to bring the proper one
/* SWAMI KARUPPASWAMI THUNNAI
... |
I'm porting a 2-D Terrain Generator from Python to C++ as Python is too slow due to the number of features that have been added.
I'm new to C++ and would like to know of any criticisms that you can make of the code at this time before I continue with the simpler parts of the generation. Right now I'm interested in mai... |
This code is working fine and I would like for it to be reviewed. Am I using extra objects and variables to store values?
LinkedList
package lab5;
public class LinkedList {
public static void main(String argsp[]) {
List ob = new List();
ob.addAtStart("y", 6);
ob.addAtStart("w", 4);
... |
The aim is to have any strings with integers within to be reorder by these integers.
Let's say you have the following string:
re5 Forty1 cash2 Man3 Booker4
The aim is to have the string order by the integer contained within the string:
Forty1 cash2 Man3 Booker4 re5
I created this function:
def reorder(wordchain):
... |
I have a buffer - int array with defined length. I want to read and write values into this array in parallel. For instance, 5 readers and 3 writers with different intervals. Additionally, I want to block waiting readers and waiting writers until a specific operation (read or write) is available.
Buffer:
public class In... |
I have designed a quadratic Equation Calculator with Java FX. It is divided into four separate classes:
GUI.fxml to design the UI
Logic class with the all the logic formulas and code that runs the program
Main class which brings all the different components together
Controller class
Any input is appreciated.
GUI.fxml... |
I created plugin for MySQL Workbench that allows you to export an ER Diagram to RoR migration files. I would like to know if any other developers appreciate it.
export-rails-4-migrations_grt.py
# -*- coding: utf-8 -*-
# MySQL Workbench module
# <description>
# Written in MySQL Workbench 6.3.6
from wb import *
import ... |
I'm learning Rust so as an exercise I'm trying to write a datatype wrapping the builtin BTreeMap to allow it to store duplicates. Like the STL multimap type. The functions I have:
fn insert_dup<V>(map: &mut BTreeMap<i32, Vec<V>>, k: i32, v: V)
{
if map.contains_key(&k) {
map.get_mut(&k).unwrap().push(v);
... |
I've made a little colour conversion app, and below is my JavaScript.
The app converts HEX values to RGB values and vice versa, as well as using a simple colour picker to get colours and convert them to both HEX and RGB.
Here is a picture so it is easier to understand what the code does. Basically you enter a HEX or RG... |
I'm working on learning Python, and this is my second GUI project using PyQt. I've played it a few times to test it and it seems to work. It isn't anything clever; the computer just picks randomly. Any feedback would be quite welcome.
import sys
import random
import time
from PyQt4 import QtGui, QtCore
class Tic(Qt... |
I've written my first program in GO, a command line tool that parses JSON containing events from a file or from STDIN and outputs the upcoming events in sorted order. Please critique it!
package main
import (
"encoding/json"
"io/ioutil"
"fmt"
"os"
"time"
"github.com/urfave/cli"
"strconv"
... |
This is a design data structure and movement for a tilt maze. For example, this one.
My major idea is to divide into Ball, Maze, HorizontalWall and VerticalWall classes. Ball is the core class which operates on Maze, HorizontalWall and VerticalWall.
I feel my code is a bit inefficient since each time, I need to enumera... |
As an exercise, and in an effort to avoid wrapping callback APIs in every node library it seems, I threw together a resource pool class. The intended usage is the following:
const pool = new Pool({
createConnection() { return ... Promise<MyConnection> }
destroyConnection(c: MyConnection) { return ... any }
})
cons... |
Can someone please review this code and provide comments?
Please comment on error handling
Is it right to do like this in method LinkedList::InsertFront()?
Node *node = node->CreateNode(key);
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
class LinkedList{
public:
LinkedList(){
head = NULL;
... |
I made the following bash script for extracting a group of ECG signals from ECG files. I would like to know if there is any mistakes and/or weaknesses. I have experienced difficulties in integrating bash parameters to it as a function because of AWK part.
I think it would be better not to use so much different separate... |
Suppose each node of a tree has maximum n children. I want to serialize and de-serialize for a tree. My current solution is doing pre-order traverse, and using # to represent None child.
I'm wondering if there are any better implementation method. My current concern for my code is if the tree has too many None node (ki... |
I solved HackerRank Nikita and the Game. The implementation is correct as program passes all test cases.
Nikita just came up with a new array game. The rules are as follows:
Initially, there is an array, A, containing N integers (1 ≤ N ≤ 109), with 0 ≤ Ai ≤ 109.
In each move, Nikita must partition the array into 2 n... |
I am automating a login page. I am using the page object design pattern Selenium with Java. What should I improve on in my code?
package Pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
publi... |
I'm new to coding and have cobbled together some code to run an automated test against a web application. The code works but I have some complexity rule violations (CA1505, CA1502 and CA1506) and would be grateful to anyone with insight on how to go about improving the code.
The code logs into the UI, makes sure the u... |
I made a on-off switch to be more fluent in React and added touch functionality to it.
The idea is to have it independent of the state management library/logic, and be easy to import into a project, regardless of the state managing being used.
My question is: is the touch implementation (and overall React logic) corr... |
As the subject suggests:
Loop recursively through folders
All files are XLSX
Remove all non ASCII characters
Save as a CSV
Can it be improved with regards to speed? Would using openpyxl help?
import os
import xlrd
import csv
for subdir, dirs, files in os.walk("C:\Users\Alan\Downloads\Knowledge"):
for file in fil... |
I would like to get some performance improvement suggestions to a simple project I made using Bash in Linux.
The target is to read all the *.desktop files, and extract Name, Exec, Icon and Comment entries. Then will be displayed in a GTK yad List.
I have built the code in two versions. Both versions works OK, but are v... |
I have created a BeautifulSoup vacancies parser, which works, but I do not like how it looks. Therefore, I'd be very happy if somebody could give me any improvements.
from urllib.request import urlopen
from bs4 import BeautifulSoup
page = urlopen('http://rabota.ua/zapros/python/%D0%BA%D0%B8%D0%B5%D0%B2')
soup = Beauti... |
Here's my attempt to draw Koch snowflake. My initial state is a line instead of an equilateral triangle so that I am able to fit maximum detail in a mobile phone window.
My thought process was:
Start with two points A, B separated distance r.
Draw three points between them, P1, P2, P3.
P1 at distance r/3 from A on l... |
I'm using MongoId in a Rails project. I need to select some products which contain some SKUs which has an embedded document. The models are respectively Product and Sku.
The point is I want to keep it DRY and the conditions I apply to those subdocument already exist as a scope of the model. My working strategy so far i... |
I have a Winforms project in which I have a screen which loads a questionnaire. It restores answers the user has previously entered by restoring the saved results from the database to a single list (see code below).
The answers the user fills in are saved in my SQLite database table 'Results' with a result_id, assessme... |
I'm using the following code to unzip file which is working OK.
I'm getting file with the request (express) and unzip it in specified folder
_unzip: function (req) {
return new Promise((resolve, reject) =>{
var noOfFiles = 0;
let filePath = path.join(req.file.destination, req.file.filen... |
I have written this code and I am wondering if the code could be optimised.Please review.
public class Anagram1{
public static boolean check(char[] c1,char[] c2,int l1,int l2){
/*if the lengths of the strings are not equal,they cannot be anagrams of each other */
if(l1!=l2){
return false;
}
... |
I have two lists of coordinates,
lat = [-23.23, -44.23, -12.23]
lon = [-21.23, -14.23, -62.23]
and I generate a tuple of lat long pairs with zip:
latlon = zip(lat, lon)
and that gives the expected result. Now there is a very common pattern of generating lines with the points. It is common to do something like
li... |
I'm a beginner who wants to learn properly how to write code. The following code takes initial RGB values and gradually changes them (shade by shade) to targeted rgb values, scroll by scroll. The code works, but is there a way to clean this code, and get the same gradual result?
//GRADUALLY CHANGE BACKGROUND COLOR WHIL... |
I’ve written a script for automatically backing up my Goodreads data. This mimics the Export function on the Goodreads website, which returns a CSV file – but this doesn’t require going through a website, and provides JSON instead of CSV. The idea is that I could run this on a cron job, and have regular backups of my u... |
I recently started replaying Final Fantasy XII. One of its optional bosses, Zalera, has, among others, the following mechanics:
His attack sequence is Lv. 2 Sleep, Lv. 3 Disable, Lv. 4 Break and Lv. 5 Reverse, affecting characters whose levels are divisible by 2, 3, 4 or 5, respectively, and then Prime Lv. Death, whic... |
I decided to make a small program for filter design, to practise C++. I intend to also add a GUI, later on (Qt, most probably), so I thought that the way the program would go in the main() should be very modular and flexible, to be able to be used by widgets. I also thought I should be able to call only a filter at a t... |
Here is my solution to Programming Exercise 15-7 from Stephen Prata's C Primer Plus, 6th Edition. This problem asks the reader to:
15-7
Write a program with the same behavior as described in exercise 6, but
use an unsigned long variable to hold the font information and
use the bitwise operators instead of bit me... |
I made a method that takes 2 DateTimes as a parameter, a startDate and a stopDate.
The routine should return a list of DateTime ranges by checking if the range in the parameters is above one year TimeSpan. If it is, it should separate the range into smaller ranges of one year, starting form startDate and adding a year ... |
I'm looking for a code review on the following C++/STL graph implementation:
Edge
#ifndef edge_h
#define edge_h
template <typename T>
class Edge
{
public:
Edge(const T &weight): weight(weight) {} ;
const T& getWeight() { return weight; };
private:
T weight;
};
#endif /* edge_h */
Vertex
#ifndef vertex_hp... |
I'm looking for ways to optimize a function that I wrote as an answer to this problem in Python:
You and your rescued prisoners need to get out of this collapsing death trap - and fast! Unfortunately, some of the prisonners have been weakened by their long imprisonment and can't run very fast. Their friends are tryi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.