« first day (1995 days earlier)      last day (2958 days later) » 

12:00 AM
because I'm perfectly happy with it as it is
(and most of my matlab development was in matlab's editor, so I might have lied about that IDE thing)
 
hi i want to earn a star on my comment for a badge - will help you do any research you need
i will do the reserarch first
ask me any questions - very happy to help
i hope its not spamming doing this - not meaning to spam just expressing my desire to help
 
what?
you're definitely in the wrong place
 
o :(
 
Starred messages here are generally interesting / funny stuff, rather than used in a similar way to rep on the main site.
I'm guessing you're new here, so just letting you know that chat's a bit different to the main site. This room's rules are linked at the top right of the screen. There's a wide range of different styles in the different chat rooms (apologies if you already know all this)
 
You
12:17 AM
こんばんは!
 
@JRichardSnape No need to apologise: if they already know this, it's all the worse
@You jó estét
 
@AndrasDeak fair point
 
You
@AndrasDeak ?
@AndrasDeak I don't understand. lol
 
Neither did I
 
You
lol
 
12:19 AM
I probably speak the same amount of Japanese as you do Hungarian:P
 
thank goodness we have babel fish
 
You
Yep
I don't even speak much Japanese lol
 
Interesting tactic to initiate a conversation on an English language site, then!
 
You
Just say hi in some obscure language and you're set
 
12:23 AM
we might disagree on some fundamentals of social interaction:P
 
You
My keyboard broke lol
 
 
1 hour later…
2:18 AM
Hello. Are functions and variables in separate namespaces in python?
Seeing the following code, I presume that they are in separate namespaces, much like common lisp.
def my_decorator(some_function):
	def wrapper():
		num = 10
		if num == 10:
			print("Yes!")
		else:
			print("No!")
		some_function()
		print("Something is happening after some_function() is called.")
	return wrapper

def just_some_function():
	print("Wheee!")

just_some_function = my_decorator(just_some_function)
just_some_function()
 
There is a different namespace for each module, function, and class. There is no difference between the names of functions and other variables, all things are objects in Python, and names can refer to any object.
 
Or perhaps just_some_function is being updated using itself as prior value, the same way variables can be updated: a = 5 a = a + 1
Oh
 
You're rebinding the name just_some_function, but assignment evaluates after everything to the right of it.
 
Ah, got it. So it's working exactly like a variable, or any other mutable object technically.
Excellent
Thank you
 
No, names are not objects. Functions are not mutable. Your example doesn't mutate a function.
 
DSM
2:29 AM
Aww, I was about to post "ehh.. you can mutate functions", but now it's too late!
 
It rebinds the name of the function using its prior definition, just as a variable would though, right?
@DSM Haha, that is how I feel every time I see an easy question on stackoverflow and am not quick enough to answer it...
Anyways, thanks for help guys.
 
@Byte I think it does, yes
the original function is passed to the decorator, which returns a new function
this is rebound to the name of the original function
 
@AndrasDeak Thanks
 
let's just hope the gurus don't contradict me:P
 
But the decorator isn't the thing doing the rebinding. (At least I think that's what Byte thinks.)
 
2:35 AM
ok
At least I think I got it right then:)
 
When used as an actual decorator @my_decorator, then there's some syntactic sugar making it look like it does, but it's still the same behind the scenes.
 
so decorated_function = my_decorator(just_some_function) would leave the original function unharmed
under the original name, I mean
 
thanks
and with that, good night:)
 
DSM
Rhubarb, AD.
 
2:37 AM
@davidism yeah, I've read that a week ago, was pretty insightful
@DSM \o
 
Yeah, several months ago I thought the decorator was doing rebinding, but now it seems clear how it actually works. Thanks for the validation. :)
 
@Byte that's very helpful
explains why sometimes magical things seem to happen
 
@AndrasDeak Much of it is very lisp-like
 
hey, don't be mean!
;)
bye
 
