« first day (1136 days earlier)      last day (2881 days later) » 

11:14 AM
@skiwi I like how this renders differently on the starwall
 
Zak
@overactor Because it's lazy? :p
 
@Zak I'm not 100% certain if that is a joke or serious...
I don't know enough about laziness to exclude either
 
Zak
@overactor Mostly a joke. I have no idea what the algorithm is/does.
 
3
Q: Recursive flattening of Swift sequences - an overly complicated approach

overactorI recently read and answered Martin R's Recursive flattening of Swift sequences and continued to play around with the code until I arrived at something that was both pretty cool and possibly an abomination. So I figured I'd come back to CR with it and ask others' opinions. If you want a full con...

 
11:31 AM
0
Q: High performance triangle - axis aligned bounding box clipping

MatthiasImplementation of a Robust (i.e. with a finite plane thickness) Sutherland–Hodgman algorithm for clipping polygons against an axis-aligned bounding box. I use the following code only for clipping triangles. So the clipped polygon can consist only of at most 9 vertices. The code of Point, BBox and...

 
11:41 AM
We should learn designers this magic trick called source-control.
user image
6
Thank God I have the day off today, wouldn't have been productive anway.
 
@Mast But don't make the mistake of suggesting they use git.
5
 
I'm feeling evil now
> lib.rs:70:11: 70:15 error: `left` does not live long enough
lib.rs:70 (&left, &right)
^~~~
My variables die too soon :(
 
said dog
 
11:56 AM
Monking
@Legato Sorry I couldn't get to it, I'm usually inactive on weekends
 
Greetings, Programs.
 
@JeroenVannevel Shiny.
 
@Mast The problem is the file system based paradigm. It makes all kinds of good stuff hard to do.
 
SVN is surprisingly easy to use for simple things like that. If you integrate it in your menu it even has icons telling you exactly what function you need when.
 
SVN being better than Git?
 
12:05 PM
For what they do with it, probably easier to use and easier to get used to.
 
12:15 PM
The reason for not recommending git to designers is that designers produce large quantities of data (Photoshop files are huge and do not play nicely with git's delta-compression), but git requires every user to download a copy of all the revisions of all the files in the repository. So if designers store their work in git, then it quickly becomes very time-consuming to clone a repository.
 
this question must be replaced to code review network — Ilya 15 secs ago
 
Subversion is better in that respect (it only requires users to download copies of the files they are working on), but has its own problems (in particular, branching performance is very poor).
 
Zak
The (old) Ariane Rocket software bug is interesting reading. One software bug, £300 Million+ of rocket and satellites turned into so much fiery debris. around.com/ariane.html
 
@GarethRees I didn't even think about that, good call.
 
possible answer invalidation by Gareth Rees on question by Legato: codereview.stackexchange.com/posts/131804/revisions
 
12:30 PM
@Duga Nope.
 
Companies with large amounts of data that need to be revision controlled often end up using Perforce
 
@GarethRees judging by the wikipedia article it's awfully similar to SVN
just with actual branching :)
 
Hi.. I am trying this but not getting the output:
 
The Subversion design was heavily influenced by Perforce, yes.
 
@rakesh you seem to be in the wrong room....
 
12:38 PM
ok
 
i'm never dealing with date times again
4
 
0
Q: Attribute vs Static Property

David PilkingtonI have a model that needs to be saved in to a MongoDB collection. To get the collection name I have two options before me. 1) Attribute I decorate the class with a custom attribute and use reflection to access the value inside it. I can then cache this with the type to avoid future lookups. [M...

0
Q: replacing all <span> elements without any attributes in javascript

CliffThe institution I work for uses an application that has an awful software bug causing useless span tags to appear next to "misspelled" words in iframes. For instance, HTML that should look like this... <span class="myClass">Hello! My name is Tabitha.</span> ...might look like this instead: <s...

 
@DanPantry Have you started dating again? Bad plan.
 
@CaptainObvious Example/conceptual
no it's just somewhere a date goes from being 1pm to 2pm and i have no idea where or why
and worst of all its correct in some parts of the app and not in others because no single source of truth
 
The database is always right, unless it's wrong and every other place is right?
Wtf? Microsoft just bought LinkedIn?
 
12:43 PM
@skiwi DB is right
weirdly it seems that one part of the app is not rendering the dates correctly
I've just checked the inputs and they are all in zulu time and correct
 
Yep... Microsoft just bought LinkedIn for 26,2 billion dollar
 
2016-06-14T12:00:00Z which is being correctly interpreted as 12PM my time (GMT + 1)
@skiwi wtf
that's a lot of dollarinos
But one part of the app is rendering 13:00 instead of 12:00 and I just can't see why
 
@DanPantry Do they both use the same database driver?
Hmmm okay, apparently the deal still has to be improved by both the companies' shareholders and relevant governments
-1
Q: How to return a newly created struct as a reference?

skiwiAs an exercise to learn Rust I decided to implement a Bit Vector library, with inspiration from std::vec::Vec for which methods to provide. I have the following code: extern crate num; use std::cmp::Eq; use std::ops::{BitAnd,BitOrAssign,Index,Shl}; use num::{One,Zero,Unsigned,NumCast}; pub tr...

 
@skiwi Yes. Looks to be a UI issue
 
:/ I know it's not that small, but I don't see a realistic way to make the question smaller either
 
12:50 PM
@skiwi SOHVA
 
Stack Overflow; How Very Annoying?
 
Stack Overflow Help Vote Applied
 
I'm so confused
Zulu time is UTC, right?
with no offsets?
 
Zulu is just fancy speakz for UTC
Coordinated Universal Time (French: Temps universel coordonné), abbreviated as UTC, is the primary time standard by which the world regulates clocks and time. It is, within about 1 second, mean solar time at 0° longitude; it does not observe daylight saving time. It is one of several closely related successors to Greenwich Mean Time (GMT). For most purposes, UTC is considered interchangeable with GMT, but GMT is no longer precisely defined by the scientific community. UTC was officially formalized in 1960 by the International Radio Consultative Committee in Recommendation 374, having been initiated...
 
@syb0rg I appreciate it ;) But please only do it if you think it deserves it
 
