« first day (1628 days earlier)      last day (3318 days later) » 

12:11 AM
Cabbage boys :-)
 
 
1 hour later…
1:40 AM
Cabbage all
 
2:35 AM
Hey, anyone feel like helping me through Project Euler 31?
I have this brute-force thing running which is taking forever and probably not the right way to go
I feel like it has something to do with combinatorics, but I don't know where to start.
Something with how many different ways you can break down each part...hmm...
 
user2555451
That is just one big link-only answer.
 
@John if you don't get any response tonight, try asking when the room's busier (typically around 1200 UTC). There are definitely some users here who would know how to point you in the right direction.
 
@davidism Alright, thanks :)
 
@iCodez there's another naa link-only further down too
also, that question should be closed as looking for a tutorial
 
user2555451
2:49 AM
Ah, so there is.
 
6
Q: I successfully compiled my program. Now how do I run it?

Aadit M ShahI want to solve Project Euler Problem 1: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. Here's my code: \documentclass[10pt,a4paper]{article} \use...

 
hmm, is the tag an accepted thing?
 
user2555451
No. Just read the tag wiki: "On the other hand, an April Fools Day joke is by definition Not A Real Question, so any Question with this tag should probably be closed on sight."
 
user2555451
I'll go burninate it.
 
I voted to close it as no longer reproducible (since it's now April 2nd somewhere), since that's about as funny a reason as any.
 
2:54 AM
@davidism I think the general consensus is ok for April 1, close on April 2.
 
user2555451
Done.
 
user2555451
Heh, I killed the tag on April Fools. How's that for a joke!
 
@iCodez I think that's called an anti-joke.
 
user2555451
I love irony.
 
did you remember to cv those questions?
 
user2555451
3:01 AM
yea, I closed as I went.
 
the xor one actually seems ok without the tag, maybe I'm missing the joke
 
user2555451
I don't think they all had jokes. People were just tagging the questions because of the day when they were asked.
 
@iCodez Now that's funny
 
it was definitely a joke, there's a comment from the author on the accepted answer saying so
whatever, I'm over it
 
3:57 AM
Anybody here familiar with nose2 / coverage? I can't get it to make the method definition as covered.
I'm just running it via command line, with a nose2 command, but even coverage run -m nose2 doesn't work.
 
4:09 AM
You mean the top-level code in a module isn't being marked covered? Maybe it's an output option? When I run coverage using PyCharm, it is marked correctly.
 
As in, def get_triangle_type(a=0, b=0, c=0): which is a single method in a file isn't being marked as covered.
 
yeah, that's top-level code, that's what I meant
 
Any idea how to get that part as covered?
There's not a lot of settings, since it's a first HW assignment.
 
I have no clue, but like I said, maybe it's an option for coverage, check the docs.
Are you sure the module is being imported by whatever tests nose is running?
 
Yeah: from source.source1 import get_triangle_type
 
4:13 AM
can you post a gist that I can use to reproduce your problem?
 
Yeah, give me a second.
 
What versions of python, coverage, and nose are you using?
 
Python 34, nose2, coverage: default?
 
the specific versions, what does pip list say?
 
4:27 AM
sorry, not going to install your entire project, please reduce this to the smallest possible code to reproduce
 
Cabbage
 
cbg
 
tax-return-cbg
 
4:51 AM
cbg
 
@DSM shakes fist beat me to that math answer :)
 
5:07 AM
?
 
(and then I got the accept)
 
DSM
5:29 AM
@davidism: yeah, and looking at the timestamp someone else beat me to the same point, so I'll delete mine.
 
cabbage
 
DSM
The moral of the story: don't answer questions at 1 AM local, however insomniac you're feeling. :-)
 
5:57 AM
Anyone familiar with dispatch in Django?
Saw this in a Class based view that was an API endpoint:
@method_decorator(csrf_exempt)
def dispatch(self, *args, **kwargs):
return super(IDFAData, self).dispatch(*args, **kwargs)
Kinda confused about it
 
6:23 AM
cbg
 
6:44 AM
cbg
 
user4433485
Cabbage!
 
user4433485
I overslept oops
 
user4433485
@RobertGrant I'm doing good with codecademy
 
