« first day (388 days earlier)      last day (3630 days later) » 

12:01 AM
It's normally measured in unicycles ... the number of times a unicorn goes to sleep....
6
If the unicorns are not sleepy, that can take a while.
 
I need to read up on these kinds of things, I just don't know enough about Unicorns
 
My friend just learned to ride a unicycle, so now I'm really confused.
@Jamal I'm happy to delete those comments if you like. I didn't want the OP to think there was a straight-up bug in the code, but my comments don't make that clear anyway.
 
@DavidHarkness About the C# naming, or the comments on my answer?
 
@Jamal the latter, on your answer
It's pretty clear you're answer says, "refactor this and change the API"
 
@DavidHarkness That's fine. I suppose someone else may end up correcting me if needed. There are no other C++ reviewers around now (unless monkey is now a C++ reviewer).
@Corbin is better with storage containers anyway, so he should be able to tear that question apart. But the OP could still conclude from my answer that much needs to be changed.
 
12:09 AM
I can read/write it, but I haven't done so for a long time, and it was before the standard collection library. But I can say your suggestions match what I'd do in Java and PHP.
 
Another complication, to me, is that it doesn't appear that he's trying to reinvent std::map. In such cases, I'm stuck with just determining if any general bad practices are done.
 
Well you saved his bacon with the DeleteAt bug :)
 
It did look smelly to me, but since I didn't quite know how to handle it, I merely brought it up. Throwing an exception may work, but I was also too lazy to see if erase() throws.
 
@kleinfreund Not at all. Feel free to sent a PR whenever, and I'll usually get around to merging it pretty quickly.
 
12:34 AM
I actually quite like this question now
3
Q: iOS7 ChessGame UIChessboardView Design

LiterphorThank you for the fast and constructive responses, I think I better understand my issue and the mindset that's expected of me. I've been designing UIChessboardView in the likeness of UITableView using protocols and delegates. UIChessboardView.h @interface UIChessboardView : UIView @property ...

Although, I wonder... am I beating a dead-horse that most of my answers say "Look at ______ class that Apple already provides--model your class after this pattern that's already been laid out for a similar class Apple has"?
 
12:52 AM
@Jamal hmmm.... there's a lot on that question that I want to comment on, but I'm not confident enough that I would be correct. I'm just not sure if I understand the goal correctly. Why bother sorting the vector at all? I wonder if he could get away with a std::map with a custom comparator. Seems like he probably could unless there's something I'm missing.... Certainly an interesting post though. Will have to thoroughly look into it when I can.
 
@Corbin I wasn't sure of his intentions, either; I was going after the practices used (and to kill another zombie). The OP hasn't been here in a while, but he's still active on SO, so he may come back.
Is my answer decent at least? I'm not quite sure about Find(), especially given his goals.
 
Hrmmmm, I just don't see why std::set (meant set when I said map earlier ;p) wouldn't work. What did he mean by this? "If I use std::set, I need to calculate the index first (such as using distance function) when adding an item under a tree node and need a binary search when deleting and accessing an item."
 
I'm not sure. I even removed because the code didn't seem to perform any kind of sorting.
 
@Jamal it's a strange API compared to the standard style, but it's valid in its own way. It's a relic of C in my opinion to structure interfaces like that, but it's arguably just as valid. The problem with if (find()) { idx = lowerBound() } is that you turn end up doing two searches. By having find return both items of data at the same time (namely "Was it found?" and "where is it?") you avoid the second search.
There's certainly something off about the interface though. He really should be leveraging exceptions in a few of the places instead of bool returns with output parameters
 
The bools is another thing that seemed fishy to me. The standard library doesn't do that, either.
 
12:59 AM
It's typically done to either avoid exceptions or because the person comes from C and is using C paradigms.
 
Ah
 
Blerh there's just a lot of strange stuff about this. He uses key comparisons to determine equality. That feels.... wrong.
 
hi @hichris123!
 
Why not just use a map of key -> std::unique_ptr if you have to know the key anyway? This just makes no sense.
I would love to know what his specific use case is. I would be very surprised if there's not a better option once his actual use case is known.
 
My first question!
0
Q: Inheriting DefaultControllerFactory to enable Constructor Injection

