« first day (782 days earlier)      last day (3236 days later) » 

12:00 AM
RELOAD!
2
There are 1401 unanswered questions (94.3576% answered)
 
@QPaysTaxes All the external code is checkArgument, which you may simply leave out. And Lombok @Getter is trivial to replace and @Nullable is just documentation here.
 
@QPaysTaxes that's the actual zombie count
 
@QPaysTaxes The hard part is overflow and overall optimization. I'd bet it can be done much better.
 
OK. The IntelliJ manual does not match the IntelliJ program I'm using. :|
 
12:09 AM
0
Q: Pagination in Python and API Calls

bnlucasI'm working on a wrapper for the Spotify Web API which paginates it's results. I wanted a nice fluid, seamless way of cycling through the pages, getting the total number of results to built the paginated object and only make calls to the API when more info is needed. Currently, it pulls the firs...

 
That Database tool is nowhere to be found
(neither is it on that "right-hand tool window bar"
Hm, I have 14.1.3 (instead of 14.1.1)
Wouldn't think they'd move such a rudimentary, essential function to a completely different place :\
I might hit SO, this is perplexing
Might poke around with JDBC a bit more before though
Too many tabs...
> Because Java is platform neutral, it is a simple process of just downloading the appropriate JAR file and dropping it into your classpath.
How do I know what my "classpath" is?
 
It is specified in one of three places, depending on how you start your program
In intelliJ, you probably tell the project to include the jar
16
Q: Adding Jar files to IntellijIdea classpath

java developerI have created a new Intellij project. But I can't use the third party jars in my project. I have the jars in a directory structure as follows: repository/commons-logging/commons-logging-1.0.4.jar repository/commons-lang/commons-lang-2.1.jar etc. I want to add them just by pointing to the repo...

 
12:25 AM
@rolfl If you weren't a monkey, I'd kiss you! I think we'd agree a hug will do though :)
Never been so happy to finally see this error:
Caught: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "Phrancis"
org.postgresql.util.PSQLException: FATAL: password authentication failed for user "Phrancis"
Apparently the greyed out line is more than what appears :)
 
Swift protocol extensions effectively allow abstract classes (which were never possible before in Apple-land), but they're extraordinarily powerful...
It'll get reverted.
 
Huh. I just made a working DB connector. Imagine that!
 
So, in Swift, we can declare a "protocol", which is like an "interface" in other languages. It's just a list of methods (or properties). Anything that "conforms" to the protocol implements those methods.
And now, we can make "protocol extensions". The extensions allow you to give a default implementation of methods within the protocol so that anyone conforming to the protocol doesn't have to implement the method itself in order to have the method.
So, effectively allowing you to create abstract classes.
But the most powerful part is that we can put conditions on the extensions.
This protocol extension only applies to types who conform to this protocol and meet these other conditions, like also conforming to some other protocol.
 
12:43 AM
So wait. Apple land doesn't have abstract classes?
 
No.
Well, technically no.
There have always been solutions if you really, really want to do it... but no one has really seen the point...
No.
@RubberDuck Given that most of my programming experience in Apple land and abstract classes simply haven't really ever been a tool at my disposable... I'm not in the mindset to quite easily see their utility. So, given that, want to take a crack at demonstrating to me an irrefutable case where an abstract class absolutely must be used?
 
s/disposable/disposal
you could always use an interface instead. but an abstract class removes the redundant boilerplate that's common to all implementations, when that's the case.
 
Perhaps, but also concrete base classes?
 
sure, except an abstract base class explicitly says "I must be inherited" - you can't instantiate it directly
 
I'm not certain right now for Swift, but there are ways of making Objective-C class uninstantiable.
 
12:52 AM
private constructor?
 
Sure @nhgrif. One sec. I have a great example.
 
@RubberDuck make sure it doesn't involve cars or animals ;-)
 
