« first day (266 days earlier)      last day (2498 days later) » 
00:00 - 21:0021:00 - 00:00

12:29 AM
0
Q: Printing a week range string in python

BryceFor some reporting I need to print a human readable date string for the week covered by the report, using just the standard python module library. So the strings should look like: Dec 29, 2013 - Jan 4, 2014 Jan 26 - Feb 1, 2014 Jan 19 - 25, 2014 Below is a script I threw together to achieve t...

 
1:02 AM
0
Q: Functional programming code, collect consecutive numbers (F#, OCaml, Haskell)

citykidHere is my functional approach to collect numbers in a list into another list of lists of consecutive numbers, so the input [1; 2; 3; 2; 4; 1; 5;] computes to [[1; 2; 3]; [2; 4]; [1; 5]] The code works, but I need a while to understand it. Would prefer a solution that is more clear. Is there...

1
Q: Regex to clean text in preparation for word count in PHP

LenoxusThis regex seems to work for me, but I'm curious if anyone can think of a breaking case, or tell me anything I did wrong. (If it seems the regex does what I say I want it do to, say so, then for fun you can help me become more neurotic about what I actually want it to do, which hinges on the que...

 
1:51 AM
Hey, @lol.upvote!
 
Hey!
 
Have you voted on this question? The OP has created his account here, but still has 11 rep.
 
Yeah ;)
 
Cool. I'm glad we were able to get this done. Maybe he'll ask more questions now.
 
I was just thinking, if I should drop @lol.upvote and revert to @retailcoder. And then I had a better idea.
(meta post brewing)
 
1:54 AM
lol.star?
lol.mug?
 
lol.no.
Votes are anonymous.
Upvotes are anonymous
So
My upvoting helps the site, good.
but
...
no one knows, no one sees. If I commented on every question I vote on...
Visibility.
upvote
subliminal
lol
but that's not the point.
Comments are activity. They're important.
 
I haz a confuze...
 
The power of comments is underestimated. I think there's nothing like reading the reason why someone else [up|down] voted on something, to motivate a user to think "yeah, me too!" and [up|down] vote too.
2
 
#TeamComments!
 
lol.starred ;)
 
2:06 AM
That's a reason why I comment: partly to inform the person I'm commenting to, and partly to attract (or dissuade) other voters.
 