Mat's MugI've decided to [finally] get into some web programming, and so I'm diving into asp.net-mvc-4. I want to architect my application using Dependency Injection and Inversion of Control, so in order to enable constructor injection in my controller classes, the first thing I did, was tweaking global....

 
1:02 AM
Oh... apparently that's what I thought a year ago too: "It seems like there would be a weirdly specific use-case for this class? But interesting, nonetheless."
 
Oy.
@Malachi Why are you guys getting swag?
 
@Corbin The OP hasn't even commented on it at all. :-/
 
Yeah. I want to answer it, but I'm just not sure I can until the OP comes around. Otherwise, my main comment would only be "use a std::map<int, std::unique_ptr<T>>."
 
@Corbin I didn't "rush" it, right? I just found a zombie that I remotely understood. He may still benefit from advice on this, at least to avoid bad habits.
 
1:06 AM
2
Q: Inheriting DefaultControllerFactory to enable Constructor Injection

Mat's MugI've decided to [finally] get into some web programming, and so I'm diving into asp.net-mvc-4. I want to architect my application using Dependency Injection and Inversion of Control, so in order to enable constructor injection in my controller classes, the first thing I did, was tweaking global....

 
Why are there so many good SE sites that I have no time to contribute to? :(
 
0
Q: Special usage of metaclasses in python

user3002473I was messing around with python metaclasses and I came across something very intriguing that I didn't know existed or was valid: class Meta(type): def __new__(metacls, name, bases, kwargs, extra_thing=None): if extra_thing is not None: print(extra_thing) return s...

 
@Jamal I like your review over all, but your critique of Add is a bit off in my opinion. I would probably have int add(std::unique_ptr<T> element) that returns either the index of some special end() value if adding failed. That way you avoid the bool/outparam complications but still get all the data you need out of it.
(and it's consistent with std::map, std::set, etc)
actually wait... they return a std::pair<bool, iterator> now that i think about it
so that's probably what i'd do. that way you get the index of hte one that already exists
 
Yeah, that. I guess I was still thinking vectors, not maps.
Or should I just go with your first point: have it return the index?
 
1:34 AM
@hichris123 they havent emailed me to get my shipping address yet
 
0
Q: Link in between parenthesis

fotanusA common pattern while creating links is adding a help link in between parentheses. Something like this: <div>(<a href="help">more help</a>)</div> In haml, the best way I found some ways to write it (using the link_to rails helper): %div ( = link_to('help') ) or %div = raw "(#{lin...

 
@Malachi Why are you getting swag?
 
82
Q: What happens when you plug a UPS into itself?

Tim PostUPSey daisy; so we had a little ... incident ... Pretty sure that has power. We're past that now, and things are returning to normal. It's only appropriate that we take a moment to think about the folks that got pulled out of bed and worked their knuckles to the bone to get things back up and...

 
Ah.
Reminds me: I need to incessantly bother ask Tim for my mod hat.
 
1:48 AM
0
Q: STL Stack Implementation

axonI implemented std::stack from the STL for deeper understanding of the language and memory since I still am only a beginner. I implemented the stack using a singly linked list. Header file: /* Header file for abstract data type "STACK" implemented using a linked list */ #ifndef STACK_H #define...

 
@hichris123 The ones with a diamond in the front? We can request those?
 
82
Q: What happens when you plug a UPS into itself?

Tim PostUPSey daisy; so we had a little ... incident ... Pretty sure that has power. We're past that now, and things are returning to normal. It's only appropriate that we take a moment to think about the folks that got pulled out of bed and worked their knuckles to the bone to get things back up and...

 
4 mins ago, by hichris123
Ah.
;)
 
@Mat'sMug LOL
 
@hichris123 - no hat for you, me and @Jamal ...
Only for elected mods.
 
2:02 AM
@rolfl :-(
 
@rolfl Nope, Undo got one. He said to ping Tim in TL.
 
@hichris123 He's just a mod on Software Recs, right?
 
Yup.
 
So we just... ping Tim? That's it?
 
@Jamal I guess so.
 
2:05 AM
:O
 
@JeroenVannevel the NinjectControllerFactory still needs to be coded as far as I understand, after reading a bit about Ninject+MVC...
 
0
Q: My web site is messed up

DeviantDamienThe Jquery script and other javascripts are functioning correctly, however the page displays this IT WAS WORKING BEFORE instead of this HERE IS THE BASIC HTML CODE <head> <meta name="description" content="Passion for difference" /> <meta http-equiv="Content-Type" content="text/h...

 
        private readonly IKernel _kernel;

        public NinjectControllerFactory()
        {
            _kernel = new StandardKernel();
            ConfigureKernel();
        }

        private void ConfigureKernel()
        {
            _kernel.Bind(t => t.FromThisAssembly()
                               .SelectAllClasses()
                               .BindDefaultInterface()
                               .Configure(binding => binding.InRequestScope()));
        }
@CaptainObvious lol
 
@Mat'sMug Does it not auto-generate that class?
 
didn't for me :(
 
2:10 AM
huh
Well, it's been a while so it might be
 
I deleted the post, I'll flesh up the app and see if I get something a bit less trivial to post for review ;)
 
But there's really almost nothing to it
 
well for now I have the above, and this:
        protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
        {
            if (controllerType != null)
            {
                return (IController)_kernel.Get(controllerType);
            }
            else
            {
                return null;
            }
        }

        public override void ReleaseController(IController controller)
        {
            _kernel.Release(controller);
        }
 
This is some old discontinued project of myself I base on: github.com/Vannevelj/NoName/blob/master/NoName/NoName/App_Start/…
I have the feeling I also added something elsewhere the in the project but I can't recall where
oh right, global.asax
ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory());
That's all I needed to get it working
 
makes sense
but this:
    private void AddBindings() {
        kernel.Bind<DatabaseContext>().ToSelf().InSingletonScope();
        kernel.Bind<IUserRepository>().To<UserRepository>().InRequestScope();
        kernel.Bind<IShowRepository>().To<ShowRepository>().InRequestScope();
        kernel.Bind<INewsBulletinRepository>().To<NewsBulletinRepository>().InRequestScope();
        kernel.Bind<IFAQRepository>().To<FAQRepository>().InRequestScope();
        kernel.Bind<IAdministrator>().To<Administrator>().InRequestScope();
I'd use Ninject.Extensions.Conventions and do like this:
        _kernel.Bind(t => t.FromThisAssembly()
                           .SelectAllClasses()
                           .BindDefaultInterface()
                           .Configure(binding => binding.InRequestScope()));
BindDefaultInterface binds any ISomething to Something
 
2:14 AM
Then you can drop all the InRequestScope()s?
 
there are methods to further refine the conventions, like I can say I want all classes ending with Service to be InSingletonScope if I want, except those under namespace FooBar
lol then you can drop all the kernel.Bind calls!
 
Oh wow, that BindDefaultInterface thing is pretty neat
 
totally awesome in fact ;)
 
I'm going to look into those conventions if I ever do some asp.net mvc stuff again
 
or just if you ever use Ninject again!
 
2:18 AM
Yeah, my DI habit isn't very strongly developed outside of an mvc structure
and since most of my projects involve backend stuff with perhaps a console window..
I have to incorporate it more
 
console apps are the easiest to DI with!
there's even a way to do DI with PowerShell if you're willing :)
ASP.NET (not MVC) is a bit of a pain though
 
