« first day (675 days earlier)      last day (3356 days later) » 

1:00 PM
> A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

> info@hetbijlesbureau.be
mailbox is full: retry timeout exceeded
Been a long time since I've seen this
 
wow
 
@Pimgd What for?
 
right order
 
i'm still confused. Annotations as in @Annotations?
 
/** blah blah */ @Override public...
 
1:03 PM
oh, right.
doc annotation method
 
or @Override /** blah blah */ public ...
 
the annotation is part of a method
it only makes sense that it is displayed as such
 
maybe it's because I'm adding javadoc to an interface method
yeah
 
Hello.
 
@nhgrif From what I've seen in videos it looks like a lot of fun. Why do you hesitate ?
 
1:14 PM
Is anyone around any good at figuring out Big O?
 
decent enough
 
@Pimgd Okay, so say I've got nested loops 4 deep. Then I reduce it to a loop and two nested loops. What's the change you think?
This is the code in question. codereview.stackexchange.com/q/83684/41243
 
depends what you for each loop
this is what it was:
For noOfPlayers = 1 To GetPlayerNum(ws)
For noOfOptions = 1 To GetOptionsNum(ws)
While Not endOfRange
For Z = 1 To resultsRange.Rows.Count
right?
 
Yes. That's the old code.
I know the inner most was bad. It pretty much had a random wait time.
 
O(players*options*rangething) is what it looks like
and you've made it O(players*options)...?
 
1:26 PM
I think it was O((players*options)^something) and I made it O(n)
I think
 
no
 
The inner most loop relied on a random number... so it would just keep looping until it got an unmatched item.
Yeah... I don't get big O notation. I mean, I get it, but I don't get it.
 
@Marc-Andre SimCity (2013) looked like fun too.
 
0
Q: get href from html using python

user3703384from bs4 import BeautifulSoup import urllib2 import re url = "http://blog.sina.com.cn/s/blog_53d7b5ce0100e7y0.html" html_page = urllib2.urlopen(url) soup = BeautifulSoup(html_page) for link in soup.findAll('a'): print link.get('href') I want to save article url from the blog, stated in the ...

 
I need to get back into this kind of stuff
9
Q: Photo gallery user control

MalachiI am trying to create something that is very reusable here so that I can use it in other sites for other pages etc. This code is for a simple photo gallery, I took the code from here, but I changed it a bit and would like to add more functionality to it eventually, though. PhotoGallery.ascx <...

 
1:27 PM
^something would be really, really, really nasty
and we weren't there just yet
average case = you need n*chance iterations to get the number you need
 
@nhgrif Indeed, but I have more positive feedback from players who played it on the youtube. But it would be a good thing to wait and see if things doesn't break like SimCity. I'm sure waiting 2 weeks is not a problem
 
so if he had 16 and 15 were already picked he'd have a 1/16 chance of being correct, so he'd kinda have got it in 16 iterations
 