Hi @user3234102!
Welcome to the Wonderful World of StackExchange!
If you have any of your own working code you ever want to get peer reviewed, you're welcome on Code Review too!
(and then people will vote and you'll earn reputation score and in no time you earn enough to participate in chat ;)
 
2:33 AM
Finally caught up with me ... feel absolutely shattered.... flu
Just slept for a few hours, now it's time to go to bed ...... don't think that will happen soon
 
good night!
 
Poor monkey. :-( I was unable to get a flu shot at school since I was in class, so I'll just have to manage. I haven't gotten the flu before, though.
 
Hello @200_success!
 
Hello, @lol.
 
hey all
seems a suprisingly social time?
 
2:37 AM
yeah, we're like that ;)
 
Yeah. I thought I had a good day at +232.
 
Nice!
 
Nice X2
 
... but it happened on the same day as Mr. Record Breaker.
Is it a record? A personal best, anyway.
 
I think it is a other-than-bounty high .... not sure how to check.
 
2:39 AM
@Jamal Did you see what happened to
 
+50 and Revival. Good enough for me.
 
3
Q: How to speed up this k-nearest neighbors code?

Nicolas ZhongI have wrote kNN (k-nearest neighbors) code as follows, but it is very slow. I want to get an exact k-nearest-neighbor, not the approximate ones, so I didn't use the FLANN or ANN libraries. Could you give me some advice on speeding up this code? struct Pair{ int id; double value; Pai...

Now it's not the same question anymore. A bit of a mess.
 
@200_success: Yes. Luckily the original code wasn't replaced, but it seems a bit confusing now. Perhaps I could mention in my answer that it pertains to the original.
 
Close to the same question; now much bigger. At least I know what T is now.
 
@ChrisW: Does it looks like the first update is just an extension of the original? If so, perhaps the original can be thrown out, with our answers preserved.
 
2:43 AM
I guess the OP's English is second-language and that he he writes doesn't write it fluently.
 
Is that MATLAB code related?
 
True. He also states that he's not too familiar with C++, which is why the code looks very C-like.
Anyway, we can see if the original can be thrown out, if the first update has all its elements. Along with removing the other update markings, it may make the question clearer.
 
@Jamal The if(!type)//just inner_k part of FindNN matches the original code. Your answer is still on-topic. There's a lot of additional code.
 
@ChrisW: Yeah, it appears that the original was just unfinished code. The following update continues from there.
 
Everything you mentioned in your review still applies to the updated code of the question.
I suggest we make an exception and just edit out the original unfinished code.
 
2:49 AM
I'll make the edit. If it looks like it won't work, feel free to roll it back.
Well, it should, but we'll see.
 
@200_success He says it is: says it's the driver/main code. The C code is presumably library code called from MATLAB. It doesn't quite match: he's calling mexFindNN from MATLAB, for which there's no C source; but there are probably-somehow-related-but-not-directly-related C functions like mexFunction
 
And yet there's not even a main().
 
mexFunction() is MATLAB's entry point, or dispatcher.
 
0
Q: JavaScript "Cheat Sheet"

Reverend_DudeHello I am looking to gain experience with java script. Can someone send me a link to somewhere that I can look up some of the syntax that I am having trouble learning. Mainly things like "<<" and "/\w/" I find code that works but if I don't know why it works I have little hope of harnessing th...

 
2:55 AM
Right. Thanks for pointing that out.
 
Edit done.
3
Q: How to speed up this k-nearest neighbors code?

ZhongI have wrote kNN (k-nearest neighbors) code as follows, but it is very slow. I want to get an exact k-nearest-neighbor, not the approximate ones, so I didn't use the FLANN or ANN libraries. Could you give me some advice on speeding up this code? mexFindNN.cpp #include <iostream> using namespace...

And this can start getting close votes:
0
Q: JavaScript "Cheat Sheet"

Reverend_DudeHello I am looking to gain experience with java script. Can someone send me a link to somewhere that I can look up some of the syntax that I am having trouble learning. Mainly things like "<<" and "/\w/" I find code that works but if I don't know why it works I have little hope of harnessing th...

 
3:13 AM
This question is tagged
0
Q: Functional programming code, collect consecutive numbers

citykidHere is my functional approach to collect numbers in a list into another list of lists of consecutive numbers, so the input [1; 2; 3; 2; 4; 1; 5;] computes to [[1; 2; 3]; [2; 4]; [1; 5]] The code works, but I need a while to understand it. Would prefer a solution that is more clear. Is there...

Is it really polyglot? It doesn't look like Haskell to me.
 
^^ I keep looking at this chart and can't help seeing a heavy upward tendency.
I'd like to correlate this with the number of users over time.
@Jamal thanks for completing the edit.
I feel somewhat weird about that one.
I should have refused it for being too minor.
I need to sleep. Gone, I am!
 
3:37 AM
@lol.upvote: I prefer to have it deleted, but I'll let Community handle that eventually.
Goodnight!
 
 
1 hour later…
4:51 AM
0
Q: Is this a OK way to handle access to database connection both inside and outside of classes?

ThomasKI used to include a PHP file -- database.detl.php -- at the very top of my index.php file containing the following code: try{ $dbh_options = array(/*...*/); $dbh = new PDO('mysql:host=localhost;dbname='.db_name.';charset=utf8',db_user,db_user_pw,$dbh_options); } catch(PDOException $e) { ...

 
5:46 AM
0
Q: Add index before Sort (JavaScript)

Reverend_DudeI have an array in JavaScript. I want to sort the numbers in it numerically, and then pick the largest number but know the original place of that number. My idea is to add a Key value pair as an index. But I am not sure how I can syntax my 'for' loop to perform that. var countArray = [1,2,5,...

 
 
2 hours later…
7:26 AM
0
Q: Beginner Code optimization

Reverend_DudeMy code seems is not very efficient. The problem: I want to find the word in a string that has the most repeated characters. Currently I am jumping each character and checking. Do you have any ideas that might improve the number of processes that are required to find which word has the most re...

 
8:04 AM
0
Q: Python Palindrome-Tester

NewbI've been asked to write a program that tests if a given string is a palindrome or not. n is a string of length 1<=x<=10000 containing no spaces or special characters. I wrote the following in a few minutes: def run(n): n = n.replace('\n','') nprime = n[::-1] Bool = True for i in range(...

 
8:18 AM
Good morning everyone.
 
8:38 AM
0
Q: JavaScript Quiz App

udbPlease review the code quality of this JavaScript Quiz App. Code improvement tips and simplify are welcome. Demo - http://jsbin.com/eRiSUhIB/1/ var quiz = [{ "question": "What is the full form of IP?", "choices": ["Internet Provider", "Internet Port", "Internet Protocol"], "correct": "I...

 
9:31 AM
@kleinfreund Moin. How is that open day thing at your school going so far?
 
@amon Good morning, amon. Everything is alright. As I mentioned, I brought my laptop and now I'm writing on how I built the site. Started with prototyping as usual and have to work out my concept afterwards. :p
When I started I though I'm going to end up with a simple static page, created with vanilla HTML and CSS.
Then I switched to SASS and inuit.css. Also I registered a domain and host my page on GitHub now. All of that was not planned. :p Shortly after I moved everything to Jekyll.
Basically I'm going all in for the last month and tried all the stuff the cool web kids are talking about. Well, not all. There is so much to explore, to consider. It's simply great.
Well, I need a new coffee. Too bad I forgot to bring a can of good tea.
 
10:38 AM
0
Q: Can I reduce the bloat in my Google Spreadsheet form script?

MantarLong story short I feel my code should be able to be reduced a whole lot, I just don't know how. What it does is triggers on Form Submit, takes the information from the submission (this being employee hours for a selected date) and updates a spreadsheet with the information. It allows for multip...

 
11:00 AM
@kleinfreund Don't forget to inform the visitors about a place we know as Code Review!
And btw: Did that git commit -amend -C HEAD help anything?
 
Ha! I don't think anyone here has atleast a bit of a clue of what I'm doing. It's more design-related.
As I said I use GitHub with a GUI. But I'll possibly switch to command line later, since Jekyll is used via command line, too.
 
11:43 AM
@kleinfreund What GUI are you using for GitHub?
 
The standard one they're offering for download. It's all I need for the moment.
 
12:42 PM
I've added a little mixin to my question on CR and was about to improve it, but I can't get this if-statement to work: stackoverflow.com/questions/21350537/…
 
12:55 PM
Okay, it got solved. Thank you anyway.
 
@kleinfreund I know nothing about SASS so I can't help you there :)
 
It's okay, was a scope issue. Basically I tried to define variables inside a if construct. Needed to initialize it outside.
 
1:51 PM
@OldCurmudgeon I apologize for seeming"creepy", Paul; I wasn't trying to stalk you! The reason was that this site's policy is that people may only post, for review, code which they have written themselves. Monkey (and I) had thought that maybe the name in the source code's copyright notice didn't match your user profile: so I looked for evidence of whether you were the same person (to justify or to avoid your question being closed, for posting someone else's code).
 
0
Q: Repository pattern review, question about when dispose the Context

Bruno KleinI have a question about the Repository pattern. This is my repository: public abstract class RepositoryBase<T> : IDisposable, IRepository<T> where T : class, IEntity { /// <summary> /// For iterations using LINQ extension methods on the IQueryable and IEnumerable interfaces ...

 
2:16 PM
Hello again. :)
 
0
Q: handling serial port with select and local socket

user2018761So I have another issue, I'm trying to handle connections made by local socket along with data from serial port. So here is my concept: Serial port is opened and monitored by select Local socket is opened and put in Listen state inside loop I call my function accept_connection periodically When...

 
@kleinfreund Hi there
I'm working on preparing some code for review over here, but to explain my code properly I am adding a lot of Javadoc. And that takes time, and isn't always easy apparently :)
 
2:32 PM
0
Q: Compromise password in code

user2514631I've heard that putting your passwords inside of the actual code of a program is bad practice. How would you guys go about compromising the password in a compiled program besides a brute force attack? Thank you!

 
3:23 PM
I have question on formatting.
If I have a list and a block of code (intended by four spaces) after it - with TWO newlines between, shouldn't it close the list and format my code as such?
 
@kleinfreund No, to add support for multiple paragraphs in a list item, they haven't made it that way.
@kleinfreund If you want to have the code as part of the list item, use 4 additional spaces on each of the code lines
 
Well, this is unintentional. :x
How do I... well, close the list then?
 
@kleinfreund Good question. You could write something on a line after the list, without indentation. In your case you could write "Here's the result" or something
 
Okay, thank you. :)
 
3:53 PM
0
Q: MySql in Vb to update every field of every page of a form in the database

user1646072I have a VB code here that connects to a MySql database to update every control on every page of a form in our database. I am told is taking longer than it should to run. Comment 'Setup MySql connection' is where it starts. I am wondering if there are any obvious optimisation tricks I am missing...

 
4:11 PM
@klein @simon or you put a html comment <!-- end of list --> :)
2
 
Oh, this is a neat trick. Cool.
 
That's because code blocks can be part of a list.
 
@lol.upvote Had a feeling there was another way. Hi btw :)
 
Good afternoon! I'm not really here though, phone chat :)
 
Heya. ;)
Phone chat better than no chat
I find it more intentional to intend a code block inside a list by two aditional spaces (i.e. 6 spaces in total, depends on list item level)
 
