« first day (493 days earlier)      last day (3517 days later) » 

4:00 PM
hmm just got a [badge:popular-question] for a post I wrote a year and a half ago on Programmers.SE.. is it me or it's much easier on CR?
 
@Mat'sMug Time takes time
 
0
Q: Merge two IEnumerables in elegant way

AskI have two IEnumerable variables, both can be null. I need to merge them into a single list. Here is direct approach. var ienumerable1 = GetEnumerable1(); var ienumerable2 = GetEnumerable2(); if(ienumerable1 != null){ if(ienumerable2 != null){ return ienumerable1.Union(ienumerable2)...

1
Q: How to refactor this code and make it more efficient

Mike RossThis program organise Cruises in which it set up the ship with cabins, rooms. It also do reservation with customer information and the cost for available cabins/rooms. This is my main class # Program class Program { static void Main(string[] args) { UBCruises bookings = new ...

 
@CaptainObvious step 1: refactor this title and make it more percussive.
oh.. Jamalized already
 
TTQW..
Toodles!
this is really getting my new... leaving greeting????
 
Toodles noodles!
 
4:16 PM
0
Q: Shall the Presenter depends on the View, or the contrary, in MVP?

Will MarcouillerSo far, I have used the MVP architecture pattern a few times. Every now and then, I wonder whether my Presenter shall depends on my View, or the contrary, that is, the View depends on my Presenter. Here's a short sample of what I'm used to do: public interface IHasUiHandler<H> where H : IUiHand...

 
@CaptainObvious borderline off-topic. on the fence actually.
 
0
Q: In Python, how can I robustly deal with malformed Unicode files?

ThorI'm writing a script that deals reads UTF-8-encoded XML files and writes parts of those files into a tempfile for further processing. Sometimes, the input files will have a few malformed characters. If it's just "a few" occurances, I want those glossed over, but if the file is majorly corrupted,...

 
If the View dependended on the Presenter, wouldn't it defeat the pattern's purpose? The View should be just that - a View that's only concerned with presentation concerns. This question is on the fence of high-level design, which would be better addressed on Programmers.SE - to be on-topic on Code Review we need to see your actual, working code, in full context and glory :) — Mat's Mug 9 secs ago
(CVA)
@Malachi confirmed, it shipped today.. and there's even "extra stuff" in there!
4
 
@Mat'sMug AWESOME!!!
 
4:32 PM
ello
 
Yo
 
got my lip ring in as got rid of teh stud, not sure how i'm going to eat now
 
0
Q: General code style/correctness - all comments are welcome

Germann Arlingtonpublic class SimpleDecimal implements Comparable<SimpleDecimal> { private long value = 0L; private int fractionalPrecision = 0; private boolean debug = false; public static SimpleDecimal simplify(SimpleDecimal o) { if (!((o.getFractionalPrecision() > 0) && ((o.get...

 
@everyone - Is over-reliance on email inboxes to handle day-to-day issues a problem at your workplace too?
 
Do you have a ticketing system?
 
4:45 PM
@Phrancis, it used to be. Then we rolled our own ticket system with google apps.
 
@Phrancis at my former job, yes. currently... I need to take notes, I have people coming to see me with random requests!
 
@Phrancis Yes - we use emails for practically every contact. Only exception is Redmine but most tasks are handled thru word-of-mouth
 
Ugh. That's worse. I hated the constant stream of people at my desk.
 
@RubberDuck Don't you like some sort of work-related interaction with your co-workers?
I'm having some discussions mostly in person at work, though requests are sent via mail/Skype/Linq
 
We use Jira for IT-type stuff like data updates, bug fixes and such. But everything else (like customer/dealer issues, billing, all that stuff) seems to be handled with emails and spreadsheets, I hate it
 
4:48 PM
Of course I do @skiwi, but it's hard to code when there's a constant stream of interruptions waiting at your door.
 
@Phrancis that is exactly the same with us
do you work at my office!?
just kidding, we use redmine as I said - :^)
 
@RubberDuck Well I have to say that I might not be ready yet, but I doubt I could survive 2x 4 hours of straight coding every single workday, I'm still at university though
 
Honestly, I spend so much time here because I miss the interaction since I started working from my home office.
 
I'm actually quite proud of that edit:
2
 
When I was single, I would bring my laptop home and code all night too. =)
2
 
4:50 PM
I brought up a few times that we could use Jira as an inexpensive and practical solution for day-to-day non-IT stuff, was shot down pretty quickly
 
I wish i could work from home. And that I had an excuse not to work from home after hours :p
 
For me personally the only way to concentrate fully on programming is to either be at work, or to have some small yet awesome home project which you spend a few days straight coding on
 
@DanPantry It's not as great as you think. It's got its pros and cons.
 
@RubberDuck especially with kids. Office has its pros too :)
 
@RubberDuck I can understand that; my colleague and boss get to work from home whenever. Unfortunately I do not as I am the junior (even though I've been there for a year tomorrow). Some times I need to work from home to avoid people.
 
4:52 PM
Yeah it does @Mat. My wife tends to forget that I'm at work sometimes.
Hahahaha... and I want to go work at the office to avoid people..... funny how that works @DanPantry.
 
I like working from home in the winter when there's a snowstorm and so much traffic I'd spend half the day in my car
 
@RubberDuck I have no Sig/O or kids, so yeah. when I'm home, I get to go zen-mode on my code.
 
Ahhhhh zen mode...... it's been a while since I've gotten in the zone.
 
it takes lots of caffeine or complete silence for me ha
 
last time I saw a zen mode, I was playing Bejeweled 3.
2
 
4:56 PM
@Mat'sMug That's called efficiency
@DanPantry What about all the disattractions?!
2
 
@skiwi Like CodeReview? :^) note that the majority of my reputation comes from within 9-5 hours on this site haha
I am looking for either remote working or relocation (or both) in my next job, but it's pretty hard to get that with 1 year exp
 
Like CodeReview, homework, a load of games, other chats, other games and a headset, controller and flight stick on your desk?!
 
@DanPantry on this site in this chatroom
 
@Mat'sMug on this site in this chatroom both
the two answers I've made that went to top network questions were made at work
fact of the matter is I need a disattraction to be efficient haha
 
repeat after me: dis-trac-tion
3
 
4:59 PM
@Mat'sMug I know how it's spelt and how it's said
 
;)
 
Disattraction != distraction :^)
 
@DanPantry I figured I had something wrong in that sentence
 
@skiwi it is now immortalized. congratulations on becoming part of history.
 
> starred show 9 more / show all 12996
^^ seriously
 
5:01 PM
because we give out these
user image
2
 
this made me lol for a second
> We are pleased to announce a new development branch for BeamNG.drive called 'experimental' which Steam users may opt into. Experimental will contain all of the latest, bleeding-edge updates, including unfinished vehicles, terrains, and experimental features.
 
i.e. "beta"
 
ie "beta dlc that you can pay for and have the privilege of seeing it broken"
 
Not much about that in this game... It's the general sentiment lately though unfortunately
 
hm
wonder if there's a site for freelance programmers to earn money towards a specific goal
could be cool
OH WAIT IT'S CALLED A JOB
 
5:17 PM
> Access Denied
You don't have permission to access "http://www.apple.com/" on this server.

Reference #18.7c991002.1410283062.12400cb9
 
Always funny:
You have been skeeted by 6 seconds. — Mixxiphoid 42 mins ago
3
 
monking
 
monking @janos
 
heya
 
5:26 PM
It's only Tuesday and it's barely lunch time and I've already been pulled into 4 escalated issues since this morning and I have about 35 emails to handle in 3 separate inboxes - September?
/* I need a new job */
 
@Phrancis Are you also doing something about it? ;)
 
Yeah, trying to
 
Wonderin ghow it turns out :)
 
Not been very successful so far, and entry-level data analyst/programmer jobs seem to be few and far between
 
@Phrancis :-(
someone donate a 2nd monitor to me
god damn
 
5:30 PM
Not sure if I would be wise to find help desk type job at a different company... maybe I should look into it
 
@SimonAndréForsberg why did I click
3
 
@Phrancis Well, I suppose that depends on what you are looking for
@DanPantry So hopeful, so young
 
all aboard the star train
2
 
@skiwi But is rapidly becoming calloused by the onslaught of reality.
 
5:37 PM
@DanPantry don't you have thrift stores in wales? go get a cheapo monitor
 
@bazola what nows
 
I still need to get my only monitor replaced for some defect on the left-hand side, but I cannot live without it so going to wait till end of warranty :P
 
resale shops
 
we do but i've never seen one with a monitor in it
 
We have them all over, problem, though, is the monitors are mostly CRT's
 
5:39 PM
@rolfl That's from another time!
What's this new enable desktop notification?! On the starbar of the 2nd monitor
 
It's pretty awesome
been using it myself
just shows a pop up when someone @skiwi tags you
 
It's the new HTML5 feature?
I'm using it on some other game for chat there as well
Yeah it may be that one
When did that SE update get pushed?
And can someone test? :)
 
Ping me please ....?
 
@rolfl
 
@skiwi - there
 
5:41 PM
(By pinging me)
@rolfl
Ooh even with its own graphics there!
Nice
 
seems it has to be minimized....
 
window can't be focused.
 
If you're on another tab it already works
 
ping me again in 5 secs ... .;-)
 