12:54 PM
wiki:Zulu_time
 
Technically, if you're looking for advice on improving working code rather than fixing a bug, you should post the code to Code Review rather than here; however you have three nested loops iterating over large ranges; it's unlikely that approach is going to be rapid — Dave 32 secs ago
 
@skiwi Looks like you showed research effort, seems useful and clear; all recommendations for upvoting
@Mast Today is the first day of that Machine Learning class if you still want to sign up
 
@Vogel612 crap.
That's not what I wanted to hear
 
I will probably go ahead with the attributes and get ready to fight the case in a code review. — David Pilkington 20 secs ago
 
@GarethRees Why would git not work with PSD?
I know they're large, but git has LFS
 
1:04 PM
@DanPantry it's not a matter of "working" it's a matter of feasibility
PSDs get to be huge
 
What's the better option, then?
Copy-paste source control? ^^
 
which is a pain for git, since they are a binary storage format in the first place
 
lol yeah try git diffing a psd x)
 
instead one should use something that deals better with binary files
 
Examples?
 
1:05 PM
and that doesn't force you to keep all objects of version history locally
 
I use PS so could be useful
 
SVN, Perforce
 
My eyes completely skipped over SVN and went straight to Perforce lol
2
 
Zak
daaaaamn. I'm out of stars and I haven't even had lunch yet.
5
 
Maybe also Mercurial
@Zak have one :)
I did already have lunch. 'twas great
 
Zak
1:07 PM
I think I'm regressing ^^
 
now my PC is running out of juice
 