4:31 PM
I'm not really a programmer, but I just saw that VB code and wondered how one works with this... The lack of brackets is just horrendous. :x Well, I worked with Delphi some time ago..
Hey Malachi. ;)
 
@kleinfreund and it is missing semi-colons
how is it going
 
Yep, it's really hard to read and follow constructs and stuff.
 
going to be working on a website today I think
@kleinfreund it's not that hard. but I would much rather work with C# it makes more sense
 
Oh, it's alright. I've told you guys about the open day today, yes? This evening, there is also a homecoming event there. theme: 90's.
I'd love to look through some website code.
Already answered some zombies today.
2
 
@kleinfreund Ah, a fellow JavaScript zombie killer
good
 
4:39 PM
Sorry mate, but JavaScript is not my department. ;)
HTML and CSS/SASS
 
good enough
 
@kleinfreund I started working with Delphi. Using begin and end; isn't that bad IMO :)
 
I look through my mixin code again now,,,
@SimonAndréForsberg Delphi was my first programming experience and I didn't know other languages, so I didn't had a problem. But I quickly noticed it was quite different to other syntaxes. But I liked Delphi.
Yep.. And how was that? end. ends the unit, right?
Oh I remember, there are units.
 
@kleinfreund Yup, exactly right. Delphi was my first experience also, started about 16 years ago :)
 
