This was originally posted here. I'm hoping Code Review will be a little more helpful in giving me a concrete direction.
I've been working on a project based off of this tutorial.
Unfortunately, the controller classes in this are quite dense and have terrible separation of concerns. I should h...
...all the above being said, there's just too much that would need to be done to build a genuinely efficient shell implementation to make it a good StackOverflow question. This might be a better fit for CodeReview SE -- though I still hold to the initial "use another language" suggestion. — Charles Duffy21 secs ago
I am implementing a lexer for an experimental language by the name "Phoenix", the language supports four primary arithmetic expression for integers only (add, subtract, multiply, divide), variable assignment and print statement.
Typical input:
# this is a comment
value = 1 + 7 / 4 * (30)
print(...
@syb0rg It's definitely inspired by it, it just removes certain elements. So my view doesn't change, and sort is implemented in its own class. In that class, I forgo the boolean and just keep the switch case I had
This is my first decorator in Python! I found some of it on the internet but have tweaked it to our needs.
I am curious to know if the way I am trying to grab the instance is the best way to do so. Any other general improvements appreciated!
import logging
import time
def retry_and_catch(exc...
I am wondering the best way to setup a database class, to remove repeat code by using oop. This way if I changed how I connect to the database (eg.. switch from PDO to sqlsrv driver) I can just change it in 1 file, instead of all the files that use PDO. I've setup a class that I will show below, ...
Please note, editing code in answered questions, in response to posted answers, is against site policy; please see this page for more information on how this community has agreed iterative reviews should be conducted. Thanks! — Mat's Mug ♦6 secs ago
done
@Mat'sMug There was code missing from the question. The code edited in is not in response to my answer, but to my comments requesting to code to make it possible to review what the OP was asking to review. — Justin1 min ago
I built a small "todo" app with an object oriented JavaScript approach.
I have spent this morning reading on a few ways to approach this, and I've come up with the following:
document.addEventListener("DOMContentLoaded", function () {
var todo = Object.create(null);
todo.newTodo = func...
------------------------------ QUESTION ------------------------------
How can the following implementation of fractionParse be made
less ugly? (Preserving unreduced numerators and denominators is supposed to be a feature---as shown in the second example---so using readMaybe s :: Maybe (Ratio In...
Al my keys have a red light under them and that was also off, so I knew something was up ;)
:| Windows 10 Anniversary Update will likely be released on 2 August, I need to upgrade to Windows 10 before 29 July though... So either I need to delay the hard reinstall or stop programming for a while, as I want to use the Bash for Windows part instead of Git Bash and such
Now common issues include right-clicking in the Windows Explorer crashes the explorer.exe process and yesterday I couldn't get into Windows Update at all
First off, IIRC, that license only lasts for a certain period.
Secondly, you don't even need to do that. Just do the upgrade process to switch your license over to Windows 10, then you can reinstall from scratch without worrying about it.
Any ideas how I could improve this? I already know that there is no checking for anything other than a 1, so you can enter a 2 or an a or a b and it will be interpreted as a 0, not interfering with the program's functionality. What I would like to know is if anyone has any suggestions for improvi...
Is it good practice / correct to assign a class constant to an instance variable in Ruby?
Example:
Class Example
CON = "foo"
def initialize
@foo ||= CON
end
end
I think it's a best-practice question specifically about defining properties, that uses code purely for illustrative purposes. That would be hypothetical code on CR IMO
Otherwise... "what's the best practice about X?" questions are off-topic anyway
There's reviewable material in just about any line of code you can read anywhere, doesn't make it in-scope for CR
@Zak In the better late than never category, I think your first one probably has too many key relations, might make it difficult to keep all the things up-to-date with each other
I have a class hierarchy, each member of which may create IDisposable objects.
I added a List<IDisposable> property to the base class in this hierarchy, to which I add any disposable objects on creation. The root Dispose method iterates through this list and calls Dispose for each item in its li...
Ok, so this is one of those kind of opinionated topics, but based on your knowledge, opinion, and current practice, what is the best way to set the following scenario up?
I'm building an extensive data entry application, and by extensive I mean I've only got the basics setup which incorporates a...
@Zak I'm not sure if I'm a big fan of having a universal key like a recordid but I've never really used a database that was designed like that... it reminds be a little bit of AdventureWorks sample database from Microsoft
@Phrancis It's more because, for things like, say, notes, there could easily be more than one per (record, transaction, account etc.) and it makes no sense to have a [table]_Notes for each table.
@Zak OK good. As long as these Notes (or whatever things) share most of the same properties across those different types of items, should work pretty fine. You just want to make sure to avoid an Imperfect Mirror type of situation
@skiwi USB? You can just get a small adapter and use a regular full-size or even laptop HDD as external
@syb0rg I would say the USB part may make this less advantageous than a typical SSD installation, but if it uses SATA and the MOBO supports it I don't see why not
USB 3.0 has an upper limit around 5.0Gbps. SATA III has an upper limit of 6.0Gbps. Regardless of overhead these rates are far higher than what a mechanical HDD can sustain for large transfers.
Most mechanical HDDs won't be able to sustain more than about 1.5Gbps (HDD Speed results). So I doubt y...
So, I suppose if the SSD has a write speed greater than about 5 Gbps than SATA would be a bit faster
Time to try my hand at PE4 in C#...
I can think of ways to brute-force it, I feel sure there's a more elegant solution though
it's... complicated lol.. it's part of my Linq-to-Sage implementation, it basically wraps a Sage "View", which is an ActiveRecord pattern over COM interop and 2000 layers of crap to end up talking to a database
I need to dig into Castle Windsor and see how I could generate dynamic proxies to subclass the entity types - then I'd have much better change tracking
Here is the code, it's not getting the corners like I would like it to.
/* setters the min and max for x and y coordinates */
@Contract(pure = true)
private int getMinX(int x){ return (x == 0 ? 0:(x-1)); }
@Contract(pure = true)
private int getMinY(int y){ return (y == 0 ? 0:(y-1)); }
@Contrac...
@forsvarir I don't know much C/C++, but if the OP says it's working as intended, and the code doesn't actually work off undefined behavior, and merely wastes resources and leaks memory.. IMO the key here is whether the OP is interested in general feedback about any/all aspects of the code, or whether they have a very broad approach to asking a specific question about fixing memory leaks - the former is on-topic, the latter isn't.
> I am posting here on Code Review to see if someone could point me in the right direction. I have attempted to rewrite a bit of my code to see if I can address the errors, but to no avail.
@Phrancis I'm looking at one at least 3 TB, a couple of years ago I bought one for 99€ but seems like it's more around 120€ these days, on the other hand a 5 TB one is 140€
Thanks for pointing out the codereview section. I have never used that before in my life. You are totally right the question does belong there :) Yeah I do not think macros are any better. I was thinking maybe some kind of enumerator or typedef to join the constants. Also if I ever want to expand it will be hard because I need to make sure what goes with what. — Fredlo201056 secs ago
I submitted this script as part of a interview process. It was rejected and no reasons were given. I'm wondering what parts of my script were unacceptable. The script works, and satisfies the question, but I must be doing things very wrong.
Use Selenium, Watir, Capybara, or similar to automat...
Background
I wrote my very first Python program to answer a Superuser question
Question
I'm wondering how the application can be rewritten to make it as pythonic as possible.
Unittest code
import unittest
import os
import shutil
from DeleteDuplicateInFolderA import DeleteDuplicateInFolderA
...