Alright, thanks again. See ya
 
 
1 hour later…
4:09 AM
@tristan leaving this here for you with regards to standing desks.
 
4:41 AM
cbg
 
 
3 hours later…
8:13 AM
Cabbage
Hi, Antti. I voted, and hopefully my votes won't expire. :)
 
I got another question guys. How can I make an input string turn into real code? I tried with "eval", but it doesn't work.
 
@DanielEngel eval is just for expressions. For single or multiple statements you need exec. But beware of using either of those on unsanitized user input, it's a security risk. And often there are better ways to do what you want.
 
exec(code)?
 
Yes. You may like to take a look at Antti's excellent answer to What's the difference between eval, exec, and compile in Python?
 
ok, thanks!
 
8:21 AM
Also see Eval really is dangerous by SO veteran Ned Batchelder.
rbrb
 
i tried it, and it worked perfectly, thank you again
 
@PM2Ring also: there is this "can eval be made safe"
that has even more of those loopholes
@DanielEngel stackoverflow.com/questions/35804961/… you cannot make eval or exec safe easily at all, so don't use it to run code given by an untrusted user, ever.
 
Got it :)
 
@DanielEngel thanks for badge :D
 
For what?
What kind of badge?
 
oh, yes it was me
it was 99 before i clicked on it
congrats!
 
9:04 AM
Congrats Antti :)
 
@AnttiHaapala I did upvote that answer, but it was quite a while ago. And since then, I have linked to it a few times, so I guess I helped you get that badge. :)
 
@PM2Ring thanks :D
I think it is way too verbose...
I've been moving stuff above the "tl;dr ends here" :(
 
@AnttiHaapala It is rather long, but I think it needs to be, to cover all of that stuff. If you condense it too much it'll become too abstract and only Python experts will be able to read it, and that info deserves to be accessible to a wide audience.
 
9:27 AM
bbl
 
@davidism While I generally agree that we should wait 10 minutes before posting cv-pls links on bad questions I don't think that should apply to dupes. On bad questions we should give the OP time to clarify or otherwise improve their question, but dupes should be closed ASAP to prevent answers being posted.
Of course, sometimes it's actually desirable to give a specific answer to a dupe when the dupe target isn't a close match to the new question. FWIW, in cases like that I've even seen Martijn post an answer and then dupe-hammer.
OTOH, SOPython isn't SOCVR, and closing questions shouldn't be a dominant focus here: we should let the general Python tag regulars deal with the bulk of close-voting.
But we do have our collection of canonical questions, and above-average skill in finding good dupe targets, and so I think the room members ought to help deal with dupes when we can. Of course, we as individuals can certainly do that without involving the room, but I feel that using the room to coordinate dupe closing is a worthwhile activity.
 
stackoverflow.com/questions/21241338/… still needed, unable to reproduce the "invalid char in identifier" so pretty void.
we need a new tag for finding a dupe :D
 
@AnttiHaapala I like it!
 
10:05 AM
@PM2Ring Don't forget we have this page
 
@JonClements Thanks, Jon. I had forgotten about that page.
FWIW, I think we should amend that page to include something like "We strongly recommend that if a bad question could be improved by the OP that comments requesting such improvements be made before you close-vote". I'm not saying that everyone who CVs such questions needs to comment, but there should be at least one comment to let clueless newbs know what's wrong with the question and what they need to do. Otherwise, the ten minute waiting time is fairly meaningless.
 