@Mat'sMug No. You can't make a private constructor in Objective-C (although you can in Swift, so that's the Swift solution). In Objective-C, there's pretty easy code to prevent it from compiling with a helpful error message if you try using the "constructor"
 
5
Q: Drying Up Very Similar Implementations of an Interface

RubberDuckWork continues on the Rubberduck VBA Editor Add-in. I have a need to call some VBA code from the add-in with Application.Run. Unfortunately, the Application part of that refers to the particular Office Application that is hosting the VBA editor. So, if I'm working in Excel, Application refers to ...

 
- (id) init __attribute__((unavailable("Must use initWithFoo: instead.")));
 
12:54 AM
@RubberDuck nice one
 
Thanks. That answer seriously taught me something.
 
Anyway, protocol extensions are really cool though. It's more powerful than abstract classes.
 
Weeeeiiiiirrrddd Groovy/SQL errors :|
def sql = Sql.newInstance(dbUrl, dbUser, dbPassword, dbDriver)

print sql
print "\n"

def map = [message:'Hello, World!']

sql.execute("DROP TABLE IF EXISTS test CASCADE;\n" +
    "CREATE TABLE test (\n"
        +"id SERIAL,\n"
        +"message TEXT\n"
    +");")

sql.execute("INSERT INTO test (message)\n" +
        "    VALUES ($map.message);")

sql.close()
> groovy.sql.Sql@351d00c0
Jun 24, 2015 9:00:16 PM groovy.sql.Sql execute
WARNING: Failed to execute: INSERT INTO test (message)
VALUES (Hello, World!); because: ERROR: column "hello" does not exist
 
Yeah
Or...
Possibly my new favorite SO comment:
> Asynchronous code does not run synchronously
(I don't know whether that execute method is synchronous or not)
@Phrancis You should do it in Swift so I have a beta tester for my library...
 
sql.execute("INSERT INTO test (message)\n" +
        "    VALUES ('$map.message');")
^ this worked, oddly
 
1:06 AM
@QPaysTaxes Lets you connect to Microsoft SQL Server (and some other flavors of SQL) from Apple-land.
 
Maybe I'll start using the ? prepared statements instead
2
 
Hello
 
@Phrancis Parameterized queries? Nah, don't do that...
 
Hello
 
I had an... interesting... day
 
1:07 AM
Speaking of... that is one of the walls I'm stuck on for my library... I haven't a clue how to begin getting that to work.
 
Some little kid painted my nails bright pink
 
Seriously. Don't parameterize you queries. Complete waste of time.
 
INSERT INTO test (message) VALUES (''); DROP TABLE USERS; --')
 
(where the passed in string is '); DROP TABLE USERS; --
 
1:10 AM
That's the result. I don't know what to think.
 
@nhgrif So, just used named parameters and call it a day then?
 
@QPaysTaxes Thanxs. I methinks I like it
 
There's also another syntax that may or may not be better:
 
You need to use the ? thing or however whatever library you're using in whatever language deals with passing parameters.
 
 def newUrl = 'http://grails.org'
 def project = 'Grails'
 sql.executeUpdate "update PROJECT set url=$newUrl where name=$project"
 
1:11 AM
You want prepared statements.
 
 def params = [10, 'Groovy', 'http://groovy.codehaus.org']
 sql.execute 'insert into PROJECT (id, name, url) values (?, ?, ?)', params
Is that ^ a prepared statement?
OK then, I shall start using that
 
And you shall never stop using that.
4
 
I'm new to using SQL outside of just plain SQL, forgive my ignorance
 
Until you work your way over to my library... for which I need someone to figure out how to make a way for parameterized queries work.
And make a pull request
 
Any santas want to help me get me necromancer on this answer?
1
A: Using the CMA-ES algorithm to optimize the position of wind turbines

Ethan Bierlein First off, style. Your code is... not very well styled. You have many PEP8 violations. Here's a list of those violations. You have no space between operators/variable declarations. You should have one space between operators, like this: a + b, a == b, or var = 10. Secondly, your variable names...

@QPaysTaxes Are you satisfied now? I mentioned numpy.
Yay!
Well, brb. There's free coolaid.
 
1:19 AM
Kool-Aid is spelled with a K. Bekause it's kool.
It's part of the name. Don't you get it?
 
@nhgrif I'm sorry that I wasn't taught properly as a child.
I prefer "young adult", thank you very much.
YAYAYAYAYAYAY STARS
@QPaysTaxes That's according to the govt.
 
@QPaysTaxes: 2K already? Congrats. :-)
3
 
Well, here in the USA it's 18.
Then why'd you say 20?
 
@QPaysTaxes when 14yo get older they'll understand why ;-)
 
@QPaysTaxes Sure, I see your point.
How on earth did those two messages mix.
and switxh
 
1:25 AM
@EthanBierlein I thought legal drinking age was 21 in the US
wow that's dumb
 
Well, I have to wait 6 more years until I can pop open a nice cold beer on my front porch, relax in the evening, and watch people flip out on the road.
@QPaysTaxes Doesn't your dad already let you drink wine?
brb
 
IT WORKS
import groovy.sql.Sql

def dbUrl      = "jdbc:postgresql://localhost/GroovyTest"
def dbUser     = "Phrancis"
def dbPassword = "test"
def dbDriver   = "org.postgresql.Driver"

def sql = Sql.newInstance(dbUrl, dbUser, dbPassword, dbDriver)

println sql

sql.execute("DROP TABLE IF EXISTS test CASCADE;\n" +
    "CREATE TABLE test (\n"
        +"id SERIAL,\n"
        +"message TEXT\n"
    +");")

def params = ['Hello, World!']

sql.execute("INSERT INTO test (message)\n" +
        "    VALUES (?);", params)
> groovy.sql.Sql@799f10e1
1 (Hello, World!)

Process finished with exit code 0
@QPaysTaxes Not anymore
BBL, got an appointment. Thanks @nhgrif and all for setting me straight on ?
 
2:29 AM
runs around 3AM UTC
they shouldn't all get reversed
 
2:48 AM
hey guys
is my description clear enough?
 
@QPaysTaxes Yah
 
@MotokoKusanagi Seems good.
 
2
Q: Impromptu Coding Style

Motoko KusanagiEvery once in a while I need to get some random computer thing done; so I write something to do it for me. This is one of those. It needed to be able to send text to, and receive text from, a server - without blocking. I am asking for feedback with the premise of what kind of code this is: A one-...

 
-1
Q: Implementing "Inversion Of Control" using C

overexchangeBelow is the C application design of Image processing, that provides skeleton implementation for vdrawImage and vsavefile functionality to Frontend layer UI.c. handlers.h typedef struct { int (*canHandle) (char *); int (*drawImage)(char *); int (*savefile)(char *); }imageHandler; e...

Trying to understand IOC using non java code
Can somebody help
 
3:07 AM
that's a lot of code
 
Hello again @QPaysTaxes
K
It gets reversed at ~4:00UTC
 
@QPaysTaxes might have been someone who knows what they're doing
@EthanBierlein thought it was 3AM
 
NoPE
Shh, it's only one more hour
i think
Aww
 
never a good idea to fall asleep at the terminal
 
in that case, give me to more votes on this answer and you have a deal :D
3
A: Interactive Rock Paper Scissors

Ethan BierleinThis is pretty good, but there are a few things that needed to be improved. Here are a few of those things, specifically regarding your, odd, design. Using % for string formatting is deprecated. To format strings, you should use str.format. For example, you'd do this: print 'Best out of {0}'.fo...

 
3:13 AM
i give away my points once they get too high - on questions i want to see answers for
 
Kool
@MotokoKusanagi I just want an upvote on it. :)
Woot. Methinks I will get necromancer for the fifth time
 
@EthanBierlein keep it up! I have 23 :)
 
