« first day (1532 days earlier)      last day (2780 days later) » 

00:00
RELOAD! There are 4147 unanswered questions (90.9149% answered)
2
00:47
Welcome to Stack Overflow! It seems that your code currently works, and you are looking to improve it. Generally these questions are too opinionated for this site, but you might find better luck at CodeReview.SE. Remember to read their requirements as they are a bit more strict than this site. — 4castle 35 secs ago
01:05
1
Q: Calculating and Outputting Pascal's Triangle with only Indices

DaolotheI'm relatively new to Python, and decided to write this program that outputs Pascal's Triangle to test myself. About halfway through, I realized that it's a lot of work to find the value of Pascal's Triangle from an index instead of a (row, column) formula, and ended up taking a journey to StackE...

01:30
I suspect this would fit better at Codereviewklutt 34 secs ago
02:02
0
Q: HomogeneousDict - The Python dictionary that can have homogeneous keys

Christian DeanI've created a subclass of Python's builtin dictionary dict. The subclass allows dictionaries to have multiple keys with the same value. Hence the name "homogeneous". Behind the scenes, I'm using a normally dictionary. If a key has more than one value, then it's values are implemented with a list...

02:51
it gives expected results. NO issues with it. But i wanted to check if i am implemented the promises concept correctly — Sharath 1 min ago
Had voted UWYA^ but I think it's fine
03:30
Also made an edit to hopefully improve it
04:23
0
Q: Code Style and Efficiency of 3SUM

seeqrI'm trying to implement a version of the 3SUM problem. Any help with code style and efficiency would be greatly appreciated. I'm trying to get it roughly \$O(n^2)\$. Also, there should be no duplicates. I specifically wanted to try and build upon 2SUM. I know there are other, maybe better, ways t...

05:08
0
Q: Nisse Server: Part 3 Stream Layer (attempt 2)

Loki AstariThe first code review of this code can be found here: Nisse Server: Part 3 Stream Layer After the bugs and points made by @Deduplicator (thank you) the code has changed significantly enough that a subsequent review is needed. Hopefully more people can help me out by providing input. SocketStre...

05:20
That's correct - the Code Review site is where you can ask for feedback on working code. — AJNeufeld 18 secs ago
0
Q: Path shortener for GUI application