@PM2Ring makes sense - feel free to edit :)
(although in most cases - I generally notice that people have already left or do leave a comment saying what's wrong anyway...)
 
morning
@JonClements and you can't hide among the votes of others, so you have to comment before you vote, right? #moderatorproblems
 
@JonClements Ok
@AndrasDeak No, close-voting is only temporarily anonymous: the "culprits" names are all given in the "On Hold / Closed" banner. Each close-voter doesn't need to comment, but it's generally helpful if someone does when the question has the potential for improvement. But if it's a simple toolreq, then there's no need for a comment, since the "On Hold" banner provides the necessary info.
 
10:22 AM
@PM2Ring Yeah, I just meant that if you see 1 vote before you, and vote yourself, you can still hope that 3 further voters will leave a comment:P
 
Similarly, an auto-comment is generated when you close-vote a dupe, so a separate comment is (generally) not required. But sometimes I do make a separate comment on dupes before I CV, to check with the OP if they think my dupe target is a good match for their question.
 
yeah, I'm aware, thanks
 
@AndrasDeak :) Don't feel obliged to leave a comment... unless you want to [tag:cv-pls] it here.
 
yeah, I try to be helpful, but I admit I often half-ass (as in: don't leave) the comment bit, mostly when the question's so bad
I always comment on stuff I close that are answerable but "shouldn't be answered"
 
@JonClements Done. Please feel free to tweak my edit. :)
 
10:31 AM
see you later
 
@AndrasDeak I like to give the answer to simple typo or "braino" questions in a comment. And I sometimes give a suggestion or 2 on tool req questions. OTOH, there is a school of thought that providing any info to tool reqs only encourages such questions
See you, Andras.
 
11:35 AM
How do you vote to close ?
Is it after you got 1k rep ?
 
@MarkoMackic You need 3k to vote to close / re-open any question, but you can vote on your own questions with 250. See stackoverflow.com/help/privileges
 
yeah, that's not going to be soon
 
11:58 AM
cbg
 
yaah such crappy questions today
close close close burn burn delete delete delete
especially in
almost all of the questions are of type "why wouldn't you get a C book instead"
'some code I found' - lose it again. — Martin James 42 mins ago
at least in Python there is a sane question every now and then :(
 
I just had fun with a groupby question. I guess it's borderline "gimme teh codez", but at least the OP did post some code, and described clearly how his (naive) algorithm would work. stackoverflow.com/questions/36371997/…
 
In C there was a question "I want to write a disassembler. How do I decode the opcodes?"
this was preceded 30 minutes earlier by another question by the very same user where they asked "what are those numbers in the disassembler output", and was told that they're the opcodes.
 
:facepalm:
 
12:06 PM
"I want to print 16 char hex number on lcd display. Ex: 0x5579c1387b228445. Please give an idea."
 
lol
Maybe he's using microcontroller
 
another question in its entirety from
 
you never know
 
well, I gave him an idea of CV.
and this one:
enter image description here

enter image description here

As you can see ....
 
Well, I must agree with you on that
enter image description here is the question?
 
12:09 PM
no, there are links to some images, that I am not going to open.
 
@AnttiHaapala what's your native programming language?
 
:D
Python/Java/C
 
I for some reason don't like the sintax of low level languages, I mean that was what I first learned, but forgot in shortest time interval
 
@MarkoMackic The ugly syntax is the price you pay for having more control over what the CPU is actually doing. Of course, that extra power isn't much good if you don't know what you're actually doing. :) Although I still love C, I rarely use it these days because Python is so much more fun. I must admit that writing anything non-trivial in assembler is not easy, OTOH, no other language gives you the same sense of total control.
 
DSM
If I had to write in assembly, the first thing I'd write is a compiler, so I'd be back where I started..
 
12:31 PM
yeah my preference is Assembly < C < Java < Python syntaxwise; yet Python syntax isn't perfect either
 
The last time I wrote any assembler was on the Amiga; I've never learned Intel assembler. It was a M68k implementation of Eric Jensen's algorithm for computing large numbers of digits of e: I posted a Python version here.
 
12:45 PM
I know, anyways in most cases, the high level languages compile just well for what basic user needs about program performance
But if you look, if you do programming language from ground up, and build it based on performance of low level, the app that's written in it, couldn't be less efficient then rewriting it in lower level..
Is Java efficiency of well written code equal to c ?
 
It depends. Java has to do more "housekeeping" than C, due to the overhead of OOP. OTOH, in a non-trivial program it's not easy to do efficient memory management yourself, and it may be more efficient to let the language handle it for you.
 
My favourite syntax wise is definitely python.
 
Depending on what you mean by efficiency (you should say), the fight is probably more between C and whatever JVM you choose, rather than C and Java. The Sun hotspot compiler is meant to do some pretty awesome stuff to get Java within an order of magnitude or two of C, but, yeah. That's the runtime, not the Java syntax.
 
Also, C code is compiled to machine code, but Java is compiled to byte code, which is then compiled to machine code with the JIT compiler at runtime, which has a bit of overhead. But I really don't know much about Java, so please feel free to correct me. :)
 
But JVM has optimizations while compiling based on specific cpu, I don't know if c does optimizations based on arhitecture
 
DSM
1:00 PM
There were really smart people optimizing the JVM. I've seen it beat comparable C (admittedly in toy cases, but the fact it happened at all is impressive.)
 
119
Q: C++ performance vs. Java/C#

user23126My understanding is that C/C++ produces native code to run on a particular machine architecture. Conversely, languages like Java and C# run on top of a virtual machine which abstracts away the native architecture. Logically it would seem impossible for Java or C# to match the speed of C++ becau...

 
@MarkoMackic A C compiler always compiles to a specific architecture. But that doesn't necessarily mean that the compiled code can take advantage of everything the target architecture offers.
 
I don't know, and I've made mistake, JIT queries the machine..
@PM2Ring of course it doesn't mean :)
@RobertGrant agreed with that
But I have never met someone who optimizes his code to run faster for microseconds, I mean, when you're coding, you care about performance as much as you need it, but you never try to make it the fastest it can be ( then you'd write it in assembly ) because it takes a lot lot more time, and it really is rearly so much needed.
 