I did Delphi for half a year, I think. My highest success was wrapping my head around a function with 3 times nested for loops.
 
4:43 PM
I do find the Java way more preferable though. All methods goes into classes. All classes goes into packages. Couldn't be more structured.
 
Someone knowing SASS here atm?
Delphi has this concept of procedures and functions, where procedure just do stuff and functions also return something.
 
I used Delphi for several years as my main language. Once I learned Java I didn't look back much though :) Java made me learn how to do things clean and really object-oriented
 
VBa has the same
 
Yeah, in other languages a procedure is just a function/method that returns void.
 
As I said I'm not a programmer, but I get some concepts. I'm doing programming-like stuff in SASS since today and it worked surprisingly well.
 
4:50 PM
@kleinfreund Then what are you? :)
 
Well... I'm going to be some kind of web developer I guess/hope?! :p
Atleast this is how my current "plan of things" looks like.
I think about studying media informatics. I'd prefer a more web developer/design oriented study thing, but there is none :/
 
learn on the internet
www.codeacademy.com has some javascript and python, but it's only to get you started.
then get some good books for learning logic and design
most of the time you learn more if you just do it on your own.
2
but this is not always true
sometimes you need direction.
 
I do that. Everything I know about HTML and CSS and all the other things are self-tought. I have a webdesign class in my current apprenticeship, but I'm way ahead.
The point is: I need some kind of education while I'm doing this. I can't just sit here, learn my stuff and live from nothing.
For a long time I maintained a tumblr only for the purpose of developing themes for it.
One of the first website I made was the one for my parents.
I have birthday soon and told my parents I want the money to buy myself a copy of Sublime Text xD
 
