« first day (1335 days earlier)      last day (1147 days later) » 
00:00 - 18:0018:00 - 00:00

12:00 AM
RELOAD! There are 3238 unanswered questions (91.9941% answered)
 
12:17 AM
0
Q: How would I make this search function faster?

mohhamed rafiSo I was making a library program for trying to practice C++. I wanted to use a vector to store all the books. The books being a struct to hold the general things the books would have. Which something like this: struct Book { string bookName; // book's name string bookAuthor; // book's...

 
@Mast A satisfactory result then :)
 
Sorry for the flood on the front page. I found a bunch of Qs with on them.
@Duga seems to be ok, but maybe @janos can verify it's not an invalidation.
 
12:38 AM
@LokiAstari +1.
 
@RubberDuck Better not to touch that. I rolled it back.
 
@Malachi You have an answer worthy of your bounty :)
TFS, BBL.
 
12:55 AM
@janos thanks!
 
@Hosch250 Is there a score board?
 
@Mast I see it received a quite good answer too, that's good to see
TTQW
 
1:21 AM
@LokiAstari Aren't the vote buttons the scoreboard?
My two favorite moments on CR were getting the accept for your C++ question (nobody else posted an answer--I'm sure mine wasn't that great), and having Mark Seemann post an answer on my F# question.
I made a Shell theme or my checkers game. I wrote to the image owners to see if they would license them to me on any acceptable terms.
I'm thinking about doing a Desert theme, a Flowering Plants theme, an Astronomy theme, a Bird theme (maybe a nest theme too...), maybe an Old Car theme...
 
1:50 AM
@janos alive?
or, 2k+ users, please approve my edit request here: codereview.stackexchange.com/questions/151105/…
Or, @Jamal can just invalidate it
shrugs, and goes back to Charcoal HQ
 
