« first day (474 days earlier)      last day (3547 days later) » 

6:00 PM
Kinda.
 
@rolfl I agree in practise - in C# - but actually, we sort IEnumerables and not collections, generally (and an IEnumerable should definitely be sortable)
It just happens ICollection inherits from IEnumerable
 
void testSpecializedArray() {
    Class<?> c = AnyClass<int>[].class; //ok
}
^ This is Java calling from the future.
 
in the same way that all streams inherit from Stream but it doesn't make sense for them to have Seek operations (see NetworkStream)
 
Why would Stream specify it can seek at all?
 
We do not speak of early design decisions
It is like that dark area in the lion king that simba sees
You must never go there Simba.
 
6:02 PM
Ouch, I though that C# was supposed to avoid the design issues/legacy crap that Java carries?
3
 
It can't be perfect..
 
@rolfl Instastar.
Sorry, had to do it
 
I don't think Microsoft had heard of polymorphism at the time
 
@rolfl Since when has Microsoft ever done anything right?
 
I see that, let's have a stream, and instead of defining the functionality by the class, let's instead implement a read API and a write API, and define them both in one place.
 
6:04 PM
@rolfl Microsoft have never been known to adhering to good practises. See: internet explorer. took them 9 versions to get it somewhat right, and it's still wrong
3
 
And, since a Stream is supposed to have things flowing past in just one direction (not the musical group), we'll call it a stream, but because that's awkward sometimes, we'll allow you to reverse a Stream and seek in it.
3
 
I like Java's way of having a Collector on the stream.
 
For what it's worth, C# was originally designed to be "another C-like object orientated language"
It's the .NET framework at fault here (which was introduced in 2002) :(
 
@RubberDuck This:
 
@Phrancis 1.5 years before I was born
 
6:07 PM
Ohhh. Yeah. They did that right.
 
var and lambdas are quite literally the only thing that make me use C# over Java
and extension methods, I suppose
 
Doesn't Java 8 have lambdas?
 
^^^ that ^^^
 
No idea
I haven't used Java in nearly a year
 
It does, now you have an idea.
 
6:08 PM
Actually, more than that, more like 2 now
If you can convince my work to drop all of their .NET CLR stuff
 
No need to do that.... I'll covince you to change your work ;-)
 
Ha, I use Ruby in my spare time, no .NET for me
 
@DanPantry Just drop it, Java has support on all OS!
 
Maven drives me insane so no thanks
 
Use Gradle, not Maven then :)
 
6:10 PM
if there's something like rubygems/npm/nuget in java
you might yet convert me
if there's a var keyword I'm sold. type erasure sucks though
 
@Malachi I pictured you a bit older, not sure why. Perhaps it's the motorcycle...
 
Java has something that look like lambdas
 
But - cool!
 
@DanPantry Come back at Java 10 ;)
 
@DanPantry By the sounds of it, var is a double-edged sword that can hurt as much as it helps.
 
6:11 PM
"There is speculation of removing primitive data types"
wat
 
and it only helps the lazy.
 
@rolfl: it's just type inference. you call it lazy, I call it less verbose
 
True, but I am old school, and I like it when there is less ambiguity in the code.
 
@DanPantry That sounds really bad... I don't know who put that rumor
Primitive types will in essence never be removed
 
@skiwi #wikipedia
 
6:13 PM
Wikipedia is ugly in this case
 
I prefer it when I change code in one place and I get compile errors in another because of strong typing in the code.
2
 
Worst-case all primitive types will be evolved into value types
 
@rolfl I always refer to pretty much everything by it's interface, so there's never a type error for me unless I actually alter the verbs.
Also VS spoils you for refactoring tools, it would be hard to rename/retype something without having it automagically occuring everywhere in the solution
 
The alternative is that I get changes in behaviour in places unexpected because something that was an Integer is now a Double, and 'things happen' when that happens.
and to find out where that would be a problem..... is a problem.
 
@rolfl well, yes, that is a case where I agree that type inference is bad. I suppose that's why we have literals though? :-)
 
6:15 PM
@rolfl Would things like Arrays.asList("a", "b", "c").stream().forEach(System.out::println) violate that?
 
@DanPantry It's the bomb with re-sharper
 
@skiwi Why would that be worst case? Surely 1 byte is better than a 4 byte pointer?
@Bhathiya-JaDogg-Perera I used ReSharper, and my trial period expired today. It's nice but not £70 nice.
 
