« first day (2046 days earlier)      last day (2902 days later) » 
04:00 - 17:0017:00 - 00:00

4:58 AM
@Natecat yeah the slicing doesn't really work for that
 
hi guys.
can someone help me. Im trying to get my code to auto generate the fields of a json file
would this be correct?
with open('./clinic_gov.json') as jFile:
	jData = json.load(jFile)
	sqlInsert = '"INSERT INTO table1 (id,'
	count = 0
	values = []
	for k, v in jData[0].items():
		count += 1
		values.append(v)
		if count == len(jData[0]):
			sqlInsert += k + ');"'
		else:
			sqlInsert += k + ', '
print(sqlInsert + 'VALUES(' + values + ')')
 
@Natecat below:
>>> x = bytearray([32] * 64)
>>> x
bytearray(b'                                                                ')
>>> f = open('/etc/issue', 'rb')
>>> mv = memoryview(x)
>>> f.readinto(mv[24:36])
12
>>> x
bytearray(b'                        Ubuntu 16.04                            ')
this is how you do it on Python 3
ignore all the other advice
I've not really needed it myself though
even though been a python programmer for 15 years
was about to suggest that you'd ask it on the site but it is there
 
I need some advice on Linux fork() over-allocation. So, when I use os.fork() (multiprocessing), Linux checks that each child process has at-least as much memory as the parent is using. For the scientific stuff I'm doing, this isn't always true. The parent might be using most of the RAM. One solution is to export some global variable in bash, but that feels dirty. How do you folks solve these things?
 
@Mikhail wat?
are you sure you didn't disable "overcommit memory"?
and what is that global variable?
 
So, disabling overcommit solves it: ie, don't overcommit, but I'm not sure the best practice for doing that
 
instead I am thinking you've got ulimit there
@Mikhail perhaps you should tell exactly which global variable this is, and what the fork is raising on error etc :D
 
I'm 100% sure its the overcommit, and doing this sysctl -w vm.overcommit_memory= solves my problem.
But is there some kind of python wrapper for this kind of stuff?
 
5:49 AM
what was it by default?
as the kernel docs say
1	-	Always overcommit. Appropriate for some scientific
		applications. Classic example is code using sparse arrays
		and just relying on the virtual memory consisting almost
		entirely of zero pages.
which is exactly your use case
then also, have appropriate amount of space
and limit the space used by one process with ulimit perhaps...
 
Yeah, so I know how to fix the problem with sysctl, but I'm wondering if there are some commands I can call from python
 
@Mikhail why'd you need a python wrapper? it is not standard need at all
and it is system global setting
the best option would be to do
subprocess.call(['sudo', 'sysctl', '-w', 'vm.overcommit_memory=1])
 
Yeah, I guess I gotta do that
 
python can't call this system call without running as root anw, and there are reasons why you wouldn't want the code to run as root I guess :D
root's got higher limits, for example an ordinary user can't fill a filesystem
but root can...
 
I think it can be done on a per-process basis in C++ with a call to mlockall but this would need to happen before the actual call the operating systems fork()
maybe we need more flags in fork()
 
6:08 AM
not sure it'd help
you mean mlockall to lock the memory or unlock? @Mikhail
anyhow, you can use mlockall via ctypes
 
6:24 AM
Hi can any one help me to goto r- programming room
 
@Arunkumarmahesh R U looking for R?
 
6:39 AM
Cabbage :-)
 
Cbg @thefourtheye
 
Okay another multiprocessing question, when I use multiprocessing everything works but the children don't actually appear to be closed in the Task Manager after I call join(). Have you guys ever seen this? Do I need to do something special to kill them?
 
@JRichardSnape How goes your day?
 
@Mikhail are you using threading as well?
 
maybe stuff goes deep :-)
 
6:43 AM
@thefourtheye well, so far. But it is very early here, so there's time yet... :)
 
What I'm really worried about is resource leaks where every-time I hit this section it will keep starting ~20 forks instead of re-using the old ones.
 
@Mikhail see the ps output and observe what state they're in
 
Does Windows have one of those :-)
ps -aux is linux...
 
hmm... just a moment ago you were using linux :D
lol
 
everyday I'm hustling
 