0
Q: How to improve Express.js controller with Node.js style exports.methods

Jonathan MilesSo I have some Node/Express.js controllers which implement the exports.method Node module convention. This particular controller also has a few helper methods. The code works fine! However, I'm a stickler for conventions, best practices etc. and recently I've been going back over one of my p...

 
5:25 PM
@kleinfreund do you have a Site currently up right now? I have a couple that I work on when I am not busy with work and family. (which is very little lol)
hartwebpages.com i haven't looked at it for a while either...lol
 
I'm working on my personal site atm. You know, the one with the four color schemes from my first question here on CR. ;)
 
5:46 PM
@kleinfreund Plans are what we make, while reality happens.
 
I'm not really planning. It's an idea. I think "Yes, you could work as that.".
Maybe I do something different in some years. Who knows that.
 
6:20 PM
Have a nice evening, zombie killers.
 
6:34 PM
@kleinfreund Same same :)
@lol.upvote What's the RSS link for the answers feed?
 
6:55 PM
0
Q: What might be another way to test if int is 32 bits wide at compile time?

KeithSmithBelow is code that will compile when INT_MAX is equal to 232. It will generate a compiler error when INT_MAX is not equal to 232. #include <iostream> #include <climits> namespace NBitCheck { template<bool> struct CTAssert; template<> struct CTAssert<true> {}; constexpr bool intbitw...

 
@lol.upvote Thanks, added it to my FeedReader program now
 
what's your rss client?
 
7:12 PM
hmm.. a bit of a pain to open in the browser, compared to Outlook.
 
@lol.upvote Using Feedreader 3.14, I can setup how often I want notifications for the RSS. Besides, I'd rather use anything besides Outlook if I can.
Seriously though, perhaps I'm just used to Feedreader and don't want to change :)
 
in Outlook there's a hyperlink to the post at the bottom, so in 2 clicks I can grab the url and paste it here
 
In Feedreader I can select the post and click <kbd>Ctrl + C</kbd> :)
 
nope
1
A: Split list into sub lists - Functional

leventovHaskell: import Data.List.HT -- or Data.List.Grouping takeruns xs@(x:xss) = map (map fst) pss where pss = segmentAfter (uncurry (>)) $ zip xs xss

you don't get the #answer part of the url, so it doesn't paste here the same way
Has @rolfl seen this one?
4
Q: When is (if ever) monkey-patching acceptable? Is there a better solution to this?

user1467345I am working on a project that involves xml parsing, and for the job I am using xml.dom.minidom. During development I identified several patterns of processing that I refactored into discrete methods. The code shown in the snippet below shows my definition of an Article class that is instantiated...

 
So when you paste the answers here, how do you do it?
 
7:25 PM
I click the link in outlook, it opens it up in Chrome, then I copy the url from the address bar and paste it here
with this client I need to click the title, then "open in browser", and then I can copy the url from the address bar
bah, 1 more click. I'll survive.
 
It's quite strange that the URL the RSS gives us is not the same URL that we actually end up at.
 
indeed
 
I'm starting to understand it now
http://codereview.stackexchange.com/questions/24716/comments-on-sass-from-css-f‌​or-a-sass-beginner/40036#40036 is the answer. The link we first enter is http://codereview.stackexchange.com/questions/40036 which id the StackExchange system realizes is not a question, but an answer and therefore redirects us.
 
so there's a bug in the rss feed!
 
Yes indeed. We don't get the correct link. Or you could also say that it's a missing feature from the chat system that it doesn't detect the redirect.
 
7:32 PM
either deserves a MSO post!
 
^^ And that deserves a star!
 
1
A: Find the longest unique string in the input list

David HarknessI'm on my phone so can only give pointers. In the first loop you can use Map.get and switch on its value: null: put True and add to wordsByLength True: put False and remove from wordsByLength False: do nothing Map<Integer, Set<String>> wordsByLength tracks unique word sets, one per word le...

