« first day (801 days earlier)      last day (1584 days later) » 

7:08 AM
Q: Sum of range - python

overexchangeProblem Printer A prints a random x copies 50 ≤ x ≤ 60, and Printer B prints a random y copies 130 ≤ y ≤ 140. The TAs also relax their expectations: they are satisfied as long as they get at least lower, but no more than upper, copies printed. (More than upper copies is unacceptable because i...

7:21 AM
hey @Vogel612
Q: Swap items of a linked list in pairs

Maksim DmitrievHere is the source of the question. GitHub Given a singly linked list, swap the list items in pairs (reconnect the pointers, not simply swap the values). For example: Before: A->B->C->D After: B->A->D->C See the method reversePairs. I appreciate your suggestions. Node cla...

posted on July 14, 2015 by kyle

I have implemented the solution for this problem using Dictionary and then using HashSet int[] inputArray = new[] { 1, 5, 8, 2, 9, 5, 7, 4, 3, 6 }; int SumToFind = 10; Dictionary<int, int> _results = new Dictionary<int, int>(); Console.WriteLine("Using Dictionary"); for (int i = 0; i < inputArray.Length; i++

I answered a question on SO yesterday and OP posted today saying "this is solved now" with a link to anotherq uestion
I look at the other question and its the same question as his, but with a bounty. And he posted it.
I ask him why he posted the same question twice and he said "I tried a different approach". so I look at both question's code and compare them side by side.
The code is identical.
This guy literally posted the same question twice within 4 days and put a bounty on the first one. Wat.
7:37 AM
Q: Trying to make my code faster, reality is that it's slower

Robert ForrerI am teaching myself Python, and as I am learning, I am working my way through the Project Euler problems. I am on the 3rd one which is listed at the beginning of this code. I understand it isn't elegant yet, but I added this line of code if primes[count] < test / 2: thinking it would speed ...

@CaptainObvious More of a Stack Overflow question, I think. Second opinion, anyone?
kind of a grey area, on one hand improving performance is something we do on cr
on the other hand if hes only intersted in a performance increase maybe its not suited here
and it is working code
@200_success Basically op is asking why -> explaination of code -> off topc IMHO
1. Post your code if you search for a code review. 2. The first row "java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1 at" tells you that you are trying to access to an array at index -1 that doesn't exists — Davide Lorenzo MARINO 55 secs ago
this is a question for [codereview.stackexchange.com/](codereview), not SO — atmd 13 secs ago
8:05 AM
A 100 point bounty to expire in 5 hours:
Q: Utility that decodes and logs UDP packets

Mike HamerI have written the following utility, as my first non-tutorial program in Go. The purpose of the utility is to connect to a torque/force sensor (aka load-cell) via UDP; to send an initialization command; and to record the resulting stream of measurements. Since I am planning further function...

@200_success The 'why' about code is usually a good question on Programmers (they like best-practices there), but SO will probably accept it as well.
Just my usual logic...
Connected from my laptop to an Ubuntu VM that runs in my desktop, which I access via Remote Desktop Connection
If I connect to Linux, I usually SSH
Does your VM allow that?
8:15 AM
Not sure
I'm not working on the VM though, just booted it to run the RNN calculations
8:37 AM
But that's one of the reasons I turned to programming; I can code 16/h per day and still function fine. (and hopefully the code does as well)
Helps a lot that it's the most fun thing I've ever come across
Well, I turned to programming because I like to know how to 'talk with the machines'
The problem is when they don't understand what I'm trying to say
Or when they say non-sense
Q: Populating lists with links from arrays

Vann'Tile IanitoI have the following configuration: $('document').ready(function () { var what0 = [ ["http://validator.w3.org/unicorn/", "Unicorn"], ["http://validator.w3.org/", "W3C Validation Service"], ["http://jigsaw.w3.org/css-validator/", "W3c CSS Validator"], ...

Q: Is this Bayesian spam filter interface written in the most effective way?

EmrakulI'm relatively new to Go, and created an interfacing set of functions to a naive Bayesian spam classifier. Below is how I've tried to accomplish this. In essence, what I'm looking to do is split a string into one-word and two-word segments, and train classifiers against them. First it lowercasi...

Like if( a && a.b ) throwing an Exception like Cannot find the property 'b' on a null reference
usually that means you told them something they can't interpret
computers are incredibly dumb
In the described case, I blame IE and Javascript
8:43 AM
@IsmaelMiguel I've always wanted get into cybernetics but alas, I don't have what it takes :/
@IsmaelMiguel Resistant just means you didn't get enough.
@Gemtastic I doubt it.
you have what it takes, but you don't know yet :D
@IsmaelMiguel that sounds reasonable
@Gemtastic I tried robotics as well. I've made a robot to follow a black line, while at school
8:45 AM
Starting with the AI seems like a fun project
@Mast I know, but IE is the only browser I can use at home
@CaptainObvious That was migrated after it received answers...
9:15 AM
I'm gonna go back to learning node and JS now :D
Q: Handling request errors in snap with haskell

Elliot StokesI'm currently taking a look at Snap with Haskell. I'm pretty new to Haskell and functional programming in general and am working out the best way to handle errors. Currently I have something like this createReport :: Handler b Api () createReport = do report <- readRequestBody 65536 modifyRespon...

9:33 AM
Q: Populating lists with links from arrays

Vann'Tile IanitoI have the following configuration: $('document').ready(function () { var what0 = [ ["http://validator.w3.org/unicorn/", "Unicorn"], ["http://validator.w3.org/", "W3C Validation Service"], ["http://jigsaw.w3.org/css-validator/", "W3c CSS Validator"], ...

There is some tons of unreadable code...
Do we review .htaccess files?
Q: Prettifying URLs for a PHP-based club website

Christoph EderI have a website for my car enthusiast club ("example.org") whose content can be divided into three main sections: Startseite (the "front page" of the site), Mitglieder (membership directory), and Vereinsinfos ("about us"). For each section, the content is handled by a corresponding PHP script: ...

@Vogel612 Read the question Ismael linked
@SimonAndréForsberg It has variables, it receives input and generates output.
I think it qualifies as a programming language
alright. At first I chose to "Leave closed" but alright, I'm voting to reopen
I see we have some previous questions as well
The question needs more meat
9:48 AM
Does Rev 4 accurately reflect what you are trying to ask? (If it looks good, I'll reopen it.) — 200_success ♦ 4 hours ago
I missed that comment
@SimonAndréForsberg Do you consider it code?
@Mast Apparently we've considered it code previously: codereview.stackexchange.com/questions/tagged/.htaccess
@SimonAndréForsberg If there's actual code in the file, I'd consider it as such. If there's just some plain text in it, perhaps not.
But this seems a regex problem.
Election closes in 10 hours.
@Mast Considering the power of Domain Specific Languages, where goes the line between code and plain text?
@SimonAndréForsberg The moment it starts looking like some dictionary .INF it would no longer be code IMHO.
@SimonAndréForsberg I'd say no
It's a dictionary, a list, a collection. Not code.
It is code.
It's part of our Domain Specific Language (DSL) for Cardshifter
I know, looks a bit like JSON.
But what would you possibly optimize about it?
It's a configuration.
It's telling whatever is reading it what the data is.
How the data should be interpreted.
what that code actually does is something like this:
delegate.card('Conscript', new Closure() {
    public void call(SomeDelegate delegate) {
It's a wrapper?
10:06 AM
Groovy does a lot of magic behind-the-screens.
It is a configuration, yes. For cards to include in a Cardshifter mod.
Would I post it for review? Probably not. But it is code.
And it does work
Is code included directly in my question? Yes
Am I an owner or maintainer of the code? Yes
Is it actual code from a project rather than pseudo-code or example code? Yes
Do I want the code to be good code? Yes
To the best of my knowledge, does the code work as intended? Yes
Do I want feedback about any or all facets of the code? Yes
So technically, according to our on-topic questions, I could post it for review.
Please note that I'm only bringing this up to make our on-topic/off-topic stuff clearer. I don't really think there's a problem with DSLs on Code Review at the moment really.
Valid point.
@SimonAndréForsberg Are there also bigger files around? I'm tempted to feed that into this RNN (LTSM)
I just like to find good questions to ask, and right now I find the question of "Why would I not post this for review?" a good question.
@skiwi Look through the github.com/Cardshifter/Cardshifter/tree/master/extra-resources/… directory. That's what we have.
Do I want feedback about any or all facets of the code? Yes What feedback would you want on a configuration?
@SimonAndréForsberg Ok, thanks, won't be a while before I get to run it though
10:12 AM
Naming? How to keep it readable?
@Mast Any feedback you are willing to give. What feedback I would expect though? That's a more difficult question. I don't really know what to expect from a DSL question.
@skiwi No worries. I'm sure you have better things to do than to run a RNN all day.
@SimonAndréForsberg I don't need to watch it while it runs :)
Though I have a feeling that this particular network (size, layers) is not strong enough to generate new HS cards
@skiwi Moar input. When in doubt, machine learning needs moar input.
@skiwi Is there any way that you can tell the network "This was a good card" and "This was a bad card"? So that you in a way can give it some feedback in the process?
@Mast But there aren't any more cards
@SimonAndréForsberg Not as far as I know
I'm still unsure of how this network exactly works, maybe I should figure it out
10:17 AM
Or that, indeed.
would be nice if you could. Could be used as an additional input source.
Refining would probably help your RNN a lot, since most of your cards seem close enough.
Q: Is this the most efficent way of calculating the factorial of any number?

James ZafarI have created, what was a rather simple piece of code to calculate the factorial of a number, although I wanted to ensure that my program could calculate the factorial of any given number. To do this, the only data type I thought was relevant was BigInteger. The problem I had with this was that ...

'Teaching' the system not to generate the worst ones should help a lot.
I could always add good examples to the data set, but that means I need to regenerate it
10:20 AM
Would be better than nothing I guess.
But one thing I do notice is that it's lacking creativity right now on 99% of the cards, I think that directly relates to the amount of neutrons
Neutrons are definitely involved.
I think you didn't allow it to deviate from the set. You made a system which perfectly recognizes it's original input, but that's not what you want.
You want it to use it's input to learn what input is valid and shuffle something up with that.
What I think it's trying to do, is generate a first random letter, then tries to classify it in [Classic, Basic, Goblins vs Gnomes, Curse of Naxxramas]
However, I'm not even sure if you can reason about it in "lines of text"
It also learns the concept of a line of text
I might be doing this completely the wrong way around though
10:26 AM
You should feed it with a list of valid words/sentences
Curse of Naxxramas | Minion | Rare | Neutral | None | Searobon | 7 | 7 | 5 | Whenever you play a card, summon a 2/1 Flame of Azzinoth.
It seems to generate a set, then it picks minion/spell/etc, picks rarity, picks class, picks class, picks a name, picks cost, attack, health and as last picks the card text
So for the card text there are not a lot of possibilities left
You want it to learn the structure of a valid text too?
You made it learn the difference between a name and a description on it's own. Given the limited input data, that's already very good.
Now it needs to learn how sentences within the description work, without messing with the rest.
In a 'normal' program, you'd see that part as a sub-string and give it it's own generator.
@IsmaelMiguel It will need to learn everything
@Mast It also understands that Minions have three stats (example: 7 | 7 | 5) and Spells only have one (example: 3)
@skiwi Then you need to tell it what the heck each word means
You feed it a universe of words and what they are.
If it is a name, an action, something
10:34 AM
@skiwi Nice, that's tricky.
@IsmaelMiguel I don't need to tell it anything, I just give it enough input data so that it can figure it out, and then I give it enough braincells, and it will do stuff
@skiwi But you aren't feeding a universe of data to process. You are spitting a bunch of giberish and expect it to know everything
Q: Tidy up nested Ajax callbacks?

RichardHow can I tidy up these nested jQuery Ajax callbacks? $.ajax({ type: "GET", url: numeratorUrl, error: function(request, status, error) { _this.showErrorMessage(request.status, error); }, success: function(data) { parse(data, {columns...

Q: toggling multiple divs to a single container

ChobbitI'm still relatively new to jquery, I have the below code and I want to click each of the links below and they will open (slide down) specific divs in a container below it but it toggles one to be active at a time and toggles (slides up) the rest to be hidden. Here's the code I've got: <div id=...

@IsmaelMiguel Yes, and it knows what it got and what to output
@skiwi How will it know that "xomxxm" isn't a real name?
10:39 AM
It still has some imagination...
Goblins vs Gnomes | Minion | Common | Druid | None | Druid of the Fang | 5 | 4 | 4 | <b>Battlecry:</b> If you have a Beast, transform this minion into a 7/7Finger.<<b>Omoul <b>Windfury</b>.
@IsmaelMiguel Because that order of letters doesn't occur often
@skiwi And <<b>Omoul <b>Windfury</b> occurs?
@IsmaelMiguel It made the Omoul up
@skiwi And with a nice HTML.
I'm not saying: "yer bot sux"
That's because the input also uses <b></b> tags
It is remarkable where it is now
But, honestly, I think it needs help
10:42 AM
Under loved question.
Q: After-school service for students

Edson AlcaláI have to show a select control of students with event information where Monday, Tuesday, Wednesday, Thursday and Friday are Events. (Independent buttons). The second columns are Events too, but you can add these Events using the "Add" button. Data flows in like this: I have to maintain the s...

> If your training/validation loss are about equal then your model is underfitting. Increase the size of your model (either number of layers or the raw number of neurons per layer)
That's the case, but I don't have RAM to increase it :P
@skiwi That's why you have SWAP
@RubberDuck Questions with screenshots almost get an automatic +1 from me.
@IsmaelMiguel That's not feasible, way too slow
@skiwi How many GB of RAM your computer has?
10:46 AM
@IsmaelMiguel It's an experiment in progress.
@IsmaelMiguel 16 GB
How many GB your VM has?
Together with the Windows host it uses 90% right now
I don't know exactly, it uses direct access
Probably this RNN is using 12GB RAM right now
SWAP won't help...
10:59 AM
@rolfl Seems like the Nth Monitor has found its usage.
@SimonAndréForsberg Now this chat will have a huge gap
nothing wrong with that IMO
Somewhat wrong, in my opinion. But it was our fault. This chat is the most used of the 2
@SimonAndréForsberg Seems like the Nth monitor is a trashcan :P
@Gemtastic For some values of trash, it is.
11:06 AM
@Mast One chat's trash is another chat's treasure!
One chat's trash off-topicness is on-topic in another.
Is @maaartinus around today?
Haven't seen him
That's why I pinged him
I want to discuss a protocol for playing Tic-Tac-Toe Ultimate
11:23 AM
@Gemtastic / @IsmaelMiguel - yeah, We have had a shakeup in here and it is because too many completely unrelated conversations were happening in this room. It caused a number of problems.
I know, I read the meta post
Each conversation, on it's own, is not something I can point at and say "That's not right", but if it becomes "standard" that these things can happen, then this room loses values.
I'm not putting down your decision
This idle chat cannot take over official business. If idle chatting is more important, git out. :P
I'm just saying that the other chat is dead 90% of the time
11:26 AM
@IsmaelMiguel That's because we keep posting our chitter-chatter here
And for a ton of other reasons
@Gemtastic It has become slightly more complicated than that.
Q: Nested SQLite transactions in jQuery

TimoI'm using Cordova with jQuery and jQuery Mobile to develop a hybrid app. In this app I need to save data that I get from a server. The data is a JSON. I chose this SQLite plugin for Cordova to save the content in tables for easy access. I make an AJAX-GET call to get the data I need and call the ...

It is more than just "idle chat must stop when real things are happening".
It's no idle chat at all now?
11:29 AM
No, it is not that, either, which is why it is complicated.
This room is getting a reputation on the exchange as a place to "go to hang out and shoot the breeze".
People are coming here only for the idle chat.
It's a grey line. We don't know where it is, but we sometimes notice when it is has been crossed.
What surprises me the most, and sometimes irritates me, is how many people that stay here without being active on Code Review.
I'll leave then
@SimonAndréForsberg So, there has to be something more than just "filling in the empty space" for the idle chat to be allowed, that's all.
that was unintended.
11:32 AM
Are we seriously still talking about this?
I relocated an overly-idle conversation, so, yes
35 mins ago, by rolfl
@RubberDuck Just now, it hasn't come in a while.
I did move 80 messages by them earlier today
Smh. I have a ton of respect for you. You've personally and professionally helped me, but I don't think it's helping. It feels like it's just running people off.
2 hours ago, by Vogel612
11:34 AM
@Gemtastic I'm not pointing any fingers at anyone. And I'd rather see you become more active on Code Review than leave entirely.
That ^^^^ ;-)
Is posting questions also "being active on Code Review"? :p
@RubberDuck Who are 'you'?
I presume he means me <----
11:35 AM
@skiwi yes.
I hope to work up some stuff to get more accurate reviews on things I know I need reviews on, but for now, I'm probably just helping create idle chatter :/
Getting more active people is always a good thing.
Anyway... . Off to work.
@RubberDuck for the record, I think this is what caused the conversation today:
37 mins ago, by Simon André Forsberg
@rolfl Seems like the Nth Monitor has found its usage.
@RubberDuck - I am sorry you feel that way. I have had feedback from a lot of people, and most of it has been positive about what's happening here.
11:38 AM
There's bugs all around me :|
And for the record, @RubberDuck, we talk about a lot of other things too :) Like... RNNs, and on-topicness of Domain Specific Language questions, just to mention a few topics that was brought up earlier today.
@skiwi at least you can't miss when shoothing then
Maybe I could get some JavaScript up this weekend...
That's what I want to hear ^^
11:40 AM
Or, well... I'd rather hear "Groovy" than "JavaScript" of course, but....
I think I could go that way..
The Groovy way?
yea... sth like that for the TranslationHelper
@SimonAndréForsberg Well, groovy isn't gonna help me learn Node :P
@SimonAndréForsberg I'd rather hear "Anything" than "JavaScript" of course, but....
11:41 AM
but then again I want to clean up the current functionality, and pack it into a "release"
No, but it would help you learn Grails :)
So many languages to learn which suck less than JS.
@Mast that's just because those who suck more are so intolerable nobody uses them
@Mast I challenge you to learn Corky
@Vogel612 I have nothing against Java.
Or C++/Python.
11:43 AM
@Mast You are a brave man
(Although to be fair, the newer versions of Java (with lambdas/futures) are quite tolerable)
@Mast I have loads against Java...
I'm starting to dislike the Java streams API
@IsmaelMiguel Doesn't exist on CR yet.
If it wasn't for type erasure I would use Java a lot more
In Groovy that is, in plain Java you don't have an option
11:44 AM
There are a couple of languages still missing, I've been trying to learn one of them but it's hard...
@Mast Because I haven't finished implementing it
Type erasure makes Mocking in TDD a lot harder
or at least it makes the api look ugly as all hell
TypeErasure is generally a pain
Thats the only thing I don't like about the language, though
especially with non-reifiable generics, which is one of my biggest points against java
11:44 AM
It's nice, as far as compiled languages go
@DanPantry That's why I usually stick to C++.
@Mast If you want to learn about Corky, you can check my github
@Mast I prefer type erasure to C++'s templates
@IsmaelMiguel Does it have a compiler/interpreter yet?
But maybe thats because I don't understand them
11:45 AM
@SimonAndréForsberg Never even looked at grails :P
The syntax is hilariously messy
Who needs templates anyway? Just put everything in structs and classes.
You need templates if you ever implement a type that consumes another type of A
@Mast No, that's the implementation. I have the full specification that will suffer no changes at all (except to add the syntax for lists and dictionaries)
Or rather, you need templates if you want to implement a bounded collection
11:46 AM
@skiwi that's surprising to hear coming from someone who loved it a year ago.
Oh snap.
@SimonAndréForsberg not that much, IMO..
Q: an error with the setw in Xcode 6 on mac

Roy Bassili am working on my C++ project and using Xcode 6.4. i am using the setW command in order to have a better layout of the results however Xcode tells me there is an error and that i should put a semicolon after the setW(n) and does not build unless i do so. my professor however told me that i shoul...

@DanPantry I usually define a new type for that, usually necessary if you want to create weird dictionaries.
@SimonAndréForsberg Yeah, but Streams look complicated, it takes time to understand them, and in Groovy there's other means
11:47 AM
@mast but then you could do the same thing in Java :P
the streams API is severly limited, because of the problems it has with capturing and pipelining as well as sideeffect behaviour
Streams are simpler than writing everything down in Java though
If you want to use streams imo you should use a more.. functional language than Java
thats not to say you shouldnt use Java but Java is trying to squeeze streams in really, really badly
also because it's messy wrt. the abuse of lambdas and Function types
My FizzBuzzWoofFooBar uses some weird type like that, to keep things compact and iterate over a list of strings which are bound to a number.
11:48 AM
@DanPantry meh. I think it did well enough
@skiwi there is but I believe that the Stream API is generally faster than Groovy's other ways.
@SimonAndréForsberg meh. I think that's because of the typing behaviour and not because of the approach.
@DanPantry Python.
@DanPantry that is probably a good suggestion. Perhaps @skiwi should learn Scala? (I bet @Donald.McLean would love that)
@Mast Or JavaScript. Or any language that has first-class functions, actually
11:50 AM
You know how I think about JS.
@SimonAndréForsberg Does Groovy work with Scala?
First-class functions make transforming data through streams so much nicer
There's no such thing as functionality in JS.
@skiwi Groovy and Scala both run on the JVM so I would assume so
@Mast lets not get into this again :p
@skiwi they both run on the JVM,
and in both you got the concept of classloaders and bytecode...
11:51 AM
@skiwi Scala is just another language that is built on JVM, so I think it should be possible to use Java, Scala and Groovy together.
@Mast function ality() {}
actually... the project I'm working on does that...
@DanPantry facepalm
we got mainly java, but some groovy scripts and scala API
@SimonAndréForsberg Now add Clojure to the list, and then create a project where you can argue that they all serve a purpose
11:51 AM
@skiwi ain't gonna happen.
GitHub doesn't have a search which allows you to select repositories with at least n number of programming languages, right?
@Mast I think you mean GitHub right?
Do you mean N number of programming languages?
Yes to both.
No, I can't imagine GitHub has that. It can't even correctly determine which languages are being used all the time.
11:54 AM
@Mast I think some external sites do, that keep track of GitHub repos
@nhgrif Usually their index does that quite well.
@nhgrif 'I' or 'It'?
@Mast I looked at their advanced search, I don't think you can search for N many languages. :( You can search for repos that contain a given extension though.
@Mast Tons of Objective-C libraries are marked as C.
You have to bear in mind though it's super easy to use three languages in a single repo
Shell, JavaScript and SQL are used in my current project
11:56 AM
Like this Objective-C library, marked as C.
@nhgrif presumably because of the header files
Looks like if your header files don't have anything that is explicitly obj-c in them its flagged as c
Some of my header files do though.
That's the thing.
@DanPantry 3 is easy. I managed 4 once (VHDL/TCL/Python/Shell). I'm just wondering how hard it would be to kill the SE tagging system by having 5+ languages.
I could see my repository being marked as Objective-C & C.
But it's marked as strictly C.
And there are no .c files in the repository.
But there are .m files, which is only Objective-C.
We looking at the same repo? prntscr.com/7sjcsu
11:59 AM
Where do you get that screen?
I think the graph goes off of different statistics than the file breakdown
I just took it..?
on the homepage of your repo
How do you get there?
I've never seen the graph
click one of the languages in the breakdown

« first day (801 days earlier)      last day (1584 days later) »