6:44 AM
who knows about windows
you should have warned beforehand
I use windows only to run skype for business when all else fails, and to test IE and edge.
 
@JRichardSnape Hope the day and the week stay well for you :-)
 
@thefourtheye you're still noding?
 
@AnttiHaapala he he he, I am scaling (Scala :D) these days
 
There is simply too much to learn in that area :(
 
6:47 AM
you need to go a full circle to realize it is the best there where you started
 
So many design patterns, and so many problems...
Now people in my team are analyzing Go and Kotlin as well. I cannot say that I am not scared...
 
@thefourtheye So am I \o/
 
@Ffisegydd Badminton bros have become Scala bros as well :D
Developing apps in Akka now...
 
Had a good (badminton) session yesterday. Aching now.
 
Me too :-) Played for 5 hours yesterday... But they all were beginners... So didn't have to move around much.
Nobody likes to play Singles :'(
 
6:53 AM
5 hours!? Jeez. I played for 2.
I'm not very good at singles.
I play so much doubles that I struggle to get into the mentality.
 
nobody likes singletons
 
simpletons
 
Actually, I don't have a good partner to play doubles with. Thats why I prefer singles.
 
8-10 of us from work play and so we rotate partners when playing each other.
Some team ups are better than others of course, as some skills gel more.
 
6:56 AM
@JRichardSnape yes i am looking for R and thank you for suggesting me the path
 
Cool. Here I play with people who are far better than me. Unless I have a good partner, nobody will have a good game.
There are people who are playing for more than 12 years..
While playing, most of the times I'll simply stand and watch their trick shots and disguise shots...
 
So, hows the job market for Python developers compared to C++ people?
 
@thefourtheye Yeah I'm not really fit enough to run around like a maniac, and I'm not tall enough to have massive reach, so I have to rely on deception when playing.
 
@Mikhail the Python developers are a different niche
 
7:02 AM
Then I would really enjoy playing against you :)
 
Stupid timeout.
 
@Mikhail a person who knows only Python is much more useful generally than a person who knows only C++
A C++ programmer really only programs, but Python's useful for data scientists, analysts, physicists, mathematicians, biologists, statisticians, whatnot...
 
I wonder if those people make less than C++ people. This is certainly true if you compare a biologists to a C++ dev.
 
7:09 AM
Yeah, I'm quite aware of the potential applications of python and I'm doing my PhD in vaguely physics/signal-processing. What I don't have a feel for is the job market compared to C++ (which I maybe know).
 
as I said, the C++ is limited to applications development
Python is much more widely used by experts of various areas
me myself, I do not even like C++, I am a C man myself when it comes to system programming languages.
C++ has very limited use in the fields that I am working with
most of the time it is simpler to use C instead.
 
Well, for example experts in biology tend not be very expert. Furthermore a PhD in wetlab biology pays like $50k which isn't too high. Although computational jobs for example at Cold Spring harbor appear to pay something like $60k. Not sure what the computational side looks like.
 
without knowledge of your particular field, hard to say
in my field, we certainly need both
 
if you're for money
then you'd do a startup business
and make a POC fast
then sell it for billion bucks
and you'd do your POC in Python
 
but for anything reasonably expert, your skill set tends to overrule any basic programming requirements
if you know Python and the job calls for it, you are done
 
7:14 AM
all in all:
if you're expert in both Python and C++
it is always better than the guy who's expert only in either.
and if you excel in C++ you probably can do C well too,
 
but that easily means you are not top notch in domain knowledge in your field
 
which both are useful skills when enhancing python
yeah, top notch in cobol
 
Yeah, I have a deficit of domain knowledge because I'm the sole software guy in my lab
 
signal processing sounds like you could use C or C++ skills, but I'm guessing it would not be too hard to find jobs where the basic libraries already exist, and understanding how to use them from Python is more than good enough
and vaguely agree with Antti that C is probably the more important one for this scenario
 
what you'd do is to develop an algorithm using python first :D
 
7:17 AM
or MATLAB :-)
 
or Python.
matlab is matlab...
Python is Python...
 
well, for example there aren't any MATLAB job postings
 
it is only an expert tool
 
but I would turn around and ask what sort of job you would be happy with
I could probably learn C well enough to make a living but I would hate it
 
