instruction stringlengths 71 95.1k |
|---|
Background
I'm writing code that searches for the row number of the maximum value in a partial column of a matrix. The partial column corresponds with the non-zero values of an equivalent lower triangular matrix. That is, starting from the input row index idx through the final row. (This is my own version of subrouti... |
Project Euler Problem 76 asks:
How many different ways can one hundred be written as a sum of at least two positive integers?
My code is correct but just works slowly.
import time
start = time.perf_counter()
def con(H):
J = []
Q = []
W = []
for i in H:
for j in range(len(i)-1):
Co... |
Here is the question:
Given a 2d grid map of '1's (land) and '0's (water), count the number
of islands. An island is surrounded by water and is formed by
connecting adjacent lands horizontally or vertically. You may assume
all four edges of the grid are all surrounded by water.
Example 1:
Input:
11110
11010
1100... |
I loved Norvig's Lispy, and made the first version of it in Rust, to learn Rust. I would love your thoughts :)
A few specific questions:
Is there a way to write ensure_tonicity without a macro? I tried, but was having trouble typing it
What do you think of passing in &mut RispEnv in eval. I needed to do this to imple... |
The problem is from yesterday's contest from Codeforces.
I have observed that, from the left side (i.e. MSB), for every digit, if we replace the given number with the output of f when after passing the digit - we get a bigger number we will get the desired output. I'm a beginner in programming and have written code wit... |
I've decided to move my rendering code to a separate thread, to help facilitate the move I've created a pipeline system for rendering. With this pipeline I can insert commands into a queue which will be processed later on the rendering thread. Thus far the code has proven to work well, but I would like to know if there... |
I have the following ReactJS unordered list which is generated from answers:
<ul className="mt-2 col-md-12">{this.state.answers.map((v,i) =>
<li className="list-group-item" style={{"width": "220px"}}
key={i}> {v} </li>) }
</ul>
I get answers the following way:
handleSubmit(event) {
const url = "api/" + t... |
I implemented binary search tree. What do you think about my code? How could i optimize it? Where are my major mistakes? I am not asking only about BST but about my coding style in general, using of classes, methods, naming...
using System;
using System.Collections.Generic;
/// <summary>
/// My implementation of BST. I... |
This program is the basis for a bigger game I'm working on. I want to make sure I did this correctly before moving on. Please give pointers to anything I can improve. I'm learning on my own, so I doubt my structure is the best it can be.
enemy.py module
class enemy:
'''
This is how to define users and items
... |
i am not the best at security but need a custom way to securely store personal identifiable information like name, address etc - Can i please have some feedback on this custom code, from my perspective it looks okay but with security not being my strong point i don't trust myself.
The data is passed from my application... |
Although UTF-8 validation is a common task, I'm trying to solve a slightly different task; given a string of bytes, work out whether it could potentially be a fragment of a valid UTF-8 string. That's a much less common task, so I thought it'd be easiest to write the code myself. Here's the Perl subroutine I came up wit... |
# Collect the values of a map into a mapset
def values(map) do
Enum.reduce(map, MapSet.new(),
fn ({_, value}, acc) ->
MapSet.put(acc, value)
end
)
end
values.(%{"a"=>1, "b"=>1, "c"=>2}) |>
IO.inspect
Is there a cleaner way to write this values function?
|
We have a list of points on the plane. Find the K closest points to
the origin (0, 0).
(Here, the distance between two points on a plane is the Euclidean
distance.)
You may return the answer in any order. The answer is guaranteed to
be unique (except for the order that it is in.)
Example 1:
Input: points = [[1... |
I want reverse the string with the same order. We should not use the Array functions like split(), .reverse() and some other array functions also except array.length.
Here i am attached my code. How to achieve that thing more efficiently.
var str = "i am javascript";
// result "i ma tpircsavaj"
function reverseString(m... |
I implemented a basic binary heap in Common Lisp to learn programming using the CLOS. It is quite neat and self-contained, the core of the program is about 100 SLOC. The whole repository can be found here.
The crux of the program is binheap.lisp:
;;;; Binary heap implementation.
;;;; We implemented this structure using... |
The task is to compare students homework SQL files with mentors SQL files.
I've written two functions, which return a two-dimensional array (1st elements are an absolute path, 2nd are a relative).
Then I'm going to compare the relative path of students and mentors and execute SQL files (finding using absolute path) if... |
I am writing a function to decode Argon2 hashed string to extract parameters. I need to handle many decode errors, and handle those errors lead to write many repeating if err == nil check code. Is there a better way to do this kind of check?
The encodedHash string follows the format, separated by $
"$argon2id$v=%d$m=%d... |
I created this code
@Service
public class TestService {
@Autowired
private Test1Repository test1Repository;
@Autowired
private Test2Repository test2Repository;
@Autowired
private Test1Mapper test1Mapper;
@Autowired
private Test2Mapper test2Mapper;
public void test(Map<String, Object> body){
if("test1".equals(b... |
I am working on a screen which has segmented control and has 3 segments (year value 2019, 18, 17) and what I am doing is that on each segment click I have to reload data inside a tableview (getting data from an API request).
let purchaseResponse = inputs.selectedTab.map { index -> String in
switch index {
... |
I'm using Sequelize and Google oAuth for authentication, I want to create a middleware that
Verifies the sent token passed in the headers matches the one the user was initially signed to.
Finds the user if he/she exists and returns it to the client.
The middleware be used for protected routes.
const getCurrentUser ... |
This is my code for Project Euler Problem #4
The question:
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
My code:
function problem4(){
let product = 1... |
I am looking for feedbacks about my ASP.NET Core Request / Response logging middleware, in particular in ways to lower the memory footprint and string allocations:
public class RequestResponseLoggingMiddleware
{
private readonly RequestDelegate _next;
private readonly ILogger<RequestResponseLoggingMiddleware> _... |
Question
Any way I can optimize this further using new C++11 or C++17 features? Would also like feedback on my variable naming, memory management, and style (notice my placement of varible_name++ in some areas), and how I've abstracted the sort into a recursive_merge_sort function and a merge function.
Code
#include <i... |
Is the following a cryptographically secure way to generate a random token? Does it have any of the predictability risks that are theoretically associated with using a GUID as a token?
using System;
using System.Security.Cryptography;
namespace myApp
{
class Program
{
static void Main(string[] args)
... |
This is an exercise to create a class that behaves exactly like an int.
Questions
Am I missing anything?
Or did I going about this about this the wrong way?
Is there anything I could improve on?
Are there any tricks that I could learn from this?
How about style; does the style look OK?
#include <iostream> // std::cou... |
I am using a library that specifically needs me to provide arguments as strings one by one. However, different combinations are possible. Right now I am using a bunch of elif:
def get_all_users(times=False, groups=False, ips=False):
"""Get a list of all users online"""
if times and groups and ips:
retur... |
I have a class which parses a .csv file and converts it into successful rows and errors. Currently I have 12 different kind of errors (mail is not valid, missing column x, row is duplicate etc.).
Each error has a custom message. I also need to know in other classes what kind of error a row was, so a simple string is no... |
I'm doing a application to work with PDF and TIFF files.
To divide them, the user opens the file or folder (if it is a folder, it gets all the files inside) and the app splits the file, getting a tiny image (thumbnail) in JPG format. Then it creates a ListViewItem adding the thumbnail, the name and the size of the file... |
This code belongs to a contest. I tried to apply the range of data to a std::map. The contest system however warns me that the implementation of the assign function is not valid. I don't know which part of the code is written incorrectly, hence the system doesn't reveal any details except that the implementation is err... |
I have a vba code which takes data from SQL database and dumps it into excel. I see that my query should extract approximately total of 120k records. I monitored this activity and learnt that even after 8 hours of my office time, the query is successful in extracting barely 70k records.
This is frustrating me as I am t... |
I wrote a solution to a problem based on the N-Queens problem which should use more pieces than just queens. Problem is it's very slow, it probably has to do with how I modeled data and my lack of knowledge on how to compare boards without the possibility of extending from an interface compareTo as I would do in a lang... |
I've to calculate 50% of tax .
So I approach it using two ways.
1) public static void main(String[] args) {
new Double(500) / 100 * 50);
}
2) public static void main(String[] args) {
new BigDecimal(500).divide(new BigDecimal(100).multiply(new BigDecimal(50)));
}
Using first way that's manually ca... |
I was try to reimplement the native call method in JavaScript.
Here we need to handle the object which we pass in the call function and additional params. I handle the additional params using eval() method. Is there any more efficient way to write it?
var name = {
name: "JavaScript",
version: "6",
}
function... |
My programs that I have written so far included only a few lines of source code. When I tried to write larger programs, it usually failed because I'm not a master of software engineering. This time, I want to play it safe and publish now from time to time parts of the program, which should be my first, successful major... |
Assumptions for use:
push() will only ever be called by a single thread.
pop() will only ever be called by a single thread.
Requirements:
push() needs to be as fast as possible. Requirements are stringent enough that I've determined that I can't use std::mutex (at least not in any way I've attempted to) as it is far ... |
I'm a crop scientist and am currently building a web app that collects weather data then generates and displays modeled agriculturally relevant output. My question centers around an increasingly complex Django view and a desire to learn about a potentially superior implementation if one exists.
I have a Django view tha... |
I have some long-time method (PrintInfo).
I need to know total steps of that method and track completed parts.
How to reuse same filtered query in:
TotalSteps (ex, Program: progressMonitor.TotalSteps = /* ... */)
method PrintInfo?
Description of example: .
I have BookLibrary with some hierarchy( BookCabinet → Box → ... |
This is a very bare bones program where a population of blocks learn to reach a target on a 2d screen (My attempt at making a smart rockets program)
I've only used python for 2 weeks so i'm positive certain aspects of the program have extraneous lines of code and unnecessary junk, so what are some ways I can optimize t... |
I implemented the cubic spline interpolation explained in
https://en.wikipedia.org/wiki/Spline_interpolation as a Python class. Of course, such an interpolation should exist already in some Python math libraries. However, this post is not about using an existing specific solution, but is rather about review of a code w... |
I am using jQuery data Tables server processing to show some data to user. The documentation instructs that the response that the server sends must have this data:
recordsTotal
recordsFiltered
data
when I am trying to provide this data, I have to query the database 3 times! One for total document count, once for filt... |
I'm trying to implement safe routes and checking if the user is authorized using only Context API.
I'm also trying to avoid that the user can see a PrivateRoute, but I'm not sure if I coverred all edge cases.
Also, is there a better way of doing this? Better implemantation or aproach to this?
I just don't want to use R... |
I am writing a python password manager, and I know there's a lot of scrutiny that goes into storing passwords (don't worry, mine aren't plaintext). I was hoping that this community could help me improve style, use of libraries, or anything else. Any and all pointers are gladly accepted.
There were a few ideas that I im... |
I have an attendance list like this.
problem: I need to set In and Out alternatively. but if I have only 3 records then I need to set 0 record In true. 1 record out is true. and 3 record has is both In Out is false. I tried like this its working fine. but I was checking is there any better way
ObservableCollection<Emp... |
Question
Say you have an array for which the ith element is the price of a
given stock on day i.
If you were only permitted to complete at most one transaction (i.e.,
buy one and sell one share of the stock), design an algorithm to find
the maximum profit.
Note that you cannot sell a stock before you buy one.
E... |
This is my Result class:
public class Result
{
public DateTime Checked { get; set; }
public bool IsWorking { get; set; }
}
Let's say I have theese results in list:
Date: ..., IsWorking = true;
Date: ..., IsWorking = true;
Date: ..., IsWorking = false;
Date: ..., IsWorking = false;
Date: ..., IsWorking = true;
... |
On my server I have a large json that is accessed by several applications. One application only needs a certain part of the json, so presenting the whole json to the application is an unnecessary increase of bandwith. (Original JSON: about 40 KB, Optimized JSON: about 500 b)
What I came up with is a php script to which... |
I have a nested array that represents a parent child relationship, that I need to convert to a tree structure.
Example nested array
list = [
['lvl-1 item-1', 'lvl-2 item-1'],
['lvl-1 item-1', 'lvl-2 item-1', 'lvl-3 item-1'],
['lvl-1 item-1', 'lvl-2 item-1', 'lvl-3 item-2'],
['lvl-1 item... |
I made a class to conviniently serialize/deserialize data. Now I'm stuck with the following question. Should I handle exceptions (use try-catch) inside JsonStorage or inside ConfigManager and other classes that might use JsonStorage in the future?
public class JsonStorage : IDataStorage
{
private readonly IFileSyst... |
I made this in order to teach myself pygame.
This displays an images loop at the same speed on any computer (It will lag on a slow computer).
Is my time management good or do my datetime call could be optimized to loose less time while doing computation?
Any other remarks are welcolmed.
#!/usr/bin/env python
#-*- codin... |
I am almost completing my BlackJack game in Javascript. But I realize that there must be a way to improve the performance for these two methods. Any pointers?
const hasAceInHand = (cardsOnHand) => {
for (let key in cardsOnHand) {
let arr = cardsOnHand[key];
for (let i = 0; i < arr.length; i++) {
... |
I finished CS50's bleep.py from pset6. I was hoping to get some feedback on my code (e.g., redundant code, bad practice, etc...).
Program function
load in a dictionary of banned words
accept a message from the user
if words in the message appear in the banned list, censor the word with *
from cs50 import get_string
f... |
I've creating a working subscription workflow for my webpage, which heavily utilizes a set of functions I've created for this purpose.
However, after doing some testing (functionality works fine), I've discovered the way I've designed my system is taking a heavy toll on the web-page load speed. My current suspicions ar... |
I am using the below code in Python to input a N*N matrix in its original form:
n = int(input())
l=[]
for i in range(n):
x=input().split()
c=[]
for j in range(n):
c.append(int(x[j]))
l.append(c)
print(l)
Here's the output:
2 #input n
1 3 #input row
1 5. # input another row
[[1, 3], [1, 5]] ... |
This is a program written in Sinclair BASIC (48 BASIC) for the Sinclair ZX Spectrum. It uses a hardcoded key (null right now) as seen in the bottom and outputs a stream of integers generated with RC4. Is there any way I can improve this particularly to get around 48 BASIC using one-indexed arrays (which makes RC4 hard ... |
I want to iterate a map of map in a java 8 way and get the entry which contains 40 in the value in the inner map.
I have tried the following code in order to do that. But I still don't understand whether there is a better way to do this.
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
imp... |
This is my code for my SqlDataAdapter which is similar to the code example given in the docs:
public static int CommitBirdData(DataSet pDataSet)
{
int rowsAffected = 0;
using (SqlConnection conn = new SqlConnection(connString))
using (SqlDataAdapter birdDataAdapter = new SqlDataAdapter())
{
Sql... |
I was wondering how I could streamline the following code. This was the project assigned to us:
The Canadian Forest Service wants to do a simple simulation of the growth and pruning of forests. Each forest has a name and exactly 10 trees. The trees are planted when they are 1' to 5' tall, and each tree has a individu... |
I wrote a simple function that finds a word in a string without use of the re module.
My function looks like this:
def find_in_string(string, word):
Indices = ()
wordlength = len(word)
for i in range(0, len(string)):
if string[i:i + wordlength] == word:
Indices += (i,)
return Indices... |
I've been doing a Java for beginners course for a few weeks (2 hours a week), we had an exam question.
Take a sentence as an input from a user for twitter. Using only String
Arrays and String Buffers (do not use split() or any other methods not
covered in class yet). Separate the sentence into words and add to an
... |
I am learning how to program in opencl and I made a simple program that simply takes an array and adds 1 to every element. I want to run it many times (this is just so that i can benchmark how it does against my cpu, I understand it is a dumb application).
I feel like the way I am doing it right now is inefficient beca... |
I found a Go language code to do RGB to YCbCr conversion from here! I ported it to Java:
private byte[] generateColorBar(int width,int height) {
final int COL[][] =
{
{ 255, 255, 255 }, // 100% White
{ 255, 255, 0 }, // Yellow
{ 0, 255, ... |
I have created an open source project that uses Rspec to validate the formatting of AWS::CloudFormation::Init YAML blocks in CloudFormation templates.1
My project is here.
Some general concerns:
Is this a valid use-case for using Rspec?
Is the documentation in the code okay?
I have some specific concerns about the co... |
How can I do this in a more performant way? I'm concerned that throwing the data in a queue like this is defeating the purpose of yield from the open() and also how about handling the shared reference to file handle?
import hashlib
import sys
from threading import Thread
import queue
class HashWorker(Thread):
de... |
The program needs to only keep directories that have at least 1 .osu (.ini like) file with certain restrictions in them.
It also needs to delete duplicate .osu files.
But since duplicate files are only in duplicate directories (never in the same directory), we can also just delete all but one directories with a similar... |
I'm trying to use scrapy to find image URLs that are used more than once on a website across all pages.
This is my spider:
# -*- coding: utf-8 -*-
from collections import defaultdict
import scrapy
from scrapy import signals
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
... |
I have created a logical AI for a Tic-Tac-Toe game. I want a review about how good or bad it is. Here the computer AI will defend all your attacks as well as try to attack whenever it gets a chance.
import java.util.Random;
import java.util.Scanner;
public class TicTac {
static {
System.out... |
We have a
string text =
"SOME OTHER TEXT
WHITE SPACES AND NEW LINES
[HitObjects]
109,192,7241,1,0,0:0:0:0:
256,192,7413,1,0,0:0:0:0:
475,192,75865,1,0,0:0:0:0:
329,192,86524,1,0,0:0:0:0:
182,192,256242,1,0,0:0:0:0:
256,192,306521,1,2,0:0:0:0:
WHITE SPACES AND NEW LINES
"
The third number of every row is the millise... |
This is the latest version of my Blackjack game that uses a MySQL database to store user info. I did everything I was recommended in my previous post, added a ranking system and also fixed a bug where you could make infinite money.
from random import shuffle
import os
import cymysql
from getpass import getpass
import s... |
I am in my first high school programming course; the assignment is:
Write a program that asks the user to input three integers and outputs
a message indicating their sum and whether it is positive, negative,
or zero. You should create 2 classes to run this program. One class
contains all of the procedures for yo... |
Given an array nums of n integers where n > 1, return an array output
such that output[i] is equal to the product of all the elements of
nums except nums[i].
Example:
Input: [1,2,3,4]
Output: [24,12,8,6]
Note: Please solve it without division and in O(n).
Follow up: Could you solve it with constant space comp... |
I made the login flow without any reference to a tutorial. So I want some feedback.
Basically it sends username and password in a POST request to /token. The app stores the tokens on device, then uses the auth token to request customer profile data.
LoginPageViewModel
public class LoginPageViewModel
{
public LoginP... |
I got a long string, let's call it Story.
I fetch this story from a database so I don't know how long it is.
I want to display this story in a view, but what if the story is too long so it doesn't fit in one view?
I don't want to adjust the font size because it may be a very long story and making the font size smaller ... |
I've created the following module to allow me to generate a SHA256 signature for a file. (In real life this is used to verify an image file hasn't been amended). The cut down code looks like this:
open System.IO
open System.Text
open System.Security.Cryptography;
// Get the SHA256 hash of a file
let SHA256 (file:Fil... |
I have employed an AES algorithm in order to encrypt files within a GUI. I was wondering if my algorithm is secure. Could I change anything to improve it? Is my IV secure and is it producing different random numbers each time? Am I transferring the salt successfully?
I know that I could improve this by making separate... |
I implemented my own spin on the Atbash cipher in Ruby:
# frozen_string_literal: true
module Cryptorb
# The Atbash cipher
module Atbash
module_function
# Encrypts a string
#
# @param plaintext [String] the message that will be encrypted
#
# @return [String] the encrypted message
def ... |
I've been able to reduce my solution to constant time. Is it possible to reduce this by any constant factor further? (Besides trivialities i.e. inserting constants, not lazy importing). Specifically, I'd like to speed up fastMinPayout if there is a way to do it without using log.
Lovely Lucky LAMBs
Being a henchman is... |
The problem is
Given a non-negative integer n, return all valid parentheses strings
with n open parens and n close parens.
My algorithm (represented by the MySolution class below) keeps a count of the open parentheses on the stack, and does a recursive depth-first search of possible strings.
Another algorithm (rep... |
I have an interactor/usecase class in my application. My application follows MVVM architecture with interactor/usecases responsible for logic (e.g. get data from api-service, store in local-database etc).
Now I am trying to write unit tests for my interactor classes.
Here is one on those classes:
public class ChangeUse... |
Given a string, find the first non-repeating character in it and
return its index. If it doesn't exist, return -1.
Examples:
s = "leetcode"
return 0.
s = "loveleetcode",
return 2.
Note: You may assume the string contain only lowercase letters.
My solution
public class FirstUniqueCharacter {
public int firstU... |
I have a function that returns a string that indicates if an element is the same as another element(s). The logic is:
function duplicates(duplicatesArray, id = 1) {
var duplicates = '';
var count = 1;
var length = duplicatesArray.length;
var _id = null;
for (var i = 0; i < length; i++) {
... |
I'm trying to create a shell prompt that displays the $PWD in a "smart" way. I want to display the top two directories rather than the full path. If $HOME is the parent (or parent of the parent) directory, I want to show it like ~.
Assuming my $HOME is "/home/user", here are a few test cases with expected output accord... |
The task
is taken from leetcode
Given a binary matrix A, we want to flip the image horizontally, then
invert it, and return the resulting image.
To flip an image horizontally means that each row of the image is
reversed. For example, flipping [1, 1, 0] horizontally results in [0, 1, 1].
To invert an image means t... |
def validate_time_zone
if time_zone.present? && org.present? && !org.country.states.map(&:time_zone).uniq.include?(time_zone)
errors.add(:time_zone, :invalid)
end
end
I have a user model with the following relations:
User can optionally belong to Org
Org belongs to a Country
A Country has some timezones (not ... |
I wrote a function that iterates over 3 parameters to spot out-of-stock items. To illustrate this I'll draw an example: suppose that the product 10 in store 2 for an offer named "super5" is following this trend
day | qty
1 50
2 70
3 55
4 67
5 13
6 0
Offer finished at day 6, the product was pot... |
This code is tested and works, but I am needing some guidance on simplifying these loops with non-contiguous ranges. I was thinking an array might be better, but I haven't had enough experience with Arrays to know where to start with one. Any guidance would be greatly appreciated.
Dim r As Range
Dim v
For Each r In JHA... |
Bukkit/CraftBukkit/Spigot are Minecraft server extenders that allow for creating and using plugins. A particular type of plugin is a generator, which creates the game world. Generators operate chunk-by-chunk, where a chunk is a 16x16x256 area of blocks. First, the generator creates the terrain of the chunk. Then, the g... |
Asked this on StackOverflow, not knowing that this would be a better place for the question...
I've managed to figure out a script in js to hide and show various elements. But, I imagine there must be a cleaner/simpler way to do this that what I've created? (without using jquery).
Essentially, I'm just using an event... |
The weekly coding challenge in Eric Normand's newsletter this week involves implementing Langton's ant.
I wanted something on my screen so I put together a simple re-frame app. The core functions relating to the ant:
world.cljs
(ns ant.world)
(defn init-world [width height]
{:width width
:height height
:grid (... |
I had the following interview question: Given an array of integers, for each member of the array find the product of all the other members of the array. So for instance, if you have this array:
{3, 1, 2, 0, 4}
you should end up with this:
{0 0 0 24 0}
I wrote this code which uses two loops, but I couldn't come up wi... |
I am new to TeX and here is my attempt to (ab)use mfirstuc to define an environment that counts the words. I am looking for suggestions on how to improve the implementation.
\documentclass{article}
\usepackage{mfirstuc}
\newcounter{wordcount}
%Make sure we don't accidentally overwrite things with \def and \let
\newcomm... |
When creating data-driven tests with xUnit we can use the MemberDataAttribute to get the data from a member of this or other class. This is very nice but it has one disadvantage, you have to specify parameters in the same order as the test method so you need to be very careful. I prefer to use names for that purpose be... |
I have a modelScan.php file, as you can see,
I have codes that repeated within the function/method. How can I make this code more readable?
<?php
/**
* Class for Scanning files
*/
class modelScan
{
/**
* Get the total size of file in the directory
* @param string $sPath and integer $iTotalCount
*/
... |
I'm trying to copy files to S3 after writing them locally:
I have 2 functions which I need to do this. What is the best way to refactor the code that exists in both.
s3 = False
if data_fp.lower().startswith('s3://'):
s3_data_fp = data_fp
data_fp = os.path.join(_TMP, os.path.basename(data_fp))
... |
I am confused if I can do like this:
$param = "%{$id}%";
$stmt = $conn->prepare("SELECT name, comp, date FROM stats WHERE date = ? AND name LIKE ? ORDER BY date DESC LIMIT 20");
$stmt->bind_param("ss", $param, $_POST['date']);
$stmt->execute();
$result = $stmt->get_result();
$count_rows = $result->num_rows;
$stmt->clos... |
There is an interactive program, namely Microchip Debugger (Later called MDB), which I want to communicate with from NodeJS program. You can think about it as any console-based debugger - they all do the same thing, just with slightly different output/input expectations. This question is about the lowest layer here - l... |
This is my code written to check whether a given number is armstrong or not . but the logic differs from the conventional logic of using integer and separating its digits and calculating , instead i optimize the logic of separating the digits using Sting and char array . Please review my code ?
import java.util.Scanne... |
I've been taking the Computer Science course on Codecademy. The course includes this project where we have to create a python script to find the cheapest shipping method based on the weight of an item and I'm just wondering if this is the best way to code the solution?
def ground_shipping_cost(weight):
flat_cost = ... |
This is my code to generate all possible Armstrong numbers between the two given numbers. The logic uses string instead of integer to separate the digits to optimize the code.
import java.util.Scanner;
public class ArmstrongNumberGenerator {
public static void main(String[] args) {
Scanner scanner = new Sc... |
I have a custom object that is based in the following models:
public class Filter<T> where T : new()
{
public T Object { get; set; }
public int Page { get; set; }
public int ItemsPerPage { get; set; }
}
public class TransactionFilter<T> : Filter<T> where T : new()
{
public DateTime InitialDate { get; s... |
I have coded an UI from dribble design as a challenge and completed it but I think The CSS I wrote is really bad. I am a beginner. How can I improve my CSS?. One of the main problems is that I am using position: absolute for positioning everything. I want it to be responsive.
This is the dribble design I was trying to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.