Pella86I need to display a path within a GUI application. Displaying the whole path would be an overkill. so I made a custom path shortner. def cut_path(path): ''' This function takes a path and outputs the path cut with the ... after the the first folder after the first character and comple...

 
1 hour later…
06:30
Monking ♫.
@Phrancis All those people wondering whether they implemented X correctly... Make it work, make it shine, don't care what they call it.
Where i can get code review done ? — user1778203 32 secs ago
This type of question belongs more on CodeReview: codereview.stackexchange.comAnders Tornblad 1 min ago
I'm voting to close this question as off-topic because question belongs more on CodeReview: codereview.stackexchange.com — Satpal 45 secs ago
possible answer invalidation by Baha S on question by Baha S: codereview.stackexchange.com/posts/169140/revisions
07:41
0
Q: Performance and code readability for simple DOM selects in JavaScript

K48My colleagues noticed a few unorthodox ways I am writing the JavaScript code and I'd like to get the community's opinion on that. 1. Instead of var x = $("#test"); I am writing: var x = $(document.getElementById("test")); This is because the application we're writing is a huge form with ...

Monking
08:00
possible answer invalidation by Baha S on question by Baha S: codereview.stackexchange.com/posts/169140/revisions
08:24
1
Q: Pacman OOP design - coding interview

GiladI was asked to give a high level design of Pacman. please review the OOP design, this is not a full implementation. only the design is important here. Please comment if the design is missing anything. or can be improved? the main problem I think is to keep Single responsibility, I am having a h...

08:37
0
Q: Simple TODO app in vanilla.js

YewhralIt would be amazing if anyone could give me an advice on how to improve my JS code in terms of readability and solutions used. https://github.com/Yewhral/-vanilla.js-TODO-app/blob/master/js/vApp.js I'm especially curious if having multiple "document.createElement()" in a row makes my code not DRY

08:51
0
Q: Filter table with drop down values given multiple constraints

C7AI have a table that stores drop down list values. The table looks like this: id | display_text | value | context | special_case ------------------------------------------------------------ 0 | X | x | Global | - 1 | a | a | Screen1 | No 2 | b | b ...

09:09
0
Q: Scraping content from a javascript enabled website with load more button

SMth80The script I've written is able to scrape name, address, phone and web address from a webpage using python and selenium. The main barrier I had to face was to exhaust the load more button to get the more content until all are displayed. I know the way I have written xpaths in the script is fragil...

0
Q: Standard primitive types vs custom structs in public API

MaximI am writing a .NET library and have a lot of properties like this: public ??? SomeProperty { get; set; } where valid values are 0-15 (or from 00000000 to 00001111 in binary). So I should choose a proper type of the property. I see two options: byte I can use byte and insert value validation...

Monking o/
IDK why I have the feeling that this user does some web-scraping to earn money on some freelancing site. If I'm right, it might have trouble if the client doesn't want the source to be public
@MrGrj Monking
@Peilonrayz yo o/
IDK from the ones I've seen they're non-substantial code. But that's something that user should worry about, not us :)
@Peilonrayz you're right
09:22
0
Q: Write a message to a log

NewbieUserI have started to read Robert C. Martin Clean Code book. To learn and gain more expreiences I wrote a single Log class. So I want some suggestions to improve this code.. This is a part of the Log class: public class FileLogger : ILog { private string DirectoryPath = string.Empty; privat...

09:37
That doesn't work. I've installed Chrome 61.0.3153.4 and set @page { size: A4 } in css. That makes no difference. Have you been able to obtain different sizes of paper this way? Anyhow, change that you've linked is not really connected with this problem. Look here: codereview.chromium.org/2829973002/patch/1/10010, params are brutally hard-coded when using shell --print-to-pdf option. It's more connected with @Dimitry Leonov's answer, as it gives you controll while using debugging api. — Crazy Yoghurt just now
0
Q: Time complexity of this algorithm?

Zaid HumayunI have an algorithm here to find the common ancestor of two nodes in a binary tree. def commonAncestor(self, nodeA, nodeB, root): #checking if nodeB is a descendant of nodeA checkLeft = self.checkSubtree(nodeA, nodeB, root.leftChild) checkRight = self.checkSubtree(nodeA,...

for request code review please use codereview.stackexchange.comEsmaeelE just now
If this really is working code and you just want a review of the quality, take it over to codereview. But first translate your comments in english and remove some of them (never comment the obvious). — Felix Palmen 35 secs ago
oh sorry i doesn't know codereview thank you very much — frank jones 47 secs ago
10:42
If you want a review of your code, post it on codereview — Ludisposed 54 secs ago
0
Q: Why won't some rows update?

SvenWe have 2 tables with some rows in it. What we need to do is update the first table column rapport with the value in the second table column rapport. It's normally an very easy query but some rows won't update and we cannot find why. So any help would be very nice to have. Anyway, have a nice da...

May be it will be better to post this on codereview.stackexchange.com? — Samvel Petrosov 49 secs ago
Do you want a code review? There is a separate stackexchange site for that. codereview.stackexchange.comYunnosch 53 secs ago
@MarcGravell I thought that this question is more about code review as he has working code and has not any problem except tha — Samvel Petrosov 11 secs ago
0
Q: google map with mysql and php how to display all the markers on the map

dev lebi have code php with MYSQL and embeded Google Map where the system select from the database and display on Google Map the markers and in a table the info related for the markers. the problem is that the table display all the selected data but the map just display the last marker. note: all t...

11:27
This probably fits better on Code Review. — jrenk 46 secs ago
11:38
0
Q: Display dropdowns with any database exception errors

RamaI have just started a small MVC application wherein the first task is to display two dropdowns One with Category and the other with Projects. I have to display the error messages in validation summary if there are any issues with the database. I am not really convinced with the Index method bel...

Great, I just realized the DB I'm using isn't even 1NF... :/
@Peilonrayz Not unusual in my experience. Lol
@EBrown Really?! Damn
I managed a database once that, when we put into 1NF, reduced storage allocation to 7% of the original size, which was ~1.5TiB.
3
Damn, that's a lot of waisted space, :O Did you get much of a save on 2 and 3NF?
11:46
By the time I got it to 6NF we got down to ~2% of the original size.
I didn't log the 2NF-5NF savings.
NF?
First normal form (1NF) is a property of a relation in a relational database. A relation is in first normal form if and only if the domain of each attribute contains only atomic (indivisible) values, and the value of each attribute contains only a single value from that domain. The first definition of the term, in a 1971 conference paper by Edgar Codd, defined a relation to be in first normal form when none of its domains have any sets as elements. First normal form is an essential property of a relation in a relational database. Database normalization is the process of representing a database...
Ah.
@EBrown WTF, wow
Also there's a 6NF... Damn, I've got some learning to do...
Oooooh, so 1NF simply means you use relational databases like they're supposed to?
4
I can do that.
11:51
@Peilonrayz Yeah, I recommend 3NF be your stopping point usually, unless it's plainly obvious that you can save more with 4NF, 5NF, or 6NF.
So 1NF is good, 2NF is stricter, etc.
And the higher the normal form, the more compact it can be stored, right?
@Mast Yep.
@EBrown In school I was told about BCNF, but told 3NF is normally where you stop... Thanks :)
What will a higher NF do with performance?
@Mast Not always, 5NF and 6NF can have significant performance and minor negative storage impacts.
11:53
@Peilonrayz BCNF is like 3.5?
@Mast IDK where it sits in the 1-6NF thing, I was told to do it after 3NF in school, but never told about 4NF in school, so IDK Also here's a link to BCNF
@Peilonrayz Yea, that page led me to belief it's somewhere between 3 and 4.
@Peilonrayz I'll tell you the truth, I've never purposefully used BCNF.
> A Table is in 4NF if and only if, for every one of its non-trivial multivalued dependencies X ↠ {\displaystyle \twoheadrightarrow } \twoheadrightarrow Y, X is a superkey—that is, X is either a candidate key or a superset thereof.
> A table is said to be in the 5NF if and only if every non-trivial join dependency in it is implied by the candidate keys.
6th is where things get truly confusing.
@Mast Yes it is.
Personally, my take on it is normalize to 5NF during dev if necessary, 3NF otherwise, and if it's not 1NF in production then make it that way.
12:00
If I understand this correctly, I see no reason why you'd ever target lower than 3NF.
@EBrown Oh, welp that's a weight off, :)
I have ported a production database to 6NF from UNF exactly once and that was a 6-month project.
@Mast I always try to go for 3NF at worst in development. But taking a production DB to 3NF sucks.
Especially if it's UNF to boot.
Thankfully my DB isn't in production yet, but god, I don't remember how to do any of this... I'm not looking forward to this afternoon, :/
If the database started out as a glorified Excel sheet, I can imagine getting it to something decent takes a while.
I should really finish my library some time soon...
0
Q: Converting multiple excel files in multiple folders into CSV

AxelThe whole project is quite large, involving parsing the CSV-files, validating them, exporting them to a database and such, but my code in question involves subset of the project: converting multiple excel files. The converter method can be seen below: import glob from openpyxl import load_workbo...

12:04
@Mast You lost me at 4th
@Mast What library?
I took that DB to 6NF during production as well. :)
the concept is as simple as it can be, if you need to use a client you use client.jar, if you use server.jar there must be someone reputable enough to tell you that you cant do it (code review is a good thing)... — vach 12 secs ago
12:22
@Mast Think of 6NF as the proper way to log data.
> Nevertheless, you need to think very much before trying to apply the 6NF normalization because this implies a dramatic increase in the number of tables and may not suit your needs.
That's very true as well.
And technically, you violate 1NF if you have a NULL value.
Hmm... I just realized that my Minesweeper game table of games played in my online game is not fully 1NF. I have a column with "clicks" that contains a String like "P72Pc1P53" which means "Play at (7, 2)", "Play at (0xC, 1)", "Play at (5, 3)"...
But having a table for each and every Minesweeper move that has been made would be.... ugh.
@SimonForsberg Yep, that's a 1NF violation (pretty classic one as well).
@SimonForsberg Yep, that's a downside of normalization lmao
What if I would make it a BLOB? :D
Out. Lol
Compared to the alternatives, I'm happy with my non-1NF-compliant table.
12:34
:(
1
Q: Downloads historical data from a yahoo finance csv and returns a pandas DataFrame

APorter1031Not too long ago, yahoo-finance shut down its public API for downloading historical data. There are however works around and the below code is on of them. I started looking for solutions of how to grab the correct cookie and crumb pair and then implemented that into it's own function. I am new ...

I might actually release my C# programme that I used to use to help analyze database tables for normalization.
I did learn one good thing though when I took a class in this about six years ago: Previously I had a column "player1" that contained the name of the first player, and one column for "player2", and one "result1" and one "result2" for the resulting scores. That was.... ugh.
The SQL statements I had to write were crazy.
Yeah, usually if you find yourself doing Thing1, Thing2, that's a very good candidate for 1NF.
So now I have one table "playing_players" with columns: gameid, player_index (which both make up the PK), then columns: name, score, cause.
But why are NULL values not 1NF?
12:40
@SimonForsberg Because they represent two things.
A NULL has two parts: does it have a value here, and if so what is the value.
Instead of a null you would extract all dependent nulls to a new table, which would then be joined on if necessary.
So if you have Id, Name, Email, Phone(NULLABLE), then you would rework that to Id, Name, Email with a join to Id, Phone.
Then there are no NULL values, and you just LEFT OUTER JOIN to the table containing phone.
So now the presence or lack of a phone is no longer represented by a 'bit' on the table, it's represented by the actual presence or lack of a phone.
@EBrown Okay, that makes sense, but... I honestly would not make Phone a separate table.
Because, essentially, NULL is a special way of writing Has_ and _, where _ is strictly dependent on Has_.
@SimonForsberg I would, because some people may want to have multiple phones.
If people may want to have multiple phones, then of course I'd go for a separate table.
So how do you handle that? Phone1, Phone2, or Phones (comma separated), or Id, Phone in a separate table?
@SimonForsberg Well having no phone and having a phone are technically that possibility. ;)
But your example had a Phone(NULLABLE), not Phones(NULLABLE)
12:45
@SimonForsberg Right, so my phone possibilities are 0-1 phones.
@SimonForsberg I have a truckload of PDFs, so I built a database for them. Except, I've been building that database for half a year now and lack the time to finish it.
Reality keeps getting in the way.
@EBrown Possibly having a phone is a Optional, having multiple phones makes it a List/Set
@SimonForsberg Exactly, but you can represent the Optional with a List of 0-1.
Though you should note, that the NULL thing (as we're discussing) is highly controversial.
@EBrown Hmm... yeah, okay, when you say it like that it actually makes perfect sense to put the phone in a separate table.
> A table with at least one nullable attribute. A nullable attribute would be in violation of condition 4, which requires every column to contain exactly one value from its column's domain. It should be noted, however, that this aspect of condition 4 is controversial. It marks an important departure from Codd's later vision of the relational model, which made explicit provision for nulls.
@EBrown Why does it matter so much whether a variable is nullable or not in NF?
@SimonForsberg Personally, I use NULL values in tables against 1NF, though it's because that particular restriction is often ridiculous. I consider a table with them to be 1NF, so long as they make sense. (Though I would not consider that for phones, an SSN/EIN is more realistic example of that.)
> Every row-and-column intersection contains exactly one value from the applicable domain (and nothing else).
The issue with NULL is that it's a double-value.
4 mins ago, by EBrown
Because, essentially, NULL is a special way of writing Has_ and _, where _ is strictly dependent on Has_.
@Mast See ^^
@melpomene This question is highly inappropriate for Code Review! Please take a look at their on-topic help center. — Mast 51 secs ago
@EBrown Huh?
So if you want to get a list of all phone numbers, you have to select Phone WHERE Phone IS NOT NULL, whereas the example I demonstrated for @SimonForsberg removes that constraint, you would just SELECT Phone FROM Phones and ignore the Id column.
@Mast Where are you confused?
12:50
Say one of your users has no phone number. Now what?
@Mast I'm not suggesting they ask this question on Code Review. My link was intended as an answer to their question. — melpomene 43 secs ago
@Mast Then I don't drop a value in the Phones table.
Users
Id, Name
User Phones
Id, Phone
So if I have to select all the user data, I would SELECT Id, Name, Phone FROM Users LEFT OUTER JOIN [User Phones] ON Users.Id = [User Phones].Id
You won't put anything in the Phones table for that user, but the user will still have a column for it, right? So that value is empty.
So if a user has no phone then it gives me a NULL on the first row.
@Mast No, they won't have a column.
They won't have any data.
Users
1 EBrown
2 Mast
User Phones
1 800.555.1234
So now you don't have a phone in my example, but I do.
So when I do my SELECT Id, Name, Phone FROM Users LEFT OUTER JOIN [User Phones] ON Users.Id = [User Phones].Id, it'll give me:
Id Name   Phone
1  EBrown 800.555.1234
2  Mast   NULL
But then if I add 800.555.4321 as another phone for me, I get:
Id Name   Phone
1  EBrown 800.555.1234
1  EBrown 800.555.4321
2  Mast   NULL
questions like this are better suited for codereview.stackexchange.com — Tab Alleman 29 secs ago
12:55
Ah, because you simply re-use the id of the user to look-up whatever relevant information comes up.
Yep.
So now there are no non-trivial joins or attributes.
Would that still work for many-to-many relationships?
In what regard?
2
Q: Can't get the syntax highlighting for Go

oliverpoolThe syntax highlighting (for Go) does not seem to be applied for this question: db access wrapper for Go project I tried to apply it manually to my answer (https://codereview.stackexchange.com/a/169234/80949), using <!-- language-all: lang-go -->, but it looks worst than in the question! I know...

Say you got Users and Tags. A User is following a Tag, can follow multiple Tag so it's multiple Users and multiple Tags.
A user can follow 0 Tag. A Tag can be followed by 0 users.
12:59
@Mast Yeah, so you would have three tables: Users, Tags, UserTags.
If no entry is present in UserTags for your Users.Id, then you're not following anything. If no entry is present in UserTags for the Tags.Id, then the tag is not being followed.
Right.
It's so bloody obvious when you put it like that.
4
@Mast :) Normalization gets complex beyond 3NF, but up to 3NF it all makes sense.
In my experience 2NF is mostly violated by Products tables and such.
Then 3NF is violated by a few types of tables, but mostly Products tables again and Cart tables (pretty often).
Generally I haven't seen a lot of glaring 4NF violations, those don't have much of a pattern.
By the time you get to 5NF you're interjecting business logic, which means that taking a table to 5NF may not be possible (and as such is already defined).
And then unless you're doing something that needs micro-performance improvements (data-warehousing), you don't really need 6NF most of the time.
Hmm, maybe it would be worth it to study up again on the NFs. Especially 4-6.
If we take our same Users table, we can violate 6NF by adding Posts and Rank to the table, where Rank is dependent on Posts.
I.e. at N posts you have X rank, then it's a 6NF violation, so you just move Rank to a new table with a MinPosts or whatever, then you're solved.
It's hard to violate 5NF with our Users table, so I won't contrive an example.
We could contrive one to violate 4NF if we wanted to, say we created multiple users that had a Car and ServiceArea, where the User services that Car in that ServiceArea. That would violate 4NF if we assume that they're independent: if a User services a Car, then they are valid in any ServiceArea, and the same in reverse, if they have a ServiceArea then they can service all valid Cars there.
So then we create UserCars and UserServiceAreas tables, and we've solved that.
If we had a OwnedCar and FirstYearAvailable on the Users table, then we are violating 3NF. We may only have one of each (so we satisfy 1NF and 2NF, but FirstYearAvailable is dependent on OwnedCar, which means we could have discrepancies. So we would make a Car, FirstYearAvailable table, and then OwnedCar references that.
13:19
For the final exam, you take a screenshot showing off all the work you've done in the class, and it has to survive being uploaded, thumbnailed, and re-screenshotted through a chain of social media sites.
5
To 2NF is actually moderately difficult to violate on the Users table without violating 1NF as well, so I'll skip it because I'm lazy.
And we saw how to violate 1NF, so that's our lesson for today.
0
Q: Serializing output of a match result web scraper

Lukasz SalitraThis is a follow up to a previous question. As part of learning the object oriented approach and web scraping in Python, I've set out to write a program that will give me match results of professional Counter-Strike games, in order that appears on hltv.org. At first I just wanted a simple script...

0
Q: IS it good practise to use services for data/form validation in AngularJS

BentCoderI just to find out if my approach complies with AngularJS good practise or not. I am not familiar to AngularJS so need an advice. I created a custom service to validate my form fields. Is that OK to use service for form/any data validation or should I use something else? Note: I know I can use ...

Kaz
Kaz
13:32
@RMunroe It took me a good minute to get the joke ^^
I think I might just keep using this like this for a while
Also, the battery is smaller than I thought it would be :)
@Kaz That looks… repairable.
Is that a FreePhone or something similar?
@Zeta It's an iPhone 4us.
@EBrown Wouldn't that also violate 2NF or 3NF?
@EBrown Huh. That's a lot less glue than I expected.
@SimonForsberg It depends on how you classify it, if the only dependency is on Posts, and the only additional info is a Rank string, then it violates 6NF but stays in line with all forms up to 5NF. As you can see it's a slippery slope.
An easier example might be Id, Name, Department, where the table is in 5NF, then we break it down to only trivial join dependencies, where it would be Id, Name and Id, Department in two separate tables.
Basically, in 6NF almost every column will become a separate table.
And to be completely honest, most tables don't violate 4NF or 5NF, and conforming with 6NF is usually a bad idea.
13:51
@EBrown That sounds bananas.
2
And you said 6NF was used mostly for data warehousing. So.... is it performant to have almost every column as a separate table?
@SimonForsberg It reduces space use considerably, and it has significant performance benefits if done properly.
0
Q: Pythonic way to choose in a list comprehension

nachoIn a recent code review, a work colleague and I have been discussing for the last very intense 30 minutes a very silly discussion for which we seek clarification. I argue that when iterating over a list and deciding between two values, the pythonic way should be: My version colors = ['blue' if ...

0
Q: Python Proxy Checker/Scanner

Aaron NelsonHere is my attempt at a simple HTTP proxy scanner/checker. I've been learning python for about 6 months now and decided to move beyond simple scripts and data scrapers. I think the code looks messy and bulky, especially after if __name__ == '__main__' portion. The program runs well, searching t...

Both of these I just listed are only if it's done right.
Basically, by moving all data to separate tables, you can more easily prune how it scans.
If I only need A, B, C and not D, E, F, even though they're all trivial properties of Id, it eliminates a significant amount of index and page scanning.
Basically, data is stored as tightly as possible.
I'm not sure how familiar you are with the underlying data storage of a database, but data is stored in "pages", the more columns you have the fewer rows you can store in a "page", by eliminating everything to 2-3 columns, you are storing all your data very close together, so when it has to do a table-scan, the data is tightly packed and can be sequentially viewed.
@EBrown It's counter-intuitive to me that having one table with three columns take up more space than having two tables with two columns.
@EBrown Not very familiar with that. But it makes a bit of sense that if it is stored tightly, it is faster.
Kaz
Kaz
@Zeta The glue is on the case (which came off).
13:59
@SimonForsberg It depends on the implementation entirely, because records can be omitted and data can be compressed more easily. Part of 6NF is also reducing more dependencies, so in the example I mentioned earlier you would reduce all the Rank strings to one table, and have no ID reference, which means you've reduced it even further.
Kaz
Kaz
See this
@EBrown How would it even work with no ID reference?
If there are 5 ranks, all 8 characters across 1000 rows, that's 8KiB you're storing. If you use 6NF, that reduces it to one table with all 5 records that have 8 chars, plus 4 chars for the 'Min Posts' value, so you're down to 60B, and no foreign-key references are needed.
@SimonForsberg Because the 'Key' is a property of the attributes on the table.
So for Posts, Rank, the Rank is not dependent on the Id at all, it's dependent on the number of Posts.
You would also probably want a MaxPosts to make joins easier, so that's another 4 bytes (assuming int) which puts you at 80 bytes (still significantly less than the 8KiB), so you would join on Posts >= MinPosts AND Posts <= MaxPosts.
So basically: SELECT Id, Name, Posts, Rank FROM Users INNER JOIN Ranks ON Posts >= MinPosts AND Posts <= MaxPosts WHERE Id = 5
Now Ranks doesn't need an Id or anything, because the key is Rank, MinPosts, MaxPosts.
And we're literally at 1% of our original storage space.
Assuming only Posts, Rank are the columns.
Generally, with the more columns we have our shrinkage is not as cool, but in the academic example it's pretty nice.
Of course if we don't end up needing Rank, now we're not even selecting against it, which means we are not bloating our pages.
And we don't have to seek to new positions on the disk in order to collect our data.
Also my 1% is wrong there, it's actually 51% (did the math just a bit off).
14:21
@Kaz Oh, wow. Is it okay?
Nah, just kidding. What did you do? Did you drop a Nokia on it?
3
14:33
@EBrown Wow, I went to lunch, ad that's one hell of a read. :) However, I have a question. Say you have posts, each post can be updated, and should normally show an amalgamation of the updates, but you want to record who done each up-date how would you do it? (Kinda like an SE question / answer)
@Peilonrayz Easy: `PostData (PostId, UserId, DateTime, Content, Reason)
The latest version is the one with the most recent DateTime.
@EBrown To double check I get you. You'd make a 'Post' table and then a 'PostData' table?
Of course this violates 1NF immediately, as there's a top-to-bottom ordering of the rows (you have to ORDER BY DateTime DESC then select the first record).
And update the 'PostData' table each change
@Peilonrayz Add a record to PostData.
@Peilonrayz That wouldn't necessarily be necessary.
You could create a composite key over PostId, UserId, DateTime.
14:39
Greetings, Programs.
@EBrown My bad, :)
Thanks @EBrown I think I get it now, :) I didn't think it'd be so simple...
So in order to comply with 1NF, you would need two tables again: Post (Id, Content), and PostRevision (PostId, DateCreated, Content), when you revise a post you insert the current Content, DateCreated into PostRevision, and then change what's in Post to the new Content.
@EBrown Would that be 1NF? How would you uniquely identify a PostRevision? As IIRC that's one of the requirements for 1NF
@Peilonrayz PostId, DateCreated, assuming that there are no two revisions submitted at the same time for the same post.
Would it just mean adding an ID column to it or something?
14:53
@Peilonrayz You could do that as well.
Oh yeah, damn that should have been obvious...
@Peilonrayz Was just discussing with a couple DBA folks, one of them has told me that we could ignore the isomorphism (row ordering) in this respect and consider it 1NF without needing a revisions table and post table be separate for this purpose.
@EBrown IDK, maybe. The way I envision using the table is you can change all bar one item, so it'd just duplicate data for the heck of it...
0
Q: Multiply matrix algorithm

21koizyd#include <iostream> #include <vector> void function(std::vector<std::vector<int>>& matrix1, const std::vector<std::vector<int>>& matrix2) { std::vector<std::vector<int>> matrix(matrix1.size(), std::vector<int>(matrix1.size())); int result = 0; int column = 0; if (matrix1.size() ...

@Peilonrayz Well for actual logging, you wouldn't track a table like that. My logs are usually Log (Table^, RecordId^, DateTime^, ColumnName^, Original, NewValue), (^ = key) and then when 1 column changes one record is added, when 2 change two records are added, etc.
15:09
@EBrown Yea, I'll take a serious shot at 3NF and probably not care about it for a long time.
Thanks for the truckload of info :-)
@Mast 3NF is truly the most appropriate - no duplicate columns, no duplicate keys, no functional dependencies. Going above 3NF is a lot of work and has much less benefit.
@Mast No problem. :)
@EBrown Damn, that's opened my eyes, I was just going to use null, and fall into that trap you were on about earlier. However, I'm using SharePoint as my DB, so IDK );
@Peilonrayz Well, I don't necessarily agree with a lot of the work that Date did regarding 1NF, and I don't agree that NULL is always a 1NF violation.
SO isn't the best place to "make code more elegant/simpler/aesthetic" - Code Review is! Instead of just posting a tiny little snippet, give CR reviewers your whole procedure (heck the whole module!), and watch them shred your code to pieces - no code should be "forever fated to don a paper bag over its head" ;-) — Mat's Mug 7 secs ago
@EBrown Sorry, I don't understand anything what you mean by "I don't necessarily agree with a lot of the work that Date did regarding 1NF"
The problem with SP as a DB is you have 70+ rows in each of your tables off the bat. :/
15:17
@Peilonrayz Date was one of the people who helped define the 1NF requirements, and his requirements are the NULL value one (that @SimonForsberg mentioned seemed wrong earlier, because it can be usually is), and the top-to-bottom aspect.
Mat's Mug strikes again ty kindly — Sean Kelly 54 secs ago
lol
monking!
@EBrown I thought you were on about dates, XD Ok that makes much more sense, thank you :D
@Mat'sMug Monking!
@Peilonrayz Nah, Chris Date.
@Peilonrayz Also, you'll want a SqlUser and PlatformUser (where PlatformUser is the Sharepoint User).
@EBrown Hmm, I've not come across them... I'm using SharePoint Lists, as you can't use like anything else in the cloud...
However my user would be User (SpUser user, ...)
I'm not familiar with SharePoint, but the idea is to track who made the change as well.
On our system I log that as the SQL User and Web User (because all Web Users have the same SQL User, but different SQL Users can make changes).
15:25
@EBrown Yeah, I was planning on adding User to PostRevision, such as PostRevision (PostId, DateCreated, Content, User), but I'm easily overwhelmed so didn't want to mention it, :)
Kaz
Kaz
16:03
THANKS SANTA!
2
Seems like this would be a better fit on CodeReview. — pjs 1 min ago
16:18
MONking
2
Q: Simple ES6 TODO list

YewhralThis is how my app looks like: I can add and remove tasks, mark them as complete, move them up and down on a list, and filter them. I have few questions about some parts of my code that I'm pasting here. First thing that concerns me is that in addTask() function I have tons of document.creat...

I recommend taking this to Code Review SE instead. One thing I see in GetAudio() is that the index passed is always 1 higher than the index used. return audio[index-1]; would work, collapsing all of those if-blocks into a single statement (you would still need to check for out-of-bounds, though). — Draco18s just now
SO isn't really the right place for this question because there is no clear answer. [codereview.stackexchange.com](codereview.stackexchange.com) would probably be a better option. — JNYRanger 57 secs ago
@Draco18s My problem is that that code doesn't correctly count the shots when reloading when you are on low ammo. Sorry, I should'ce stated that more clearly. Also my problem wasn't the GetAudio() Method. It were the Reload Methods. I can't post my code on Code Review SE because my code doesn't work. I'm new to this side so I wasn't quite sure how to ask my question. I'll be more specific next time. Reweriting my code now. :D — DeepQuantum 48 secs ago
17:18
0
Q: Overwrite disk space for the purpose of deleting old data

Henry WeinertI have written a little program that overwrites memory. It creates useless files in a folder named "folder" (I am so creative). The purpose is to overwrite old data. It's not a very professional program because I am a beginner, but I think it should do for which it is destined: exhaust memory and...

17:31
0
Q: Trending Machine Learning topics for Alexa

alecxeI've created a small Flash Briefing Alexa skill that reports the top 5 trending topics in Machine Learning from the My Bridge service. The feed for the Flash Briefing skill can be pointed to an external endpoint, but the response has to be in a certain format, sample: [ { mainTe...

You can take a look at this link which maybe be a good solution for you: codereview.stackexchange.com/questions/52351/…Gugas 8 secs ago
18:21
0
Q: JavaScript to scroll Elasticsearch and send to Kinesis

toy /* eslint-disable */ 'use strict'; const async = require('async'); const elasticsearch = require('elasticsearch'); const request = require('request-promise'); const AWS = require('aws-sdk'); const kinesisClient = new AWS.Kinesis({ region: 'us-east-1' }); const kinesisStream = 'streamName'; c...

0
Q: Is it OK to have multiple expectations in a single Rspec test?

Mateusz Koniecznyrequire_relative '../price_entry_class.rb' require_relative '../exceptions.rb' require 'spec_helper' describe PriceEntry do it "throws expection on invalid date format" do expect { described_class.date_from_input_to_storage("20010101") }.to raise_error(InvalidInputData) expec...

In local news:
Flooding on Main St. in Findlay. If you have any non emergency questions you should call 419-424-7000 https://t.co/bPCJKSEl8w
possible answer invalidation by hi im vinzent on question by hi im vinzent: codereview.stackexchange.com/posts/169081/revisions
If you have working code which you want to improve you can post here: codereview.stackexchange.comyuriy636 13 secs ago
@yuriy636 the second example here does not work, and this is a very trivial task. Code Review typically accepts more elaborate code submissions. — Patrick Roberts 15 secs ago
18:47
You'd probably get a better reception at Code Review. — pjs 34 secs ago
19:23
0
Q: Finding the closest data point in a sequential list

TimGiven a List<double> and a double, it will find the closest value and return the index of the closest value in the list. The list will always be in order. private int FindClosestPoint(double val, List<Double> list) { int ret = new int(); int max = list.Count; int min = 0; int in...

+1 Great answer, but would it be too much to ask for a review here ? codereview.stackexchange.com/questions/167585/…, thanks in advance! — kuskmen 21 secs ago
If you think you can do it, then try it first and then came asking for help. Not the other way around. And if you want just opinion about your code go to codereview.stackexchange.com — Juan Carlos Oropeza 44 secs ago
19:44
0
Q: Code improvement suggestion - Insertion Sort in Python3.6

MeadowCan this insertion sort program be improved in anyway? Please suggest considering in terms of efficiency and lines of code as well. def insort(lst): for i in range(len(lst)-1): l = i + 1 for j in range(l, -1, -1): print(j) if j == 0: br...

0
Q: Validate Louis Vuitton Date Code

ByteSettlementOn Louis Vuitton bags they contain a "date code" on a tag inside the bag. This code is sometimes used to validate the authenticity of the bag. In reference to this site: http://authenticationfiles.com/louis-vuitton-date-and-country-code.html and the rules displayed there, I created a "Louis Vuit...

19:58
0
Q: Best way to assign base class variables in a derived class?

medman826Recently at work I came across this code (this is a contrived example, but is fundamentally doing the same thing): class A { public: int foo; }; class B: public A { public: int bar; }; int main() { A a; a.foo = 1000; B b; A* a_ptr = &b; *a_ptr = a; } Above, what ...

20:12
0
Q: Indian numbering system formatting

Ashwini ChaudharyThe following code converts a number into Indian numbering system format. I know locale can also help in getting similar format but I wanted something that can work on any system because not all locales are present in all OSs. The code was written for Python 3.5 hence no variable annotations. ...

-1
Q: Using Spyder editor

JennyWrite a program that does the following in order: 1. Asks the user to enter a number “x” 2. Asks the user to enter a number “y” 3. Prints out number “x”, raised to the power “y”. 4. Prints out the log (base 2) of “x”.

"Code cleanup refers to the act of writing code so that it cleans up leftover data structures and other unwanted materials from memory and the filesystem. It is not the same as refactoring code, which involves making the source code itself easier to understand, maintain, and modify." Code Review is over that way <-- — Will 35 secs ago
Code that works but that you wish to improve better fits on Code Review. Stack Overflow is better suited to more targeted questions and answers. Note how your title, which should be a question, isn't. — Shepmaster 31 secs ago
20:47
0
Q: Find the intersection of ArrayList elements inside an ArrayList

coder1532So the structure is {{Dog,Cat,Human},{Human,Dog,Whale,rabbit,Cow},{Monkey,Human,Dog}}. Output should be: Dog,Human. I have to find the intersection of ArrayList elements (Strings, for now. Could be integers as well) inside the bigger ArrayList. Previously, I have seen codes of finding the inter...

1
Q: Unwrapping and Dreferencing in Rust

Dan AmbrogioI'm writing a function that, given a Vec<i32> of numbers, lists the combinations that add up to 0. The code works, but it feels amateurish. Specifically, the inside of the loop looks really ugly -- there must be a simpler way of doing this that avoids unwrap() and the repetition. Maybe with matc...

1
Q: Submit form data to server side

Euridice01I have this method here called SubmitProc which submits form data that the user filled out to the server side and does a check if the response to the server goes through. If it's fine, great. If not, return the status error from the server. The data actually gets sent to SharePoint (not sure if i...

21:01
0
Q: Codeforces 831A python

Gaurish GangwarI solved Codeforces 831A using two methods in python3.5. I was expecting method 2 to be faster than method 1 but auto-grader showed the opposite. So, I wanted to know the reason that what makes the difference here? method 1 a, lst = int(input()), input().split() lst = [int(ch) for ch in ls...

I don't understand what you're asking. Does this code work? If so, then this question is off topic on Stack Overflow, but may be good for our sister site Code Review. If not, you need to elaborate on why it does not. — Joe C 58 secs ago
21:33
0
Q: CursorAdater with ListView

Sam ThorntonI am trying to populate ListView using SimpleCursorAdapter from Database using SQLite. Everything is working fine except the data won't show on screen i.e. the fragment shows no data even though database,queries and every function is as intended. There's no error in Logcat. ForecastFragment.java...

0
Q: Given two strings, write a function to check if they are one edit (or zero edits) away

EangoThere are three types of edits that can be performed on strings: insert a character, remove a character, or replace a character. EXAMPLES: pale, ple returns true pales, pale returns true pale, bale returns true pale, bake returns false My solutions seems to work for any case I could think...

21:46
Is anyone here familiar with VHDL, Verilog, or SystemVerilog?
@SirPython I had some assignments in VHDL..
Do you know why VHDL was chosen for those assignments, as opposed to the others?
I'm going to start a project, and I don't know which to use.
1
Q: DRY for rendering same header table for different content

newdimensionI'm trying to make the following code DRY. The code outputs a table that shows violations. If there is any violation.status = resolved they go in separate table for resolved items. Since the header and columns of the table are the same, I believe I should be able to make this DRY using a For loop...

22:08
0
Q: Scraping data from linkedIn using python with selenium

SMth80I've written some code to glean data of the persons and organisations available in view all recommendations section at homepage in LinkedIn. It was very difficult for me to accomplish the task errorlessly. I had to face to main difficulty to complete the script. First one is off course lazy-load ...

22:42
 
1 hour later…
23:52
0
Q: Fill out webform with Selenium

bediI am automating a webform on a webpage. I am still learning Selenium on the road. I know a few bad/good practices but a code review is always a good thing to do. What should I improve on in my code? Quick explanation of the code: 1. I read a json file with customers out. 2. Initializing some var...


« first day (1532 days earlier)      last day (2780 days later) »