@orlfl
@rolfl
nailed it
 
5:43 PM
meh, not sure it worked for me.
 
What browser are you using there @rolfl?
If you ping me I can show how it's supposed to look like
 
0
Q: Complex Conditionals in a Strategy Game

bazolaI have been looking at this method for a long time and I have finally refactored it into something that I believe is much more readable. I am not totally happy with it though so I would like to get other opinions about it. There are a great many questions about complex if-else structures here o...

0
Q: Developed Fully Working Alternative to String.format(...) | Has Reusability Issues

Christopher RucinskiGoal Now, we get taught that reusability is very important in university; however, when I applied what was taught before, I found out by SO users that my code was not reusable - well part of it was at least. So my main goal here is to create a reusable part of my application. Secondary goal wou...

 
I'll ping you @skiwi now
 
It actually also works if the tab is active
 
Interesting, biut not for me... ;-)
 
5:47 PM
@skiwi you have more tabs than obama has on countries with oil reserves
 
@DanPantry I cut my amount of tabs recently down to 102 from 500 and formerly 2,500 before my browser crashed!
I really hope every site will implement those notifications, no more missing messages
@DanPantry So many people reinventing their wheels...
It's sad they always turn out worse
 
@skiwi
 
@DanPantry It works, right?
 
Meh, that's not reinventing the wheel, that's reinventing the road.
 