Cabbage!
 
cbg @danidee
 
1:12 PM
cbg
 
So, someone from QA is moving to R&D after proving herself. She needs to learn how to code, programmers.stackexchange.com/questions/96504/… would frustrate her for 6 months before she can start producing code. What would you recommend? (She needs to work on C# code).
cbg
 
DSM
So one of our room's JS gurus drops by for recommendations on training new C# devs? Just another Saturday in sopython.. ;-)
 
@DSM This room has several good educators, I'm looking for advice
 
@BenjaminGruenbaum you should ask Jon Skeet!
 
@DSM What's your plans now then?
 
1:22 PM
@BenjaminGruenbaum pineapple really doesn't belong on a pizza? :p
 
Joel Spolsky has some really weird advice that'd take months...
 
DSM
@Ffisegydd: not sure yet! Haven't even decided whether I want to stay in Large Canadian Province or move back to Western Canadian Province. I've basically planned for a few months of indecision.. but it already feels like all this tension is slowly releasing. :-)
 
:D what about non-work plans then? You should take a gin-tasting tour around Europe.
 
@BenjaminGruenbaum a book.
 
1:25 PM
@Ffisegydd Your place should be just fine for gin tasting I'd have thought? :p
 
@AnttiHaapala which?
 
I haven't read any C# books :D
 
DSM
I did think about doing some international travel. If I find a new position relatively soon and can negotiate a non-immediate start, I'll definitely go somewhere. Otherwise I think I'll put off any trips until the situation is more stable.
 
Hilarious as always! lol
 
I'm a fan of projects as a learning method
 
1:29 PM
well if one's studying C#, I guess one should get the book from Jon Skeet...
 
"The book from Jon Skeet" - they're printing SO now?
 
ah but that is probably too HC :d
 
is it free?
lol
 
I know
But it's worth it, Jon Skeet wrote it.
 
1:30 PM
Eh.
 
yeah but it wasn't a beginner book it seems :D
 
I'm not saying it's not worth it, but just because someone can answer questions well doesn't mean they could write a good book.
You should not blindly place your faith in people because they have a lot of rep.
 