+1 for phone-posting a CR answer! — lol.upvote 38 secs ago
 
This has been flagged as NAA, but I'm not sure I agree or not:
0
A: How to speed up this k-nearest neighbors code?

miniBillYour algorithm is O(n^2), and as much as you can optimize, you can't do better with this. I don't see any particularly slow path.

 
I flagged it.
It's a comment, especially when compared against the other 2 answers on that question.
 
The question is: How to speed up this code? This answer says: You can't.
 
7:36 PM
But is it a code review?
 
It might not be a correct answer, but that I can't determine.
The flag says "Not an answer", not "Not a code review".
 
hey I didn't write these. The flag would be called "not a code review" if I had.
 
"I don't see any particularly slow path." is a code review I'd say. Not a particular detailed one but that's another issue.
 
I won't be mad if you disagree :)
 
I disagreed with the flag this time.
 
7:39 PM
Then you're upvoting the answer?
 
It might also not be a helpful answer but there's a simple solution for that: Don't upvote. (Never thought I would say that)
Nope I'm not, I can't determine whether or not the answer is helpful or not since I'm not familiar enough with the code.
 
The OP did say "thanks"
Thanks, sir. I think it will be better to use paralleled code, but I'm not very familiar with that. — Zhong 18 hours ago
out of ammo
 
He also said "I think it will be better to use paralleled code", which sounds like the code can be written to run faster.
 
It's a semi-answer: saying that the slowness is a property of the algorithm, not its implementation. A more helpful answer would have explained how to improve the algorithm.
 
I agree
3
A: Battle game simulation seems to have too much code

Roddy of the Frozen PeasFirst, I'd like to start off by saying that if you've really only been coding in Java a few days -- well done. For "a few days'" worth of experience, having code that compiles and does what you want it to (and expect it to) is the most important thing. That being said, this is a code review site,...

 
7:44 PM
@SimonAndréForsberg Perhaps that's the OP, wondering whether multi-threading could make it faster, but not knowing how.
 
Seems like it, yes.
 
[belated] Welcome to CR! That's an awesome first post, stick around, we can't have enough answers like this! — lol.upvote 30 secs ago
^^ if anyone has a spare vote to spend, that's one deserving post!
so many monkeys..
2
 
^ napalm'd.
 
@Jamal nice!
 
I hope I do get that 5th vote on yesterday's answer, which will get me Necromancer.
 
7:55 PM
I was able to move a vote from the question to your answer.
 
Thanks, Santa!
 
Ah. Well, when you do reload, remember to upvote the OP again.
 
0
Q: Read text from Stream char by char

MarcinJuraszekI've started learning F# and functional programming in general, but the code I wrote doesn't seems to be really functional. Could you take a look and say how to make it more as it should be in functional programming? type internal CsvReader(source : Stream) = // input stream let stream...

 
@Jamal sure will!
@StackExchange added tag
 
7:59 PM
Also, as for that NAA flag, I'll let another moderator look at it. Since I've already posted an answer, I don't want to abuse my powers by deleting it (if it were purely NAA, then that would be okay).
 
@Jamal do questions really need a tag?
 
Had to add a little emphasizing here: "I don't want to abuse my powers by deleting it (if it were purely NAA, then that would be okay)."
Lesson learned: If it's purely NAA, then @Jamal can abuse his powers all he wants to.
 
lol. Twists the meaning slightly ;P
 
@lol.upvote: Not entirely sure, but you may remove that tag.
@SimonAndréForsberg: If it's for instance, a "thank you" answer, it's not getting votes anyway, and it can't really be considered competition.
 
2
A: Split list into sub lists - Functional

leventovHaskell: import Data.List.HT -- or Data.List.Grouping takeruns xs@(x:xss) = map (map fst) pss where pss = segmentAfter (uncurry (>)) $ zip xs xss EDIT Example: xs = [1, 2, 3, 2, 4, 1, 5] xss = [2, 3, 2, 4, 1, 5] zip xs xss = [(1, 2), (2, 3), (3, 2), (2, 4), (4, 1)] uncurry (>) (1, 2) == 1 >...

