> This is pretty fundamentally impossible, and probably honestly undesirable. Your hardware is racy, your OS is racy, the other programs on your computer are racy, and the world this all runs in is racy. Any system that could genuinely claim to prevent all race conditions would be pretty awful to use, if not just incorrect.
If you have working code which merely needs improvements then you're probably in the wrong place with this post. Code Review is where they handle existing / working code and do their upmost to improve it in terms of speed, security, sustainability, and longevity. Give it a try. They're good! In the meantime, you might want to look into moving your sheet into an array variable and do everything there. Here is something to get you started: stackoverflow.com/a/36875006/1153513 — Ralph22 secs ago
> When almost every class has the same prefix. IE, when a user clicks on the button, a SmurfAccountView passes a SmurfAccountDTO to the SmurfAccountController. The SmurfID is used to fetch a SmurfOrderHistory which is passed to the SmurfHistoryMatch before forwarding to either SmurfHistoryReviewView or SmurfHistoryReportingView. If a SmurfErrorEvent occurs it is logged by SmurfErrorLogger to ${app}/smurf/log/smurf/smurflog.log
@syb0rg, I don't have a problem with people answering off-topic questions, but there is a line in the sand when it should be done. I wouldn't go as far as to say "don't do it"
If there's a second one, you sort by it, otherwise you just sort by the first one. you can't assume everyone in the western world has a first and last name.
@DanPantry Sure, but the system runs on our company. And our company/industry runs on all sorts of huge systems which already assume people have first/last names.
For instance, we have to have a passport (or other govt. ID) on file for every client.
@N3buchadnezzar There's still room for further improvements — my solution is O(n^3 (log n)^2) but I think someone might be able to bring it down to O(n log n) by using the techniques for solving your question about binomial coefficients together with careful organization of the multiplications.
@DanPantry Payments is for money coming in. Commission splits will then be used to decide where it goes from there. X% to us, Y% to the adviser, maybe Z% to an introducer etc.
I noticed all your PK/FK fields seem to be GUIDs, I have a feeling, if you write SQL queries a lot, you may get tired of having to deal with D201B551-3F49-42AA-8F68-5794CC2FFDD5 type numbers. However, if they are primarily just used for joins and indexing, then you should be fine
I modified @Phil Sandler's code to remove the effect of calling GETDATE() (there may be hardware effects/interrupts involved??), and made rows the same length.
[There have been several articles since SQL Server 2000 relating to timing issues and high-resolution timers, so I wanted to minimise t...
GUIDs solve the problem where each node in a distributed system needs to assign ids that are globally unique without consulting a centralized database. But if you are designing a centralized database, there should be no need to use GUIDs — there is only one database, so it can assign unique ids
Was it GUIDs that are not strictly unique, but have the chance of your server literally disappearing from earth higher than the chance of a collision happening?
@GarethRees I feel like GUID has a specific technical meaning which I'm not aware of here. To me it just means (ID that does not appear anywhere else).
> While each generated GUID is not guaranteed to be unique, the total number of unique keys (2^128 or 3.4×10^38) is so large that the probability of the same number being generated twice is very small. For example, consider the observable universe, which contains about 5×10^22 stars; every star could then have 6.8×10^15 universally unique GUIDs.
Normally, if you're designing a database that needs to have a unique ID for each record in a table, then you can easily get the database server itself to generate unique IDs, for example by declaring a field PRIMARY KEY SERIAL in PostgreSQL or PRIMARY KEY AUTO INCREMENT in MySQL.
The problem comes when you need to generate unique IDs in a distributed system without consulting the database. GUIDs provide a mechanism for this — basically each GUID is chosen randomly and the space of possibilities is so big that collisions are extremely unlikely.
Genereal Introduction
This is my first project
which involves a Database
which involves testing (especially unit testing)
where the quality is really important for me.
The long term aim is to create two frontends for Android and normal Java and a backend with the database. That means, the a...
I tried to reproduce the merge-sort algorithm. It was tough as my understanding of list was less than stellar, a few days ago.
I will be honest, I'm ashamed of what I did but I tried to finish it the way I see it, with my knowledge at that time. I checked on the net and there are easier way to ...
Tree algorithms are kind of out of fashion at the moment, since many of their applications are better served by hash tables. This means that lots of nice tree algorithms that used to be important have been forgotten, for example Morris's algorithm for traversing a tree in O(n) time and O(1) space, or Sleator and Tarjan's "splay" algorithm that searches a tree and simultaneously optimizes the tree for a future search on the same or nearby keys
I'm voting to close this question as off-topic because OPENQUERY is not a matter of code review but rather a database-specific question/problem. This would be better asked on DBA.SE but reworded according to their on-topic guidelines. — Phrancis33 secs ago
I preemptively flagged that question for migration to DBA, but after further discussion they would prefer if it were re-posted and re-worded according to their guidelines
I'm thinking (for some time already actually) about creating a relatively simple application to replace an Excel sheet, what are my options regarding databases? So far I see SQLite is an option to embed it in the application directory or run a full-blown PostgreSQL server somewhere and connect to it (needs online functionality though), any opinions?
One nice thing about using SQLite as your data store is that you don't have to run your program to interact with it — you can just run the SQLite command line. For example, I can open Firefox's history database by running sqlite3 "~/Library/Application Support/Firefox/Profiles/*/places.sqlite" and then I can run SELECT * FROM moz_places LIMIT 2; or whatever
I'm designing a small Java desktop application to interact with my database and this is a very important part of it as a majority of the operations will be involving the SQL Server 2012 database. I am using the SQL Server JDBC driver (v6.0) provided by Microsoft.
I wrote a class to hold credenti...
In the single-user application case you'd rather not run a database server if possible because of the difficulties of installation, setup, upgrading, security and so on.
@Boneist That is incorrect - it can be used with both dates and timestamps. I just use it to explicitly state that the number 14 is 14 days so that there is no confusion during code reviews as to what the number means and the context in which it is being used. — MT035 secs ago
@Zak Better finding them at design time than after it's implemented. Trust me, designing/architecturing a database is not an easy task, but it's worthwhile to spend time upfront finding potential problems
The way to be confident that your database design is good is to have a reasonably comprehensive list of use cases, and then check that it's straightforward to implement each use case using your design
I've removed my downvote from here. Not sure whether it's a good answer now, but at least it's more than a code dump now. Can I get a second opinion on whether the notification is obsolete?
@Zak And now I guess you're going to tell me that you need to write an email if you want to see the database updated? No internal client or whatsoever?
Whenever I am designing a database schema, I start by writing down the use cases in a big list. I have one here: it starts (1) maintainer defines a device type; (2) maintainer defines test procedure for a device type; (3) operator executes test procedure for a device; (4) analyst defines pass/fail criteria for device based on test results for that device; (5) and so on...
Each use case has a "role" (here, maintainer/operator/analyst) and some action that involves the database. From the use cases I can deduce the schema items — there have to be database entities representing device types, devices, test procedures, test runs, test results, and pass/fail criteria.
@Zak suggestion: have Id int not null, DateInserted datetime not null and DateUpdated datetime null columns in all tables. What motivates using a GUID for a PK?
my understanding is that GUID collisions are technically possible if the GUIDs are generated on different machines, e.g. client-side. that's why a GUID should be generated on the server with the newid function.
turns out that the communication between teh dublin and LA offices of Riot is somewhat lacking
So while Dublin has been like "yeah sure you can interview this week" LA have dragged their feet.. and Dublin have only just noticed that the interviewers are not in this week
Or next week
...And any later than that and my 2 months notice period starts to run into the time I need to be in a new place
Because as far as I am concerned it is either this Thursday/Friday, or MAYBE sometime next week or not at all. Unless I can work some kind of miracle out.
The notice period IS for my job
it just overlaps with the time I would need to be out of my place
So the idea was that I could have the onsite this week, get the offer over the weekend, hand in resignation, bish bosh, be in Ireland before I had to be out of my place
But..... if it can't be this week, the earleist it can be is week beginning 4th of july, which puts my resignation AT BEST on the 4th sept. which is probably too late. and also after I have to agree to a new project or not.
I have some PHP code that I am trying to improve by putting it into a function. The problem is that it edits specific variables outside of itself.
Here is a general layout:
$edit0 = "";
$edit1 = "";
pseudo while loop {
if(!empty($day0[1])) {
if(strcmp($day0[1],"...
I have the following code snippet from a unit test using Mockito which has happily been passing for months/years.
TableRowCount downloadRowCount = new TableRowCount(tableDownloads);
//create the item that will appear in the table row
MyHSAItem item = createMyHSAItem();
Mockito....
They knew it in May, they have been told it now, they knew it on Monday when It old the interviewer, they knew it last Thursday when I told the other interviewer.. who seemd to have no idea about what was said in May
Just finished creating my first bot using Discord.js for the chat application, Discord. This is my first bot and first javascript program I have ever created. I'm mainly interested in ways I can optimize the code and make it a bit cleaner. Any help or suggestions is greatly appreciated.
Github R...
@DanPantry Do they not do Skype/video/phone interviews? I find it a bit silly to need to see someone in person for an interview when not practical (as is the case here apparently)
Again, it was practical up until the point where apparently 3 of the interviewers were not in on Thursday/Friday, not really sure whose ball dropped that was
I cant' take time off next week, week beginning 4th july is too late, tomorrow is apparently no-go. sounds like it's going to have to have me refuse the offer
I still haven't heard from the HR person about flights at all. The only reason I even know I can't interview tomorrow is because I was checking up every single day with the team lead.
@Zak Well, I mean, the interviewer I interviewed with LA had no idea about the fact I could only itnerview this week until last week, despite me telling the team lead a whole 3 weeks prior.. so it's possible information is not being shared effectively.
@Zak Senior person is the one who told me I won't be interviewing tomorrow.
The only other one is the one I am talking to tonight hopefully
@Mast my potential boss is the one I have been prodding literally every day
I had an interview with him on monday and he said I should hear by monday evening.. then tuesday evening.. then wednesday afternoon.. then nope, you're not interviewing because interviewers are not in
> We still don't know what problem your code is solving, and that should be in your title. There are major differences between how SO and CR work, explained in detail here and of course, in our How to Ask page. It might seem counter-intuitive at first, but trying to narrow down your post (as you would on SO) to a specific problem with your code is actually making it harder to helpfully answer. Tell us what edit0 and edit1 are, what their purpose is, what problem your code is solving
I've recently started programming and have been working through some problems such as the one below:
Write a program that finds all files with a given prefix, such as spam001.txt, spam002.txt, and so on, in a single folder and locates any gaps in the numbering (such as if there is a spam001.txt ...
I put the whole test. It makes little difference. The point is about the error being received. The code is written, you would need to read better the description. Please reopen. Thanks. — user147267220 mins ago
He's not getting it...
@syb0rg We'd have to make it obligatory to read or it won't make a difference.
I wrote the following little piece of Python code to take in some integer, and return a permutation that has that rank in the lexicographical ordering of permutations. While this works, I'm worried that the number of calls to pop() and append() might be slowing this down. This function is part of...
I want to write a function to produce an inclusive range of Day such that Saturdays are excluded.
import Data.Time.Calendar
import Data.Time.Calendar.WeekDate
let sel3 (_, _, x) = x
let dateRange d1 d2 = takeWhile (<= d2) [ d | d <- map (flip addDays d1) [1..], (sel3 . toWeekDate) d /= 6]
I b...
Problem
Write a program that can calculate the Hamming difference between two DNA strands.
GAGCCTACTAACGGGAT
CATCGTAATGACGGCCT
^ ^ ^ ^ ^ ^^
Code
object Hamming {
def compute(s1: String, s2: String): Int = {
if (s1.length != s2.length)
throw new IllegalArgumen...
This is a follow up from the question Making Permutations in Python faster. The goal is to make some function that can return the number of possible permutations with repetitions. As Gareth pointed out there is a nice formula for this problem
See https://en.wikipedia.org/wiki/Permutation#Permuta...
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...
Notes before you proceed:
I use Petapoco for DB Queries and Petapoco CRUD Wrapper for methods like Get(id), Save(), etc. But, it should not matter because Petapoco is not exposed here.
This question is for code Eloquence and reducing the bulkness of code.
Here it goes. I have a class, say Acc...
Stack Overflow is not a code writing/refactoring service. If you have more specific questions on refactoring working code, you can try Code Review. Please include specific goals and previous attempts of improving your code. — ryanyuyu55 secs ago
@ryanyuyu just a note. Code Review doesn't need previous attempts (and, in fact, they just get in the way). We just want the current, working, version of the code. — Zak32 secs ago
Thanks for including code, I've reopened the post... but now I can't help wanting to see more - can you edit and include the full code for bot.on? The missing closing brace indicates there's more than that going on here... — Mat's Mug ♦12 secs ago
i'm debating whether or not i should make my irc project in c; and include a javascript interpreter, or spend a lot less time and just write it in python
I am currently learning Stacks and Queues and I found a good resource in Python on codility,
But i write Java for now. Please how best can I convert this code from Python code to JAVA, in the most efficient way.
queue =[0] * N
head, tail = 0, 0
def push(x):
global tail
tail = (head + 1) ...
This goes with an application that tracks Git activity in our repos. I have a base manager that excludes any members that haven't been flagged as removed from the system (removed members are still kept in the DB for persistence). Then I need to perform queries on subsets of users based on their a...
Welcome to Stack Overflow! Consider posting on codereview.stackexchange.com instead. (also, the "optional" tag refers to the concept of optionals in programming) — PWhite44 secs ago
> Engineers are hired to create business value, not to program things:
Doesn't that quote depend a lot on what companies you apply to?
I mean if you apply for a development position in a company that is not developing a certain software suite / service, then you ought to expect that you will only be used for automating existing processes
i was trying to solve this problem. as it mentions:
In the popular spreadsheets systems (for example, in Excel) the
following numeration of columns is used. The first column has number
A, the second — number B, etc. till column 26 that is marked by Z.
Then there are two-letter numbers: ...
I'm looking at getting a job as a php developer. I have submitted tests, but not heard back from them. Can I please get some feedback on my coding technique for object oriented php?
Here is a test I was set and the code I submitted.
Can you please tell me where I'm going right and where I'm goi...