...why did Microsoft buy LinkedIn? http://blogs.microsoft.com/firehose/2016/06/13/microsoft-to-acquire-linkedin/
 
@syb0rg Thanks for the heads up, but if I'll take it it will be next round :-)
 
@ardaozkal The best way to stop Java development is to make sure Java devs can't find jobs
 
@Quill now tweet that to nick
 
1:12 PM
Watched netflix recently?
 
for free retweets
and internet points
 
@DanPantry Yes, git-lfs (large file support) is a workaround for the problem I described. But note that it's an extension (not built into git) and that it requires a server.
 
@Mast Second week and I'm still pumped about learning all this stuff
Its a really good course
 
Good :-)
 
1:19 PM
@syb0rg No worries. Though if you are afforded a moment I do have a C question.
Morning.
 
@Legato As in a review or just a quick thing for chat?
 
It's for an entire program that will later be a review -- this just a question however and probably quick for you. It has to do with how to properly use strcpy
 
@Legato What's the use case?
 
There is no way to properly use strcpy — use strncpy instead!
2
 
Initializing an array of strings with values that I read line by line.
 
1:23 PM
@GarethRees I was going to recommend that lol
 
I was doing something else at first but then I realized that I was setting the pointer and at the end they just all had the last value, so I looked into how to properly do it and found strcpy
I'll look up strncpy
 
@GarethRees Actually, I would probably use memcpy...
 
@Legato In that use case there should be no need for copying at all — you'll be reading the input into a buffer that you've malloc'ed, so then you can just put a pointer to the buffer into the array
@syb0rg memcpy if you already know the length of the string for some reason, sure
 
True, using strlen() and then memcpy() would probably take longer than just using strncpy()
 
See, now I'm not sure which I should be using, should I create a snippet? Mind, I've written 1 C program and pointers and memory allocation are low level things that have been abstracted until, though I do understand the concepts.
 
1:28 PM
@Legato Create a Gist and post it here
 
Alright.
 
Why not post a question on Code Review?
2
 
0
Q: I can has(kell) moar cheezburgers?

Michael Brandon MorrisKITTEH HAS IMPROOVD CODE SKILLS, AN NAO HAS BETTR CODE 4 U This is an improvement of my original Haskell Lolcats Translator, and now features a function to do the translation (recursively?) using a map. I still have two let statements, which I know are frowned upon, but I couldn't get both the s...

0
Q: Dice rolling game

