instruction stringlengths 71 71.9k |
|---|
In Python I am trying to create an API for a connected device. I want to be available for both threaded (using request) and async applications (using aiohttp).
What I've come up with is wrapping the get method of both requests and aiohttp in a decorator. This decorator is passed at init and API calls are explicitly wra... |
My day job is supporting a piece of software that just started using the DevArt Oracle drivers, which utilize the Oracle.DataAccess .NET drivers.
However, the assemblies in the .NET GAC may not uninstall correctly, and I have encountered later assemblies that do not match the installed Oracle client, and which therefor... |
The idea is the following:
I have a large text with a header upon it and a navigation bar. The navigation bar is located between header and text.
If the user scrolls downwards then the header-part moves out of the browser window. The navigation bar moves upwards too. But just in the beginning. When its top reaches the ... |
I'm new to JavaScript and jQuery and need input about how to optimize my script:
(document).ready(function() {
var inputs_1 = $("form#myForm .case1 input, form#myForm .case1 select");
var inputs_2 = $("form#myForm .case2 input, form#myForm .case2 select");
var inputs_3 = $("form#myForm .case3 input");
... |
I have implemented a through function for myself in a project.
Since I am still quite new in python and want to learn it correctly, I would be happy about any feedback including style, variable naming...
A first question is how to name the function. Because of Mathematica's documentation I called it through. Is there a... |
I'd really appreciate if I could get some feedback on the following code with regard to security, efficiency and possible uncaught errors. Personally I feel the printAndCleanString and friendlyLookup functions combined are very messy but I don't know how to fix them.
In particular I would love feedack on how to more c... |
I am trying to return distinct characters from the combination of 2 Strings. The following is my solution which seems to work based on my tests.
Is there a more efficient way of going about this? I have converted the strings to arrays, to sets, to a StringBuilder and back to a String. I'm wondering if I have overcompli... |
I've been looking at some async comms in C#. As a proof of concept, I've written a simple multi-client echo server. The server allows multiple TCP clients to connect and listens for input from the clients. When it receives a complete line, it forwards the completed line to any other connected clients.
For testing, I... |
I've made some improvments on the code from : Csharp-AES-bits-Encryption-Library-with-Salt
saltBytes is now the SHA512 of the password.
Random IV for each encryption call. ( IV length 16 is added to the encrypted file , removed from file before decryption)
Do you see any flows, something that needs optimization ?
Is ... |
I tried avoiding nested loops and usage of too many variables. This is up for review and comments.
void bubble_Sort(int *arr, int n)
{
int i = 0;
int* temp = arr;
while(n > 1)
{
if(i == (n-1))
{
i=0;
n--;
temp = arr;
}
if(*temp > *(temp+1))
{
*temp ^= ... |
I decided to implement some data structures- this time an AVL tree. I think the logic is correct. Is there a way to make it clearer and do you have any ideas about more tests to add?
# An AVL tree, python
import random
class TreeNode:
def __init__(self, key, val, left=None, right=None, parent=None, bal=0):
... |
I created a quiz game program with 25 questions, 4 answer choices, correct answer and 4 points awarded per question. I realize this code isn't the best; I am still a beginner and this is my first major project. I am open to criticism and any suggestions on how to shorten this code (especially where the questions are ty... |
The following query lists all domains from multiple companies in which a value occurs in an XML set. This is filtered to the most recent occurrence within a provided date range.
On large databases the query has performance problems. Is there a more efficient method to retrieve the most recent query results within the p... |
I'm trying to make a game with inheritance & interfaces and I'm wondering if my system could be working without ECS. (I explain at the end why I'm not using components).
To make it easier to understand there are three core class "families" in the code:
Engine related classes:
Graphics, Inputs, Audio, Physics,...
Using... |
I want to make sure I won't have to go back and redo large chunks of code. I have each opcode as a value in an enum that implements Runnable. Is there a more efficient way that I should do this or am I on the right track to getting something that runs a testsuite ROM accurately?
package com.codeblox.nes.cpu;
public cl... |
I am implementing the Random Ferns Algorithm for Classification. For simplicity, let's imagine a single decision tree with only a single node. As input we have a feature and the label of each dataset.
The function should work properly for any number of classes (length of set(labels)). The output is a feature threshold... |
I made a Snake clone for a programming class. I wanted some feedback regarding coding style and will appreciate any other opinions concerning my code.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Snake extends JFrame {
/* Some properties. */
private final int BOARD_WIDTH = 20... |
My task is to write a function that would take an array of zip codes and spit out only the zip codes that do not qualify. A non-qualifying zip code will not exist in the database and does NOT have other input zip codes within 140 miles.
For example, if I input 90210, 90211, 77389 into the function, it should only spit... |
This code is meant to create a list of subsets of a given set which is represented as a list.
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures for an upcoming coding interview.
def subsets(s):
if s == []:
return [s]
sets = [s]
for i in range(0,... |
Here are two sample blocks of my code:
function FindTheNumberOfAddedItems ( PageObj, ItemType )
{
var localPageObj = PageObj;
var localItemType = ItemType;
var numberOfAddedItems = 0;
var NROCssSelector = "div[class='assessment-stub list-top-border-colour-1 clearfix box-shadow'] strong";
var OROCss... |
Intent
Increase code usability/readability of functions with many default parameters while maintaining as much compile time safety as possible.
Motivation
It is very common to create functions that have many default parameters that extend and customise their side-effects. A problem arises in function usability/readabil... |
I'm working on a quiz application for training purposes and I think I'm done with most of it.
However, I'm not comfortable with what I've done: it seems to be too complicated and unprofessional, and I would like to make it more organized and simple to understand.
first, the database contains a three simple tables:
quiz... |
I would just like some input on how I may improve my code(in terms of content not formatting) without changing the output. It's just a simple magic 8 ball program using dialog boxes.
import java.security.SecureRandom;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
public class MagicEightBall {
pub... |
In less that 5 seconds on a normal PC, I found the answer in simple brute-force. Before I met Go, I didn't believe that it will be so easy to use all the power of the PC by using Go Goroutines for concurrency and multithreading.
I tried exactly the same simple algorithm, without concurrency in Haskell and JavaScript. I... |
My goal with this bit of code is to check if my processor supports rdrand and, if not, execute some other random number generating function. To check if rdrand is supported, the 30th bit in the ecx register should be set.
I guess my one of my dilemmas is whether or not I should explicitly check inside level 1 but I thi... |
My code shares some values with its neighbor. The names "Instructions, Registers" can be ignored in the comments; just see them as "names". What's important is how they are shared, which can be seen in the calculations.
What I want is to improve this code, because it looks awful and one can barely understand what's goi... |
I am trying to optimize the filter method for RecyclerView Adapter in Android. The list is used as an ArrayList. I have seen this post but they are filtering from the original list every time. They are not using old results if a character is added.
Example: if there are 10 results for String 'a' then user type 'm' , 'a... |
My project is using a specific version of JDK which is jdk-6 and the default JDK_HOME path will vary from distribution to distribution, so I wrote a script to guess it. Is there any way to do this better?
#!/bin/bash
JAVA_HOME=""
JDK_TEMP=""
shopt -s extglob
JDK_ROOT_DIR=( /usr/java/ /usr/java/jdk/ /usr/j2se/ /usr/j... |
The base64 decode algorithm is taken directly from Base64 wiki page. This exercise is meant to help me learn Rust, so any pointers in that general direction are very welcome. :)
fn main() {
println!("{}",
hex_to_base64("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d75736... |
I've a standalone Java application, which basically starts and manages two socket servers. I'd like to configure server ports in a .properties file using the following class.
class ApplicationConfig {
private static final Logger LOG = Logger.getLogger(ApplicationConfig.class.getName());
private ... |
I've written a program that solves questions of:
Addition
Finding the hypotenuse of a triangle
Checking if the triangle has a right-angle or not
I've also written it to be viewed in English or French. There's a few errors regarding int and while but it still works all the same. In case of any exception, I just termin... |
I'm compressing an array of strings in an Android app. Is there something you would suggest?
public static String compressArray(String[] data){
String jsonData = Arrays.toString(data);
try {
String compressedData = compressString(jsonData);
int compressedLength = compressedData.length();
... |
I've just solved this problem and I hope you guys give me any feedback to make my code be better.
Problem: There are N strings. Each string's length is no more than 20 characters. There are also Q queries. For each query, you are given a string, and you need to find out how many times this string occurred previously.
... |
Basically, if the function parameter is None, I ignore it, else I concatenate all arguments like arg1:arg1_value AND arg2:arg2_value AND arg4:arg4_value considering arg3==None when the function got called.
def _get_query_string_for_get_config(self, host, app_name, instance, config_source, config_name):
query_string... |
There are APIs like the Except extension that require the IEqualityComparer<T> to work. I find it's too much work for such a simple task to implement an interface so I thought why not automate it.
I implemented this interface in a reusable fashion so that I can use it with any value and any number of properties.
inter... |
I'm making a text based java game to help me learn java. I would like to know if I am doing things ok and if there is a better way to do the things I'm doing thanks. I have two separate files.
adventure.java
package sam;
import java.util.Scanner;
public class Adventure extends TheGame{
public static void main(String... |
I got sent a challenge from a friend;
You are given a file that contains numbers, one number per line. Convert the numbers from the file into roman numerals.
Test input:
45
65
23
98
123
7754
Expected Output:
XLV
LXV
XXIII
XCVIII
CXXIII
MMMMMMMDCCLIV
I think I've succeeded in doing this successfully, and would like ... |
I made a simple temperature converter to serve as an introduction to swing. I used Eclipse WindowBuilder and did not attempt to make the components more modular. I'm curious as to how you guys would organize this code to improve readability.
Also, if you have any other criticism I'd love to hear it.
import java.awt... |
I started working on some code, and it works, but I feel like it could be done more effiently. Below is a portion of it to show what I'm doing. To simplify the idea, I've made it here so if the cell in column M is A, B, or C, it puts a 1 in column L. If column M is a D, E, or F, it puts a 2 in column L. And if column M... |
Always the endeavour to write cleaner code or in general better code.
I have a scenario where I receive an object OrdersRootObject which contains a list of Orders, BillingInfo, ShippingInfo, LineItems ... etc whilst receiving the object I need to connect to an additional data store ClientConfig, in which yet performs m... |
After learning prime factorization today, below is the C code written,
#include<stdio.h>
#include<stdlib.h>
#define FIRST_PRIME 2
typedef enum {false, true}bool;
bool isEvenlyDivide(int compositeNumber, int number){
return (compositeNumber % number)? false:true;
}
int findOtherFactor(int compositeNumber, int numbe... |
I have a basic example of a REST API that I've done to control LEDs. I've read Dr. Dobbs article about REST and how to do it but I feel that my example doesn't look professional for some reason. Particularly the main menu on GET / request. Could anyone please suggest improvements?
import falcon
import json
LEDS = {"r... |
I'm new to PHP and I didn't know there is something called coding style standards. Now I'm trying to stick to PSR coding style standards and after reading PSR-4, which is about autoloading standards. I wanted to change my php project to follow the standard. I'm also trying to change my project to be OOP rather than cur... |
I just recently started reading the python.org documents and it looked like a really interesting language. Now, since Visual Studio 2017 supports Python, I decided to finally actually start learning it. My friend challenged me to write a program that checks if a number is an Armstrong number.
import sys
def isArmstron... |
I have reached a mini-capstone where I am asked to create a tic tac toe program. I have successfully created the program. What I'd like feedback on is two things:
1. How do I number my columns like I numbered my rows?
2. Can you spot areas where this code could be written in a more optimal manner (i.e. better code reus... |
I've got a lot of links (150+) in an href (here I can only post 2) and I want them to be opened in a new tab or window. I've got this piece of code that works, but before I add it to my website and before I add it to a lot of articles of mine (250+), I want to make sure the syntax of the code is 100% correct. Also, do ... |
I'm a hobbyist programmer.
What I try to do here is to read 8-bit grayscale PNG file. Then unfilter it. (That caused a headache). And after that perform Prewitt operator for "edge detection". I know that there is million and five libs for this but I want to learn why and how these things works.
I try follow OOP-princi... |
I am trying to wrap a responseJSON function of a Request class of Alamofire because when I send an API request I get a response in a specific pattern. I have achieved this, but I am still not satisfied with it. I can see much code repeated in both "handle" functions. One is for handling an array of Mappable type and th... |
I've written the following unsafe C# method to convert a byte array to Base64 encoding. It works, but it runs at a significantly slower rate than the built-in Convert.ToBase64String method.
public static unsafe string From(byte[] data)
{
int div = data.Length / 3;
int mod = data.Length % 3;
... |
I have created a trie in Python and am looking for feedback. Specifically, I am looking for feedback on:
If my code is 'pythonic'
If my logic is proper when inserting and retrieving from the trie
I have implemented the following logic:
Insert a word into the trie
Check if a word exists in the trie
Given a prefix, g... |
This code is meant to implement a Graph class which has a method that returns a path between 2 nodes using breadth-first search.
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures for an upcoming coding interview.
from queue import PriorityQueue
from collections imp... |
I have a simple application that can receive and send tcp data.
right now there's a thread used to start the listener and within this thread there's another thread to receive.
it works but it seems like a waste of resources. Can the connect be simplified?
public partial class Form1 : Form
{
private readonly... |
I would like to find out if there's a cleaner way to go about validating input before it goes into a function. What I'm doing seems like a lot of code, I'm sure there's a better way. I would also really appreciate some constructive criticism as my goal is to grow as a developer so anything you may see wrong with it or ... |
I've been refining my previous idea for pretty exception strings and made the following changes:
Exceptions can be ordered.
Prints all properties including Data.
The stack trace formatting is now more eye friendly.
Added indentation for inner exceptions.
Examples
Output for Exception.ToString() does not contain any ... |
I would like to write a small helper to filter datasets. Each dataset is a dictionary and some filters I want to apply are common to all the datasets.
That my needs, I wrote this following pattern:
class Dataset(dict):
"""Just a regular dictionary that can be filtered using filters."""
_filters = []
def add... |
My server receives requests in one thread and responds in another. I am using thread pools of pthread-s for both receiving and sending. The performance is not that bad, however...
When I am doing the same algorithm in one thread only(MULTITHREAD not defined) so that both recvs and sends are in the same worker thread, m... |
A week ago I requested a review of my code for a game of Snake.
First game of Snake
I made some changes based on your answers and now I want to show you present code. Something else to modify here?
GameMain.java
import javax.swing.*;
public class GameMain extends JFrame{
public static void main(String[] args... |
I receive a message that contains a collection of items that need to be processed.
Processing each item involves sequential calls to various services.
The services return a CompletableFuture that will be completed when the result is available.
Data directed to certain services needs to be sent in a specific order.
Fo... |
I'm beginning with Django and I have a Civil Status project.
I created my first models.py in order to get a Form, but I had some advices in order to normalize my database.
I made this process and I would like to know what do you think about this new restructuration.
My old models.py :
from django.db import models
from... |
This is my attempt at making a 'rock, paper, scissors' game in python. The game takes the user's input and the computer's random selection and calculates who has won. All feedback appreciated.
from random import randint
def getUser():
print('Rock, Paper, Scissors: ')
userIn = input().lower()
if userIn == ... |
This is my first program in akka so I wanted to know if the program is efficient and is using the advantages of actor model.
The program's purpose is to scan a given directory for any files and print the number of lines in each file.
The main Application class will create the actor system and send a Scan message to a... |
Yesterday I posted a question about converting an integer to it's Roman Numeral equivalent. Apparently you guys liked it and gave me some good advice, so I decided to take all your advice, and go a step further, it will now not only convert to Roman but will now also convert to Greek numerals.
I would like some criti... |
I'm curious about the best way to instantiate my repositories. Currently they're in the main controllers constructor method.
I was thinking making separate controllers for inbounds, outbounds, directs then instantiate the correct repository in the controller constructor. But that seems redundant in some ways.
I am wo... |
I've done an equation system that takes as input the equations (you choose the number of equations), and gives as output the values of the unknowns.
I splitted the code in four files:
-equation class(move all to left member and acquire values)
-matrix class(find determinants)
-equations system class(craft matrices to ... |
I'm new to programming in Python, and I am trying to create a multiplication exercise generator. I've got the following code for the solution, but I'm wondering if there is any more elegant solutions than this one.
Note: I have not covered lists, tuples, or dictionaries as of yet so I'm using the absolute basics to cre... |
Given sample_size many arrays of length dim. For each index from 1 to dim, i want to give a list of indices, where no sample contained in both indexes 1s. The code is really slow and i want to improve the performance.
# Test set
dim = 10000
sample_size = 1000
from random import *
randBinList = lambda n: [randint(0,1... |
After my Brainfuck Interpreter written in x86 Assembly I decided that it was time to get to the next step, writing a Brainfuck Compiler in Java that generates x86 Assembly and compiles that to an executable.
Currently it only supports Windows and it still uses NASM and GCC as dependencies to transform the x86 Assembly ... |
Intention
I intend to replace my own Bash script executing the following commands indefinitely in favor of this C++ compiled code, the reason being that the Bash script seemed very CPU ineffective.
It's not that I would think this solution is effective, nor perfect, but better than the one written in Bash for there is ... |
I've recently started studying C++ (from internet) Made my very first program, calculator. It works, but i'd like to know how could i make this more "advanced"?
#include <iostream>
using namespace std;
int pluss(int num1, int num2)
{
int answer = num1 + num2;
cout << num1 << " + " << num2 << " = " << answer <<... |
Here is my code for implementing an adjacency list from scratch. I would like to get feedback from the experts for optimization.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
/*a single node of an adjacency list*/
typedef struct adjList{
int dest;
struct adjList *next;
} adjList;
/*Image of... |
I wrote a bit of code that takes a file, justifies the text and writes to another file.
It uses a DP approach to minimise a badness metric, which is the amount of undershoot of the line length, cubed (see my answer below, the badness function isn't quite right if there is an overshoot, the badness should be inf - I bel... |
I'm trying to optimize this twiddle computing function:
void twiddle(int N)
{
int i;
for (i=0;i<N;i++)
{
twiddle_table[i].re = (float) cos((float)i * 2.0 * PI /(float)N);
twiddle_table[i].im = (float) - sin((float)i * 2.0 * PI /(float)N);
}
}
where N = 4096 size of twiddle table and could be bigger... |
I have this brute force code, where you input a password and runs through combinations of numbers, lowercase and uppercase letters, and special characters until it match the password given.
The problem with it, is that it took about 2 days just to crack the password "password".
What is a way that I can speed up this pr... |
Please refrain from negative comments about the code being poor and inefficient and not idiomatic. I know that much, and that's why I'm here.
I need a function, that takes a byte array and length and returns a byte array.
The function need to do the following:
Drop any leading zeroes in the byte array
If the array len... |
I am trying to use an algorithm similar to the Apriori algorithm for discovering frequent itemsets. This program hashes 2 strings to an int and maps them in the HashMap. I'm not concerned with how good the hashing algorithm is but whether or not it is a good attempt at my own implementation of counting frequent item se... |
I am learning redux by doing a small project. Everything is working fine, but I need to know how I can refactor such code. For this situation, it might be good to use if conditions like I have done, but what if I need to handle 7-8 languages? It won't be viable to use else if for 7 times. What is the proper way to hand... |
I wrote code to solve the running median challenge using 2 heaps, and I'd appreciate any and all feedback.
Here is the problem:
You have a list of numbers and are scanning them one by one. Calculate
and print the median every time you get a new number.
My code:
//program code
var minHeap;
var maxHeap;
function ma... |
We have an object that needs to be converted to a different type before storing it in database. For that purpose, the library provides an annotation over the field that specifies the appropriate class[given as ClassName.class] to use for converting back & forth.
The class implements an interface of the library that has... |
Description:
Its not a programming challenge but I though to write a small utility which will return the path to a primitive value in a possibly nested object. The idea is not original.
Code:
console.clear();
function each(obj, cb, path) {
path = path || [];
for (let k in obj) {
let val = obj[k];
if (isLea... |
I have written the code below as a BFS implementation. Could someone please review. In particular, I want to know if there could be a memory leak.
#include <iostream>
#include <list>
class Graph
{
int number_of_vertices;
std::list<int> *adjList;
public:
Graph(int number_of_vertices);
void ad... |
I have created a method to check for null/empty values of class properties and if any null property is found I'm stopping the checking process and returning the result as true. I've used a solution from here and following is the code I have implemented:
/// To check the properties of a class for Null/Empty values
/// <... |
I wanted to have a good review on my code I wrote today to read files in C++ line by line. The file can look something like this:
# Program configuration
network.port=30000 # The port the server uses
network.ip=127.0.0.1 # The IP the server uses
Notes:
Lines that start with # won't be processed
Lines that are empty ... |
I have implemented a data structure that allows storage of number of users of a hypothetical application in a tree-like data structure in nodes as per their classification based on categories such as Gender or Country which have specific values such as Male and Female and India, China and USA respectively. The requirem... |
I need to find the substrings within my array. If I have an array: ["abc", "abcd", "abcde", "xyz"], my method should return the array members: abc, abcd, abcde as each is a substring or a superstring of the other, but it should exclude "xyz" as it is not related to other strings in any way.
function find_substrings(arr... |
I have a need to try to automate the testing of a large Web Service with an XML API interface. The framework takes the form of a Mavenised Java project.
The usual maxims apply: must be highly extendable, maintainable and ideally will be relatively data driven: requirement to parameterize the tests to accept different... |
I've an ArrayList of Object that could contain String, Date and Long. The Object list is nearly mandatory. (I obtain this list through reflection, reading all the member variables of an unknown class.)
ArrayList <Object> values = new ArrayList<Object>();
I build dynamically a query for Alfresco cmis from it:
... |
I am able to solve this challenge but when look at my code I know it is not good.
The challenge:
Bill and Ted are taking a road trip. But the odometer in their car is broken, so they don’t know how many miles they have driven. Fortunately, Bill has a working stopwatch, so they can record their speed and the total time... |
I am posting my first project in C++ (and also my first in object-oriented programming), can someone review it and cross check that everything I have coded is alright? If you have any tips to improve my code please tell me. The project is running and working. This is a home assignment and I know there are no default co... |
I've created this program to show how to stop threads in a controlled manner.
Important points in the program:
Starting and waiting for threads
Exception handling
Stopping threads in a controlled manner via the CancellationToken.
Overall simplicity and correctness.
The scenario
3 tasks with access to the same List t... |
This phonebook application has a menu, which sorts by name or category. I do it like this in MainActivity:
Bundle bundle = new Bundle();
Fragment lvFragSortBy = new ListViewFragment();
switch (item.getItemId()) {
case R.id.menuSortOrderName:
item.setChecked(true);
bundle.putString("sortBy", "name... |
I've written a simple log writing class. My code is also hosted on my Github.
Specifically, I am looking for criticism on these items:
Resource management. What is a more correct/safe way to obtaining a hold to stream-like objects?
Clarity. Is my code as clear as it could be?
Error handling. I've only had a few classe... |
I am trying as a part of a bigger job to merge parts of several JPEGs into one huge BMP which will be processed further.
As a start, I tried to just copy a few JPEGs each to his own BMP file. In doing so I noticed that Visual Studio 2015 Community shows increased memory consumption if I repeat the copying of files in ... |
I wrote a library that detects the version of the ECMAScript that is running on JavaScript, and that also allows to check support for few syntax-features.
For the ECMAScript version detection I run 4 checks, each check tests if JavaScript supports some features of a specific ECMAScript version. Until a check is success... |
This is the code I currently have for adding various elements inside the svg and then inside a circle. On the text element I added 3 attributes that are the same. But I haven't found a way to remove this to minimize code.
var node = svg.selectAll("circle")
.data(nodes)
.enter()
.append('g')
.append("circle"... |
I have a little function that parse a nested list of coordinates into a flat list of compressed coordinates. By compressed coordinates, I mean that only the delta (distance) between each coordinates are stored in the list and the float coordinates are transformed in integer.
input = [[-8081441,5685214], [-8081446,56852... |
I'm requesting from a web API information about 20,000 people that I need to update continuously at lightning speed (the web server doesn't throttle the number of requests). I can request an update on 20 people at a time (it's the maximum allowed per request) so i loop the List of people and ask the server info on grou... |
I'm doing a CodeEval challenge, where the object is to find a famous writers name and a year, inside of a random given string.
You have a set of rows with names of famous writers encoded inside. Each row is divided into 2 parts by pipe char (|). The first part has a writer's name. The second part is a "key" to generat... |
I just finished my very simple and beginner-friendly C project and wanted to hear your thoughts and opinions about ways to improve it or something.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void getFile();
void createFile();
int main()
{
createFile();
getFile();
return 0;
}
void createFi... |
This function generates all factors of an input n.
It begins at the square root of n, and checks numbers down to zero. When a factor x is found, then another factor must be n divided by x.
Also, if n is odd, only odd numbers need to be checked.
from math import sqrt
def factors(n):
"""
Generates all factors o... |
I'm a beginner in CSS and need help with a suggestion.
I'm working on a project, in which I managed to position container_main right next to container_menu giving the remaining dimension of the screen, giving it relative position and floating it to the right. container_menu has a dimension and a fixed position specifie... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.