but in any case, that wasn't a beginner book, my bad :D
 
@Ffisegydd It's rather an irony :) Because these days, there are a lot of jokes on Jon Skeet
 
@MarkoMackic those jokes are from 2008
 
DSM
1:32 PM
I never really know what to recommend for beginners, because when I try to learn a new language there's a lot of material I already have in hand for comparison and contrasts, and so the things that confuse me aren't going to be the same things as would confuse someone starting out. (Depending on the language, there might not even be fewer things which confuse me, only different ones..)
 
@AnttiHaapala i know
But these days name Jon Skeet is repeated many times?
 
Anyone here worked with async iterators in 3.5?
So I um, need to make a 50 minute lecture on them :D
 
I haven't :/
 
DSM
Have you read Cannon's explanation? I found it helpful.
 
no project going on that could utilize async in any way :(
 
1:37 PM
It's long text :) still not awake enough to read it :)
 
@DSM yes, it's nice, but way too basic
 
@BenjaminGruenbaum if such a long text is basic, what do you find complex?
 
Note I'm asking about async iterators, not async/await.
Well, something with actual use cases would be a nice start
Namely, that doesn't contain a single reference to async for
or async with
 
DSM
Ah, got you. I've only had cause to do toy things yet, nothing nontrivial at all.
 
Well, I'm supposed to be presenting the proposal of bringing the feature to JavaScript in front of quite a few people.
 
1:41 PM
get the with in javascript first :d
 
do you prefer polymorphism when coding?
rather than switch or if
 
of course...
 
@MarkoMackic Nah... I enjoy staying a "Puppy" :)
 
though I rather prefer *ducktyping*/interfaces to subclassing
@BenjaminGruenbaum the async iterator stuff in python is mostly to support async for
 
which is used for?
 
1:46 PM
you have some collection whose items you can iterate over, but the items themselves arrive asynchronously,
you use async for i in async_iter:
 
that's a description, not an example
 
well, async for chunk in request.body:
but the reason why there needs to be such a thing in Python in the first place is that you cannot easily do that which you could do in JS:
request.body.forEach(chunk => {})
or something :d
 
This is producing no result
subprocess.Popen("wine",shell=True, stdout=subprocess.PIPE).stdout.read()
 
@Wally that's nice - thanks for letting us know :)
 
Whlle if I type it in the terminal I get
wine
Usage: wine PROGRAM [ARGUMENTS...]   Run the specified program
       wine --help                   Display this help and exit
       wine --version                Output version information and exit
 
1:58 PM
are you sure it's not outputting that via stderr instead of stdout ?
 
That works thanks.
subprocess.Popen("wine",shell=True, stderr=subprocess.PIPE).stderr.read()
 
Why use Popen anyway... much nicer to use: command_output = subprocess.check_output(['wine'], stderr=subprocess.STDOUT) (or something)
You might want to check some caveats in the docs - IIRC correctly using PIPE may cause issues...
 
2:30 PM
@Martijn didn't see the int() when I commented :p
 
cabbage :)
 
cbg - you finished your exams(?) yet?
 
Yep. Got over today
2/3 went well, the other was yam :)
 
yam as you know it's yam, or yam as in you just have a bad feeling about it but it could be okay anyway? :p
 
Lol, The second one :P
 
2:34 PM
Cabbage!
 
@JonClements tsk tsk.
 
cabbage poke \o
 
thanks!
 
@poke what kind? :p
 
2:35 PM
Happy (2 day) belated Birthday @Martijn :-)
Had exams for the last 3 days so couldn't wish earlier :/
 
@JonClements :)
 
"red" hammer
 
Hmm…
 
This one :P
 
Haha... I'd forgotten about that... wonder if TH is still using that :p
 
2:38 PM
wanted to search for a picture “rabbit/bunny with hammer” but the only things I found which were close are Bugs Bunny with a hammer, and a female Thor cosplayer with bunny ears.
 