@rolfl my image counts for both, really. :p
@skiwi I didn't test it, I just saw the subject and thought "oh dear, "
 
5:56 PM
That's fixing the road after having mistakenly reinvented the wheel.
 
that's reinventing a wheel and then making a new road for that wheel (see img)
at the very least the OP should be decorating string.format
not making a new one
 
@DanPantry do you think there should be no comments at all in code?
 
@bazola I think code should be fairly self explanatory
Code should explain how, comments explain why
I.e, comments ideally should explain how something works but why you've taken that route
 
I think that you should not necessarily have to read through the code again to understand the big picture of what it does
 
That's not the point
the point is that you should be ABLE to look at the code and understand what it does
If you rely on comments to explain the how, then you need to re-think your design
obviously,
 
6:01 PM
whether that is true or not does not eliminate the usefulness of a comment, even when the code is readable or "obvious"
 
in theory, there's no difference from theory and practise, but in practise, there's a difference :-)
if you can understand code and you put a comment there, then the comment is cluttering imo
for example
  // adds 3 to 2 and returns the result
  return 3 + 2
What's the point of the comment there?
 
my philosophy would be to strive to have as few comments as possible, but put them in if there is any doubt. but i agree that for small picture stuff comments can be clutter though
 
@bazola in practise, that's what I adhere to
but I think if you are relying on comments to explain your code whne you haven't looked at it in a whle
then there's something that could be done with your code
 
that may be true, but if a comment now saves you time later, isn't it useful? even if the comment might be considered somewhat redundant
 
Why are you programming for the future :p
> Always implement things when you actually need them, never when you just foresee that you need them
- Ron Jeffries
I would say that principle applies to all code, not just functionality
 
6:05 PM
@DanPantry Comments are useful on a method level though ;) Especially if you didn't look at it for a few months, then realize that you were too lazy to add method level comments back then
 
@skiwi I would say documentation = fine, comments for "why did I do this" = fine
comments for how = no
if you need to explain the how, that means that your code is obfuscated somewhat.
 
@bazola If you feel a lot like commenting, then you would be better off putting explanation on the methods (ie. javadoc)
 
I only use javadoc and comments to explain in places why I used a certain pattern
but alas, I am 19, I ccould very well be wrong, I don't work in a software team :-)
As I said, in practise, things are very different from theory
 
Usually the need to comment inline (for the why) shows that you should have partitioned your code more into methods
 