@Malachi web forms :(
I started a virtual machine and installed redis on it
it's still testing
It's been going for about 15 minutes now
just running tests onitself
 
@Marc-Andre I've watched a few videos... Quill18 and Arumba seem to be desperately avoiding traffic lights at all costs--which is worrisome to me.
 
@Pimgd I'm pretty sure it went from O(n^2) to O(n).
 
1:34 PM
Execution time of different units:
  15 seconds - unit/printver
  19 seconds - unit/quit
  25 seconds - unit/multi
  27 seconds - unit/auth
  26 seconds - unit/expire
  33 seconds - unit/scan
  91 seconds - unit/protocol
  45 seconds - integration/aof
  142 seconds - integration/replication-psync
  48 seconds - integration/rdb
  11 seconds - unit/pubsub
  5 seconds - unit/slowlog
  26 seconds - integration/convert-zipmap-hash-on-load
  197 seconds - integration/replication
  12 seconds - unit/introspection
....redis pls
 
@RubberDuck where n is what
there's n*m in there
players and options
 
@Pimgd That's a good question. I would say the number of options.
There's really n*m*p
 
players, options and...?
 
And the actual list of options.
#players, #options, number of options to choose from.
Idk...
 
players, options and options does not make sense
 
1:36 PM
Yes it does....
For each player
    For each optionToReturn
        For each optionToChooseFrom
 
except that last one is constantly decreasing in size
hang on
 
Now it is.
 
talking about old or new?
 
Before, it would actually take longer on each iteration.
 
previously, it went through all the players to check if it was already picked
 
1:40 PM
@DanPantry hey long time no see!!! I think I am actually going to turn it into MVC, I just haven't gotten around to it yet. I know Web forms, hard to step out into the unknown, you know??
 
All of that could be done in javascript D: that's why I said ew. but hi o/ @Malachi
 
@Pimgd Not quite. It went through the results to see if it had been picked already.
 
@DanPantry it is done in Javascript
 
And then just kept looping until it found one that wasn't.
 
I only saw the web forms @_@
 
1:41 PM
<script type="text/javascript">
    $(document).ready(function () {
        $('#ImageGallery img').click(function () {
            var bigImagePath = $(this).attr('src');
            $('#bigImage').attr('src', bigImagePath);
        });
    });
</script>
:)
 
okay, I guess
anyway, there never was a ^
 
ew Jquery! ;-)
 
Yes there was (and still is I think)
> Here we're nesting two loops. If our list has n items, our outer loop runs n times and our inner loop runs n times for each iteration of the outer loop, giving us n2 total prints. Thus this function runs in O(n2) time (or "quadratic time"). If the list has 10 items, we have to print 100 times. If it has 1,000 items, we have to print 1,000,000 times.
 
@DanPantry lol, what do you expect I work for the state, and didn't learn quite enough in school, now I don't have much time for anything else.....
 
which list
 
1:43 PM
@Malachi :P no offense intended friend
 
  def print_all_possible_ordered_pairs(list_of_items):
    for first_item in list_of_items:
        for second_item in list_of_items:
            print first_item, second_item
 
@DanPantry none taken, I know I need to learn more. I just gotta get somewhere where I can make some real money and don't have to work 2 jobs to stay afloat, so that I have time to study up on stuff....lol
and spend time with my wonderful family
 