@JonClements I got it from his profile :D
 
female Thor?
 
@AnttiHaapala equal opportunities and all that! :p
 
Wow Wine is a b1t(h
 
@JonClements You know, Thor, but female
 
2:40 PM
location = "/home/user/Portable-software/Sigcheck/"
wine_out = subprocess.check_output('cd '+location+';' 'wine sigcheck.exe sigcheck.exe',
                                   stderr=subprocess.STDOUT,
                                   shell=True)
Had to cd into the directory.
 
@Wally news at 9.
the cwd keyword argument.
If cwd is not None, the function changes the working directory to cwd before executing the child. In particular, the function looks for executable (or for the first item in args) relative to cwd if the executable path is a relative path.
 
I'd also not use shell=True unless you really need to... pass a list instead and let it handle any escaping as necessary
 
indeed, and one pretty much never needs to use it
 
yeah, if one needs it, they are doing Python wrong.
 
wine_out = subprocess.check_output(['wine', 'sigcheck.exe', 'sigcheck.exe'],
                                   stderr=subprocess.STDOUT,
                                   cwd = "/home/user/Portable-software/Sigcheck/",
                                    )
Works.
 
2:45 PM
Much much much nicer :)
Now - if we could just convince you to change your indentation :)
 
Bloody hell. The OP of that groupby question I answered earlier chameleoned me after giving me an accept.
 
wine_out = subprocess.check_output(
    ['wine', 'sigcheck.exe', 'sigcheck.exe'],
    stderr=subprocess.STDOUT,
    cwd = "/home/user/Portable-software/Sigcheck/"
)
 
command = ['wine', 'sigcheck.exe', 'sigcheck.exe']
cwd = "/home/user/Portable-software/Sigcheck/"
wine_out = subprocess.check_output(command, stderr=subprocess.STDOUT, cwd=cwd)
 
That is much better
 
@JonClements that is my preferred format but not quite pep8
 
2:49 PM
@AnttiHaapala same here... I ignore the bits of PEP8 I don't agree with :)
 
also pep8 disapproves dangling ) :(
 
mine is actually pep8
 
I prefer Jon's
 
It’s only 79 characters!
 
pep8 is wrøng
børken
 
2:50 PM
øbviøusly
 
Wi nøt trei a høliday in Sweden this yër? See the løveli lakes The wøndërful telephøne system And mäni interesting furry animals
 
Yeah... looks like I've picked that up as preferred style - appears I did it here yesterday as well...
 
DSM
Is the Swedish telephone system famous?
 
@Antti you are the northenmost Sopythonian :-)
 
@DSM And that's what you chose to pick out of that sentence - the telephone system!? :p
 
2:55 PM
@Bhargav How many Germans today?
 
Where do these maps keep coming from!?
 
Where do we get that from again?
 
DSM
@JonClements: well, I could imagine going to visit a place on account of the lakes or the wildlife..
 
I'm not on it ;___;
 
woot who's from stockholm?
 
DSM
2:56 PM
Welshmen don't show up in maps, like vampires and mirrors.
6
 
I'm not on it, thankfully
 
Where Wales is on the map there's just /dev/null
 
@poke 2 at the moment
 
huh, who else? :o
 
@DSM Ummm... I'm supposedly already racist for mocking the Welsh about vowels - good luck with the vampires and mirrors remark :p
 
2:57 PM
#Linux Fail
 
that is not stockholm but somewhere on the coast near uppsala
 
@poke Thief master
 
ohhh, right
 
So like @Ffisegydd said - where do we get that map from? :p
 
2:59 PM
It’s based on the location in your SO profile
 
I guess that marker is for @JohanLarsson :D
possibly just a random marker for sweden.
 
@Ffisegydd You are with Interprid there.
@JonClements Source --> github.com/r-public/room_utils
 
Yes but where is the map from?
 
@AnttiHaapala what where?
 

« first day (1995 days earlier)      last day (2958 days later) »