I've heard mixed reviews of codecademy
I liked it when I went through it for...Ruby I think? Maybe JS?
I forget
(which I guess speaks volumes....)
 
user4433485
6:54 AM
for a total beginner it can be useful
 
Cabbage Guys :-)
 
user4433485
Cabbage !
 
cbg fourtheye
 
@Katherina good :)
 
user4433485
Currently at the if else statement ;) @RobertGrant
 
user4433485
7:00 AM
chapter 5
 
http://stackoverflow.com/questions/29384696/how-to-find-current-day-‌​is-weekday-or-weekends-in-python/29384728#29384728
 
user4433485
No don't ! I finally know a answer on a question:p
 
user4433485
a nvm already got answered
 
@AdamSmith it's one of the best things I've seen for that sort of thing, even though it's definitely not perfect.
It teaches some concepts and a reasonable amount of syntax, which is nice
And no installation required, which is definitely nice
 
user4433485
did you finish the course @RobertGrant
 
7:09 AM
Yeah I did Python, Ruby and Javascript a while ago
 
user4433485
Ah
 
user4433485
how did you feel about your knowledge of python after the course?
 
Just redoing Python now to see if there's anything I missed
 
user4433485
I am only at 16% atm, but seems good tho
 
It was better than it was before :)
But I didn't know any Python before
 
user4433485
7:10 AM
oh well exactly like me:)
 
user4433485
I got stuck sometimes when I need to do maths
 
user4433485
I suck at maths
 
Code Academy is pretty good. I would also suggest Learn Python the Hard Way. learnpythonthehardway.org/book
As well as Dive into Python diveintopython.net/toc/index.html
 
user4433485
@ApathyBear Well Learn Python the hard way was not recommended by @AnttiHaapala he said it was kinda crap:p
 
Everyone hates it
 
7:14 AM
@Katherina @ApathyBear not only me, but judging from the sheer amount of questions arising from the said book
it is not only hard on the learner but hard on stackoverflow answerers as well :D
 
user4433485
=DD
 
user4433485
I am wondering how long it will takes before I got enough knowledge of Python to help people :) I also want 5k rep+ like most of us have here
 
@ApathyBear please recommend dive into python 3 :) getpython3.com/diveintopython3
The version you posted covers Python 2.3 at best, I think
 
user4433485
How important is Math in programming?
 
Certain kinds of maths - pretty important
 
user4433485
7:17 AM
like squared(?) the ** thingy:p
 
user4433485
I've never done that
 
user4433485
I suck at it
 
@AnttiHaapala I enjoyed it. It was the first "course" I have ever taken. I think it accounts for self- sufficiency. It may not be for everyone.
 
user4433485
2**3 == 108 % 100 is this true or false?
 
7:18 AM
Not so much, but maths will generally help you with lots of subjects, programming included
 
print "Mary had a little lamb."
 
@Katherina True
 
SyntaxError: Missing parentheses in call to 'print'
 
@Katherina true
 
lol yea, if you add parens
 
user4433485
7:18 AM
Could one of you explain why? @jerry @RobertGrant
 
108 % 100 is 8 (remainder when 108 is divided by 100)
 
user4433485
I really want to understand
 
and 2**3 is 8
 
You're saying that the result of 2**3 is the same as the result of 108%100
And since those two things both equal 8, it's true
 
2**3 is 2 * 2 * 2 aka 2³
 
user4433485
7:19 AM
2**3 = 8
2 x 2 x2 = 8
 
user4433485
that whay?
 
user4433485
tnx
 
@Katherina Its a good time for you to understand the Operator Precendence as well
 
So when I said "squared", that's specifically for something ** 2, not something ** 3 (which is cubed). It's just a slang term for something ** 2.
And something **4, ** 5 etc doesn't have a name, as far as I know
 
7:21 AM
shiit
 
user4433485
I will try to learn that
 
@Katherina there's a nice diagram version of why it's called squaring here: en.wikipedia.org/wiki/Square_number
 
anyone know how can I make beautifulsoup to do select a[title="Katso lainasi"]
 
user4433485
Thanks @RobertGrant
 
ValueError: Unsupported or invalid CSS selector: "a[title='Katso"
§ValueError: Unsupported or invalid CSS selector: 'a[title="Katso'
 