why hate C?
 
7:20 AM
you'd also be making bombs or embeded devices (probably bombs)
 
I'd hate to do C forever though
but that's what you get if you're a top notch in one field :D
 
@AnttiHaapala because you spend too much time on painting the bike shed and don't get to concentrate on the fun stuff
 
yeah but speeding up python with C is fun
instant gratification
 
sure, but my scenario was specializing in C and basically demoting Python to your second or third language
again, not what I would prefer, but obviously there are people who feel quite the opposite
 
I wouldn't like that
I like solving problems, not producing new :D
 
7:37 AM
Cbg
@AnttiHaapala is pypy a dead end, do you think?
 
Cabbage!
 
Cabbage!
 
8:06 AM
sxcole.com/2016/05/22/… finally someone is using data for the public good.
 
> Contrary to popular belief, burritos do not merely exist in 3 dimensions. They transcend the physical limitations of space.
 
8:55 AM
@RobertGrant undecided.
the fact that they cannot get python 3 support beyond 3.2.5 done is a bit alarming
@IljaEverilä döner
 
@AnttiHaapala kebab?
 
9:10 AM
as in "döne"
 
@AnttiHaapala huh, yeah
 
On that last note - there was a great blog written by the guys that did backwards compatibility for Windows as it went through the ages, but I've had a google, and can't find it - anyone remember what it was called? Really great blog, talked about how ensuring backwards compatibility for stuff from 15 years ago was one of the reasons Windows ME sucked.
 
10:15 AM
Hm yeah I've read something like that
 
@AnttiHaapala I have tried to use Windows APIs. They are as he describes. shudders at the memory. The documentation. Those wierd, indecipherable structures. Eugh.
 
@Withnail this?
 
Ah, yes - it was the one linked from there - weblogs.asp.net/oldnewthing (404 now) :( :(
That would explain why I couldn't find it though
aha
 
> Raymond Chen writes, "I get particularly furious when people accuse Microsoft of maliciously breaking applications during OS upgrades. If any application failed to run on Windows 95, I took it as a personal failure. I spent many sleepless nights fixing bugs in third-party programs just so they could keep running on Windows 95."
 
Thanks!
 
10:18 AM
Sure
 
I'm up to the bit where Windows changes its memory management code to accommodate a bug in SimCity iff SimCity is running. Wow.
 
It's such a fascinating read
 
Yeah it's cool
 
It's right up there with 'Dragonfly - the story of Mir' for sheer 'what the...' moments, imo.
 
> Two new web applications, Gmail and Oddpost
:D
I was on oddpost ~2003/4. I loved it.
That's what made me sure that my dev job at the time, developing some arcane and poorly featured web interface for our bespoke mail server was a sitting duck.
That's a very interesting article.
 
10:40 AM
yeah, but that just proves that open source is the way to go
if you do not have source, then you're screwed.
 
10:50 AM
You won't get anything other than open source love from me. You might be able to bait others ;)
 
or certainly, if you're going to be in a walled garden, you just need to keep building the walls higher...
and that comes with practical limits. Sooner or later it comes crashing down.
 
11:11 AM
Hah - just found some oddpost.com source code for their gXmlSubjectOMatique= still live on yahoo.com. What a strange place the internet is. I quite like bernard cribbins for president of the universe as a suggested email subject.
 
@AnttiHaapala ping!
Do you know what master and slave represent, here?
 
11:33 AM
I do
@thefourtheye master is the "controlling end" that takes keyboard commands, slave is the "towards application program" end
 
I quite like this article on medium.com How Technology Hijacks People’s Minds — from a Magician and Google’s Design Ethicist. Of course I'm aware of the irony of having read it and posting it here.
 
when for exmaple you ssh, the sshd process will hold on to the pty master, and the applicationhas its controlling terminal, stdin, stdout etc set to the slave
 
@AnttiHaapala So, my application would be writing to master fd and the program will read from its stdin and my application would read the slave fd to get the result?
 
if you want program X to think it has interactive terminal, yes, that one would be connected to the slave
@thefourtheye see that as an example
 
Thanks :-) I am going through it now
 
11:38 AM
the intercept part has most of the tty code
it is a command colorer, you can even color top output
 
 
1 hour later…
1:02 PM
Morning cabbage.
 
afternoon
 
Morning everyone
Amazon Launchpad sometimes has some okay things
 
1:20 PM
They should put that on the site as a testimonial.
"Sometimes has okay things." - Random talking crow from Boston.
 
> The Seaweed Bath Co. Detox Cellulite Bar Soap
Yup, definitely what I need.
 
cabbage
 
1:35 PM
I noticed one of the products on launchpad was made by the group of software engineers downstairs
 
DSM
Morning Queen Victoria's birthday (observed) cabbage for all.
 
cbg DSM
 
@DSM do you start at NumberCorp today?
 
DSM
@Ffisegydd: no, here we spend the day honouring Her Majesty. I start tomorrow.
 
1:50 PM
Side project I'm working on has asked me to do some web design/css. Literally it is this:
I am literally pawing the keyboard and trying to make it do the needful.
But it's not. It's not doing the needful. I don't even know what the needful is.
 
DSM
Hey, I saw that "but I like it". By the end of the year you'll combine your new loves and give up data science to become a full-time Java webdev.
 
I had the wrong meme.
 
DSM
Suuure.
 
I can handle all the JS side of it fine, that's just logic and wizardry.
XML also makes me sad.
 
2:21 PM
Redux is actually super great, but for some reason, I feel like the game industry has been using something like this since like, the early 90s
 
Cabbage
 
Morning, glorious PM 2Ring
 
Hi, crow-man.
 
Guess it's evening/night for you @Pm2
 
Yes, it's very early morning here - 12:25AM
 
2:25 PM
I'd guess morning by now.
Kevin'd.
 
@PM2Ring Straining your eyes? Go sleep :-)
 