So, @Mat'sMug - what're you going to do with your question?
It's sort of answered in the comments.
 
@rolfl I deleted it
 
Ohh ... I see that now.
 
well technically it could be reviewed as a poor man's DI ControllerFactory
but now that I have one set up with Ninject...
 
2:46 AM
(thunderstorm... might go poof)
 
@hichris123 that is so Cool!!! I want one!
I can't wait for my swag
2
 
3:02 AM
1
Q: Proposal to rename [programming-challenge]

200_successIn Rename [code-challenge] to something more site-specific, it was proposed to rename code-challenge to avoid confusion with programming-challenge. That renaming (to community-challenge) has been completed. However, part of the problem is that programming-challenge could also be better named.

 
3:17 AM
0
Q: combine two indexOf and regex into one using javascript

chovyI have tried combining these two conditions into one, but the results were not what I wanted. var name = 'Ron & Peggy Sue'; //or 'Ron and Peggy Sue'; if ( name.indexOf('&') > -1 ){ names = name.split(/ & /g); } if ( name.toLowerCase().indexOf(' and ') > -1 ) { n...

 
@StackExchange The only problem with keeping [online-judge] and [project-euler] different is that there really are other sites (someone just posted a question about oj.leetcode.com
Here's the tricky bit, it's called LeetCode Online Judge ... but it has you fill in a method they provide that takes pre-parsed input--no I/O manipulation required.
Is this an [online-judge] even though it doesn't fit the description for it?
Hmm, guess this should have been in comments lol
 
4:12 AM
@Malachi I feel like I'm part of a secret society when I wear mine out.
 
@Donald.McLean i wouldn't have known what it was if I had seen it before this discussion....lol
 
@Malachi I didn't know what it was/wouldn't have recognized it until I got mine. :-)
 