user4433485
7:23 AM
100**0.5 = 10 ?
 
Yes :)
 
user4433485
I get it
 
user4433485
slowly tho ^^
 
user4433485
need calculator:p
 
Although it's easier to think of that sort of stuff as 100 ** ½
because then the denominator (the 2) means you can say square (remember square from ** 2?) root
And then, say 8 ** â…“ is 2, because the denominator (the 3) means it's the cube root, ie the opposite of the cube
 
7:26 AM
(a ** b) ** c == a ** (b * c)
(a ** 2) ** 0.5 == a ** (2 * 0.5) == a ** 1 == a
 
user4433485
will need to train it :p
 
user4433485
my poor brain
 
user4433485
so much to learn
 
@AnttiHaapala Looks like RegEx is supported. Did you try that?
 
not yet
 
7:28 AM
rbrb
 
I guess this is ok, I just look for lainasi = your checked out books; I need to do a robot to renew my books... :P
 
@Katherina but you won't be squaring numbers every day; I wouldn't focus too much on it yet
 
user4433485
@RobertGrant I will focus on Python first;)
 
@Katherina but a separate maths course will help you a lot generally, with all sorts of things
But yeah, one thing at a time!
 
user4433485
3**4 < 4**3
==
3x3x3x3 < 4x4x4
 
user4433485
7:32 AM
Ah well I get it now: )tnx
 
must be the most unsemantic HTML I've ever seen
 
Cbg :)
 
Cabbage!
So tired…
 
user4433485
7:48 AM
Cbg @poke !
 
user4433485
Well @poke I overslept this morning, I know the feeling
 
Hey up
 
Hi
 
user4433485
How often do we use Len() syntax?
 
8:01 AM
You mean len function?
 
user4433485
uhh yes
 
user4433485
lol
 
I check the length of a list quite often in my code
usually to check if I got (enough) results and thus be able to handle cases where I didn't get (enough of) them
I see I also used it once to be able to decide the height of a window and whether or not a scrolling was required
 
user4433485
8:18 AM
@RobertGrant Do you remember the PygLatin game?
 
user4433485
@RobertGrant Set new_word equal to the slice from the 1st index all the way to the end of new_word. Use [1:len(new_word)] to do this.
 
user4433485
pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    new_word = word + first + pyg
    print original
else:
    print 'empty'
 
brb lunch-ing
 
user4433485
brb coffee! will be fast this time, because I overslept :p
 
@Katherina very vaguely
 
user4433485
8:34 AM
I don't know what to do here:p
 
user4433485
if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    new_word = word + first + pyg
    new_word == [1:len(new_word)]
    print new_word
 
That's not good.
You want to try DRY.
"Don't Repeat Yourself"
 
user4433485
original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    new_word = word + first + pyg
    print original
 
user4433485
this is what i've got
 
user4433485
Set new_word equal to the slice from the 1st index all the way to the end of new_word. Use [1:len(new_word)] to do this. this is what they want
 
8:38 AM
gimme a minute
 
Well your first mistake is using Python 2 Is the idea to convert "shoot" to "hootsay"?
 
user4433485
Yes @Ffisegydd
 
def pygify(word=None, pyg='ay'):
    if word is None:
        word = get_user_input()
    if len(word) > 0 and word.isalpha():
        return '{}{}{}'.format(word[1:], word[0], pyg).lower()


def get_user_input(prompt='Enter a word: '):
    return raw_input(prompt) # Python 3 input(prompt)
>>> pygify('shoot')
'hootsay'
A little tip @Katherina You should try to put your code into a function, and use returns instead of printing. You get a better grasp of what is happening that way.
 
user4433485
the thing is @InbarRose, it's CodeAcedemy, can't change the entire code ^^
 
user4433485
Functions is the next chapter
 
8:42 AM
Well, I didn't know you were following a tutorial.
 
user4433485
my mistake
 
I thought you were just experimenting.
My fault for coming in the center of a conversation.
 
user4433485
np :p
 
user4433485
Instructions
Set new_word equal to the slice from the 1st index all the way to the end of new_word. Use [1:len(new_word)] to do this.
 