I saw this odd question yesterday stackoverflow.com/questions/37379187/… I'm trying to figure out what the yam his employer is going to do with that ridiculous file of random numbers. Maybe I'm just being overly suspicious, but this comment makes me think it's for some sort of inept cracking script:
@TankorSmash Client said it's about a FB app , for verification code. Don't know more, I just have to do this. — GLHF 18 hours ago
 
That's sad Don't know more, I just have to do this
Kinda my situation a few days back.
 
I was going to suggest using a simple Linear Congruential PRNG, or maybe a Linear Feedback Shift Register. But I don't want to help script kiddies.
 
Ah, the dangers of letting your client micromanage technical specifications.
 
2:39 PM
OTOH, it motivated me to refresh my memory about LFSRs, and in the process I stumbled across this little gem: stackoverflow.com/a/3094476/4014959
 
@Kevin Insisting on a dashed line eh? Even though it doesn't work on Windows! You should tell that Kevin that his demands are too much.
 
"random numbers? Sure thing, I can do that in 30 seconds" "great. Just write a text file of a billion numbers and pick one at random from that, right?" "er, no, the usual way is to--" "look, who's the one paying here?"
 
The proper (and unfortunately probably incorrect) response to that is "Yes. You're paying. You're paying me because you can't do what I can and because I know what I'm talking about."
 
@Kevin I think it's probably a case of the blind leading the blind. THe OP still hasn't explained why they need to store this giant list rather than just generating number as they need them. OTOH, I guess they don't realise that it's possible to generate a pseudorandom non-repeating sequence without shuffling a list.
 
Dashed line bug report epilogue: the person working on the ticket read the chat room transcript where I effectively said "they'll probably pass the buck to the TK team" and sassed me about it.
 
2:42 PM
hahahahahahahaha.
 
I keep forgetting that people other than us can read this.
 
Ain't nobody here but us... and thousands of lurkers. :)
 
I acknowledge the fact consciously, but my animal hindbrain doesn't recognize the possibility of consequences from that fact.
 
@Kevin Lol, What did they do? Did they send you a message or something?
 
I like to think that their response was something along the lines of "Think we'll pass the buck eh!? How dare you! No respect for us core devs! Now. This is actually an issue with Tk, you should go raise the report with them."
 
2:45 PM
They said:
> "Not our fault. Try reporting this to the Tcl team" ;-)
>
> In any case thank you for your report Kevin.
The bit in quotes is exactly what I wrote in here
A light sassing. 3/10 intensity.
 
And yet, I'd imagine you'll be scarred for life.
 