Sorry. :-( I don't think that kind of rejection counts against you, though.
 
it doesn't, it just irks slightly :)
 
Maybe I should've just deleted the post first, which apparently also wipes out the suggestion. I find that kinda cool. :-P
 
:P
There's also the almighty "SEND THE THING TO HELL" button
it's that big red one with the upside-down pentagram and the nuclear mushroom cloud image on it.
though, as diamond powered people, we shouldn't be using that button :P
 
-4
Q: What the heck happened?

JetairThePlaneI tried to make enigma, but ugh. I don't know what is happening. static void Main(string[] args) { string[] alphabet = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; List<string>...

 
2:10 AM
This Cutting the Cord hat is perfect with my user image (considering the kind of work I do)
(just waiting for it to load on here...)
 
Good night everyone
 
Any suggestions on debugging C code that just "hangs"? I'll add debug statements but anything else?
My linked list push() function works fine except for the case of an empty list (i.e. a single node pointer)
Oooohhhhhh found my bug!
Or at least, where the bug starts happening
void pushTestEmpty() {
	fprintf(stdout, "Debug: before Node* declarationfprintf\n");
	struct Node* newNode = malloc(sizeof(struct Node));
	fprintf(stdout, "Debug: before push()\n");
	push(&newNode, 1);
	fprintf(stdout, "Debug: after push()\n");
	int expectedLen = 1;
	// LAST STATEMENT REACHED:
	fprintf(stdout, "Debug: after expectedLen\n");
	int actualLen = length(newNode);
	fprintf(stdout, "Debug: after actualLen");
	fprintf(stdout, "Debug: before test\n");
	if (actualLen != expectedLen) {
		fprintf(stderr, "Error: pushTest() expected length %d, but actual length was %d\n", expectedLen, ac
See // LAST STATEMENT REACHED:
HAH an infinite loop in my length() function, there we go
Probably off-by-one or something like that
 
2:30 AM
@RubberDuck It's relatively quiet, so no harm done.
@Phrancis Unless you're working on infinite-length problems, that shouldn't happen.
 
-1
Q: Learning python (GUI Qt not working)

immagsI'm having trouble programming a GUI in python. It turns out that when compiling the same code without a GUI, everything works fine. But with the GUI, it stuck at one point in the code. The code starts as follows: class MyApp(QtGui.QMainWindow, Ui_MainWindow): def __init__(self): QtG...

 
@CaptainObvious Broken.
 
user image
2
@Mast ^^ see my armchair debugging
int length(struct Node* head) {
	fprintf(stdout, "Debug: entering length()\n");
	struct Node* current = head;
	fprintf(stdout, "Debug: length() after head pointer\n");
	unsigned int count = 0;
	fprintf(stdout, "Debug: length() before while loop\n");
	// GOES INTO INFINITE LOOP HERE:
	while (current != NULL) {
		fprintf(stdout, "Debug: length() before count++\n");
		count++;
		fprintf(stdout, "Debug: length() before next Node assignment\n");
		current = current->next;
	}
	fprintf(stdout, "Debug: length() before return\n");
 
Who needs a debugger when you got good ol' paper.
2
 
2:46 AM
So I may need to add some sort of special case for this single node pointer case, I suppose
I may have to delete Sublime Text 3 (which I love) just because it won't use spaces instead of tabs :|
Notepad++ may be the better choice
Actually, I don't love Sublime that much
More or less identical to N++ except the user preferences have to be put into a manual copy of JSON file and then edited. Who needs GUIs anyways.
Soooooooooooooooooooooooo uh... What happens if you add NULL to a number in C?
I'd bet that's exactly where my bug is
 
@Phrancis Atom.
@Phrancis You don't usually do that.
As in, you really don't want to do that.
NULL is a value which is explicitly meaningless.
 
3:08 AM
I still think the bug might be related to pointers, but in any case, I need to fix this unacceptable case
 
It's C, your bug is likely related to pointers.
 
I'm kind of surprised current = current->next keeps going
Might need to add a NULL check there too
They said: "C is easy, you can learn it in 2 hours." ಠ_ಠ
 
Good Morning
 
@Phrancis You shouldn't believe everything you read :P
@Tushar Morning.
@Phrancis Are you sure it gets to NULL eventually?
 
@Mast I'm quite sure it doesn't actually
 
3:21 AM
So all next nodes are valid? Must be a big list.
 
3:32 AM
0
Q: Simple remote shell in Rust

ChrisRI wrote the following code to learn some Rust. I suspect that this is far from idiomatic, and therefore would like some feedback on making this more idiomatic. Functionalities: hashed password protection (SHA512), port changing with availability checking before testing, request connection close,...

 
3:48 AM
"Is this code fast / good / Pythonic enough?" is the kind of question Code Review handles best. That said, I can suggest that using generators and generator expressions would be much faster than building lists just to throw them away. Start by replacing code like sum([comprehension_or_generator]) with sum(comprehension_or_generator). The missing []s stopped everything to build up a list, which was then consumed one item at a time --- so no need for a list at all, just generate the one item at a time. — Kevin J. Chase 17 secs ago
 
@Mast NULL
Still trying to determine the issue (though I've taken a break, practicing playing drums now with a guitarist friend of mine)
Music is complicated, but it's usually simpler than pointers.
 
4:21 AM
I'm voting to close this question as off-topic because this is better suited for Code Review if on topic there. — Eli Sadoff 39 secs ago
 
Oh hi, @Duga. I was wondering if there had been an EMP or something, it was so quiet.
 
4:32 AM
@EliSadoff This will be rejected by Code Review. See A guide to Code Review for Stack Overflow usersDanh 50 secs ago
 
0
Q: PHP login validation

4 Leave CoverI have a few questions: Am I showing the error the correct way? Any flaw? If public user manually type in the www.mydomain.com/login.php in the address bar, he will be redirect to index.php correct? Any method that the public user can fake the $_POST in login.php or try to execute the validatio...

 
4:57 AM
Can someone tell me why this doesn't compile in C++ 11?
bool dfsGrid(int m, int n, int a[][n]){

dfsGrid(m-1, n, a);

}

int main(){
int m= 10, n=10;
int a[m][n];
dfsGrid(m, n, a);
return 0;
}
 
int a[m][n];
IIRC, you need constants there.
Either integer literals, or a constant field/variable.
Also, you should perhaps look at the error message and see what it says.
@JeroenVannevel I'm having an awful trouble getting VSD's tests to run.
It won't find most of them unless I update the NuGet packages, and it fails most of the ones it does find.
If I do update the packages, it finds them and fails every one, except the ones that failed before.
This is off the latest develop.
 
@Hosch250 m and n are initialised during compilation that's not an issue. The code compiles fine in C. The error is the following "error: cannot initialize a parameter of type 'int ()[]' with an lvalue of type 'int (*)[n]"
 
That makes me pretty sure that's the problem.
And just because it is assigned before that point doesn't mean it is allowed.
Just try changing those values to integer literals and see what happens.
NVM, you are right there.
The first bug is using the variable n before it comes into scope in the method body.
The other bug is similar to what I said.
 
@zorro It's because of int a[][n]
 
5:12 AM
How do I make it work I used to code this way in C and this doesn't work in C++ :(
 
After you make that int[][10] (for example), it won't compile with a[m][n] because it doesn't know for sure that n will fit.
Well, you could use a vector.
0
Q: Using a 2D array as an argument in recursive function

WillI'm trying to recursively call a function with a 2d array as an argument. My compile error is knapsack.cpp:76:55: error: cannot convert ‘int (*)[(((sizetype)(((ssizetype)(knapsack_capacity + 1)) + -1)) + 1)]’ to ‘int**’ for argument ‘1’ to ‘void backtrack(int**, int, int, std::vector)...

That says you can solve it by using a pointer to a pointer, but it recommends using a vector, like I did.
Vectors are like C# Lists, and are variable-sized.
 
Thank you for that link. Yeah I thought about using vector but need to change code in several places. Anyway I will make it constant integer literal and test the code. Do you have any idea why it runs in C though?
 
C is much less strict than C++.
C relies much more heavily on the programmer to get things right and optimized appropriately than C++.
C++'s compilers provide more optimizations (well, the good ones do), and check things more strictly to help prevent common errors.
 
(Y)
 
@Hosch250 They'll accept variables just fine, but his notation is off, yea.
 
5:26 AM
@Mast Yeah, I got mixed up.
 
Half of C is undefined behaviour, so there's a lot of crazy stuff legal in C.
3
With C++ they decided to stop that arcane practice.
 
I almost typed my email signature in the chat and sent it over, instead of putting it in an email.
Meh, you know I'm getting tired when I post stupid things like that.
Voting is positively messed up.
It doesn't remember that I voted on these answers (except one) already, so I've voted them up about 3-4 times already: meta.codereview.stackexchange.com/q/7102/34073
It doesn't appear to remove my votes, either.
 
@Mast did you just assume I am a guy XD
I hope there are no feminists here haha
 
@zorro Close to 80% of the people on the site are. I think you would be the first female regular in chat if you aren't.
 
@Hosch250 I am a guy lol chill
 
5:42 AM
@zorro On the internet, nobody knows you're a dog.
I honestly don't care about your gender, but I got to refer to people with something.
Could use your name instead, it's short already.
 
0
Q: Script to activate an alarm at a time in the future

theonlygustiI am making a flashlight plugin for macOS. Here is the main code, plugin.py, the method results gets called first and is passed a dictionary like this for example: { "~arguments": "3h30m" } And I try to parse the time span given and activate a macOS alert later. Anyway, I'd appreciate any po...

 
@Mast 2016 was the year of 'they'/'their'
> They'll accept variables just fine, but their notation is off, yea.
 
If this is working code then Code Review SE is down the hall. — John Bollinger 8 secs ago
 
5:59 AM
@EBrown The year forgot to tell me with enough authority.
Now the year is almost over. I guess the year has missed it's/they/their chance.
 
0
Q: Is this a genetic algorithm?

user124527I have written some code in processing aiming to create a genetic algorithm. And i think I've done it! Since there is a lack of expertise on the topic in my area, I need some confirmation/critique. This IS really a genetic algorithm, right? How can I improve my design? The Algorithm

0
Q: Efficient algorithm to count the number of elements of a kind in an array

user3248186I'm given a matrix in the form of an array like this : [3 2 3] [4 5 6] => [3 2 3 4 5 6 7 3 9] [7 3 9] I'm also given the number of rows and number of columns in the original matrix, (here 3, 3) and also the element whose occurences need to be counted (say 3). Now I want to count the num...

0
Q: Decimal to Binary Conversion and vice-versa in Python

Orion Given a decimal number I need to convert it into binary Given a binary number I need to convert it into decimal After the conversion I need to perform some operation on it (for example, addition). Also I need print the result with a specified width. To accomplish the above I wrote the followi...

 
6:18 AM
0
Q: Advent of Code 2016 Day 1

Matthew PiziakI'm working through Advent of Code 2016 in Rust. The prizes go to the swift, but I'm aiming for well-written code. This is Day 1. To summarize the problem statement, given a instruction string of turns and distances (e.g. "R5, L5, R5, R3"), return the Manhattan distance from the origin (in this ...

 
6:39 AM
0
Q: Singleton Design Pattern Implementation : Bill Pugh

megamindjokerI have been trying to implement the Bill Pugh Singleton Design Pattern using a private static class to return the singleton retrofit instance. SO far i have been able to come up with the following code. Can someone help me review this code and confirm if this is a proper implementation of the sin...

0
Q: Multithreaded Monte Carlo pi approximation with own pseudorandom number generator - Follow up

alvaroceballos1This is a follow up of the question I posted previously here. I made some changes, based in the answer by MikeMB, making use of asynchronous calls (with std::async and std::future), instead of std::thread as before. Here is the code: monte_carlo_pi.cpp: #include <iostream> #include <iomanip> ...

 
7:01 AM
0
Q: unordered_multimap approach to adjacency list and graph search

user11881I looking for suggestions on how to improve the usage of modern C++ features with this simple graph search algorithm. Particularly with regard to the use of STL containers and lambda expressions. Compilable code below: #include <deque> #include <unordered_set> #include <unordered_map> #include <...

 
@EBrown maybe you'll have more luck with your answer, the OP didn't like mine which I deleted today :-] I virtually suggested the same... but with filters...
 
7:26 AM
If you'd stop deleting your answers for once, you may even get an upvote. Or learn what's wrong with them so you can improve them.
 
7:42 AM
I was trying to understand code written by a previous member of the project I am working on where neo4j has been imported from py2neo. It can also be seen here : codereview.stackexchange.com/questions/75842/…Jmj 52 secs ago
 
7:55 AM
I'm voting to close this question as off-topic because this belongs on codereview SE site. But for some reason the migration tab does not list that site — RedBaron 52 secs ago
 
8:22 AM
C is hallucinatingly fast. I start my program, going into infinite loop, and before I have time to react it's already went through 6000 iterations
 
0
Q: Missing Numbers

CodeYogi Numeros, the Artist, had two lists A and B, such that B was a permutation of A. Numeros was very proud of these lists. Unfortunately, while transporting them from one exhibition to another, some numbers were left out of A. Can you find the missing numbers? Notes If a number occ...

 
That includes 2 fprintf(stdout) for each iteration
while (tired != NULL) {
    sleep++;
}
 
8:59 AM
Question is better suited to Code Review. — kaylum 45 secs ago
 
0
Q: Check if bootstrap modal is opened

Yo YoThere are lot of answers to this question I just wanted to be sure that the code which I am using is actually reliable. I want to check on click of ENTER I want to check if a particular modal is open $('#myModal').hasClass('in'); Please give your valuable thoughts

0
Q: Ice Cream Parlor

CodeYogi Each time Sunny and Johnny take a trip to the Ice Cream Parlor, they pool together m dollars for ice cream. On any given day, the parlor offers a line of n flavors. Each flavor, i, is numbered sequentially with a unique ID number from 1 to n and has a cost, , associated with it. G...

 
9:45 AM
@Phrancis Same with Assembly :D Well C is kind of glorified Assembly and Assembly is likely to link with the cstdlib anyway if cross-platform
 
C is just an infrastructure-independent layer over ASM of sort.
3
At least that's why it started.
How it started.
To not have to write code for 8 different infrastructures.
C was one of the most important inventions if you look at it like that.
The widespread usage of C is also the reason they no longer teach ASM on a lot of Electronics bachelors.
I should C more often.
 
10:13 AM
@Mast I like to C# too
 
10:32 AM
This is not a code review site. — Raedwald 27 secs ago
Why not go to code review stack exchange — Tilak Madichetti 29 secs ago
 
@Mast lol I have a class on how computers work. First thing we learned was boolean algebra, mext was CMOS, and then it was already floating point math in binary and after that it was assembler. Not asm, but eh
Monking btw.
 
10:55 AM
Monking
 
11:15 AM
0
Q: Comparing internet connection to a string for in Xamarin.Forms application?

Danny GoodallIn my application I have the following code which returns a value depending on the status of the internet connection: public string IsNetworkAvailable { get { return Reachability.InternetConnectionStatus().ToString(); } } This is then used in the following: if (Xamarin.For...

 
12:05 PM
Monking
The battle with WPF continues
 
12:23 PM
1
Q: creating multiple threads to process items in a listview

bro_phpThe goal is to pick items from a listview, do some web related task with the information and then update the UI with the returned information from the web request. The problem is with having multiple list view items processed at once, me being a newbie to C#, i came up with this code, I'm pretty...

 
Monking
anyone ever set up their own TFS server for Demo purposes or just for learning or whatever?
 
@Hosch250 Did you get it fixed? I'm testing it now and I'm only seeing tests ran for the non-analyzer parts
Definitely looks like some version mismatch
Doesn't make sense though -- all the csprojs indicate we use 1.0.0 for everything
 
0
Q: A program that guesses your number using bitwise operations C++

alienCYI got the idea of this program by this site : http://www.cut-the-knot.org/blue/Cards.shtml I made the program using 4 files. functions.cpp : #include <iostream> #include <cstdlib> #include <iomanip> namespace my { int getOneOrZero() { return (rand() >> 14); // >> the bitwise o...

 
12:39 PM
Looks like I did all that in the last commit: github.com/VSDiagnostics/VSDiagnostics/commit/…
I'll write it down to have a look at later
 
12:59 PM
0
Q: Code that rotates images in a set of divs

user126884I am rotating images inside some divs. An image is associated with a link.Eg: image0 is associated with link0, image1 with link1 and so on. image0 and link0 should display in pos-1 image1/link1 and image2/link2 should rotate on page refresh in pos-2 image3/link3 and image4/link4 should rota...

 
Hmm, looks like I need to use some kind of ObservableCollection in WPF, but it doesn't provide an ObservableDictionary if I want to use a dictionary
Using an ObservableCollection is wrong imo, but I guess I'll just give in to WPF and avoid fighting it
 
1:34 PM
@Juggy I'm sorry, I didn't notice that you were new here :) anyways, how it usually goes is that you ask a question about your code if something is not working. If something else comes up, it's common to make a new question. This way, if other people have the same question as you, they can easily find it. On the other hand, what you are asking me belongs more in the Code Review site, and not Stackoverflow. If you still have issues, I would be happy to give you better pointers on how you should proceed — PierreDuc 57 secs ago
 
@skiwi I had to implement my own ObservableQueue for a rolling graph once. I had the same issue, ObservableCollection wasn't an appropriate data structure.
 
@RubberDuck Ouch that must suck
I solved it with ObservableCollection<ObservableCollection<KeyValuePair<int, double>>> for the time being
 
Yeah. I got it working with a collection, but it ate memory for breakfast.
I should have asked the boss to let me open source that code.....
 
@Malachi @DanPantry might have, he had to work around some TFS limitations in the past so there was a Git/TFS combo going.
 
@RubberDuck What surprises me is that there's no 3rd party library at least that offers the most important classes, let alone Microsoft itself
 
1:45 PM
thank you @Mast, I did find what I was looking for. and it allows you to pick between Git and something else (Microsoft's versioning control)
 
@RubberDuck I do it the other way around... I first opensorce it and pretend working in my spare time on it and then I give it to my boss :-]
 
@t3chb0t I try to do the right thing, and if I write it on company dime, it's company property. Then again, my boss has no problems with open sourcing generic libs like that.
@skiwi sounds like we have yet another project to create??
 
@RubberDuck I'm pretty sure I don't have enough projects yet
2
Is there a better way to do this? pastebin.com/g0Cnnuy7
Well, I know there is :D
 
@skiwi doesn't ObservableCollection's ctor take an IEnumerable??
 
@RubberDuck I would have no clue
I'm still new to C#, I prefer code that works over code that doesn't work
2
 
1:53 PM
something like new ObservableCollection(Enumerable.Repeat(11, default(KeyValuePair<int, double>))
 
Oh that's pretty cool then
 
or simply new KeyValuePair<int, double>[5]
 
Also a nice option ^
 
0
Q: Please check this slider based on flexbox and greensock animation

CasufiThis is the slider based on flexbox and greensock animation https://greensock.com/ http://codepen.io/casufi/pen/mONWry Please check

 
Thanks, will try
I wonder if I should put it up for review, given that I have no clue what I'm doing
3
 
2:00 PM
@skiwi alredy considered implementing an observable-dictionary? stackoverflow.com/questions/5663395/net-observabledictionary
 
@t3chb0t Yeah, but I don't really want to deal with that stuff right now
One more thing to do and I should have a preliminary version done :D
I guess at about 4pm I can call yesterday a day then
 
@CaptainObvious Rubbish.
 
2:20 PM
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Matrix rotation
 
@skiwi I preted I didn't know it if you post it on CR and suggest the dictionary anway :-]
 
That's fine
Great, all my items in a ComboBox are appearing as empty strings :)
While they are integers ranging from 0 up to and including 3
 
I thought that there was a hat for awarding the bounty on its last day...but I think that the hat criteria changed....
 
So it's working and yet not working
 
or there is
it is called the philanthropist
 
2:27 PM
evil databinding/templates
 
Hello
 
@denis hi
 
Can this question codereview.stackexchange.com/q/151140/98577 get some love ? The OP is new to CodeReview and we might motivate him to post more or at least give him a nice welcome message.
 
@Mast Nope, I've never set up a TFS server like that. @Malachi
All I did was use git-tfs to pull the tfs info down locally into git
seriously, screw TFS
 
lol
I am getting back into my game again, I need to get a desk to set up my Desktop machine at home...
 
2:36 PM
0
Q: SQL Insert Performance

ManuKarachoI am using a DataTable and the MySqlAdapater to insert around 100 000 rows with around 40 columns to a MySQL database. I chose this way, because my program needs run on mono (unix / mac) where I could not establish a connection to my database via the System.Data.Sql package, but only via the .NE...

 
@DanPantry you seem to like git... is it possible to flatten the repository and delete all history older then 30 days?
 
@t3chb0t ........why
yes it's possible, but I am not going to tell you how unless you give me a damn good reason as to why you would want to do that
cus that's a bad idea
 
Protip: Work with technology, not against it
2
 
@DanPantry haha that's enough.. I can google, just wanted to know whether it's possible at all... well the reason... I don't need the history since the beginning of the time, some recent backups are all I need
 
@t3chb0t That's not how git works.
2
 
2:41 PM
git = code backup
 
if you collapse the history, you will change the SHA hashes of all commits after the history.
This makes your backup completely worthless.
 
^^
 
trust me, I'm well familiar with how git works, and @DanPantry here is right
 
Start learning how Git is supposed to work instead of abusing it for something you don't really want.
 
2:42 PM
you'll fubar the rest of the commit history, backups become worthless, death to thee and thy backups.
I agree with @Mast, learn how Git works.
 
If you want backups, just distribute it among other people. If you want an off-site backup, you can always zip up the current repo (or tar/gz it) and store it somewhere in cold storage like Amazon Glacier.
This is the main reason why you do not modify history that you have published. Because it screws everything up and ruins your day as well as every other developer who relies on your repo.
 
This question may be better suited for the Code Review Stack Exchange. I recommend migrating it to: codereview.stackexchange.comgfullam 28 secs ago
 
I'm 101% sure I will never need the old stuff, even if it collapses it to a new fresh state I'd be happy with it
 
Why do you need to collapse it?
File size?
 
It basically boils down to whether you want to be a developer or just some guy messing around and shooting himself in the foot.
 
2:43 PM
Git repos are typically quite small, unless you've stored large binary files in it...
 
You just got expert advice. Use it.
 
Take it from everyone here.... you do not want to do this.
It's not a case of "you will never need to use the old stuff".
 
I think you should do it
 
If you take a backup and collapse all the previous history
 
Feel the pain
Never do it again
 
2:44 PM
And you do some work on the main line
One day, you lose your backup
er
... let me start over
 
that's not how life works, Dan
 
...Never mind
Basically - don't do it. All of your work will be useless unless you keep starting all of your work off the latest backup
This works fine for a solo dev, I guess... but you would never want to do this in a team
 
Even as a solo dev, you want to practice for the real deal. Work consistently.
 
I thought if I collapse it, it would be easier to work with the console everytime the ui cannot handle several commits ahead and the console shows hundreds of conflicts, changes, additions... ok, I'll reconsider doing this
 
2
Q: LINQ: better way to flatten a list

Sirwan AfifiSuppose that I have a model named User. each user can have some social links, Now I want to get all users with their social link as a single row in the result, Here's mu models: public class User { public int Id { get; set; } public string Name { get; set; } public ICollection<Social...

0
Q: Scala: Singly linked list implementation

Calculus5000I've written a basic implementation of a singly linked list in Scala. Would appreciate any feedback and improvements (especially the remove() method, I feel like it could be implemented better). Node class class Node[T](data: T, var next: Option[Node[T]] = None) { override def toString: Stri...

 
2:47 PM
@t3chb0t Git is pretty well designed, despite the name. If you ever find yourself in a situation where you have to work against Git, you are very likely using Git wrong.
4
It sounds like you have two problems.

1. You have a convoluted history
2. You want to take backups
You can solve problem 2 without having to screw up your history, and you can solve problem 1 in isolation
 
@DanPantry In other words: Git good.
 
You can simply view only the latest part of your history if length is your problem.
@skiwi Get git.
 
yep - $ git log -n X will show you the X most recent commits. $ git log since 3.days will show you all commits made in the past 3 days. etc.
Come back to 2nd monitor after a few day break and welp I'm the star-wall now.
2
@ThomasWard I noticed you're a contributor to the Ubuntu project, have you made any commits to git yourself? (You mentioned you were intimately familiar with it)
 
ok, next --> study git, until then no experiments
 
The main thing you need to learn really is how gits are linked together (branches) and how that works
once you learn how that works, it will be much easier to understand why what you've suggested will not work
(hint: the hash is generated based on the file diff from the previous patch + the time of the commit)
er... no, I'm wrong there, actually.
79
Q: How does git compute file hashes?

netvopeThe SHA1 hashes stored in the tree objects (as returned by git ls-tree) do not match the SHA1 hashes of the file content (as returned by sha1sum) $ git cat-file blob 4716ca912495c805b94a88ef6dc3fb4aff46bf3c | sha1sum de20247992af0f949ae8df4fa9a37e4a03d7063e - How does git compute file hashes?...

Although, if that's the case, why does rebase screw up hashes? Time for some learning
 
2:55 PM
@DanPantry "Commits to git"? You mean the git package, or just the use of git with any given repository?
 
remember: if you have an issue, git rm *.* is your friend. rm stands for "Rescue Me"
6
The emoticon is because git is friendly
6
 
@ThomasWard The actual package
Ah, that's why, because git does actually use time information based on the commit header to make the commit. gist.github.com/masak/2415865
 
@DanPantry No, I haven't worked with the git package directly, I work mostly with the Server Team, and nginx, though I do other work sometimes
 
@JeroenVannevel ;-P
 
@DanPantry this is pretty funny.
> Step 1. Create a empty text document (name does not matter) in your repository
Step 2. Stage and Commit the document
Step 3. Identify the hash of the blob by executing git ls-tree HEAD
Step 4. Find the blob's hash to be e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
Step 5. Snap out of your surprise and read below
> But wait!, did you notice that the <filename> is not a parameter used for the hash computation? Two files could potentially have the same hash if their contents are same indifferent of the date and time they were created and their name. This is one of the reasons Git handles moves and renames better than other version control systems.
That ^ is actually terribly enlightening. Makes so much sense now.
 
3:03 PM
Does C# these days support anything in StringFormat for plural words?
 
@skiwi you mean like internationalisation?
 
@DanPantry Not sure? Don't think so
 
plural words?
give example
 
I assumed you meant that because you mentioned plurals
 
I have this string Mulligan x cards, where x = in range of 0 to upper bound
 
3:04 PM
'Cus that falls into the realm of internationalisation
 
Well, I guess I can use "card(s)" :D
 
Nope, do it yourself
would be a silly thing to provide framework support for
 
Yeah, that is l10n. C# doesn't have that by default. github.com/Humanizr/Humanizer
 
I could write my own IValueConverter I guess
Finally, I've finished what I wanted to finish yesterday
 
0
Q: Validating input next token has a double

robbenI was getting a NoSuchElementException when parsing my double so I had to refine my code to validate the input. Is there anything you recommend? Code prior to the validation: public List<Map<Field, List<String>>> dataLookup(Map<Field, List<String>> inputValues) { Scanner scan = new Scanner(...

 
3:11 PM
Maybe I should commit it
 
3:21 PM
0
Q: Position with part of my code is messing it all up

Jeff1231guys, I created an empty list called allprice Which stores the calculations.The problem is because I have my code in a loop, the list "resets", meaning when the user press enter (to stop the loop), the final price of all my products is only the last calculation and not all calculations together.P...

 
LOL :D
161
A: Why shouldn’t I use Unicode characters to simulate typographic styles (such as small caps or script)?

WrzlprmftGeneral Those characters are not intended for regular Latin-alphabet text but for phonetics, Cyrillic-alphabet text, for use as mathematical symbols (representing variables), or similar. The only Unicode-compliant way to encode text in the basic Latin alphabet is to use the characters predominan...

 
3:32 PM
per a conversation yesterday.... I remembered that I had written a blog post about Null Safe Dereference in C# 6.0
 
0
Q: Class fields instantiated in constructor or in method

PhritzyI'm curious to see which one of these is preferred. The first one seems like it would be better since if I add more methods then I've already initialized other classes that I'm going to call, but if the other methods don't need to use myUtility or myBiz than it would be bad to have them setup in...

 
Monking
 
Hello
 
Greetings!
 
4:01 PM
@ThomasWard I saw that. >.>
 
@ThomasWard ಠ_ಠ
 
This sounds like a good question for codereview.stackexchange.comJonas just now
 
0
Q: Is this a good way of separating graphics from game logic?

TudvariCurrently my architecture (game engine) looks like this (not accurate): Everything graphics related is done in the GraphicsEngine (and in its components, like Material, Mesh, etc), but my problem is that If I want to store the pointers in RenderData, I have to include Mesh, Material etc header f...

 
4:17 PM
@CaptainObvious Utterly off-topic.
 
@JeroenVannevel That's what happens when I don't upgrade them.
 
possible answer invalidation by user1095108 on question by user1095108: codereview.stackexchange.com/posts/144112/revisions
 
@Duga RB
 
@EBrown @DanPantry :P
 
@JeroenVannevel I fixed it, pretty much.
Basically, I had to install all 29 NuGet updates. It only fails on one of the naming tests now.
 
4:32 PM
@ThomasWard How's it going eh?
 
@EBrown it's going. Want to beat my head against Python sometimes, but eh
 
You may also be able to seek help over at Code Review. That site emphasizes on slimming down code and improving performance on code that already works. — PartyHatPanda 46 secs ago
possible answer invalidation by user1095108 on question by user1095108: codereview.stackexchange.com/posts/144112/revisions
 
0
Q: Maximizing grad student happiness

EdwardA local university's graduate school has a field placement that's a required component for graduation. Each student works in the field (something like a residency for medical students) for one year in addition to completing their course work. The process of matching students with placement lo...

 
4:51 PM
1
Q: Accessing Properties by Name

Kittoes0124Over the weekend I decided to start work on my own version of FastMember. I began with my take on an implementation of TypeAccessor so that I could work with the properties of any type, create an instance of the type, and one or two other little tricks. I've reached a point where I'm out of ideas...

 
5:02 PM
My merging works. :)
 
Nice message.
 
It only shows up if you got to that page from the source site of the merge.
That's what FromMerge query string parameter does.
 
That's even nicer.
 
So if you go to that page without traveling from a merge (sese.evbpc.com/Sites/…) it's not there. :)
It also works for the Meta sites.
I feel accomplished. :)
 
how does strikethrough work on SE sites? I cannot find this formatting, the markdown ~~ does nothing
 
5:08 PM
@t3chb0t Main site question/answer it's <strike></strike>, comments/chat it's ---strike---.
5
 
so I'm not the first one asking this question, thank you :)
 
Nope. :)
 
strike
 
0
Q: Elemental selection sort functions in R

snoramA simple selection sort functions in R. Just for practice. Given the choice of algorithm and tools I wonder what can most easily be improved about the functions. NB. I wanted to keep the first function as elemental as possible. # Selection sort playing with loops sels <- function(x) { n <- ...

 
@Mast cool, I can copy it and extend.. oh, wait, the formatting won't copy
 
5:20 PM
@EBrown IIRC, you can use ---...--- on the main site too.
 
@Hosch250 Nope. I've tried it many times before.
 
Oh. The other ones work...
 
I just did and it didn't work, only the html
 
;)
 
@t3chb0t ---strike---
Be aware of spaces, they brake stuff.
 
5:28 PM
@Mast I thought it was the absence of space that braked things.
 
strike_one
strike two
--- strike_three---
The --- must be followed directly by a non-space.
 
You mean "break"?
 
Oh.
Yea.
 
Can you break a loop in C?
 
Does break work?
 
5:41 PM
I don't have a compiler with me to try it :(
 
Ah
 
Guess I could ask Google
 
It should, I would expect.
 
You'll need to specify what "better" means in this context. Also, this question could be suitable for Code Review, as long as (a) your code works as intended, (b) your code is real code, rather than example code, and (c) your code is included in the body of the question. If you wish for a peer review to improve all aspects of your code, please post it on Code Review. — Mike McCaughan 38 secs ago
 
@EBrown I'm going on a strike
 
5:47 PM
@Phrancis Yep. Just do an off-by-1 error.
 
-1
Q: download csv file from MVC in angular js

Bhargav My MVC Controller public FileResult AddBook(List<Class1> cl) { cl = new List<Class1>(); CsvFileDescription outputfiledescription = new CsvFileDescription { SeparatorChar = '\t', FirstLineHasColumnNames = true, FileCultureName = ...

 
possible answer invalidation by Kittoes0124 on question by Kittoes0124: codereview.stackexchange.com/posts/151167/revisions
 
@Duga harmless
 
I should release my non-Linq Linq replacements in a NuGet package:
public static List<T> Where<T>(this IEnumerable<T> collection, Func<T, bool> func)
{
    var newList = new List<T>();
    foreach (var item in collection)
    {
        if (func(item))
        {
            newList.Add(item);
        }
    }

    return newList;
}

public static List<T> Select<T, U>(this IEnumerable<U> collection, Func<U, T> func)
{
    var newList = new List<T>();
    foreach (var item in collection)
    {
        newList.Add(func(item));
    }

    return newList;
}
 
@Hosch250 What's the usecase for that?
 
5:58 PM
@Hosch250 mhmmm collection.Where(x => test).ToList()... Select(x => x.Property).ToList()
 
@skiwi For when you don't want to use Linq because of the performance hit.
 
@Hosch250 Why is your version better? Does it do things a lot differently?
 
It doesn't create the state machine.
Basically, it doesn't use the yield keyword.
 
00:00 - 18:0018:00 - 00:00

« first day (1335 days earlier)      last day (1147 days later) »