@Katherina you do realise that in your code you're printing original right?
And not new_word
 
8:44 AM
Just use a slice.
word[1:]
 
user4433485
I know @Ffisegydd I don't really get the point either
 
def translate(words, pyg='ay'):
    def pygify(word):
        return ''.join([word[1:], word[0], pyg]).lower()

    return ' '.join([pygify(word) for word in words.split()])

print(translate('shoot the pig'))
# hootsay hetay igpay
 
@Ffisegydd If I am not mistaken, ''.format() is faster than ''.join()
 
Yeah I'd written that before I saw your format answer.
 
user4433485
pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    new_word = word + first + pyg
    new_word[1:]
    print original
else:
    print 'empty'
 
8:46 AM
new_word[1:] still needs to be assigned.
 
And, again, you're printing the original unchanged word.
 
new_word = word[1:] + word[0] + pyg
And you don't need "first" variable
new_word = word[1:] + word[0] + pyg is better written as a join or a str.format() (as myself and @Ffisegydd have shown above)
 
Yeah, addressing the fact that the variable hasn't changed is the main thing here. Everything else is probably secondary to that, and I'd imagine confusing :)
 
user4433485
http://i.imgur.com/We4oFfe.png
I resetted the code > this is default
 
Are you iteratively modifying the code as you step through the lessons?
 
user4433485
8:50 AM
Yes
 
user4433485
this is what they give me with this lesson
 
Then maybe they expect you to actually change print original?
 
user4433485
nothing changed yet
 
user4433485
print new_word
 
user4433485
but they expect me something else to do too
 
8:51 AM
Yes because your logic is wrong, as me and Inbar have already pointed out.
 
user4433485
What do I need to do ? I changed the print original to new_world
 
@Katherina what's the point of doing a CodeAcademy course if we have to feed it to you?
 
@Katherina "world" != "word"
 
Inbar has already explained what's wrong to you once.
 
user4433485
@Ffisegydd Because I can't continue without doing this, been stuck for 30 minutes now lol, but thanks @InbarRose new_word = word[1:] + word[0] + pyg works
 
8:53 AM
Indeed.
Now switch the concatenation with a join or a format.
 
I don't think you were getting my point, but I don't have the time or inclination right now.
Need to pop into town to pick up my dry cleaned suit
 
People learn best from making their own mistakes.
 
user4433485
but the question was poorly explained
 
Indeed.
 
user4433485
I could have been stuck there for ages
 
8:55 AM
They usually are.
 
user4433485
Chapter 6: Functions
 
Wonderful.
def translate_to_pyglatin(phrase):
    return ' '.join(map(pygify, phrase.split()))

def pygify(word=None, pyg='ay'):
    if word is None:
        word = get_user_input()
    if len(word) > 0 and word.isalpha():
        return '{}{}{}'.format(word[1:], word[0], pyg).lower()


def get_user_input(prompt='Enter a word: '):
    return raw_input(prompt) # Python 3 input(prompt)
>>> translate_to_pyglatin('I love functions')
'iay ovelay unctionsfay'
And just for the pedantic among us: Yes I am aware that there are many unhandled scenarios in the functions above that can cause many bugs.
 
user4433485
Thanks @InbarRose I figure it out:D
 
9:01 AM
I will be there, I think
 
@Inbar what's with the if len(word) > 0 and word.isalpha() ?
@Katherina I also thought adding ay was for words starting with a vowel or something
(or you move part of the word up to the nearest vowel to the end or add ay or something)
 
@JonClements Copying the logic from @Katherina .....
 
user4433485
@InbarRose My logic has influence mate ;p
 
Or, you know, import this
 
Not at all how I would write this code, but I just wanted to rewrite the code in a better way using the same logic she had.
she/he?
I need a definitive answer.
 
user4433485
9:06 AM
Could also check my profile :)
 
@Ffisegydd What a simple code
 
A letter given to a colleague from a passenger onboard his aircraft.. Providing proof that we're all in this together http://t.co/a0NrT3LAtT
Umm
 
Wow... someone has a good memory for stuff: sopython.com/wiki/Birthdays
cbg @Martijn
It does not work.All the sorting done at the first line is potentially reversed by the second line. — Sylvain 21 hours ago
 