Ah, there's a smiley at the end. So it's a light sassing indeed.
 
I'm glad the smiley is there or else I'd assume that I had been added to a Seinfeld-eque list.
 
for user in sopython:
    cbg(user)
 
I was going to provide a link to the synopsis of the Seinfeld episode where Elaine gets put on a secret blacklist by her doctor that causes all medical workers to not take her seriously, but searching for "seinfeld list" understandably returns a lot of irrelevant results.
 
2:49 PM
cbg(@MattDMo)
 
has never seen Seinfeld
 
Well, there's this one episode where Elaine gets put on a secret blacklist by her doctor that causes all medical workers to not take her seriously. That's all you need to know for this particular conversation.
 
That Elaine eh!?
 
That is so Elaine.
 
The problem with Elaine is that she just tries to walk it in to the doctors.
 
2:52 PM
Ah ha, found it.
"The Package" is the 139th episode of the sitcom Seinfeld. This was the fifth episode for the eighth season. It was first broadcast on October 17, 1996. == Plot == Elaine cannot receive medical treatment for her rash because of a reputation as being a "difficult" patient. Kramer offers Jerry a method to get a refund on his stereo that is two years out of warranty. George discovers that Sheila (Heather Campbell), a clerk at the photo store, is looking at his pictures. Jerry refuses delivery of a package with no return address. George thinks that Sheila has stuck a revealing picture of herself in...
 
@Kevin It's a festivas miracle!
 
Festivus does not officially end until the head of the household has been pinned.
Ah ha ha, the google result for "festivus" has an aluminum pole running down the side of the page.
 
Classy flag there.
 
I couldn't catch that. Perhaps I need to learn some "Kevin" skillz
 
You didn't miss much.
I'd go so far as to say that your life is better for not seeing it.
 
3:04 PM
Hah, Then good that I did not see it.
 
GH is 500ing. The end is nigh. The Closed Source Brigade has struck.
 
How can I say "You never return anything, so your function doesn't return anything" without sounding snarky?
 
That isn't snarky.
 
DSM
You can decrease perceived snark by reducing the symmetry.
 
Try to frame it like you and OP are on the same side, fighting against the madness that is dynamic typing. "If Python required you to specify the return type in the function header, these None-returning problems would be detected at compile time. But noooooo, they had to go and be different and weird"
 
3:11 PM
"Let me paint you a word picture - you're not returning anything, you idiot."
 
I went with "Well, currently you're not returning anything from any of your functions. So it's always going to be None. It sounds like you may need to reread the docs on how functions work."
 
Python: 3.0 You Can (Not) Return
(note to self: withhold making obscure anime references until davidism is in the room)
 
Is there a dupe for "If you don't return, nothing returns"?
 
I remember spending some time shopping around for a canonical target for "q: why is my recursive function not working? a: because you didn't return anything in the recursive case", but I don't recall if I ever found something satisfactory.
 
I feel that you could have made a recursion joke then but you didn't. I'm not mad, I'm just disappointed because I feel that you could have made a recursion joke then but you didn't. I'm not mad, I'm just disappointed...
Behind The Scenes [SOPYTHON GOLD MEMBERS ONLY]: I actually wasn't going to make my own recursion joke then, I was just going to leave it at "I'm just disappointed.".
 
3:20 PM
I have discovered a truly marvelous recursive joke, which this margin is too narrow to contain. Or any margin, for that matter, as it is infinitely long.
 
We code in Python though so it can only go to 1000.
 
KevinScript goes to 1100.
 
That's just madness.
 
@MorganThrapp I'd say that None isn't nothing, but we had that conversation a week or so ago...
 
@PM2Ring Heh.
 
3:22 PM
Many Bothans died to bring us these extra 100 layers of call stack.
 
3:41 PM
@Kevin it's ok, I'm here to appreciate your reference now
I still haven't watched 3, I should do that.
 
My friend, who is way more into Evangelion than I am, showed me something which I assume is 3.
 
For all the fancier graphics, they didn't manage to make the story any more clear. Maybe that's the point.
But man does it look good.
 