@DanPantry Value types are simply types that are composed of either primitives or references
 
Alt+Enter is so nice though
 
@skiwi No, because if you want the type inference to escape the method you have to explictly declare the signature.
 
6:17 PM
@ValueType
public class Int {
    private int _int;
}
 
And you get the compile warning immediately.
 
Example of a valuetype
 
@skiwi I'm aware - a value type is either a primitive or basically a struct (which can container other references or value types)
Oh, I misunderstood
 
ah yes, a value type can of course also contain another value type
 
Valueception
 
6:18 PM
@rolfl Might've been a bad example, but lambdas do omit the type
 
They don't, they just allow you to infer the type in a different way, and the functions are allowed to be relatively loosely defined, but the definition is made concrete by the use of the function.
 
@DanPantry Also Java relies a lot on the type-specification of a variable, var would not be that useful at all.
I think
 
0
Q: Tail-recursive query string builder in F#

Kenneth PoseyI have a situation where I'm generating a url based on a set of query string parameters for use in an api. I know ahead of time that the values passed to this function are url-safe and the tuples are complete, so I don't need to serialize the data or do data validation beyond just checking the le...

 
What's with the hating on var? Get back to your Java caves!
 
We aren't, actually I mentioned the only reason I use C# was for lambdas var and nuget :p
hence this conversation
 
6:23 PM
Eh, the aliases sold me over
I hate String
I love string
 
grabs popcorn
 
Where's Michael when you need him?
 
@RubberDuck Michael Jackson?
 
Yeah. That's obnoxious after a second though.
 
@Phrancis lol. I was shaving actual facial hair when I was 12, so I am all sorts of screwed up when it comes to acting my age.
 
6:27 PM
This book I bought a few weeks ago: I definitely recommend it. Very interesting with some very good debugging explanations as well. amazon.com/Writing-High-Performance-NET-Code-Watson/dp/…
I feel so ready to micro-optimize everything now
 
@JeroenVannevel calling premature optimization here
 
@JeroenVannevel Premature optimization something something!
 
> Many programmers who failed to jump onto the .NET or Java bandwagon, and stuck with the language during the late 90ies, remain upbeat. Marcy, a retired Delphi programmer from Boston, MA told us: “When I read the news in this mornings paper, I immediately started flipping through my Rolodex and called all my old colleagues on their telephones. Those of us who are still around are simply thrilled.”
2
 
@Vogel612 I particularly liked the part where he created a whole reflection.emit sample to increase performance of dynamic object creation (Activator.CreateInstance)
What surprised me most was the performance cost for a struct's .Equals and .GetHashCode
Apparently it uses reflection in the standard implementation
 
The fun thing when two people in the same house have a different OCD on the same object... My mother puts some thing always not he right side, I always put it in the center. The fight never ends.
 
6:38 PM
@skiwi the toilet paper roll problem huh
Used to have that with my wife, until she realized the power of feeding TP from the top towards the front.
 
@Phrancis Oh god... that would be annoying.
I always hang it with paper away from the wall in unknown places, that wall might be dirty.
 
0
Q: Looking for an algorithm for sorting different types of objects

ChronicleI have two different types of objects, both of which have an integer which holds their priority. In another class I want to go through each object in an order that depends on those priorities, objects with higher priorities go before ones with lower priorities. Now my issue is that the objects a...

 
I like that question... but it needs some code :|
 
