« first day (1178 days earlier)      last day (2831 days later) » 

12:00 AM
RELOAD! There are 2579 unanswered questions (92.8530% answered)
 
12:35 AM
1
Q: Break a full name into a dictionary of its parts

HatshepsutIt seems like I'm repeating myself here. Is there a standard way to deal with code like this? def getNameParts(name): """Return a dictionary of a name's parts. name: e.g. 'JOHNSON, John Roberts, Jr. (Jack)' Ignores nicknames. """ csSplit = name.split(', ') try: la...

 
12:46 AM
0
Q: SSRS: code function to sanitise HTML for rendering in RDLC report

sasfrogBackground I have an RDLC that among other things displays text coming in that is captured in SharePoint, using a custom control (TinyMCE) that exposes limited formatting options to users. The SSRS local report renderer supports a subset of HTML (see details here) and has limited configurabilit...

 
1:08 AM
Usually you shouldn't do that (and when using try-with-resources you can't). Of course, it always depends.. You could also post a question on codereview.stackexchange.com if you want some more comments on custom code. — Mick Mnemonic 56 secs ago
 
1:59 AM
@GhostCat sorry, I didn't know about Code Review. I'm gonna post my code there. — Quan Tran 6 secs ago
possible answer invalidation by Pankaj on question by Pankaj: codereview.stackexchange.com/posts/132673/revisions
 
2:49 AM
0
Q: Beginners Project: Calculating Area

SweetBubbleTeaThis was my second project as a beginner in Java programming. Please provide feedbacks/ tips on my program. Thank you! import java.util.Scanner; public class Area { public static void main(String[] args) { Scanner Area = new Scanner (System.in); double length, width,totalArea, he...

 
3:05 AM
0
Q: Taking arbitrary length input in C

jaskaInstead of having to use something like char buf[100500] and hope that no possible user input could be longer than 100500 bytes, I decided to make the following function: char* input (FILE* in, size_t size) { char * input_str = NULL; int c; size_t len = 0; /*initial allocation*/...

 
3:31 AM
Welcome to Stack Overflow! Thanks for your interest, but working code that needs improvement is better suited for Code Review, being off-topic in StackOverflow. — Mephy 55 secs ago
Also CodeReview is for complete working code. The snippet above is not selfcontained. However CodeReview would hapilly review your code, when you have updated it into a complete working code. — N3buchadnezzar 14 secs ago
 
0
Q: Concatenating an array of optional NSAttributedStrings

KVTaniguchiImagine you had to join together attributed strings with a separator in between them. Which of the following methods would you use? An extension on SequenceType with a function that takes in a separator. Can't use any optionals in the array. extension SequenceType where Generator.Element: NS...

 
4:32 AM
Have you tried asking this on codereview.stackexchange.com? — cricket_007 6 secs ago
 
5:03 AM
0
Q: I created a file downloader using Java, multithreading and HTTP Range request. Is this design optimal?

Quan TranSo, I'm making a file downloader using Java. I separate the file into parts and download them using HTTP Range request, with each part being handled by a thread. All of the threads share an object, which is used to keep track of the progress and print the progress bar. The code is something like ...

 
5:15 AM
Cross-posted on Code Review. You can just delete the Stack Overflow question, since it is off-topic here, as you are not asking to solve a specific programming problem. — 200_success 24 secs ago
 
5:33 AM
@JakeTheSnakeRoberts this is what codereview.stackexchange.com is for — m.s. 46 secs ago
@m.s. No, Code Review doesn't fix broken code — this question would be very much off-topic there. Please read A Guide to Code Review for Stack Overflow Users to avoid inappropriate referrals. — 200_success 23 secs ago
No, I meant where I declared everything const. I will use codereview. — Jake TheSnake Roberts 10 secs ago
 
Monking
 
5:50 AM
possible answer invalidation by jaska on question by jaska: codereview.stackexchange.com/posts/135813/revisions
 
@Duga Let it slide.
 
6:10 AM
This question is too generic and sketchy to answer in objectively. Instead of asking this generic question, I suggest that you post real working code for open-ended critique on Code Review, and mention this as a minor concern (among other issues that you might want to raise). — 200_success 41 secs ago
 
@jrh Hmmm, good call, I thought he was asking about C++ here. My bad. C doesn't have references. @BernardMeurer You're stuck with pointers here :-)
 
6:40 AM
Monking!
 
Monking @Gem
 
'sup?
 
-1
Q: Is this usage of Dictionary thread safe?

CSharperI want to let a maximum of 10 people in, and also have arrival time of those that I let in. // definition: var dict = new System.Collections.Generic.Dictionary<string, System.DateTime>(); //usage: if (!dict.ContainsKey(key) && dict.Count >= 10) return false; // Reject dict[key] = S...

 
@Gemtastic Interview in 2 hours :-)
 
6:56 AM
Oooh! Fingers crossed
What kinda job is it?
 
Automotive electronics.
R&I position.
@Gemtastic Thanks :-)
 
R&I?
I hope it goes well :)
 
7:12 AM
More appropriate for Code Review - codereview.stackexchange.comAndrew Guy 29 secs ago
 
Zak
7:40 AM
Monking @all
 
Monking @Zak et al
@Mast how did it go?
 
I'm voting to close this question as off-topic because it belongs on Code ReviewSayse 20 secs ago
 
8:00 AM
0
Q: Feedback for Python guessing game

Taylor WrightI am new to Python (and coding in general) and after about a week of reading "Thinking Like a Computer Scientist: Learning with Python" I decided to try and build a version the classic "guessing game". I added some extra features such as counting the number of guesses the user takes, and playing ...

 
Naruto answer; accepted non-selfie answer with 0 score: PHP MySQL connection class
 
i feel like such a hipster. drinking costa coffee wearing a tartan shirt and looking intensely at a mac. what have i become
 
8:16 AM
a poor person
 
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: PHP Dependecy Injection Container
 
I'm dying for some energy drink but I've decided to keep off the carbonated stuff for a while. Regretting my decision so much
I wish I liked coffee
 
drink water, you'll be fine
 
I just want that energy boost
But I really should stick to water
First world problems
 
Stick to water
You'll get over the energy hump in a couple of days
okay so i have two windows of Chrome open
 
8:32 AM
Not really
 
is there an easier way to switch between them other than right clicking the dock
 
I'm always like this, even since before I consumed any caffeine
It's only RedBull that's strong enough to do anything. side effect; headaches :/
And we have free free-flowing red bull at the office
 
You need to really stop drinking redbull, in that case
Trust me, I drink a lot of carbonated drinks but the time i was most productive was when i only drank water for a couple of weeks
nowadays i only have carbonated drinks on weekends
 
At work, I only drink water
 
he says, with a can of pepsi in his hands
 
8:40 AM
english is hard
 
I have one can/day none on the weekends. And it hasn't been going on for very long
If even that tbh
 
one can of redbull a day is a lot different to one can of pepsi
 
Pepsi won't stop your heart
So you can totally use it with your vodka
 
redbull is great because it gives you energy and makes you think you're having a heart attack
 
I don't get those effects though, I just get a headache
Feels like the acidic nature of the bevrage goes to the brain, which I suppose it does, but I also don't fall asleep standing
 
8:45 AM
it's a vicious cycle
because you will become more and more dependent on red bull
unless you drink it
trust me, you won't feel like you will fall asleep after a few days of not drinking red bull
red bull literally has the same effect on you as caffeine dependence does with coffee
i have one every now and then when i want to force a "Zen" moment
 
RED BULL IS DRUGS
- for recreational use only.
 
Yeah, but the cycle hasn't really began to me, I'm just tired and want to depend on it, but I won't
@DanPantry I will feel like falling asleep 3 months after my last redbull or any similar kinda drink
I'm just really tired
It's been 5 days since my last one
 
I'm voting to close this question because this is about working code, and probably more suitable for CodeReviewtrincot 56 secs ago
 
what a difference an SSD makes when using git..
 
9:11 AM
lol
I'm now a sudoer on my PC
right after sending in a list of software I needed
go figure
 
0
Q: Project Euler 2 sum returns infinity using Javascript

Bernard ParahMy solution keeps returning infinity as the sum of all the even numbers. I have seen that javascript has no Long and other answers suggested using libraries that handle large numbers. How do I fix this without using any library? Also, any suggestions on how to improve this code is welcomed. /* ...

 
> My solution keeps returning infinity as the sum of all the even numbers
works as intended?
 
Well there are an infinite number of even numbers
:^)
 
> the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms
ahhh I see.
var first = 0;
var second = 1;
var sum = 0;
var i = 0;

for ( i=first; i<100; i++) {
var next = first + second;
if (next % 2 == 0){
sum += next;
}


//update the values here
first = second;
second = next;

}

console.log("sum of even numbers = " + sum);
sum of even numbers = 1.5005088278427221e+21
code formatting is hard
 
that var i though :/
 
9:21 AM
whatever, you get the point
yes I just added it myself
to make sure it's being initialized
anyway, fibo 0 to 100 = something something e21
riiiiight
That's hilariously broken
I wonder why?
... actually...
it goes 1, 2, 3, 5, 8, 13 so it goes from e0 to e1 in 5 steps
and from 13, 21, 34, 55, 89, 144, again, 5 steps to get to e2
so I guess it's not that broken after all?
 
possible answer invalidation by BusyAnt on question by Taylor Wright: codereview.stackexchange.com/posts/135824/revisions
 
because 4 million divided by 5 is gonna be 800k, so yeah, you're gonna get an answer in the range of e800k
he read the problem statement wrong, it's asking for terms below 4 million, not indices below 4 million
 
9:41 AM
And, in general, code review question are more suitable at Code ReviewYuval Itzchakov 52 secs ago
 
0
Q: Avoiding code duplication for reading in similar values for each derived class

John TanI am designing a program that handles many types of grooves TKY, VSingle under GrooveType. Each of this groove is paired with its specific parameter SimulationParam (e.g. TKY will pair with SimulationParamTKY, which inherits from SimulationParam) under the Dictionary simParams. As such, if i wa...

 
@Duga ok comment, doesn't warn about scope, but there's a comment above that saying there needs to be more info
 
 
1 hour later…
10:45 AM
0
Q: Hotkey detection for UI elements

denisI have several UI elements that can be opened using hotkeys for example the settings menu's key is Escape. The problem is that I have the Keycode stored in Dictionary along with an Action or a Button.ButtonClickedEvent here's how the 2 dictionaries are declared : public static readonly Dict...

 
I'm voting to close this question as off-topic because questions to review working code belong on codereview.stackexchange.com — GhostCat 54 secs ago
 
0
Q: building a search functionality

C0DEPirateI am trying to search account table by providing a search string. I am building a query based in different conditions and then adding the returned records in a list. The functionality is working correctly but I want to know how an below method be further optimized. public PageReference sear...

 
11:04 AM
Monking
 
Monking
 
mONKING
 
Zak
HMRC: Took a whole 3 minutes just to get through all the keypad-selections.
 
monking
 
I'm voting to close this question as off-topic because it asks for code review. — bolov 28 secs ago
 
Zak
11:07 AM
And now I get to wait on hold for god knows how long.
 
@Duga, I think bolov is right. Waiting for others
 
in The Nineteenth Byte, 31 mins ago, by Quill
I'm doing a few new languages this semester actually.... Java, C++, Haskell, Oracle SQL
Ain't that gonna be fun
 
the funniest will be C++ with all the templates, namespaces, pointers and references
btw what would you recommend for first C# exercise? Want to grab it for higher level understanding
 
FizzBuzz
 
@Zak HMRC?
 
11:11 AM
@Quill, thanks. Gonna try
 
1) Don't cast the result of malloc & friends. 2) Don't use magic numbers. 3) This is no code review service. What is your specific problem? — Olaf 46 secs ago
 
@Duga false positive >_>
 
@zyabin101 HM Revenue & Customs
 
Zak
@zyabin101 Her Majesty's Revenue & Customs
 
google tells all of the things
 
Zak
11:12 AM
AKA the taxman
 
This question should probably be asked on codereview codereview.stackexchange.com, not SO. — fabianegli 41 secs ago
@fabianegli, this question is not suited for codereview. codereview is only for code that works as intended. — Stewie Griffin 11 secs ago
 
Quite satisfied with this review =) #self-promotion
 
11:30 AM
killcam or pimping is the correct meme
killcams have been retired, I think
 
Any gotchas I need to take into account when upgrading from W8.1 to W10?
I'm pretty sure I made a back-up of everything on my PC already by now
 
@skiwi, prepare do be dissapointed. It seems like it boots win8 before loading win10. kinda backend
btw, do you have SSDs? if so, be sure to check if AHCI didn't reset
 
Zak
I was only on hold for 15 minutes. That's almost a record for HMRC.
 
@Zak, I think it depends on the country. In my country every pass through HMRC is around 15-20 mins for a car
 
@OlzhasZhumabek I've got one SSD, didn't fiddle around with it as far as I remember thouugh
 
11:38 AM
@skiwi, if you have intel cpu the SSD will probably slow down on IDE mode
sometimes it will prevent booting, system will argue that there is no SSD
@skiwi, btw start button uses user profiles to open, so sometimes it doesn't work. Google search says that they messed up something with user restrictions or similiar
 
If you want a review post it on CodeReview — boxed__l 44 secs ago
@boxed__l, > Help me spot the bug , doesn't seem like asking for code review — Olzhas Zhumabek 40 secs ago
 
guys have you noticed that migration suggests became too frequent? Or is it just sometimes more than other days?
 
Meh, it's always been like this
 
Zak
11:57 AM
@OlzhasZhumabek Funny thing, despite the name, HMRC is not, actually, in charge of customs & border patrol.
 
0
Q: C# Winforms MVP (avoiding circular dependencies)

digital_fateI asked the following question on stackoverflow and as a result came up with the following code to avoid circular event logic when using winforms. There are two occasions where my model can be updated, either programmatically via some application logic, or by the user via a view. There is no l...

0
Q: WPF Mvvm async function ViewModel

user108567I worried about this code in a ViewModel. ViewModel shoud not contain any code exept binding's. But without async update ui should stuck. How to improve it? The main problem that this is need to be done under .net 3.5. public ShippingDocumentsRegisterViewModel() { this.Columns = model.Initia...

0
Q: Filtering array by list of keys in PHP 5.5

Ruslan BesI have an associative array with data (let's say language codes and descriptions) and a second array with allowed keys (lang codes). I want to filter the data array by these allowed keys. The problem is I'm bound to PHP 5.5 and I can't use ARRAY_FILTER_USE_KEY flag. I came up with the followin...

0
Q: Noughts and crosses in python (high school project)

AK92So I've been tasked with helping my little cousin with a python project to build a noughts and crosses game. The game doesn't actually need any functionality, it just needs to show his ability to code the grids and place the 0's and X's in the grids. So his teacher has sent the code for specifi...

 
@DanPantry Slow, but steady.
Good company, good projects, good people and for some reason they think I'll fit the profile.
I'll need to improve my German though.
 
Hey @EdelyGomes welcome to the 2nd monitor :)
@Mast so the job is with a German company?
 
@CaptainObvious Make that go away, broken.
 
@Mast Draus!
 
12:08 PM
@Vogel612 No, it's in automotive. The automotive business is English/German in entire Europe.
 
(I don't actually know how to spell that)
 
@skiwi no d ....
 
But I could yell it :D
 
It's a European player, so, yea, gotta play international.
 
12:09 PM
Monking everyone!
 
Also, looks like a good market to stick to for a while and there's some pretty big players in Germany in the automotive business as well. So it definitely won't hurt to learn some.
Monking @syb0rg
 
Time to upgrade to W10... shivers
 
0
Q: Intersection of two lists in clojure

KRCcontext: this is somewhat related to project euler problem 5, which is: What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? I apply prime number decomposition to the range of numbers from 1 to 20, and the product of all that should be the smallest n...

0
Q: Function to find a substring within a string. Code works. Far too much of it?

Matt ClearyBeginner here. I'm working through 'Programming in C' by Kochan. I've just completed an exercise in which I had to create a program that searches for a string within another bigger string. If the substring exists then it is outputted to confirm and the starting index is given where the first c...

 
I learned last weekend that Letzeburgesch (what they speak in Luxembourg) uses 'Moien' as general greeting, regardless of the time of the day. They don't use more specific greetings.
 
> Yup, baby was found in mommy
 
12:12 PM
Oddly familiar.
 
wat
 
> how is babby formed
 
    for(i = 0; i <= babeLength-1; i++)
    {
        for(j = 0; j <= momLength; j++)
        {
            if(babe[i] == mom[j])
            {
                test[i] = babe[i];

                if(babe[0] == mom[j])
                    index = j;
            }
        }
    }
Oh heck, that's not how you're supposed to do that.
 
@Pimgd Edited comment
 
Personally, I'd go for a double while loop with pointer hax
 
12:16 PM
@Pimgd, no pointers either
 
what?
 
@Pimgd "Use C, but don't use C"
 
> WITHOUT using pointers (something I'll learn next), could I have considerably cut down the amount of code I wrote?
 
oh well
 
gonna be fun lol
I mean without type safety (no way to know the length), and no pointers to find it out
 
12:17 PM
while(i < length && searchingFor[i++] == searchingIn[offset + (j++)]){}; something like that?
 
@Pimgd, you don't know the length :P function signatures don't include them
 
=) search for \0 first to get the length
and we can alter the function signature
 
Yup.
Find length first, makes it a lot easier.
If you're not allowed to use standard functions, you got to do something.
 
@Pimgd, true :)
 
add a guard clause for trying to find a substring that can't fit in the remainder, and done
@OlzhasZhumabek he actually searches for string length everytime
 
12:21 PM
@Pimgd, thanks. Seems like I need to stop being lazy and scroll down
 
This probably belongs on the code review site. That being said, if this is the function in question, I honestly think it's just easier to write myList.size() == 1; everywhere instead of a wrapper call. — CyberneticTwerkGuruOrc 1 min ago
 
btw why C inventers didn't make compiler to generate overloads on every length of the array with unknown bounds?
 
@OlzhasZhumabek overloads?
 
@Pimgd, the same name, different parameters
or isn't it possible in C?
 
I don't understand the following parts:
"to generate overloads"
"every length of the array"
 
12:25 PM
@Pimgd, array length is part of the type
 
I still have absolutely no idea what you're talking about
 
@Pimgd, int a[2], b[4]; ... func_name(int a[2]); .... func_name(int b[2]);
I believe there was something to prevent array from decaying to a pointer, but it has to be part of its type
So, instead of finding out the length of the string manually
one could use sizeof(a)/sizeof(a[0]); given that a is non zero length array
it will probably be compile time, because sizeof evaluates at compile time, so it's simply a division
 
1114
Q: With C arrays, why is it the case that a[5] == 5[a]?

DinahAs Joel points out in Stack Overflow podcast #34, in C Programming Language (aka: K & R), there is mention of this property of arrays in C: a[5] == 5[a] Joel says that it's because of pointer arithmetic but I still don't understand. Why does a[5] == 5[a]?

read and scroll down and read more
then ask again
 
arrays are not pointers.
they are pointers at run time
 
They're apparently pointers after a compilation step
 
12:33 PM
yes, that's why sizeof returns what it should, and taking address of array itself and doing pointer arithmetic will be surprising (e.g. &a, not &a[0])
 
did you read that question and its answers?
 
@Pimgd, I've read them now
 
@Quill I'm tempted to get a Mac
 
@Pimgd, so did it clarify what I was meaning?
 
@OlzhasZhumabek I'm waiting for you to ask your question again in a clearer form now that you've read that question
use more words if you need to
 
12:38 PM
@DanPantry what did windows do now?
 
@Pimgd, why on using arrays with unspecified length compiler doesn't keep type information
still bad?
 
0
Q: Randomizer App as Decision Maker

Andrea LiuretaI am a newbie and self taught in programming. This is my first attempt to make app. Appreciate any input or comment to make my code writting skill better. https://github.com/snufflesrea/Decision-maker A simple randomize app to give random result from the user's option input. A simple randomize ...

0
Q: Using Bash within Python

tehjokerI'm writing Python code and working with some database tools (bash). Unfortunately there are no Python libraries available for the Database so I'm trying to find a clean solution to this problem. First, lets take a look at some code: import os BIN = "/mydir/bin" TOOL = os.path.join(BIN, "tool")...

0
Q: Converting XML to DOT

AhmadI would like to show an XML tree as a tree using GraphViz Dot tool. Then I must convert it to a DOT file. It is what I have tried string dot = "digraph G {" + Environment.NewLine; XML2DOT(XmlRoot, "r"); dot += Environment.NewLine + "}"; .... private void XML2DOT(XmlNode n, ...

 
hmmmm
 
@Pimgd, on using a[] it should internally know that it is a[whatever], so sizeof could work
 
I don't know the rationale behind the compiler design
I know for sure that "generating overloads" is a really bad idea
because program size expands to really huge
 
12:43 PM
yeah, it increases obj file size.
so bad that there is no choice
 
yeah, by factor maxint
but as to why you don't make a special language construct that keeps the length...
I don't know
 
@Pimgd, but it will add overhead. Type information is only compile time, at least in C
 
one answer refers to this
 
Greetings, Programs.
 
@Donald.McLean, hi
 
12:46 PM
Hey there Donald
 
@Pimgd C is funny like that.
Monking @Donald
 
> Problems became evident when I tried to extend the type notation, especially to add structured (record) types. Structures, it seemed, should map in an intuitive way onto memory in the machine, but in a structure containing an array, there was no good place to stash the pointer containing the base of the array, nor any convenient way to arrange that it be initialized.
> For example, the directory entries of early Unix systems might be described in C as
struct {
	int	inumber;
	char	name[14];
};
> I wanted the structure not merely to characterize an abstract object but also to describe a collection of bits that might be read from a directory. Where could the compiler hide the pointer to name that the semantics demanded?
> Even if structures were thought of more abstractly, and the space for pointers could be hidden somehow, how could I handle the technical problem of properly initializing these pointers when allocating a complicated object, perhaps one that specified structures containing arrays containing structures to arbitrary depth?
> The solution constituted the crucial jump in the evolutionary chain between typeless BCPL and typed C. It eliminated the materialization of the pointer in storage, and instead caused the creation of the pointer when the array name is mentioned in an expression. The rule, which survives in today's C, is that values of array type are converted, when they appear in expressions, into pointers to the first of the objects making up the array.
And that's why you lose the length of an array when the array moves scopes.
 
@Pimgd, thanks for the citations. I've reread them twice but still can't get why compiler can't hold the type till it finishes compilation and then convert to whatever it wants. Anyway, I will try to find it out myself. Thanks again
 
It's the same cause as always
compatibility with legacy systems
 
@Pimgd, such compiler wouldn't be able to run on older systems? o_O
 
12:55 PM
no, the programming ideas would be too different for the programmers!
 
@Pimgd, seems like I'm too young to understand that
 
It's one of the reasons C++ was developed.
 
imagine everything is OOP
 
One of the many.
 
and you come with a functional programming language as "the new, cross-platform compiler"
there would be too many "wtf is this" and too little buy-in
 
12:57 PM
@Pimgd, yeah. I imagined disability to write free functions in C++. Like in Java. Irritating
 
@CaptainObvious Borderline off-topic really, it isn't asking for a review but for general best practices.
 
@OlzhasZhumabek You can create anonymous classes just fine
just not functions
 

« first day (1178 days earlier)      last day (2831 days later) »