@Mat'sMug A zombie slayer never rests! :D
 
revival x47
 
i did you one better and put a bounty on your syntax highlighter
 
3:17 AM
I need some upvote sprinkles. @janos is about to pass me for the weekly rep leagues, and I don't want that to happen
 
yeah those are always nifty
 
I did
 
goes and upvotes janos
 
They are the hardest fucking things to make ever
@Mat'sMug You will do no such thing.
Both
are hard
 
@EthanBierlein try writing a bootloader
 
3:19 AM
^^
 
in VBA Rubberducking, 37 mins ago, by Stack Exchange
Try this at home: Shift+F2 on a property setter usage. Takes you to the getter declaration. I just got my code to resolve it to the setter.
 
@MotokoKusanagi That's a whole completely different area.
 
it's what i thought of when you mentioned difficult
 
Does this work? If so, you should ask for a review on Code Review. if not, please explain what the problem is. Either way, as it stands it's off-topic — Hobo Sapiens 11 secs ago
 
I bet it's hard. But it's assembly, so it's always hard.
 
3:21 AM
'night Q
 
Night
 
@QPaysTaxes it could have been much worse lol
 
@Mat'sMug *snerk*
Now it's quiet
 
@QPaysTaxes It looks like your upvotes weren't reversed.
Goodnight!
 
