Top new questions this week:
|
Randal Schwartz stole LISP's decorate-sort-undecorate idiom when he came up with what we'd later call the Schwartzian Transform. With all of my LISP knowledge disappeared through nine half lives, but ...
|
The code will move the mouse from a start point (xs, ys) to finish point (xe, ye) like a human would.
I'd like some help possibly shortening the code (by optimizing it) and making it more readable.
...
|
In this program, I have to check the range of a given age and then print a message as per the age. I want to optimize the if else logic.
/* Sample code to read in test cases:*/
import java.io.*;
...
|
def greatest(a,b):
if a>b:
return a
return b
def odd_check(a):
return not(a%2 == 0)
def go(x,y,z):
a = odd_check(x)
b = odd_check(y)
c = odd_check(z)
if a and b ...
|
I've been working on refactoring a project of mine and need some help. I'm looking to apply some design principles and patterns to make the code cleaner and easier to maintain. It looks like I'm ...
|
f-strings is a new feature in the upcoming python release which basically lets you do this:
>>> s = 'qwerty'
>>> f'{s} {1+2}'
'qwerty 3'
Not pleased at having to wait until ...
|
First Class Functions
So, VBA doesn't support functions as first class objects - no passing functions as arguments or storing them in variables.
I eventually found a way to implement function ...
|
Greatest hits from previous weeks:
|
I have recently written the following Pong game in Java:
Pong class:
import java.awt.Color;
import javax.swing.JFrame;
public class Pong extends JFrame {
private final static int WIDTH = 700, ...
|
To learn more about OOP, @nhgrif challenged me to implement a Shape abstract class (more details in code remarks below. Here is how I did it. Any and all advice appreciated!
Shape.java
/* nhgrif ...
|
Can you answer these?
|
I was bored the other day and decided to have a crack at Project Euler Problem 54 for some fun. Given a file containing one thousand poker hands dealt to two players, the task is to count the number ...
|
I'm developing an ASP.Net web application, using MVC 5. This application authenticates via LDAP and will assign an Identity Role of "Admin" to a designated user.
The Admin user will be able to go to ...
|
This is the application for small school, which will store students' info in Firebase and also retrieve data from Firebase. I am using JSON Parser to parse the data and save the same in Access tables.
...
|