lol
I will talk at you all in a few hours gotta get some sleep
later
 
 
1 hour later…
5:24 AM
morning all
 
It is!
 
@chillworld Yo
 
@Donald.McLean - what happened to TTFN?
Well, it is TTFN for me
 
@rolfl And me, very soon.
 
rolfl any idea how to search for a log4j dependency between your dependencies? (don't find it in pom or as transitive dependencie)
 
5:29 AM
Well, what do you know - the code now compiles.
@chillworld What kind of dependency?
 
log4j
I set now the log4j dependency in the ear file but get error when startup
 
Sorry, I was referring to compile time vs run time. I know what log4j is.
 
org.jboss.logging.appender.DailyRollingFileAppender cannot be cast to org.apache.log4j.Appender
2014-05-26 08:46:18,925 ERROR [STDERR]
not a blocking error but I miss some logging now
 
What JBoss library/libraries are you using?
 
and if I remove the log4j dependencie I get "No such field TRACE" error
an ancient one 4.05
jboss logging is 3.1.4.GA
mhh I se enow that I don't have that class in the jboss logging
DailyRollingFileAppender just search in complete project => no match found
so it has to be in a config file somewhere
of a dependencie
 
5:43 AM
Just trying to explain the problem to others can often help you figure out what it is.
 
Oke, I'll try
Mine war starts good in jetty
one sec, deploying now to get the error
 
esec?
Ah
 
mhh building war take some time :s
 
0
Q: Follow up : Employee wage/salary calculation MVP solution

ChathurangaThis is a follow up post In this project (C# Win forms) I'm supposed to calculate wages of employees. These are the steps: Calculate earnings from Attendance data. Here all regular earnings like BasicSalary, OverTimeAmount etc will be calculated. Then these earning details will be shown in a ...

 
and getting this error when deploying on the server
java.lang.NoSuchFieldError: TRACE
at org.jboss.logging.Log4jLogger.translate(Log4jLogger.java:60) ~[jboss-logging-3.1.4.GA.jar:1.0.0.GA (build: CVSTag=Branch_1_0 date=200609301059)]
at org.jboss.logging.Log4jLogger.isEnabled(Log4jLogger.java:35) ~[jboss-logging-3.1.4.GA.jar:1.0.0.GA (build: CVSTag=Branch_1_0 date=200609301059)]
I can get rid of that with the ear if I set the log4j dependency in the ear
 
5:51 AM
TRACE is a constant used in some logging libraries, especially log4j and logback.
 
indeed
but I'm bouncing constantly between the 2 faults
but this is a blocking one and the other not
 
So you're using some library that is using JBoss logging which is, in turn, using log4j. Are you using Hibernate?
 
yes using hibernate
 
That's probably it. You're going to have to include log4j. No getting around that.
 
if I include I get the DailyRollingFileAppender cast fault
 
5:55 AM
You might have to change the version of something.
What version of Hibernate are you using?
 
hibernate-core-4.2.8.Final.jar:4.2.8.Final
it comes from hibernate the fault
and the strange thing is I have a second project also with hibernate where I use slfj as logger and it works
 
Even Hibernate 4.3.5 only uses JBoss logging 3.1.3.
 
I just can't find the difference between them
 
Is there some reason you're not using slf4j on this project?
 
I'm trying to
the TRACE error keeps coming
cause I have now slfj dependencies
I just did see that I don't have the slf4j-log4j12 dependency
I'll add this and try again (but I gues I get the 3th fault now)
nope the same one
2014-05-27 08:07:38,895 [main] ERROR o.s.web.context.ContextLoader - Context initialization failed
java.lang.NoSuchFieldError: TRACE
at org.jboss.logging.Log4jLogger.translate(Log4jLogger.java:60) ~[jboss-logging-3.1.4.GA.jar:1.0.0.GA (build: CVSTag=Branch_1_0 date=200609301059)]
at org.jboss.logging.Log4jLogger.isEnabled(Log4jLogger.java:35) ~[jboss-logging-3.1.4.GA.jar:1.0.0.GA (build: CVSTag=Branch_1_0 date=200609301059)]
at org.jboss.logging.Logger.isTraceEnabled(Logger.java:98) ~[jboss-logging-3.1.4.GA.jar:1.0.0.GA (build: CVSTag=Branch_1_0 date=200609301059)]
well, first coffe and a whole day to search again :)
 
6:09 AM
JBoss logging thinks you want to use log4j apparently.
There's a SLF4JLogger, but your configuration isn't using it.
Off to bed.
 
6:39 AM
I get some error whenever I am starting my JBoss that SLF4J is falling back to NOP mode...
monking btw.
 
mhh thinking of lowering th ejboss-logging to 3.0.0
 
7:05 AM
0
Q: (SPOJ) How do I reduce the complexity of my algorithm?

RanveerThe problem statement can be found here. In short, here's what the problem is about: You're given a set of numbers and you need to find whether the the numbers are ordinary or psycho. For a number to be psycho, its number of prime factors that occur even times should be greater than the numbe...

 
7:18 AM
I'm having hard to read c++, still basic but I don't get this
if (primes[i])
oh lol primes is a boolean
lol now I get why it's taking so long
 
7:36 AM
Nope, primes is an array of some type that can be converted to a boolean :p
@200_success I will have a look.
 
@SimonAndréForsberg I saw it as well ye, just bugfixes until now though, which is expected, but it is cool that it is already up, most of them I expect to be backported though to Java 8
 
@Morwenn indeed but he's doing so wrong
 
35 min remaining, save the battery...
 
I am writing on a review for that..
 
7:56 AM
@Vogel612 For what?
 
@Morwenn the one that @CaptainObvious posted
that's like... my first / review ;)
 
8:29 AM
@Vogel612 You could have told him that the name erastho is yet another insult for that poor Eratosthenes :p
 
well that one's half an hour late ;)
 
hey
 
hi @skiwi
 
Why does no bus have a tight schedule when going home? :(
 
I tried to fix Eratosthenes name where it has been butchered (unless it appears in code).
 
8:40 AM
0
Q: Refactor mass assigning from a hash

AdamHere is the piece of my controller action that takes a session[:auth] hash and then assigns the values to the ActiveRecord object represented by @user whilst the key names happen to be the same. def new @user = User.new if session[:auth].present? @user.first_name = session[:auth].extra....

 
how's everyone today?
 
good, just messing with the pom for ghetting the logging right without startup error
 
@skiwi Kind of fine.
 
@chillworld I tried that once, too. Even though I just got a warning...
 
@Morwenn Kind of doesn't sound fully fine though.
 
8:44 AM
@skiwi I have an internship report to write and that's boring.
 
Sounds boring indeed
 
@Vogel612 a warning should be nice for the moement :D
 
@chillworld well I am using Jboss 7.1.1-Final without any other configuration concerning logging...
 
@Vogel612 when I'm using that I should not have a problem, servers here are ancient : jboss 4.05
 
Youch.....
Can you even download stuff like that anymore?
 
8:48 AM
Oh of course... need to leave in a few minutes and then it's going to rain extra hard
 
@skiwi You want me to laugh at you now?
 
@Vogel612 Yes
 
<-- brb searching for a nelson gif
 
@Vogel612 well jboss 7 is in the pipeline just as java 7. Can take some years when it is finally done :)
 
@chillworld you want a laugh too?
or rather that?
 
8:51 AM
gotta get going and do more stuff
 
well laters then ;)
 