@Jamal That's because the reverser runs at 4:00UTC
 
3:27 AM
I saw a reversal on another user (on SO), though.
 
Hmm. Oh well. I'm gonna go stalk people waste time on Twitter. Bye.
 
0
Q: Properly managing a collection from deserialized XML file throughout app's lifetime

SeeSharpCodeI'm developing a WinForms app to manage some settings and profiles for multiple video games. The list of video games is specified by the user, and I'm trying to figure out how to properly maintain that list/collection throughout the lifetime of my application. I decided on an XML file to manage ...

0
Q: Countdown timer in PHP

Archit SaxenaUsing PHP and jQuery, I was able to make this countdown timer. I've searched various books and obviously on Google, but couldn't find this type of approach as used by me here. I sincerely feel there is something wrong with it. Can anyone tell me if this is the right approach? <!...

0
Q: Unique letter counter for string in Python

user2740614I'm trying to create a program that creates a record of how many times letters appear in a given string (ignoring blank spaces) using recursion. s = "Hello there this is the string" new_s = "" for i in s: if i != " ": new_s += i new_s = new_s.lower() com_dict = {} def merge_count(s)...

 
Welcome to Stack Overflow. Please take the time to familiarize yourself with the Stack Overflow help file, which will help you understand what kinds of questions are appropriate for this site. This site is intended to help you obtain answers to specific programming questions, as opposed to providing tutorial, design or code review assistance. That said, what you want is a diff tool or library, which is often incorporated into code repository and wiki software to perform text comparisons. — MarsAtomic 27 secs ago
 
4:10 AM
0
Q: Maintaining a single collection subdivided by a value's property

BenI'm working on a networked game. In this game, the base entity is called an actor. An actor can either be replicated or local, with each instance having a "replicates" field that represents this. When managing a scene, a collection of actor must be maintained. My problem is finding a suitable so...

 
5:04 AM
0
Q: Imitate UITableView reordering interaction

RickyI have a UIScrollView full of vertically stacked subviews which I want the user to rearrange as they desire. I've implemented a UILongPressGestureRecognizer on my UIScrollView to successfully move the items around. The more difficult part is when the user brings their finger to the edges of the ...

 
5:48 AM
"Java Was Strongly Influenced by Objective-C" cs.gmu.edu/~sean/stuff/java-objc.html
 
I have a new longest post ever.
 
0
Q: The stocks problem - find the biggest profit that can be made

Paul The Stocks Problem: Given an array of n integers representing the price of a stock over the course of n days, determine the maximum profit you can make if you can buy and sell exactly 1 stock over these n days. My solution is using the same approach as the merge sort algorithm. It is i...

0
Q: Who's using what and where - resolving identifier references, take 2

Mat's MugThe first version of Rubberduck's IdentifierReferenceListener class caused StackOverflowException that brought down the VBE and its host app with it. So I rewrote it, and I'm hoping not to get a CodeReviewException now. Is it violating SRP? Some methods were removed to fit the 30K limit. publi...

 
I need to reduce the size of this class, big time. How should I go about it? Should I extract some Resolver class and constructor-inject it? — Mat's Mug 12 secs ago
 
Some methods were removed to fit the 30K limit. :O
 
uh-huh
they look like this:
        public override void EnterSubStmt(VBAParser.SubStmtContext context)
        {
            SetCurrentScope(context.ambiguousIdentifier().GetText());
        }

        public override void ExitSubStmt(VBAParser.SubStmtContext context)
        {
            SetCurrentScope();
        }
 
5:58 AM
737 lines
 
well the code file has 854 actually
 
fair amount of similarity between the Enter* methods
 