As long as there are gratuitous, occasionally non-euclidean fight scenes, I'm happy.
Ok, maybe I didn't see 3. The last thing I remember for sure is hover for spoilers. That matches up with the end of 2.
Whoops, there was a post-credits scene I missed. Guess I gotta watch the whole thing again.
 
4:01 PM
Do we have a cannonical dupe for this? I couldn't find anything, but it seems like we should.
 
0
Q: Python TypeError: 'str' does not support the buffer interface

KyleI have the below code that was working fine and then started throwing this error. I have a csv file that I am trying to write one row to. While other solutions involve converting things to a byte string first, since I'm working with a csv, I'm not sure I can do that. Code: def saveFile(): w...

 
Perfect. Hammer that one?
 
Done :)
 
user559633
4:16 PM
what's up, nerds?
 
Cbg!
Plz explains:
class UniWat(object):
	def __repr__(self):
		return u"€".encode("utf8")

wat = UniWat()
a = dict(wat=wat)

# This will work fine
print dict(wat=u"€".encode("utf8"))

# This won't - assumption is ascii in repr?
print unicode(a)
 
> wat
Nice name for a variable
 
:D why thank you
 
I really can't tell what you're trying to show in that example.
Can you make a clearer one?
 
DSM
The repr stuff is a red herring. The same would happen if you just did s = "\xe2\x82\xac"; print unicode(s).
 
4:21 PM
It does vaguely remind me of something to do with what repr expects compared to str. Also, what version?
 
Trying to work out why DjangoRQ is crapping out when trying to log a completed task
It's printing out a dictionary where a value's repr is returning a utf8 encoded bytestring
But it fails due to UniDecodeError, so presumably it's trying to ascii decode the bytestring
class UniWat(object):
	def __str__(self):
		return u"€".encode("utf8")

	def __repr__(self):
		return str(self)

wat = UniWat()

will_break = dict(wat=wat)
will_be_ok = dict(wat=u"€".encode("utf8"))

# This won't - assumption is ascii in repr?
print unicode(will_be_ok)
print unicode(will_break)
Is that clearer? In both cases trying to represent a dictionary as unicode. In the OK case the value is a bytestring literal where the value is utf8 encoded. In the second case it's an object whose repr returns a utf8 encoded bytestring. In the second case it doesn't work however as it's trying to decode as ascii seemingly
 
DSM
Again, this has nothing to do with dictionaries or reprs. In both cases you're trying to decode a bytestring as ascii. In one case, that's possible, and in the other, it's not.
>>> a = "hi"
>>> b = '\xe2\x82\xac'
>>> unicode(a)
u'hi'
>>> unicode(b)
Traceback (most recent call last):
  File "<ipython-input-90-a6ea91218dce>", line 1, in <module>
    unicode(b)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
By contrast:
>>> unicode(a, "utf8")
u'hi'
>>> unicode(b, "utf8")
u'\u20ac'
>>> print unicode(b, "utf8")
€
 
DSM
4:47 PM
@vaultah: aargh, I was just going to link to that!
 
:P
 
cbg
Anyone know how I can view a .explanation file
 
@Dominico909 probably with a tool used to view that type of file. What does this have to do with Python?
 
@davidism It doesn't but I don't know how to search it since any results just return an actual explanation of a file extension and not what .explanation is
 
This is the Python room.
 
4:50 PM
Okay, I apologize, but people ask questions about where to get certain rums so I thought it wouldn't be too crazy to ask about something pertaining to computers...
 
You can view any file by opening it in notepad. Hope this helps.
I just made a file called data.filesWithThisExtensionCannotBeReadByNotepad and I opened it in Notepad and it worked. Truly a mighty program.
 
@Kevin It's encrypted so I guess I gotta figure that out ahaha
 
Computers nowadays! What will they think of next?
 
DSM
Use Notepad++ instead. It's got Kevin Code(TM)!
 
Have they invented sliced bread yet? I bet that would be pretty good.
@DSM Oh yeah, I forgot that I tainted it with my vile presence.
Something to do with keyword highlighting in Python 3...
 
4:57 PM
@AnttiHaapala Remember the pty thing I pinged about earlier?
That was for one of the Node.js PRs only.
Can you check if this is okay, when you find time?
 
04:00 - 17:0017:00 - 00:00

« first day (2046 days earlier)      last day (2902 days later) »