9:09 AM
@Vogel612 no boxes ;)
 
d'awwwwwww.
gotta love military...
 
euuh yeah I suppose :D I got 2 screens ^^
and a personall phone
 
well...
2 screens, headset, a phone for 2 and a shared room for (up to) 7
 
Monking @all
 
monking @Nobody
Room for 4 people, are with 3 in it
1 phone per person
and 3 time's a week I can telework 10km from home, 2 times I got to go to mine desk 70km from home
the last one is the best ^^
 
9:25 AM
I am living 30 minutes afternoon-walk from my workplace... just sayin.
 
pffft, I'll hope it rains when you go home :p
and prob better paid also :D
 
@chillworld prob not...
~630€ after income tax.
 
monking @SimonAndréForsberg
no full time?
 
who, me??
well yes, but I am a Trainee FWIW...
 
9:38 AM
My internet connection totally died last night, that was kinda fun... or not.
 
@Vogel612 so you have course also?
 
roundabout all 6 weeks I have school for 2 weeks...
but school is....
well let's say our teacher names his variables in German and keeps classwide instances of IO-Streams ...
so... it's something like preschool for programmers...
 
10:02 AM
variable names in german? dutch I can understand but german?
 
10:51 AM
well I am german FWIW..
 
oh lol I tought dutch
 