I already had an answer whipped up for it :(
 
> EDIT 06/06/2014: added more graphics to illustrate adoption curve, etc … if you don’t like those, please use the spoon to block.
 
6:48 PM
"I can't see it therefore it isn't there"
 
0
Q: Optimizing "Poker hands" challenge solution

mu 無I'm trying to solve the project Euler problem 54. The code works alright, but I'm interested in learning how I can improve its quality in any possible way. from collections import Counter suites = { 'C' : "Club", 'D' : "Diamond", 'H' : "Heart", 'S' : "Spade", } values = { ...

1
Q: how would you clean up this short ruby script to add tags to xml files?

jphI'm new to ruby. Recently I wrote a script to add a "credentialsID" node to each SVN location node in each config.xml file for all of our Jenkins jobs. (We have many). It works, but I'm guessing it could be done more elegantly. How would you fix this to be more succinct, clean, etc. require 'nok...

 
7:19 PM
@Jamal would you check my work? or anyone that knows C for that matter
0
A: Generating prime numbers using Sieve of Eratosthenes with CUDA

Malachiyou shouldn't use the same incrementation variable twice in the same scope, it can get messy and cause weird bugs and you do it with two different incrementing variables, i and j. uint64_t maxRoot = sqrt(max); // optimization #1 uint64_t i; int j; // sieve multip...

 
@Malachi the second int j; is useless.
 
@Malachi You could also mention that the display code should have curly braces. I hate it when people get lazy with using them.
 
@Jamal will do
and done
 
Where's @Mat'sMug?
 
I dont know why this question appeared in my newsletter today - considering how old it is to be included - but if I'm not wrong this is an example problem from Head first design patterns book ? — Gufran Jul 2 at 12:39
are we closing or answering this?
3
Q: Is this a good PHP strategy pattern?

DanielTheRocketManI am a very beginning in PHP and Design Patterns. I have been studying the amazing Head First Design patterns. So, I have been trying to translate the original into PHP. The class is working well, however, I would like to ask: Is this considered good PHP? Someone mentioned that this is not a St...

oh no Phrancis!!!
12
Q: Executing large SQL script file with GO statements using ADO

Jerry DodgeI wrote a small component (still in the works but working) which takes a large SQL script file, splits it into different "blocks" based on GO statements, and executes them one by one. The only major flaw I know of is not being able to detect when a GO statement is inside of a comment block, for ...

 
7:32 PM
I know :(
 
0
Q: Evaluating algebra expression using an auxiliary VB class compiled on the fly and consumed in a C# project

cyanide-based food I want to create algebra evaluator but I don't want to write my own parser because it takes much time to learn. I don't like algebra expression in C# because it does not look natural compared to VB counterpart. For example, "x^2+1" in VB must be written as "Math.Pow(x,2)+1" in C#. I am still a n...

 
0
Q: Handling infinities in this numerical integration method

ShaktalI have written a parallelized version of Gauss-Laguerre quadrature and am wondering how best to handle infinities that occur due to lack of floating-point precision. Basically, I use Newton's method to approximately solve Laguerre polynomials in order to find the abscissae \$x_{i}\$ and weights...

 
jumping off the bridge here on this next answer, I have to go pick up my daughter from school
0
A: Logging into WebAPI 2 site from c# desktop application

MalachiI don't like that the password is hard coded here HttpContent requestContent = new StringContent("grant_type=password&username=" + Username + "&password=" + Password, Encoding.UTF8, "application/x-www-form-urlencoded"); I am sure that you could move it into a configuration file or something. ...

BRB
 
@Rubber lurking ;)
 
7:41 PM
Private Sub AbusingIt()

    Dim var
    For Each var In Enumerable.Range(1, 20).Intersect(Enumerable.Range(5, 10))
        Stop
    Next

End Sub
But that's not why I was asking.
The whole, put NewEnum in Iterable...
If I do that, the whole For Each in Enumerable.Range thing breaks.
So it has to be in both places. Still think it's a good idea?
 
oh god that api thing looks awful
@Malachi
 
Should work if .Range returns an Iteratable
/instance
 
Ahhhhhhhhhhh
 
Does it?
 
Right now Range returns an Enumerable.
 
7:45 PM
Alright, let's make a deal. If someone answers this with good reasons they shouldn't use since it's a defunct language(codereview.stackexchange.com/questions/57424/…) and propose a better alternative gets the 100 bounty
 
It feels a little weird to bind the two classes together like that. If they're that tightly bound, why split them?
Maybe I'm thinking about this wrong.
 
the interface returning an implementation is weird, indeed.
 
No. My boss did.
 
lol
 
I definitely need to think about this project before I mess with it a whole lot more.
I do know that Merge and Sort are going to return Me for chaining though.
 
@Malachi someone please help this poor guy
 
has corrupted me.
3
 
8:05 PM
the code in that question makes me want to drive nails into my skull but I can't re-write it
5
Q: How to use ByteBuffer properly?

WebbyI am trying to use ByteBuffer properly with BigEndian byte order format. I have couple of fields which I am trying to put together into a single ByteBuffer before storing it in Cassandra database. That Byte Array which I will be writing into Cassandra is made up of three Byte Arrays as describe...

Davy Jones has released a question from 'is locker
quick, catch it
 
Code looks good , there no more improvement needed as per authentication. — paritosh Aug 1 at 13:28
^ yeah right.
 
Why is this being vote on to close?
7
Q: Add color to terminal output

syb0rgI have the following header included in some of my projects so that I can add a little color to the terminal output. Here is how it would be used: fprintf(stdout, "Recognized text: %s\n", text ?: RED_TEXT("No text recognized.")); color.h: /** * @file color.h * @brief Defines all of the A...

What is unclear about it?
 
I guess he's not directly asking a question
but the title of the SE is "code review"
it's pretty obvious to me he wants his code reviewed
 
When not asking a direct question, it means "everything goes".
At least, that is what I thought.
 
It's not me you need to convince :)
 
8:18 PM
@mleyfman Can you elaborate what made you vote to close? I would like to improve the question based on your feedback.
 
@syb0rg Well, when I got there, it had a few close votes already, and then I read through it, and I'm not sure if a list of constants is reviewable.
 
@mleyfman Tomorrow I will try to post a selfie in the hope that I can change your opinion on that ;)
 
I've retracted my close vote now that there is a decent answer
 
FYI, I'm not mad. I'm just seeking clarification.
 
...so answers do affect on-topicness?
 
8:21 PM
I think so
 
@syb0rg, I've up voted it, Looks cool to me, But I think some will not like a question with majority of macro/pre processor statements,
 
A terrible question with a great answer is sometimes on topic, there's even a badge for it...
 
@syb0rg : add the compiler details to it
 
@Mat'sMug No. At least they shouldn't.
 
@Bhathiya-JaDogg-Perera What do you mean?
 
8:23 PM
I think the issue was it wasn't thought to be answerable, but was proven to be.
 
afk
 
2 revival badges in less than an hour!
@DanPantry did I give a bad answer?
 
@Malachi No, I meant the question in general, sorry
 
@syb0rg C compiler name and version.
 
Or the code in the question in general *
 
8:25 PM
@DanPantry that is what I thought. I kind of winged that answer....lol
 
@Malachi isn't that how we usually get things done?
whoa.
that is a very "special" question
 
@syb0rg : Not sure about this but, I will also add your code won't run on windows cmd
 
@DanPantry for the most part! lol
 
Okay, this is cool.
Private Sub TestSort()
    Dim numbers As New Enumerable
    Set numbers.Collection = GetPsuedoRandomCollection

    'numbers.Sort

    Dim number
    For Each number In numbers.Sort
        Debug.Print number
    Next number

End Sub
 
8:30 PM
lol
5
 
@Malachi 10/10
 
@RubberDuck seriously!
(it's "pseudo" ;)
 
I told you before that Ducks can't spell.
 
ah, mugs have very little memory ;)
 
@RubberDuck now that you changed your nick here I am going to come to you with all my programming issues.
 
8:35 PM
lol, is it Friday yet?
 
I don't expect an answer either
 
24 hours and 25 minutes from weekend
 
Okay @Malachi. I'll probably be just about as useful as a real rubber duck though. Yeah. That.
 
lol
3
 
what's the syntax for links in comments again?
[text](link)?
2
 
8:36 PM
[]()
 
Allright. I need to stop this insanity. Maybe chaining wasn't a good idea.
 
wth?
 
Debug.Print Enumerable.Range(1, 20).Intersect(Enumerable.Range(5, 10)).Merge(Enumerable.Range(17, 20))
 
0
Q: How have an optimized Social Network WebSite

Dominoi am developing my Social Network Website and i have some Question to figure out that my Website is optimized or not. first i am good at Asp .NET 4 and WebForms but not good at Mvc or javaScript. lets see this code, its for Liking a Post, i did not used any javaScript to do that, my question is:...

 
looks like @RubberDuck is having fun!
 
8:39 PM
Obfuscation can be fun.
runs away
 
it would look cleaner like..
 
This Question Has a Case of MarketingCase @CaptainObvious
 
Debug.Print Enumerable.Range(1, 20) _
                      .Intersect(Enumerable.Range(5, 10) _
                      .Merge(Enumerable.Range(17, 20))
 
@Phrancis That was a pain to edit...
 
Spoil sport.
 
8:45 PM
@Jamal you beat me to it I was in the middle of grammar-fixing it
But you were "more thorough" I'm a fool for even trying ;-)
 
I knew I should've asked first. Maybe the OP will post another question that'll need the same editing.
 
8:57 PM
TTQW
Cya
 
later!
 
Bye ducky!
@Jamal if a question has really bad grammar just ping me I'll save you the pain lol.
 
Alright. ;-)
 
> DyslexicAtheist: I see. Now that you came forward, how has this personally affected your situation?

Bennett: Well on the upside I can finally apply for this job in that call-centre which I always wanted. Because you see, … that ‘gig’ with Apple was actually supposed to be a one-off thing, … just until my application came through with the call centre. But I got rejected on the grounds that I sounded just like Siri. The hiring manager at the call centre stated “most calling customers wouldn’t believe that there was actually a ‘real’ person on the other end if I picked up the phone.” Also m
 
1
Q: Timed jobs in python and parsing JSON

MeeplI wrote this tiny script to pull the JSON feed from the CitiBike website. Here is the script: import requests import time def executeCiti(): r = requests.get("http://citibikenyc.com/stations/json") print r.json() time.sleep(62) while True: executeCiti() exit() The...

Is this question on topic?
It seems to be a grey-area one
 
9:11 PM
Sounds like the person on the forum already answered him... not much code to review either... But, I think it's reviewable-ish
 
Most of the question reads like code not yet written, as any decent answer will address what he's saying is the next step.
 
Good point
@Jamal what's your input on above?
 
Topicality-wise? I would remove the last paragraph either way.
 
0
A: Using a Dictionary to retrieve BOOL values

nhgrifLooks like most things are covered by the other answers. I can only add that you should might want to use constant string pointers rather than literal strings--particularly if you ever use these same strings anywhere else. @"FindBookMeeting" instead becomes: NSString * const kFindBookMeeting =...

 
The last paragraph seems like it could be an answer.
 
9:21 PM
4
Q: API for SQLConnect Library

nhgrifI've designed a library for connecting Objective-C (and now Swift) apps to Microsoft SQL Server 2005+. (I believe there are other databases it works with, but I've only tested with MSSQL.) The project is available on Github here, and while users are fully capable of downloading the uncompiled p...

 
I wonder if... I just copy-paste that into an answer, get my first Python badge ;-)
 
Got a downvote with no comment. :/
 
@nhgrif your answer seems to be a duplicate of bazolas last part for the BOOL question
 
Yep. Didn't notice that.
 
9:33 PM
another one to throw under the bus
0
A: Low-lock Multi-threading Implementation

Malachiyou have a little bit of rewriting that can be done on this chunk of code private static void InitThreadPool() { int numLogicalCores = Environment.ProcessorCount; int poolSize = numLogicalCores; if (PipelineConfig.MaxThreads > 0 && numLogicalCores > PipelineConfig.MaxThreads) poolSiz...

my thread count might be off at the bottom though?
 
@Malachi is your Shift key broken? ;)
 
I am horrible with Capital letters....lol
sometimes they pop up in the Middle of sentences
2
 
I see what you did there lol.
 
Incoming off-topic Python question
 
0
Q: Sumifs Function for Panda Based on Two Criteria (Python 3.4)

jurgimanI am trying to implement something similar to an excel based sumifs function based on two criteria that will add up two rows. So the input will look like this Keyword Class Number Row Jim Blue 2 1 Bob Red 3 2 Jim Blue 4 3 Bob ...

0
Q: Set desktop background

Josue EspinosaI created a simple application that downloads an image from a web API, then sets it as my desktop background. The entire project is exactly 100 lines of code, but I feel like it can be cut down significantly while still being easy to understand. It is a console application, and closes immediatel...

 
0
Q: Does this count as example code?

nhgrifA c# question was just posted: Set desktop background. One of the lines in the posted code looks like this: string json = webClient.DownloadString("super secret website url"); Clearly, in the actual source code, this is a URL and not an example string. Does this count as example/filler/stub ...

 
@Phrancis I tried... something...
And i guess it worked?
And i hit 200 rep again :)
5
3
A: Timed jobs in python and parsing JSON

mleyfmanWhile this is a good start, there are several things that should be noted. r = requests.get("http://citibikenyc.com/stations/json") This is code snippet is network-based, and so errors may occur. You will want to handle these errors in some way, with a try-except block like so: try: r ...

 
How do you force a particular syntax on a code snippet if the language tag isn't in the question?
 
Could you provide a "not-so-super-secret" web URL where this would work so we can actually test it out? — Phrancis 10 secs ago
 
9:53 PM
thanks
 
Good post on meta, Buy This Wok
 
Hmm.... C# code doesn't prettify on meta?
or is their no syntax highlighting on meta?
 
@Phrancis not even on purpose either....lol
 
Wow... I just realized something...
We are about to have 9 iPad minis and 1 iPad Air at work.
We have 8 and 1 now.
 
1
Q: Does this count as example code?

nhgrifA c# question was just posted: Set desktop background. One of the lines in the posted code looks like this: string json = webClient.DownloadString("super secret website url"); Clearly, in the actual source code, this is a URL and not an example string. Does this count as example/filler/stu...

 
9:59 PM
The boss uses the iPad Air.
He'll frequently leave it with me for hours at a time...
I should put some autocorrect definitions in there for him...
 
99 rep points on the wall, 99 rep points on the wall.....
 
Are you asking us to take 1 down and pass it around?
 
sorry @nhgrif we dog piled this one codereview.stackexchange.com/questions/60657/…
 
Yeah, I saw.
Wow...
 
0
A: Does this count as example code?

PhrancisI can see both of your concerns. In a way I feel by doing this the asker robs himself of good aspects of CR that could only be tested by compiling/executing the code, such as performance issues. I think it is one thing to remove potentially private data like passwords, server IP and such that c...

 
10:02 PM
20
Q: If a baby is born on an international flight over international waters, what nationality are they?

Mark MayoI seem to remember one of our members being on a flight when a baby was born, but can't find any reference to what happened to the baby in terms of citizenship. Generally you hear about pregnant women being advised not to fly, but it does happen. Sometimes the unexpected happens and a baby is b...

16
Q: If a baby is born mid-flight, what happens visa-wise for them when they land in a foreign country, sans-passport?

Mark MayoI asked a similar question about what nationality a newborn midflight gets, but I'm also now wondering - when they land, what happens? Normally you need a passport and possibly a visa to travel - so how are they usually processed when the plane lands with an extra person?

Interesting.
 
Welcome to Code Review! I'm afraid this question does not match what this site is about. Questions must involve real code that you own or maintain. Questions seeking an explanation of someone else's code are off-topic. Pseudocode, hypothetical code, or stub code should be replaced by a concrete example. — Heslacher 9 hours ago
@Heslacher I have to say I like that comment very much ^^
 
TTQWALTDFIEB
2
(Time To Quit Work And Leave Behind This Dogs Forsaken Internet Explorer Browser)
 
I'm afraid this question does not match what this site is about is a very friendly way to say "Your question is off-topic". I like it that we post such comments around here.
 
drops
(Hammer Time)
 
@SimonAndréForsberg hi see this
 
10:11 PM
...
@Phrancis If I were forced to use IE at work, I'd just quit.;
I wish I'd quit seeing people use sleep()
 
@Bhathiya-JaDogg-Perera Added a comment, I don't know if it would be on-topic but perhaps something for UX.StackExchange?
 
0
Q: Error Handling - Controller's OnException and Application_Error

user1552869Pretty new to MVC here. Below is the code that I have added to an existing MVC 5 application. Code is using log4net to log any run-time error/exception. NOTE: I could override OnException() in MVC filter "HandleErrorAttribute" but I preferred to have this functionality in my custom Controller bas...

 
Hey, we're at 96% answered. Weren't we down to 95% just a short while ago?
 
@SimonAndréForsberg we'll discuss it with janos when he's back
@Phrancis Even Dogs Forsaken the IE, eh
 
@SimonAndréForsberg I answered like 3 or 4 today, and they were up voted.
3 Zombies Down on my watch today, would you like a recap @SimonAndréForsberg?
 
10:27 PM
@Malachi have you tried freelance websites ?
 
I answered 2 zombies.
 
I got 75 rep today for doing nothing, and a long-lost asker came back to accept my answer. :-)
3
 
Does stackoverflow has a chat room like this one ? eh
 
@Jamal NICE!
@Bhathiya-JaDogg-Perera yes I am on couple of them, but I am not cheap
ttqw
 
@Bhathiya-JaDogg-Perera Not exactly. The SO community is larger. The SO chat rooms are generally subdivided by language.
 
10:38 PM
4
Q: Too many raw input device from GetRawInputDeviceList()

user408141After a UINT lSize; GetRawInputDeviceInfo(hDevice, RIDI_DEVICEINFO, NULL, &lSize); RID_DEVICE_INFO* lInfo = (RID_DEVICE_INFO*) malloc(lSize); GetRawInputDeviceInfo(hDevice, RIDI_DEVICEINFO, lInfo, &lSize); I get 9 devices: 3 mouse, 3 keyboards, 3 hid devices. I have one mouse, one touchpad,...

 
Hmm, I'm stuck trying to figure out how to generate all permutations of an integer....
For example, 123 should return 123, 132, 213, 231, 312, and 321
 
Recursive?
 
Yeah.
 
@Malachi What do you mean if I would like a repcap?
 
But my recursive skills are not the best...
 
10:41 PM
hello @Mehrad
 
Plus, I don't want to just print them all, I want to add them all to an array and return the array.
 
List<int> permutate(List<digit> previous, List<digit> remaining) {
if (remaining.isempty) return previous;
List<int> results = new list;
for each (int digit in remaining) {
copylist = copy of previous;
copylist.add(digit);
newRemaining = copy of remaining;
newRemaining.remove(digit);
results.addAll(permutate(copylist, newRemaining));
}
return results;
}
Not entirely sure if that code will work or not, I just made it up. A very naive implementation
How you want to store the List<digit> and stuff is entirely up to you of course
Technically there's a bunch of error messages you would get if you implemented that directly, but it should get you started I hope
 
Especially considering I'm not writing Java or whatever that is.
But thank you.
List is basically an array?
What two arguments would I send to call this?
with 123, as example
An array with 123 and an empty array?
 
That's more pseudocode than Java
@nhgrif yes
@nhgrif yes
Because the recursive method needs to track "what digits have been picked so far" and also "what ints are available to pick next"
 
In python it would just be list(map(int, itertools.permutations(str(num))))...
but objective c doesn't have itertools :(
 
10:51 PM
I'm writing Swift.
 
Does swift have any sort of permutations built in?
 
Don't know
 
even if it does, it's always good to learn how to do it manually
 
Home!
 
11:05 PM
That's a very helpful page...
not.
If you write: "The Swift standard library contains a variety of algorithms to aid with common tasks, including sorting, finding, and many more." and then only show sorts... you fail
 
@nhgrif or the iterative version (in js) codereview.stackexchange.com/a/57893/44723
@nhgrif or (finally) if you can call c++ fns cplusplus.com/reference/algorithm/next_permutation
 
This could use a better title. I was hoping the suggester had something in mind.
 
11:23 PM
0
Q: Bitmap problem performance boost

mirgeeProblem statement: Input is a rectangular bitmap like this: 0001 0011 0110 The task is to find for each black (0) "pixel", the distance to the closest white (1) "pixel". So, the output to the above should be: 3 2 1 0 2 1 0 0 1 0 0 1 Below is a working, heavily commented 78 lines solution. ...

 
@Jamal "GUI for network settings" as a title?
"First casualty would be all those extraneous blank lines." oh god he really took that to heart...
 
@mjolka Close enough I think.
 
catch (Exception ex) { } sigh... is there a name for that? like ostrich programming? stick your head in the sand, and your problems will go away
 
:) off to a day off meetings.. have fun all
 
11:34 PM
Anyone want to hear our newest jam is welcome to listen/free download here:
It's pretty smooth groove
 
@mjolka I thought it was pokemon handling :)
 
Almost 19.9K.. I might hit 20K before the next SEDE update! :)
@Santa's been busy today!
Pokemon handling sounds right @DanLyons ;)
 
most of the time I just bucket brigade exceptions, though
catch one, log it, then (re)throw to the next guy
 
11:51 PM
And the next guy logs it and rethrows?
 
or fails to catch it and gets wet
 
Until the whole thing crashes. =)
Buckets all the way down.
Just joshing @Dan.
 
"An unexpected error has occurred. Program will shut down, unsaved changes will be lost. Blame the IT guy."
(and then IT guy inspects log, and blames dumb user)
 
If there's one thing I've heard continuously, it's that you can't anticipate how your code is going to be used - and this includes by you. Unless you make it actually safe by design (so that it can only be put together a specific way), it's going to be "misused"; for instance, what if a workload processor decides that a result requires more work-sets - simple, just call Add(...)! Given current processor trends, I too want a multithreaded engine; however, I'm thinking more along the lines of immutable/functional code so I don't have to worry about locks at all.... (ish...) — Clockwork-Muse Jan 5 at 4:50
s/includes/particularly
 

« first day (474 days earlier)      last day (3547 days later) »