@Jamal I guess it helps the top 40 tags...
 
8:05 PM
@Jamal True, but in that case I wouldn't say that it's abusing your powers. It's just normal usage of them.
 
2
A: How to speed up this k-nearest neighbors code?

ChrisWUse a run-time profiler (test and measure, instead of or as well as trying to guess what's slow). Who knows, just from looking at it: the most expensive line of code might be something innocuous-looking like your push_back method calls. For a description of how to do this, see for example Profil...

 
@SimonAndréForsberg: I do want to stay on the safe side. The same applies if one of my questions turns CW on normal use (that actually happened with one). If I really wanted to lift the other status, I would let another moderator decide.
 
^ I posted a suggestion for improving the KNN algorithm. Can anyone say whether this suggestion is good sense or nonsense?
 
@ChrisW Using a run-time profiler sounds like good sense. Perhaps one day it will be common sense.
 
Yes, but what about the algorithm suggestion?
I.e. using fast/approximate algorithm first, then using slow/exact algorithm on smaller partitions?
It sounds plausible to me ... but, I never studied computer science, nor the KNN problem nor its algorithms; so perhaps this suggestion was nonsense? Or is it good sense?
 
8:13 PM
0
A: What might be another way to test if int is 32 bits wide at compile time?

luiscubalIn C++, sizeof returns the size of a number relative to the size of char. So, sizeof(int) should give you how many chars each int takes. Next, we need to know how many bits each char has. CHAR_BIT has that information. So try this: constexpr size_t bits_per_int = sizeof(int) * CHAR_BIT; const...

 
Yeah, it does sound like reasonable advise. I'm not familiar with the KNN problem though (yet)
 
I'm not familiar with the algorithm either, but it looks better than anything I could think of.
I just love seeing a forgotten zombie turn into something very prosperous. :-) Imagine if many of the remaining unanswered questions received the same treatment. Another Revival, and even Necromancer, awarded to someone is another victory.
2
 
Some of the zombies aren't easy to answer, are they.
 
Nope. I pretty much had to scrape some out for myself. But, that is natural. However, I'm sure many of them were just plain forgotten, but can still be answered by someone here.
 
@Jamal Posting any answer encourages your followers to attack it too.
 
8:24 PM
Right. And I'm glad there was still more for you to review on that one. For most cases now, I'll refrain from mentioning everything I can find wrong in the code.
 
(If they think you didn't completely kill it with your first shot)
 
Hopefully not. I certainly didn't address the speed issue, but improving the C++-ness is still good. If the code becomes cleaner, it could also make it easier to find underlying issues.
 
@ChrisW Zombies, by definition, can't be completely killed with a single shot. These things still crawl, even with their legs chopped off.
2
 
And even their head, I believe.
 
0
Q: Node.js chat code review

Alex GarrettThis is a chat using Node.js, socket.io and MongoDB for storage. I'd appreciate any feedback on what can be improved. I understand that this allows for non-unique usernames to be used, and it's currently a JavaScript prompt, however this is simply a demonstration for entering a username to test ...

 
8:29 PM
@lol.upvote: By the way, I don't think anyone has reviewed 200_success' C++ interpreter. Loki Astari has looked at it, but hasn't posted an answer.
 
C++ scares the shit out of me
3
Hi @SakhalTurkaystan!
 
I can say the same about Java. And I'll be taking it in class next fall.
 
Welcome to the 2nd monitor! ..and to the Wonderful World of Stack Exchange, too!
How did you enjoy your Code Review experience so far?
 
Well, I'm too new to tell :D
 
8:33 PM
Hello!
 
I am not a professional programmer, just hobbyist
 
@SakhalTurkaystan feel free to mark an answer as accepted on your question, if you feel it's been answered.
That's cool!
You can post your hobby-code here on CR to get it peer reviewed :)
 
Well, I didn't marked one because every of them were useful
 
I'm just an undergrad and by no means a professional. I've learned so much on SE, enough where I was able to give back by posting answers.
 
You mean reviewed if it has a problem, right?
 
8:36 PM
@SakhalTurkaystan you can also upvote any useful answer - votes are our $$$ :)
Not necessarily
The concept of CR is basically "I wrote this code, does it make my ass look fat?"
 