chrisI created this program and coding for the task mentioned. Could some advice if this is right. import java.util.*; public class Dice { public static void main(String[] args) { String name; int bet; String option; Scanner input = new Scanner(System.in); Syste...

 
@GarethRees I was assuming the code wasn't working
 
@syb0rg Ok, then on Stack Overflow
 
1:31 PM
@GarethRees shudders
Updating Windows, I'll be back in a few
 
The quality of answers is quite low, but after a question has been asked 1,000 times even the experts get bored with it
 
That's the dichotomy of SO sometimes.
There's too many questions asking the same thing.
 
If only there were some mechanism to close some of them as duplicates
 
because duplicates are still broken even after dup-hammers for gold-badge users
 
As someone completely new to the language sometimes you don't know which is correct / best. Up-votes and duplicates do help though, but those are applied parsimoniously. Also, sometimes things aren't updated.
 
1:35 PM
^^ that's a huge problem in on SO
 
So proceeding "duplicates" have updated info, but it would be better if it was all in one place.
Yeah, for sure.
Anywho, here's the gist
Thank you both for your input.
 
The code doesn't allocate any memory for the lines read from the file
In particular lines_to_print is an array of pointers to strings
But where's the memory for the strings that are going to be pointed to?
One simple approach would be to allocate it like this: char lines_to_print[number_of_lines][LINE_BUFFER];
And then instead of fgets(line, ...) followed by a strcpy, you'd read the line directly into its destination using fgets(lines_to_print[i], ...)
 
0
Q: Accessing and caching attributes

David PilkingtonI have the following manager class that handles access and caching attributes from classes. I am a bit worried about the caching mechanism. Is there a better way of handling it? public static class AttributeManager { private static Dictionary<Type, Attribute> _cache = new Dictionary<...

 
@GarethRees Is that valid? I thought you couldn't initialize an array like that with a variable
Hence the need for allocation with malloc
 
1:52 PM
Dynamic array sizing was introduced in C99.
 
Oh wait, I was thinking of initializing the dynamic array sizing... which isn't allowed
He'd have to use memset to "initialize" it
 
@CaptainObvious VTC broken; missing parts of the code and not following the problem description
 
After some tinkering and research, it works.
 
By the way, it is usually not necessary to read the whole of a file into an array in memory — the usual thing to do would be to read one line at a time, and process it before reading the next line
That way you don't need to allocate memory for the whole file
 
0
Q: What is a good practice to generate a HTML table from a java class

Shubham Roy ChoudhuryI am rewording my earlier question. Below is a code that I am using to generate an HTML table based on some criteria. This is just a sample class, in real we are using a class with complex business logic and then generating an html table. Is there a better way to generate HTML tables without wr...

 
2:00 PM
I'm not reading the entire file, actually. Just a given x, it'll make more sense once I complete the challenge! I could still be misguided though.
 
This question is better suited for Code Review. — Gerald Schneider 51 secs ago
 
@CaptainObvious 2 more VTC
 
One last quick question, for sorting C seems to have qsort do you recommend using that or just writing my own?
 
qsort is fine.
 
@Legato Use qsort, and if you are comparing strings you don't have to specify a callback for the last parameter, just pass in strcmp
@MichaelBrandonMorris In your most recent question, you have a ... in your code which indicated you seem to have cut a bit out
I'd recommend inserting that bit back in
I accidentally left Wireshark running again... this time all weekend
It crashed when I attempted to maximize it and see how many packets I captured
I think I had captured about 6 GB of packets tho
 
2:09 PM
Can't say much about that without seeing the rest of your code - one line doesn't really give a lot of information about its efficiency. Take a look at Code Review and post the whole code there; they'll soon speed you up if it's possible — Dave 25 secs ago
 
Zak
2:21 PM
I'd like to see SO FGITW on this one:
0
Q: Why is there an Application.Activate method for Word but not for Excel?

ZakA Word.Application object exposes an .Activate Method. An Excel.Application object, on the other hand, only exposes an .ActivateMicrosoftApp method which performs a notably different function to "activate this particular application object". Why isn't there an Excel.Application.Activate Method?

Welcome to IT. Struggle, learn, grow. We have ALL been making this up as we've been going on. — Richard U 49 mins ago
Appropriate?
Speaking as somebody in your situation only recently (though in my case, I was literally on my own when it came to learning how to program), Come to Code Review. It's not quite as effective as having your own personal mentor, but it's pretty damned close. — Zak 23 secs ago
 
definitely. at least if the CEO doesn't mind his devs' code to be peer reviewed and improved by experts from around the world, for free.
 
-1
Q: Speed Up Macro Code--Beginner

Student LI'm a business student who just started to learn VBA. I am trying to write a macro for a project but only have minimal experience actually stepping into the code. The macro I have written is to delete all row entries which do not meet my criteria if they contain certain words, including removing ...

 
I think it's best to do code review internally to the company if at all possible, for the reasons I gave here
 
yep
best would be for him to work on side projects at home, and post not-work-related code here
 
Zak
2:37 PM
@Mat'sMug Depends on his work and the attitude of his boss.
 
yeah. still "totally my own code" is always better than "I wrote it, but I need to ask if it's mine enough to post"
 
Zak
Posting "horrible implementation of xyz #23" to Code Review is hardly going to betray a company's competitive edge, but it is important to make sure your boss agrees with that statement before you do so.
 
It might be bad for the company's reputation, though — it suggests that the company lacks the expertise (and/or time) to review its own code
 
well it's already known that before that guy came, they lacked the expertise (and/or time) to even write their own code...
 
Zak
@GarethRees This is also why you don't mention the Company anywhere. Just "Here's some code I wrote to do X"
 
2:43 PM
lol, clicks user profile, "works at XYZ LLC"
(didn't check)
 
@Zak That would be unethical and possibly ineffective — in many cases "to do X" would narrow the set of candidates so that someone in the know could guess
 
Zak
@GarethRees X (especially when junior) is likely to be something fairly generic / common.
 
@GarethRees "Here is code I wrote to normalize capitalization of words that come from a database in all upper-case format."
What company do I work for?
 
Zak
"Here's my class for adding method operations to 2D Arrays in VBA"
 
Zak
2:48 PM
"Here's my implementation of a simple Risk Parity Model"
 
Wrote ugly code that works. Uuugh
 
Zak
"Here's my code to copy certain columns from a spreadsheet and put it in an Outlook Email"
"Here's my generic SQL Query"
etc. etc.
very few of the questions on CR are actually unique enough to offer more than a wild guess at the industry somebody's in, let alone the company.
 
"Here's my code that I've posted against the terms of my employment agreement and I'm hoping no-one at my company will ever Google for any of the variable names in it"
 
Zak
@GarethRees It happens. But very rarely. And is the kind of thing which (obviously) people shouldn't do.
 
Is there some python libary for quickly printing twin primes? I already got a fast primecheck
 
2:52 PM
speaking of that, I need to find a way to OSS my Linq-to-Sage implementation
@N3buchadnezzar wth is a twin prime?
 
(3, 5), (11, 13), ... , (101, 103)
 
Zak
@Mat'sMug Where N +-1 are both prime
 
Are there any triple-primes by that logic?
Apart from (2, 3, 5)
 
@EBrown (2, 3, 5) is the only one. By some quick thinking you can figure out why
 
Yeah, multiples of three...
 
2:58 PM
@N3buchadnezzar tuples are already formatted that way. You just need the logic and go for some prints
 
`def twin_primes(limit):
prime_list = primes(limit)
twin_lst = []
p1 = prime_list.pop(0)
for p2 in prime_list:
    if p2 - p1 == 2:
        twin_lst.append((p1, p2))
    p1 = p2
return twin_lst`
Seemed to work
 
@N3buchadnezzar 4 spaces
 
Unsubscribes from LinkedIN. Burns PC. Moves to uninhabited island. Receives message in a bottle. It's Windows Update.
6
 
have you heard that Microsoft bought Linkedin ?
:(
 
@Zak I regret to inform you that I'm going to steal that checkmark :p
 
3:09 PM
@N3buchadnezzar I'd use zip. The way that you are using it is fairly simple and ok. For a memory inefficient way with zip:
def twin_primes(limit):
    prime_list = primes(limit)
    return [
        (p1, p2)
        for p1, p2 in zip(prime_list, prime_list[1:])
        if p1 + 2 == p2
    ]
 
Zak
@Mat'sMug That's absolutely fine. I didn't have much time to devote to a review but I can give 2 minutes to tell them about screenUpdating ^^
 
@JoeWallis See the pairwise recipe in the itertools documentation
 
:30326130Yeah, I think there are other parts of my code which is slow :p
 
@GarethRees Thanks, I always forget about tee. I really have to commit it to memory.
Now I can't edit the code, ):
 
Just need to wrap my brain around a good way to form a number such that the last digits of the number is p1 and the number is divisible by p2, where (p1,p2) forms a twin prime.
Easier with an example... (101,103) -> 48101. Because last digits are 101 and 48101/103 is an integer
 
3:17 PM
@JoeWallis Returns like that are idiomatic?
 
@Mast They're not?
 
That was a question, I don't know :-)
 
Like wise. Returning comprehensions is ok, so I don't see why making it more readable would make it not idiomatic...
 
@N3buchadnezzar What about (3, 5, 7)?
 
@N3buchadnezzar You have p + q(10^k) == 0 (mod p + 2) and want to solve for q. Now p == p (mod p + 2), so that means q(10^k) == 2 (mod p + 2). So q is 2 divided by 10^k (mod p + 2).
 
3:24 PM
@GarethRees And k is the length of p right?
 
Yes, that's right
 
@syb0rg Sorry, just now saw your message from earlier. The ... is part of a very long string map definition that bears no significance on the functionality of the code.
 
Oh my god LinkedIn is going to have an "Interview for this job over Skype" button now
 
@MichaelBrandonMorris I disagree actually, one recommendation (based on the length of the table) might be to export it to a file, or do something else to represent it better
 
0
Q: Sample Rails application

Manoel Rebelo AbranchesI did a very simple Rails application as example for a job interview with a simple client to post data. I didn't get approved so I would appreciate if you could point out where I did bad and how I could improve it. I would also really some reference to read more about what I'm lacking here. Thanks

 
3:27 PM
@CaptainObvious No
 
`def p1_div_p1(p):
    k = int(log(p, 10)+1)
    q = (10**k % (p + 2))/2
return q*10**k + p`
 
@syb0rg Fair enough, but how many lines is too many for a code review? 100 lines of strings? 1000? If I did that, you'd be scrolling a very long time to see the 10 lines of code that actually do something.
 
@GarethRees Do you see anything wrong in my implementation? Keep getting the wrong answer
 
@MichaelBrandonMorris The character limit of a question is too much for Code Review
But I doubt you'll hit that
 
@syb0rg Very well.
 
3:29 PM
@MichaelBrandonMorris Limit is 65,536 characters.
Or 65,535, I can't remember which.
 
(i) q is 2 divided by 10^k (mod p + 2), but you've done the division the other way round; (ii) you can't use ordinary division here, you have to use modular division
For example, 2 ÷ 1000 == 48 (mod 103)
 
Isnt that what % is :p Will flip it
 
Modular division is the opposite of modular multiplication: for example, 1000 × 48 == 2 (mod 103), so 2 ÷ 1000 == 48 (mod 103). There's no built-in operator in Python that computes modular division — it's up to you to implement it.
 
0
Q: Parsing and executing a simple shell script

Programmer 400I'm writing a simple shell and want to parse and execute a simple shell script. PAGER=more if type less > /dev/null;then PAGER=less; fi echo $PAGER printenv|grep $1|$PAGER The above sets a pager and greps the environment variables for a variable. I run the script from my shell after I start...

 
2 more votes on this till the guru badge: codereview.stackexchange.com/a/56807/27623
setbuf(stderr, NULL); /* do not buffer the output to stderr */
The library code that I'm using has this line... I learned stderr isn't buffered in CS1
 
Zak
3:49 PM
@Mat'sMug you around?
 
@StudentL if you have a specific programming issue, feel free to ask on Stack Overflow if you cannot find an existing post with your answer. Code Review comments are not the place to fix your code. — Mat's Mug ♦ 6 secs ago
yes
 
lol
 
Zak
@Mat'sMug I was literally about to invite him to a chat room, was going to ask if you could migrate the comment thread ^^
 
I need to post my answer first =)
 
Zak
@Mat'sMug I did not know about Select Case True. That's going to be Soooo useful.
Though actually, now that I think about it, it explains why you can do things like select case ... Case >x, Case <y, Case = Z etc.
 
3:58 PM
that was creepy and almost scared me....
@EBrown WHAAAAAAAAT!?
 
Zak
@Mat'sMug Beat me to that comment by, like, 2 seconds ^^
 
@EBrown is that account really Taylor Swift's account?
 
0
Q: Averaging nearby points in an array

TheLethalCoderThe following code takes in an point array and removes all of the nearby points whilst averaging them based on the conditions past in. The variable _nCornerTolerance is an int that is calculated prior in the class. Typically it is around 5; private Point[] AverageNearbyPoints(Point[] points, bo...

0
Q: Simple restaurant menu

Daniel NetzerMy first time with web programming. just wondering how bad it is. index.html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Restaurant Menu With JQuery</title> <link rel="stylesheet" type="text/css" href="style.css"> <script src="https://code.jquery.com/j...

 
Hello @StudentL
 
Thanks for all of the help guys! Never really had to post on a forum before, so this has been quite an experience
 
4:10 PM
@StudentL forum Q&A site
 
Just getting embarassed all over the place haha
 
Lots of people fail to make the distinction, not just you
 
Well thanks a lot guys! You're crazy knowledgeable about this stuff, at least to someone not well acquainted with knowledge of programming
 
@Malachi Not likely.
 
@CaptainObvious Could use some upvotes
@StudentL You should review some questions in the future!
 
4:23 PM
I need some air I think
Allow me to strongly doubt that. Turns out robust code isn't tested manually by stepping through, but by specifically writing a Sub procedure in a dedicated test module, that only runs that code you want to test; if the procedure does 20 other things, there's no way to test it cleanly and automatically. I don't know why basic OOP and clean code principles get systematically thrown out the window whenever we're talking about VBA code, AFAIK VBA is just as capable of SOLID and OOP code as Java or C# is. — Mat's Mug 1 min ago
 
@EBrown she could be like super smart about that kind of stuff, I don't like to judge people I haven't really met...you know what I mean?
 
@Mat'sMug Most recent question is duplicate of past closed post
Seems like the user doesn't know about the "edit" feature
 
well, OP has a 200-liner procedure and is asking how to "automatically" step over a chunk of it, because they want to only validate/test that part
talk about a X-Y problem
and the accepted answer goes "comment-out that chunk you don't want to run"
in what language tag other than would that be a checkmark-worthy answer?
 
@syb0rg Here's the solved challenge
Hopefully some of the decisions make sense.
 
@Malachi IIRC she had a tweet that gave it away.
 
4:32 PM
@Mat'sMug All?
 
lolwut?
 
@syb0rg I hardly find myself qualified to review someone's code man! The extent of my knowledge has come from the help you guys gave me on my practice class project!
 
It would be better to actually write modules to break it up and actually test those individually, but I'd say all, it sounds like the asker simply didn't even think about that use of comments.
 
@StudentL everyone says that. @Zak said it, @syb0rg said it, I said it.
truth is, everyone can look at anyone else's code, and see something they either like or don't like - and say why
and you learn TONS by looking at other people's code, too
 
Indeed.
I look at my own code and see stuff I don't like all the time.
"Wtf is that doing here?"
 
4:34 PM
@StudentL For sure. Where's the comment I said needed more upvotes?
 
"Who wrote this crap?"
Oh, right. I did.
 
@StudentL I remember and sort of still do feel like I'm not qualified to give people other answers, but the truth is even if it's only minor you can contribute a bit, and you'll get so much out of it.
Besides the fact I feel that, I somehow have 50+ answers...somehow.
 
You'll keep feeling like you're not qualified for a long time.
 
CR is welcoming and rewarding place, if you let it it's basically the best place on the interwebs.
 
We'll see I guess! I'll keep doing more practice and view some people's questions. If I happen to have an answer I'll go for it
 
4:38 PM
2
Q: Bottom up (iterative) mergesort in C

coderoddeI have this C implementation of the bottom-up (iterative) mergesort: mergesort.h: #ifndef MERGESORT_H #define MERGESORT_H #include <stdlib.h> #ifdef __cplusplus extern "C" { #endif void my_mergesort(void* base, size_t num, size_t size, ...

0
Q: ChocolatesByNumbers- Find the number of N chocolates in a circle

Tolani Jaiye-TikoloRecently, i have been indulging in a lot of codility challenges to improve my coding performance. For each of this exercise, I always aim for simple solutions as opposed to complicated ones that arrive at the same answer . The question is Two positive integers N and M are given. Integer N re...

0
Q: Rails Sample for interview

Manoel Rebelo AbranchesI did a small sample application for an Interview. Since I didn't got accepted I would like your opinion on how to improve it. The aux methods are private. I have a usage_common to remove duplication in the usage and usage_instance methods add_item_hash is used because the format written in the ...

0
Q: C the large print

LegatoChallenge Write a program which reads a file and outputs a specified number of lines, sorted on length in descending order. Specifications The first argument is a path to a file. The file contains multiple lines. The first line indicates the number of lines to output. The following lines a...

 
@Mast I need a little help with this API thing for the SE site stuff.
Mostly structure/endpoints.
I've no idea what to create/name carp.
 
Jul 18 '15 at 19:01, by Mast
@IsmaelMiguel There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.
 
Yes, please help. Lol
 
Like I'm any good at it :P
 
I just need to know what endpoints I need to create.
 
4:41 PM
At least 2.
 
@StudentL Even if you can't answer anything for a while, even just asking is creating a valuable opportunity for you to learn until you can / someone else to answer. I think I asked 30 or so questions before I started answering. So, don't let it dissuade you if you don't find anything at first.
 
I know I need an endpoint for gathering the trend of the history data points.
 
I know nothing about endpoints I'm afraid. I wouldn't recognize one if it was right in front of me.
 
4:54 PM
@StudentL Reviewing code is how I got to where I am now knowledge wise
I doubt I'd have my current internship if I hadn't been introduced to this site and reviewed other people's code
@CaptainObvious I'll try to get to this after lunch
@Legato Unless you have a decent answer to it by then
@CaptainObvious @Mat'sMug This was the question I was talking about before, the duplicate
 
a duplicate of what?
 
@syb0rg You don't even have to answer if it's not interesting, just sharing since you're to thank for its existence.
 
OP should have edited their other post
 
This question might be better suited for codereview.stackexchange.com. — Alexander Vogt 44 secs ago
 
@GarethRees TIL. Thank you for correcting my ignorance
 
5:03 PM
@Duga It could work I guess, but it could use some polish.
 
@GarethRees I tried to implement this rosettacode.org/wiki/Modular_inverse#Python. However it does not correlate with your test cases.
 
5:15 PM
wait i got it
 
@N3buchadnezzar That code show you how to compute the modular inverse. To compute modular division is one small step further.
For example, modinv(1000, 103) returns 24. That means that 1 ÷ 1000 ≡ 24 (mod 103). But what you want is not 1 ÷ 1000 (mod 103), but rather, 2 ÷ 1000 (mod 103).
 
@GarethRees Yeah, I got it. Python actually had a built in function
`def p1_div_p2(twin_primes):
    p, q = twin_primes
    k = 10**int(log(p, 10)+1)
    m = 2*pow(k, p, q)
return p + k*m`
 
Right, that's taking advantage of the fact that p + 2 is prime, so you can use Euler's theorem
 
Indeed
 
@LovetoCode If you would like to have your code reviewed you might wanna take a look at codereview.stackexchange.com maybe you'll get some more and / or better help on that site. — Mango 44 secs ago
 
5:27 PM
@N3buchadnezzar If you need the smallest solution, then you need m = 2*pow(k, p, q) % q
 
@GarethRees Right, thanks. Totally forgot about that
@GarethRees Bah, I keep getting the wrong answer even though everything seem correct
keeps trying
 
5:45 PM
@GarethRees Take a look if you want. Still not sure why it is wrong pastebin.com/sTVXsKtt. The correct value should be 18613426663617118.
 
See...Mario is really his last name. His first name is "It'sa me!" — RianBattle 6 hours ago
2
lol'd
 

« first day (1136 days earlier)      last day (2881 days later) »