cbg all
 
@Martijn can you double check the answer on that - I've either mucked up the order, or someone just doesn't get it
 
9:21 AM
@JonClements they just don't get it.
 
Actually - might just remove it - didn't notice Duncan's much more comprehensive answer
thanks for the comment though :)
and it's gone...
 
@Ffisegydd Can’t be there. Have a meeting then.
@JonClements Good memory for stuff?
 
@poke well - I was trying to remember if we had a birthday list on the old wiki?
 
oh
I don’t think so
 
But I certainly didn't add my b'day... so someone's done a fairly good edit :)
 
9:31 AM
Yeah, that was me
I didn’t want to start with a blank page, or with just my own birthday. So I added a handful I knew :)
 
:p good job sir
 
@Ffisegydd oh btw, where will this meeting be held?
 
@vaultah Switzerland... we're blowing the sopython budget and flying out there for the day
 
Cabbage
 
cbg @matsjoyce
 
9:39 AM
Do you think stackoverflow.com/q/29387325/3946766 should be migrated to Programmers, or is it on-topic?
 
@matsjoyce not sure it's entirely on topic for programmers
 
@vaultah here.
 
@Ffisegydd no - Switzerland
 
wheee, I discovered that Excel has a leap year bug.
And the bug is deliberate.
Bug-compatibility with Lotus 1-2-3!
 
Yeah, read Spolsky :)
"So, it's a bug in Lotus 123?"

"Yeah, but probably an intentional one. Lotus had to fit in 640K. That's not a lot of memory. If you ignore 1900, you can figure out if a given year is a leap year just by looking to see if the rightmost two bits are zero. That's really fast and easy. The Lotus guys probably figured it didn't matter to be wrong for those two months way in the past...."
 
9:58 AM
@RobertGrant nice find!
 
From my perspective it was more impressive, because I typed that as soon as I sat down at my PC, and less impressive, because I didn't find it, I just remember that article very well :)
 
Cbg Antti
 
"In most modern programming environments, dates are stored as real numbers. The integer part of the number is the number of days since some agreed-upon date in the past, called the epoch."
LOL
 
@Antti well - Excel stores dates as floats :)
 
user4433485
10:04 AM
Lunch! brb!
 
Shouldn't that be seconds, not days?
Anyway. The article after that, joelonsoftware.com/items/2006/08/01.html, totally blew my mind-hole when I first read it
Nothing else has done that since, other than Daniel Tao's lazy.js intro, where I finally got what the heck was going on with laziness. Very obvious in retrospect, but astonishing at the time.
 
@JonClements programming environment
 
CBG!
 
10:15 AM
Yeah, it's more the explanation that blew said mind, not the specific implementation :)
 
10:28 AM
Is there a way to formalise interface requirements in Python? As in, what do I need to make sure something is a duck?
 
@RobertGrant Well, there's python.org/dev/peps/pep-0484, or just lots of hasattr calls.
And docs.
 
Got a programming test for a job.
It's in C++. Begin crash course
 
Unfortunate choice of words :)
 
@Ffisegydd yeah
 
Unfortunate...or deliberate? You decide.
 
10:40 AM
@Ffisegydd C++ is the most difficult programming language in existence
good luck
 
It's fine. I'm prototyping it in Python first.
 
hem
@Ffisegydd you need to do all the pitfalls of C and then add onto that the C++ and the rules of 3 and 5 and template metaprogramming which is turing complete, then std14 and lambdas and whatnot and bleh. In the end your program will take 2 minute to compile, the result will be both slower and consume more memory than Python, but at least it is obfuscated not only in binary but also in source code form.
the difference between C++ and Perl is that in Perl you spend less time compiling and your fingers will not become tired. That's all.
 
@Ffisegydd but, you know. Good luck! :)
 
^_^
 
@AnttiHaapala C++ isn't that bad.
 
10:46 AM
no? is it worse?
 
@Antti was my first "main language" in employment... wouldn't wish it upon my worst enemy though
 
Christ guys stop filling me with such enthusiasm I think I might burst.
 
@MartijnPieters Oh, that old thing. Beautiful, isn't it? :)
cbg
 

« first day (1628 days earlier)      last day (3318 days later) »