There are some cases where there are oddities in code for a reason, like
' we need to pad x bytes for y algorithm'
that's what I mean by the "why"
 
6:08 PM
@DanPantry That low leel stuff is always tricky
 
update @skiwi set word = 'level' where word = 'leel';
 
@Phrancis That
 
@DanPantry regarding "programming for the future", I think that if you do not put in comments when you are writing the code, you usually will never do it
 
@bazola well, if you don't need to then why would you need to ;-)
 
0
Q: Move uploaded file

hellboyAs I mentioned in Node.JS fs.rename can not move files in right way. And it should be solved with stream piping. Please verify this code and answer questions in comments: var fs = require("fs"); var moveFile = function(sourceFile, destFile, callback) { var sourceStream = fs.createReadStream(sou...

 
6:16 PM
-- gets all information from MyTable
select * from MyTable;
 
 truncate table MyTable
There, let me help you with your performance problems.
 
^^ I find comments are most useful for labeling/organizing sections of a script, rather than explaining what it does (which should be self-documenting if it's written well, no?)
 
That got out of hand in a hurry. Shamelessly pimping this one.
0
A: Managing a cruise system

RubberDuckCustomer Class It's good practice to explicitly declare the scope of instance variables, if you don't specify it, they will public by default. However, instead of exposing instance variables as public, you should use properties with default Getter/Setters. public class Customer { int disc...

@rolfl All out of stars, but yes yes yes. All problems are now over.
 
> explicitly declare the scope of instance variables, if you don't specify it, they will public by default
in .NET class instance variables are private by default
 
@Dan, was that quoted thing for Java or C++, or something else?
 
6:21 PM
@rolfl I assumed C# because of the conventions
Yeah it's C#.
 
Ah, context acquired.
 
57
Q: Default visibility for C# classes and members (fields, methods, etc)?

Ryan PetersI'm trying to find a reference for the default visibility of various aspects of C#. Class types, fields, methods, enums, etc. Can someone provide a list of these along with their default visibility (i.e., no prefixed modifier). Thanks.

 
Generally speaking in programming, is it a bad idea to rely on defaults as opposed to declaring explicitly? I always heard being explicit is better, but my only experience is database stuff.
 
I am always explicit for private members
even if it's default.. it signals your intent
letting it default is ambiguous (did they leave it out by accident?) - explicit is clear
 
@DanPantry I updated it. Thanks @DanPantry.
 
6:30 PM
@RubberDuck no problem, @RubberDuck
 
I'm very used to it being the other way round.
 
What's public by default? I thought in java it also defaulted private
and in C++?
 
VB6. Unsure of VB.Net, but I would assume it is private by default as well.
 
vb.net is private, indeed
 
Wouldn't the default also possibly be different depending on some system settings?
 
6:31 PM
I think that's baked into .NET framework.
But certainly in language slike C++, YES.
Some things are based on system/compiler settings (hi Endianness/Word length)
in java, default is big endian, in c#, it's little endian
(or is it the other way around? I forget)
Obviously you can't use Java code in C# or visa versa but it's a good example
 
Well, the point stands that it's better to be explicit.
 
Unless you're implementing an interface inC#
:-)
 
@Phrancis - I tend to be overspecific for what it is worth, and I am regularly chastised for that, but I won't change soon ;-)
 
for clarity: explicit implementation of an interface in C# (+VB.NET?) causes members of the implemented interface to only be accessible from an instance of the interface, rather than the implementation
 
Can't teach an old monkey new tricks, huh? ;-)
 
6:38 PM
You can, but they have to be nice tricks ... see, you now have a primate mod ;-)
 
How long you been mod, out of curiosity?
 
since March 28
 
@Phrancis Let's put it this way, would you do this?
ColumnName VarChar or ColumnName VarChar(25)?
 
the latter. but would be NVarchar(25)
 
The latter, for sure
 
6:41 PM
Because if you don't explicitly state it, the column ends up 255 characters wide.
(At least in SQL Server)
 
Right
 
monkernoon
 
Was just curious if that (being explicit) applied pretty much across the board in computer languages
Hi @Schism
 
No, not across the board.
In fact, C# encourages loose definitions.
var x = something(y)
 
I would say it has the capability for implicit inference
 
6:43 PM
That's interesting... is it for flexibility or... surely not performance?
 
not that it encourages you to overuse it :b
var was mainly created so you could assign instances of anonymous structures, right?
 
@rolfl I don't care for var, but that's just me I guess.
 
var enumerable = Enumerable.Empty<Object>().Select(o => new { Stuff = 3 });
 
@DanPantry The default access for members in Java is neither public nor private.
 
Above code creates an anonymous object. It could have fields, but the point is is that it isn't Enumerable<Object> anymore.
 
6:44 PM
27
Q: Which is the default access specifier in Java?

bennedichSo I just started reading a Java book and wondered; which access specifier is the default one if none is specified?

 
with var we can do enumerable.Where(x=>x.Stuff) because var infers the compile type time i.e, we have type safety now
without var, because we cannot type the anonymous type's identifier - it doesn't have one - we have to use dynamic
@200_success I stand corrected :-)
 
@DanPantry That's a fine use of it, but I've seen some really bad uses of it.
 
@RubberDuck I was actually trying to say that that is what it is used for
there is certainly abuse of it
var i = 0 is one of the worst
 
0
Q: How to mark items as selected in angular directives?

WarlockI am new in angular and feel that I'm doing mistakes and inventing a wheel. Could you please review my code and share your ideas about how it can be improved. Demo The problem is very common. I have a list of items (countries), that can be loaded inside a directive controller. I have an Id of se...

 
I do use var a lot of the time where the type is obvious, though
it just reduces typing a lot
 
6:46 PM
And changes if the type changes.
 
Also good.
Example:@
var expectedBytes = new byte[] {1, 2, 3, 4, 5};
Stream stream = new MemoryStream(expectedBytes);
var networkConnection = new NetworkConnection(stream);
var mockObserver = new Mock<IObserver<byte[]>>();
var scheduler = new TestScheduler();

using (networkConnection.Read(5)
	.ObserveOn(scheduler)
	.Subscribe(mockObserver.Object))
{
	scheduler.Start();
	mockObserver.Verify(observer => observer.OnNext(expectedBytes));
}
 
int i = 1
int i = 1.0
var i = 1.0
var i = 1
 
@DanPantry oh, come on. isn't it clear that i would be a System.Int32 here?
 
@Mat'sMug yes, it is. but sometimes you don't want a System.Int32, and unless you know it defaults to an int you would be confused
 
I'm a hardcore fan of var :)
 
6:48 PM
especially as i = 0 could be a byte, short, int or long potentially
I like var as you can see
I use it unless I have to be explicit about what the type is, or unless it's not clear
 
like in var x = Something();
 
Stream stream = ... because I wanted to say "this is a MemoryStream, but we only want the Stream interface"
 
actually the guidelines also warrant the use of var when the actual type doesn't matter. So in the above, if x would be a method's return type, I'd go for var still.
and do var result = Something();
@DanPantry or that
 
and fyi I mean the question I linked
I am happy to discuss var with you @Mat :-)
 