indeed
Full code is on GitHub (links to this exact version) — Mat's Mug 12 secs ago
ugh, something broke, it no longer seems to be resolving With blocks correctly.. dammit.
deleting post for now.
 
@Mat'sMug what about something like this
    public override void EnterArgDefaultValue(VBAParser.ArgDefaultValueContext context)
    {
        Foo(context.ambiguousIdentifier());
    }

    public override void EnterFieldLength(VBAParser.FieldLengthContext context)
    {
        Foo(context.ambiguousIdentifier());
    }

    private void Foo(VBAParser.AmbiguousIdentifierContext context)
    {
        if (context == null)
        {
            return;
        }

        var identifier = Resolve(context, _currentScope);
        identifier.AddReference(CreateReference(context, identifier));
 
that would help a bit ;-)
the more I look at it, the more it seems to me anything that's not an override doesn't quite belong there
 
6:15 AM
@mjolka are you familiar with this syntax by any chance?
typedef struct TaskControlBlock
{
    int		type:1;
    int		state:7;
    int		priority;
    }
I mean the colon after type and state
and then a number
It's C so it might be a bit of a stretch but I don't recall this syntax in C++ either
 
google, my friend :)
38
Q: What does 'unsigned temp:3' in a struct or union mean?

Munir Ahmed Possible Duplicate: What does this C++ code mean? I'm trying to map a C structure to Java using JNA. I came across something that I've never seen. The struct definition is as follows: struct op { unsigned op_type:9; //---> what does this mean? unsigned op_opt:1; unsig...

 
:O maybe I was just lonely here
to be honest got lazy and didn't know what to search. thanks :D
 
what're you working on?
haha i just googled struct colon
 
-4
Q: Python ?? Need largest number on file code

BillWrite another program named readfile.py that uses a loop to read and process mynumbers.txt. The program should output all of the integers, one per line, with no blank lines between each line. This program should also output the largest random number that was on file. I have this so far: infile =...

 
damn it. I must be brain damaged or something. I use this in a regular basis. Now I am really horrified
One of the colleagues leaving us so we had a little lunch to say goodbye and I only had a single beer :O if that single drink did this to me, I should get up and go sleep
@mjolka struct colon !!! hahahaha.... that's gold
@mjolka writing a little program for our MSP430 chip.
 
6:24 AM
@Mehrad you know what they say about day drinking
 
It's going to be in our new product so I hope I can finish it soon since the PCBs that we have ordered are almost ready. if I don't end up forgetting what the for loop is, though :/
@mjolka star star I am totally with you my friend
 
in VBA Rubberducking, 25 secs ago, by Mat's Mug
fixed. for some values of "fixed".
TTGTB
 
have a good one buddy
 
6:43 AM
0
Q: Python - privat client server chat - best practice

iartusiI try to create a private chat with Python but I don't know best practice. It's only for study purpose, I'd like understand the logic behind a simple private chat and the best mode to implement it with no framework. This is my code for client: import socket from thread import * from time import ...

 
7:04 AM
Anyone around?
 
for a minute
 
Familiar with Sql query handling in non-SQL languages?
 
not really my forte, sorry
 
OK
 
Monking
@Phrancis ??
what do you mean by that?
 
7:20 AM
Monking.
 
7:49 AM
@Vogel612 Oh, just having weird errors
println sql

sql.execute("DROP TABLE IF EXISTS test CASCADE;")

sql.execute(
        "CREATE TABLE test ("
        + "id SERIAL,"
        + "word TEXT,"
        + "number INTEGER,"
        + "decimal NUMERIC,"
        + "datetime TIMESTAMP"
        + ");"
 )

def params = ['Hello, World!', 42, 3.14159, null]

sql.execute("INSERT INTO test (word, number, decimal, datetime)"
            + "VALUES (?,?,?,?);", params)

sql.eachRow('SELECT * FROM test;') { row ->
    println "${row.id}"
        + "${row.word}"
> groovy.sql.Sql@145f66e3
1
Caught: groovy.lang.MissingMethodException: No signature of method: java.lang.String.positive() is applicable for argument types: () values: []
Possible solutions: notify(), size(), tokenize(), size()
groovy.lang.MissingMethodException: No signature of method: java.lang.String.positive() is applicable for argument types: () values: []
Possible solutions: notify(), size(), tokenize(), size()
at DatabaseTest$_run_closure1.doCall(DatabaseTest.groovy:34)
at DatabaseTest.run(DatabaseTest.groovy:32)
Some of the most obscure/vague error message I've seen so far
 
Monking
 
Monk*
Seems like it gets stuck right after this:
sql.eachRow('SELECT * FROM test;') { row ->
    println "${row.id}"
Since it prints the row ID (1) but then goes into that error
I might have to hit SO on that one
 
@Mehrad Gets even better when you use it like int type:0
In that case you declare a variable with a size of 0 bits.
 
8:10 AM
0
Q: Groovy / Postgres "No signature of method: java.lang.String.positive()"

PhrancisTrying to write some basic PostgreSQL code using JDBC to eventually integrate into an application written in Groovy. I have written this Groovy code to connect to the DB and then execute statements; but, I'm getting an error that I have tried to find a solution to, and could not. Here is the rele...

 
Should this answer burn?
-1
A: Create ranges from an array of integers

otopolskyIf anyone wants/must use older revisions of C++ (without auto etc). I don't like to mix data and printing in algorithms so I divided to two parts. You can visualise the algorithm like: + hit the difference + grow the range(move max) until next difference + whatever remained add as range Drawba...

I tried clearing it up, but it's still bad.
Perhaps he just needs to learn, his intention isn't bad.
 
@Mast It looked fine to me.
Not great but the advice is reasonable.
 
@Morwenn The advice is good enough, but it's so darn hard to read.
According to his first line, he seems not to agree with the choice for , which I think is a bad line to start with.
 
On the other hand, nothing forbids to provide implementations compatible with older versions of a language on CR.
 
True.
I'm not saying the poster is bad, but if anyone manages to edit the answer further without damaging the intent that would be great.
Jamal falling in the pitfall of moderatorship:
Me? Wow, I'm not entirely sure. It is a goal of mine, albeit after graduation. If SE chooses me, I'll accept. If not, I'll be happy with anyone dedicated to help the site grow. — Jamal ♦ Oct 24 '13 at 17:13
 
8:30 AM
buenos días pequeños
 
@JeroenVannevel Buenos días, señor Vannevel.
@Mat'sMug If you decide to wake up, what did you use to plot those fancy graphs?
39
Q: Once upon a time in Stackland

Mat's Mug Uh question, why have you folks not graduated yet? - jul 13 at 21:18 by Undo It's been quite a while since the 100 days later update, which was posted around the 100th day after our last site review, which brings us back in November 2013. If a baby was conceived back then, that baby is prob...

 
That's the SEDE
Today I'll pick some cherries. The tree next to my window is bursting with ripe ones
Can't give them all to the bloody birds
 
8:47 AM
Holy sh** this works
def sql = Sql.newInstance(dbUrl, dbUser, dbPassword, dbDriver)

println "Sql Instance: " + sql

sql.execute """
        DROP TABLE IF EXISTS test;
        CREATE TABLE test (
            id SERIAL,
            word TEXT,
            number INTEGER,
            decimal NUMERIC,
            datetime TIMESTAMP
            );"""

def params = ['Hello, World!', 42, 3.14159, 'NOW()']

sql.execute """INSERT INTO test (word, number, decimal, datetime)
            VALUES (?,?,?,CAST(? AS TIMESTAMP));""", params
I didn't know you could cast the string 'NOW()' as a timestamp value :D
> Sql Instance: groovy.sql.Sql@385c9627

The row Id is: 1
The word is: Hello, World!
The number is: 42
The decimal is: 3.14159
The date-time is: 2015-06-25 04:47:05.073168
Awwww.. I can't even SQL-inject my own DB... parametrized queries rock
Sql Instance: groovy.sql.Sql@5aa9e4eb

        The row Id is: 1
        The string is: );drop table test;--
        The number is: 42
        The decimal is: 3.14159
        The date-time is: 2015-06-25 04:59:53.546777


Process finished with exit code 0
 

« first day (782 days earlier)      last day (3236 days later) »