Just for exposing them, then?
 
I don't know what I am.
3
 
@SimonAndréForsberg a weirdo
 
@SakhalTurkaystan Actually this site is for reviewing code which doesn't have a problem: to make it better shorter, faster, more readable, better handling of 'edge-cases', etc.
 
@lol.upvote lol. What makes you say that? :D
 
8:38 PM
I have worked a lot with VB6, but since it gets deprecated, I will not go much further with it
 
@SakhalTurkaystan I [unfortunately] work with VB6 in my real-life job, I can review VB6/VBA code if you bring it!
 
@SakhalTurkaystan It's up to you but I would accept the answer that you found the most useful. By accepting an answer, you give the answerer +15 reputation and you also get +2.
 
and a shiny bronze badge too!
 
OK, will have it in mind :)
 
@lol.upvote So technically, one could say that you have a deprecated job?
 
8:40 PM
totally. lol. I'll be spending about half of this year rewriting the VB6 crap into C#
 
I think VB6 will be still active on Windows 9
 
587
Q: How does accepting an answer work?

jjnguy How does accepting an answer work? When should I do it? Why can't I accept my own answers right away? Which answer should I accept? For more information, see "What should I do when someone answers my question?" in the Help Center. Return to FAQ index

 
am I right?
 
no clue
but probably.
VBA runs off the VB6 runtimes
and because of how widely spread it is in the industry, MS just can't ditch it.
 
to be honest, I don't exactly know what is the difference between VB and VBA
 
8:42 PM
VBA is the language you write Excel macros in :)
 
You should accept an answer if you're satisfied; or, not accept an answer if none of the existing answer were good enough, and you need somebody else to provide another answer.
 
Well, then it is more like an script, right?
 
@lol.upvote What does the A stand for?
 
Nah, it's more than just scripting...... albeit not very far off either.
"Visual Basic for Applications" - it's plague-ing all of MS Office :)
 
OK, Chris, I get the point :)
I personally like VB6 a lot... its syntax is so clean
 
8:43 PM
Have you done any .net?
 
Never... I downloaded VS2008 but I have not near plans to install it
 
I was a big fan of VB6/VBA until I learned about the .net framework and C#
 
I am now dedicated to web developing, but still in a basic level...
 
If you do, I'd recommend to not go for VB.NET - it's too easy to "think in VB6" with that language. .NET changes everything you know... in a very cool way!
 
I entered into PHP now...
 
8:47 PM
I'm so sold to .net :)
 
I would like to know if it is easy to upgrade a VB6 project to .net to keep it fresher
 
@lol.upvote for web development?
 
I don't do much web dev, but if I did, I'd do it with or :)
@SakhalTurkaystan it's possible, but you get such shitty .net code, you're probably better off rewriting it.
 
Rewritting... I have programs from 6000 to 20000 lines ;)
 
This looks interesting:
0
Q: How to train your growing community to self-moderate?

RaphaelTwo years ago I accepted the post of pro-tem moderators on Computer Science. At that time, and that's true for any new beta SE site, there were little to no users with enough reputation to moderate. So, what did we do? Edit, close, migrate, whatever the situation called for. I used to read, edit...

 
8:51 PM
Like, instead of If MyString = "" you'd probably get If MyString = "" when the correct .net way would be If String.IsNullOrEmpty(MyString)
 
And bad quality code would suppose problems in the execution of the application?
 
Not necessarily, more like problems with the maintenance of the app's code. Auto-translated VB6=>.NET code is a PITA!
 
Yes, understood
Still, I would be pretty happy... :)
 
@ChrisW Hey, that actually made a sentence!
 
You could always post it on CR ("I've written this code in VB6, used a tool to translate it into VB.NET, can I live with this code, or how fugly is it?")
 
8:56 PM
Yeah, you love to look at codes... still, I don't intend to install VB.net anytime soon... I'm a bit overwhelmed now :)
 
Take your time. Once you get there, there's no turning back!
 
I hope so... I'm now into web developing because of Adsense :)
 
00:00 - 21:0021:00 - 00:00

« first day (266 days earlier)      last day (2498 days later) »