:)
 
6:52 PM
@Mat'sMug yeah, that's what I mean. Unless I have to explicit, or it isn't clear, I will use var. It just reduces typing. One of the main reasons I prefer C# to Java is type inference
 
@DanPantry haha I was going to say "WTH is wrong with string.Format()?" ...but then realized it's Java.
I am happy to discuss C# vs Java with you @Dan :-)
 
@Mat'sMug I like Java because of the open source community but.. that's it :(
@Mat'sMug yes I got thrown by that too but I still think there's nothing inherently wrong with String.Format in Java.. certainly not enough to make you have to roll your own
 
seen this?
 
The problem with var is all of the instances I see it used where it's not clear what the type will be.
 
^^ I wanted more C# in my VBA life :)
 
6:54 PM
> CSharpish
> VBA
 
damn right!
 
@Mat'sMug do you think OP of my question looked at your example and took it maybe too literally?
 
that's a possibility...
 
> Java is a great language to learn programming because the time it takes the garbage-collection to complete you can learn other programming languages
2
 
I am deleting all comments here, and am suggesting that this conversation be taken up politely in chatrolfl ♦ 22 secs ago
 
6:56 PM
@rolfl I was done discussing it anyway otherwise I would have switched to chat, too
 
And me.
 
grabs some popcorn
 
(runs)
 
:-P
 
6:59 PM
Well, that brought some silence here.... must remember to invite more people to chat more often
 
@rolfl Why was that comment (in chat) removed? I meant I now felt like I would have to discuss it at more length. Was it construed as offensive towards that member?
 

« first day (493 days earlier)      last day (3517 days later) »