what the friggin hell...
mvn clean compile package jboss-as:deploy -Dmaven.compiler.debug=true war:inplace
--> code works
mvn clean compile package jboss-as:deploy
--> code doesn't work
wat?
and the most awesome thing is:
// @PostConstruct
// public void fillCustomerList() {
// customerList.clear();
// customerList = businessInterface.loadAll();
// }
public List<Customer> getCustomerList() {
      return customerList;
}
what I want is the fillCustomerList() functionality...
and it only works if it's commented out,...
2
 
lol
 
what in the world??
and it's reproducible...
but how in the world did that happen...
 
11:50 AM
> work in AI has pioneered many ideas that have made their way back to mainstream computer science, including time sharing, interactive interpreters, personal computers with windows and mice, rapid development environments, the linked list data type, automatic storage management, and key concepts of symbolic, functional, declarative, and object-oriented programming.
Now we know who to blame!!
(From Artificial Intelligence: A Modern Approach)
 
12:17 PM
Yo
 
monking @MadaraUchiha
its calm today
 
Indeed
Was invited by @rolfl, thought I'd take a break from Stack Overflow for a while
 
Hey @Madara! Welcome to The 2nd Monitor!
3
 
monking
and pimping
1
A: Justification of my current approach and possible suggestions about alternative to a Grid in a StackPanel form for an easier way of inserting new rows

BenVlodgiWPF readability To keep your xaml looking clean, I reccommend using self closing tags <RowDefinition /> vs <RowDefinition></RowDefinition> Explitily set properties instead of using the > content area < of a tag. Doing such more explicitly shows what the content is used for. <Label Grid....

 
well, you'll see it's a nice chat here
not always heavy active
 
12:30 PM
Monking @BenVlodgi
 
I'm not always nice either.
 
0
Q: Using bilt-in type Decimal or Entity type Advance, to hold AdvanceAmount

ChathurangaIn a wage processing system which employees MVP pattern We have Model classes WageInfo, EarningInfo, DeductionInfo and AdvanceInfo and entity class Advance. (With several other classes) EarningInfo and DeductionInfo has a composition relationship with WageInfo (contained in WageInfo) and also s...

 
@Morwenn you think so, we know otherwise
 
Got a new laptop ;)
*dance*
 
What about a topless lapdance to celebrate that?
 
12:37 PM
not a good idea in a shared bureau
 
12:47 PM
Good code is not only about algorithmic issues... What would happen if your primes could suddenly go up to 100000 ?? Your current code would break. Good code is easy to understand and maintain and what you posted here as final version IMO does not fulfil that requirement... — Vogel612 51 secs ago
why the heck does that guy not want to post a follow-up?
 
@Vogel612 Because all he cares about is that the code works (and quite fast) ?
 
but that code sucks in every respect different from that...
yo @MadaraUchiha
you also taking a break from Anime & Manga for a bit??
 
@Vogel612 Nah, I'm still there :)
Always lurking
 
always lurking everywhere ;)
btw, there's 43 unanswered s....
 
I'm much more active in chat than I am on the main sites nowadays
 
12:58 PM
likewise..
 
There are 80 something unanswered questions here :)
 
but only 11
and that's where we got the main bunch of questions..
 

« first day (388 days earlier)      last day (3630 days later) »