@Malachi that sucks :(
I just have a prejudice against jQuery.
It does a lot of real work every day, I just dont' like it
 
@RubberDuck n*n == n^2
 
that's not to say it is bad :-)
 
1:44 PM
n*m != n^2
 
Hmm good point.
 
@nhgrif I'm watching BDouble00 and traffic seems like it needs a fix. I don't know anything about traffic lights specifically, but that sorts of things doesn't worry me for a game, since it's patchable. But I won't buy it since I already have too much game to play.
 
this is very important to realize because it means you're likely not facing as problematic a situation as expected
 
cool. I gotta write the rest of this emailer. I will be around
 
n^2 will blow up quick, n*m can be with 1 big list and 1 small list
 
1:46 PM
@DanPantry I actually have this book sitting next to me
 
Very good point, but something has changed because I'm seeing a very real performance improvement.
 
oh that's the randomization
 
But perhaps that improvement gets lost as it tends to an infinitely large input.
 
@Malachi lol :p
 
1:47 PM
but haven't gotten very far
if I could read at work......
too many projects not enough people with the right skills, well.... not enough people to start with.
 
im currently on codereview and i'm playing with virtual machines and nodejs
at wokr
at work, I am very grateful I get a lot of freedom
 
that you've changed from players!*(1-((options!-players!)/options!)) ... I think
 
hey
 
or some form of that
anyway, I should get back to my implementation of the stream thing
 
Yeah. I've got work to do too.
 
2:01 PM
Guys, question
after I call a constructor
The object I have created should be ready to be used by everyone, correct?
And I should not be expected to set properties and whatnot to actually use the object.
 
Most of the time, yes
Unless you have stuff like async calls that can't be done through a constructor (in C#)
then you might have to call InitializeAsync() first
 
Theres a discussion on programmers about logging
 
Incoming SFPEQ! (Simon Forsberg Project Euler Question)
 
a few people have advocated for property injection
I have argued that if I use property injection, and that remains null, then my logger will cause the rest of my business logic to crash and therefore it is not really suitable; if your class depends on the logger it should be put in the constructo
r
 
@DanPantry I get a lot of freedom as well, I too am at work. but I have ADHD and get pulled from projects to put out fires and ... hey check this out etsy.com/listing/106188478/i-ate-some-pie-and-it-was-delicious
 
2:05 PM
(because otherwise your class is not complete,)
Currently I am -2 :b
@Malachi lol :p
 
you would think that a programmer with 3 screens would be able to get more work done than say a programmer with 1 or 2 monitors.
 
I have 3 screens
I get lots of work done, just not necessarily teh work I am MEANT to get done
5
 
@Marc-Andre patch able, yes... But you can only patch something if you know how to fix it. Given how much of C:SL is copied directly from SC2013, they certainly knew traffic would be a major issue... And to me, traffic is most important aspect of a city builder. I'm not confident they know how to fix it and not sure I want to give them the benefit of the doubt.
 
I am compiling/debugging ideas in my head right now, that is my excuse if ever asked what I am doing when I am not actively writing code.
 
http://programmers.stackexchange.com/a/275824/110316

for those interested
afk time for a team meeting that should really be an email
4
 
2:09 PM
But... Traffic lights should alleviate traffic problems, not create them. In my everyday life, I've never thought "this intersection would be better without a light," but I can think of 3 intersections in my city that would be better with a light.
 
@DanPantry Passing a logger into every single object that could possibly require a logger signals really bad design.
You get a class diagram where everybody needs Logger to be constructed.
 
1
Q: The answer to life, the universe, and Project Euler

Simon André ForsbergI've never did a real Project Euler in my life, so I figured it was about to do one. And what better Project Euler to start with than Problem 42? Project description from Project Euler: By converting each letter in a word to a number corresponding to its alphabetical position and adding the...

 
wat
I have a possible reverse racecondition
if you send stop first and then start the thread can get interrupted in the prechecks and end up doing start-stop
on the other hand this sounds really silly and "not a real thing"
 
0
Q: Timestamp when file last modified in C#

CameronI have the following code in PHP that appends a file path with a timestamp of when it was last modified: function AssetTimestamp($filename) { if (file_exists($filename)) { return $filename . '?' . @filemtime($filename); } else { return $filename; } } I have written ...

0
Q: Hybrid event model - comments wanted

instantMartinI've tried out a hybrid type of event management model, combining elements of the addEventListener-type and the onEvent-type. What I don't like about the addEventListener model is that you have to consult the documentation to choose the right event type, example: addEventListener("click", callbac...

0
Q: Interactive html stories creator

CaridorcI decided to write a small script to make writing html interactive stories less tedious. import doctest import re import sys import tkinter import tkinter.filedialog HTML_START = """<!DOCTYPE html> <html lang="en"> <div align="center"> <head> <title>{}</title> <h1>{}</h1> </head>

 
2:36 PM
@Pimgd it does, but so does property injection
I would rather pass a logger into everything than have everything break that requires a logger because I didnt' set a property.
 
@Pimgd why does every one needs to construct it if logger is passed to the constructor
 
0
Q: Dynamic Object Property in C#

user1477388I have the following code: if (isMandatory) { x.MandatoryServices.ForEach(y => { if (!y.IsSelectedByUser) { containsRemovedSrvcs = true; return; } }); } else { x.OptionalServices.ForEach(y => { ...

0
Q: String deduplication using a custom string pool, looking for further optimizations

JaceFirst let me address why I'm not using the built-in string interning. My code is used in a utility that needs to free all of its memory once it's closed. Strings that are interned are not likely to be freed until the CLR is restarted. I can't cause that situation since my utility is used on serve...

 
@JaDogg I think he meant that in order to construct a class you would etiher
a) need access to the logger
or b) create a new logger each time
 
Wouldn't a singleton make more sense
 
@JaDogg to X and to be X are different things
 
2:38 PM
Singletons never make more sense
:^)
 
ah, nvm
 
to construct = new Object
 
interesting
 
the problem with doing loggign that way is that it intrinsically says that your business logic relies on logging
 
to be constructed = give me a non-null Object
 
2:39 PM
I got it
 
@DanPantry maybe it does.
 
The problem with injecting it into the property is that some methods will rely on that property being non-null
But you have no idea of knowing which
From a unit testing standpoint, that's a total nightmare and just doesn't make sense
 
From a unit testing standpoint, you should provide a sane execution environment to begin with
 
Are you suggesting I use a DI container every time I want to unit test lol
 
I'm suggesting you use objects in their fully constructed state
 
2:41 PM
Correct.
Which you would get from one of two ways:
1) constructor injection
2) property injection
now, if an object requires another object to work properly
we would put it in the constructor.
because it requires it to be constructed
why is this any different in this case
 
And this is where you have a Logger class that can give you a /dev/null writer
 
I am confused.. I'm saying that property injection is a bad idea for dependencies. You appear to be agreeing with me?
 
=) I'm taking offense to "property injection means you might as well be putting it in the constructor"
> This means you might as well have it sets as a constructor dependency because the class does require it.
 
Well, that's true
 
That's just bad.
 
2:43 PM
In my opinion
I can't see a situation where you want property injection and not constructor injection
If you give me one maybe I could understand your viewpoint more clearly
 
public Object(Logger logger)
as java.lang.Object
 
I don't really see how that's relevant
You can't put a property on java.lang.Object either
 
... You can pass Logger.getLogger any class
you'd rather have it in the constructor of each object
 
yeah, but that's not property injection
You can set that as a static field
To be claer, we are talking about two different things
 
anyway, via the constructor is a lot more verbose
it makes programming cumbersome
 
2:46 PM
no it's not
 
Yes it is, all of a sudden you're paying for each instantiation
 
I don't get that viewpoint.
Your class won't work if you do property injection and your methods call a logger.
 
I have to pass a logger instance everywhere!
 
you end up having to set it somewhere
either via setter or constructor
 
instead of it being set somewhere once
 
2:47 PM
but as I said, we are thinking of different things
I was arguing against this
class MyClass {
  setLogger(Logger logger) {
    this.logger = logger;
  }
}

MyClass.setLogger(myLogger);
not this
class MyClass {
  static Logger logger = Logger.getLogger...
}
 
@DanPantry this has the advantage that the programmer never has to set the logger object
 
Yeah, and I agree with the static one...
 
injection framework automates that
 
but that is not what property injection is.
Property injection is the one I put up there just then.
with setLogger
 
Yeah
you never call setLogger
your framework does that for you
 
2:49 PM
you do in unit tests.
Your object is not fully constructed until setLogger is called.
if your injection framework is doing that for you, stick it in the constructor.
 
... I see
 
Because your ijection framewrk will do that too
 
and I still disagree.
 
The ONLY difference is that you are saying "but I have to put my logger everywhere I construct an object!"
but then you fall back on "your framework does it for you"
So are you constructing objects, or is your framework?
 
I was mistaken earlier on how the whole thing works
 
2:51 PM
Because your framework can put it in the constructor easier than it can do a setter, and it semantically makes more sense, uses less code and is easier to unit test
It makes sense, I was talking from a C# perspective, I didn't think you would be talking from a java perspective
 
@DanPantry ... and when it comes to reading code, everything needs a logger.
 
@Pimgd not EVERYTHING.. your dumb data models probably don't :p
In those cases IMO Attributes become a better fit
 
I mean you constantly see constructors with loggers
that's noise!
 
so is the setLogger pattern
 
yeah, but setLogger goes to the bottom somewhere
Constructors I see a lot more
 
2:52 PM
new Foo(getLogger()) to new Foo(); foo.setLogger(getLogger());
I would infinitely prefer
 
You're talking from a writing test code perspective
 
well, yeah, I write tests for everything - :p
 
I'm saying it clouds reading actual code
something far more harmful
 
Ah, now I understand.
Yeah, I agree thre, it does. it's not a perfect solution.
That's why I would suggest AOP/Attributes or IL weaving.
But I don't think that setLogger inherently helps you in reading things, to be honest.
Think about it, you'r reading code 6 months down the line. You look and say "oh, this logger is null. Where is it coming from?"
With setLogger you see "oh, crap. It could be coming from anywhere this object is found. That's not great. Now I have to go find everywhere setLogger is called and find out."
 
...
No, it's "What do I need for my CameraStreamRecorder?"
 
2:55 PM
When it's in the constructor, you can just say "Oh, it's in the constructor. I can just go up the call stack."
 
and seeing a logger every damn time
 
I don't get that argument either, tbh
Your constructor might be clearer.
But you will still need to document, "hey, you beter inject this logger via a dependency framework otherwise I'm going to shit myself"
 
I don't want to continue talking about a trivality such as this
 
That's fine :-) I'm just enjoying the discussion of seeing someone else's viewpoint.
I just personally think that the constructor call is superior to property injection, but you're entitled to your opinion as well as me - neither of us are subjectively right or wrong
 
it's doneee
my control object thingmabob
 
2:57 PM
By the way I still haven't seent he code you eneded help with :D
oh, good, well done :-)
 
0
Q: all combinations of a string with special characters

Aneesh KI have written a function which generates combinations of string by replacing 1 or more characters by the symbol "*". The code is as follows: /** this following code is responsible to generate all possible combiantions of letters from a word with * for eg. word = "fin",...

 
I think it still needs splitting
 
Describe the class to me.
If you say "and", you probably need another class.
 
pff
 
I'm very strict lol
Don't take my words as gospel
 
3:00 PM
It creates a camera stream and records from it
but it doesn't really do the recording
... hmhmhm
 
If it delegates the recording, that's fine.
 
Why don't you have a recording class that takes a stream as a constructor?
Err, with a constructor that takes a stream.
 
Because I got distracted and knew I forgot something
 
lol :P
 
This is what I was trying to imply 4.5 hrs ago.
Sorry I wasn't more direct.
 
3:03 PM
I did give an example doing that, :P I think we just miss things sometimes
 
meh
 
I feel like java-ing it up when i get home.
But I don't know whether I can get through maven without throwing a hissy fit]
 
what do I need it to manage...
the whole restarting stopping process
it's okay if they're linked, right?
 
The recorder needs to manage this?
 
Well, it's a very bad connection.
Goes down all the time.
Needs to be rebooted.
 
3:09 PM
Recorder needs to just stop recording when stream stops, right?
 
I have a high level one
and a low level one
The low level one just stops
The high level one is responsible for checking the connection and prodding the lower level one for restarting recording
 
High level one should manage the stream and low level recorder probably, but separately.
 
yeah, but they can know each other
one of them needs to receive the starts and stops
hmm.
 
Does it ever make sense to use your low-level recorder with any other sort of stream? Like a file stream reading from disk?
Does it make sense to use the stream outside of the recorder ever?
The high level one should probably be a go-between manager...
 
I have split it differently than I have said here
bleh.
The lower level one can be used without the p2p connection
it can just take any url
 
3:14 PM
@nhgrif one would argue you should always use the base interface anyway, regardless of intent :p
 
The lower level one is a separate library.
It's the higher level one that's bothering me
It was setting up the p2p connection and retrieving the url to stream from (treat the p2p connection as some sort of vpn if it helps making sense, where I can ask things from localhost at the other side of the vpn, and I use that to get the proper IP address)
and managing the actual lower level recorder in that if it goes down, it does the things needed to get it back up
I have now split this in p2p connection setup and retrieving the url in one
and managing the lower level recorder in the other
and I don't have good names for them just yet, which is a really bad sign
eh whatever
screw splitting
it's 200 lines atm and not really gonna grow
Splitting would be good if I could toss one of the two away at some point in the process
but I can't
 
> it's 200 lines atm and not really gonna grow
I'm putting this in my calendar as a reminder for a week's time
 
I expect it to grow by 20 lines to tell the RecordingServer about things it can't recover from (bad password provided, bad camera url provided, etc)
I do not expect it to gain new public functions
 
make an interface for it if you haven't already, then
just to be sure
that way if you do hav to refactor it at least you know what everything else dependso n
 
and what would I use the interface for
 
3:24 PM
Interfacing.
 
well, first of all, except atthe composition root you should only be using interfaces.
because if you do do that, everything that consumes that interface will remind you of what you need to expect
that your code needs to work correctly
 
yeaaaaaah I don't see the point of defining interfaces for things that are not gonna be duplicated/subclassed/implemented in another way
 
-shrug-
your project, not mine
 
It's welding two libraries together so yeah
I don't want that much things going on here, that's why I built separate libraries to start with
 
I can't wait for a year from now when @Pimgd is trying to expand functionality of this code base.
 
3:28 PM
hmmh
 
@nhgrif shhhhhhh
@nhgrif don't scare him
 
I don't expect the current high level implementation to change without it taking down the entire company
 
oh dear
 
basically, we are building this, or we are not building this
 
I don't suppose I need to link Baymax again
yeah, that sounds like a lot of "fun"
 
3:31 PM
we are not building something like this but slightly different
for instance, if you replace the communications library...
then the entire device side vanishes
then client library comes out as a set of cached values
the recorder stays intact
and the high level system has problems identifying what camera is what
changes like that take out 9 months of work
a single interface is not gonna fix that
 
that's true.
It won't.
However a single interface might save your ass if you decide that you need to change the code you have written while you are still working on it.
 
anyway, I have welded my two libraries together with 500 lines of code atm
 
besides it is just good practice
 
this is why I feel a change in these 500 lines is trivial
 
have you got unit tests?
 
3:35 PM
I fear far more for those two libraries
nope
 
So you're completely OK with having no reassurance if you refactor your code? :p
"only 500 lines" is still 500 lines that can fail
 
=) Most, if not all of it relies on external hardware
 
I don't see how that changes anything? :S
 
I don't have functions that calculate, I have functions that send via external library
 
....so?
There's still logic going on there
 
3:39 PM
0
Q: Render/Update game loop

Alex MelbourneI've just "finished" my second attempt a core game loop, which is a heavily refactored version of my first attempt. My perceived benefits are: Using functors means that the actual loops themselves are independent from the actual systems them manage. You can wrap states up elsewhere, and the on...

 
... I don't see how I can blackbox test my code
 
Well, you could test that your functions are being called in the right manner with the right arguments
and that those fucntions are calling the functions of their collaborators correctly
 
so... mocking?
 
yes
 
I don't think that will catch the bugs I want to find
 
3:45 PM
well, if it's "just" calling external hardware methods it should catch them all.
If you're saying there are other bugs than just that,t hen you should definitely have unit tests for those.
 
that's a lot of effort for something that will bring the system down with stacktrace within 10 minutes of operation
 
It's not the point of catching the bug at run time
It's the point of catching the bug before ith appens
 
I'm more interested in seeing what happens if I start a thread, make it do something, suspend it and call another thread
 
and having assurance that the bug doesnt occur again
You don't wait until a bug occurs before you write a test for it, you write the test as a preventative. That's part of what TDD is good for
 
I just hit run for the first time for my recording server
it's doing an awful lot of nothing =D
 
3:53 PM
The problem with expectations is that we're can't see the future.
Expect the best. Plan for the worst.
 

« first day (675 days earlier)      last day (3356 days later) »