code logs -> 2014 -> Mon, 27 Jan 2014< code.20140126.log - code.20140128.log >
--- Log opened Mon Jan 27 00:00:38 2014
00:24 gnolam_ [lenin@Nightstar-usbajb.cust.bredbandsbolaget.se] has joined #code
00:24 gnolam [lenin@Nightstar-usbajb.cust.bredbandsbolaget.se] has quit [NickServ (RECOVER command used by gnolam_)]
00:24 gnolam_ is now known as gnolam
00:24 mode/#code [+o gnolam] by ChanServ
01:02 NSGuest45256 is now known as JustBob
01:02 Derakon is now known as Derakon[AFK]
03:06 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [[NS] Quit: Program Shutting down]
03:54 Turaiel[Offline] is now known as Turaiel
05:02 Red_Queen [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
05:08 thalass is now known as Thalasleep
05:09
<@froztbyte>
http://www.indiegogo.com/projects/mission-bit-spring-2014-semester
05:09
<@froztbyte>
that's a cool idea
05:09
<@froztbyte>
get people who actually know what's potting to do the teaching
05:49 RichyB [RichyB@Nightstar-c6u.vd5.170.83.IP] has quit [[NS] Quit: Gone.]
05:52 RichyB [RichyB@Nightstar-c6u.vd5.170.83.IP] has joined #code
06:28 ErikMesoy|sleep is now known as ErikMesoy
06:34 Red_Queen [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
07:34 Turaiel is now known as Turaiel[Offline]
07:40 AverageJoe [evil1@Nightstar-fb1kt4.ph.cox.net] has joined #code
07:43 celticminstrel [celticminst@Nightstar-mhtogh.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
08:28 Erik [8f610223@Nightstar-qtq4f2.mibbit.com] has joined #code
08:30
< Erik>
My coworker threatens to rewrite my code to include regexes because I used Python's core "if string in string" feature instead. He says regexes are the right way to do it. :V
08:31
<@froztbyte>
is this the same coworker who was getting high on objects?
08:31
< Erik>
Yes.
08:31
<@froztbyte>
sounds like someone that needs to meet a bus
08:32
<@froztbyte>
anyway, have fun :D
08:32
<@froztbyte>
there are plenty of stuck-in-the-past folks like that
08:32
<@froztbyte>
"this is the way. there is no other consideration."
08:33
<@froztbyte>
(I'm not saying be careless in how you write your code, mind you. it's a fine balance)
08:35
<@Shiz>
people who start up a regexp engine for trivial match cases are the worst kind of hitler
08:35
< Erik>
Well, my first draft was careless and included too many things in the results, but his first regex was arguably worse in that it excluded some results that should have been in. :V
08:35
<@Shiz>
next thing you know you'll be parsing HTML with regexp
08:36
< Erik>
Shiz: We are worryingly close. I am parsing an XML file. >_>
08:36
<@Shiz>
why don't you use bs4?
08:36
<@Shiz>
it's pretty great for parsing XML
08:36
<@Shiz>
especially *broken* XML
08:36
< Erik>
Admittedly, I parse the file proper with Python.ElementTree, then look at individual attributes with string in string, which is where he wants the regexp.
08:36 AverageJoe [evil1@Nightstar-fb1kt4.ph.cox.net] has quit [[NS] Quit: Leaving]
08:36
<@Shiz>
oh right
08:37
< Erik>
I have a guarantee that the XML is well-formed.
08:37
<@froztbyte>
Python.ElementTree?
08:37
<@froztbyte>
not lxml?
08:37
<@Shiz>
^I'd also agree there but whatever works
08:37
<@Shiz>
I personally like bs4 with an lxml backend
08:37
<@Shiz>
because bs4 allows you to access the elements ridiculously easily
08:37
<@froztbyte>
no, I mean
08:37
<@froztbyte>
what the hell is Python.ElementTree?
08:38
< Erik>
http://docs.python.org/2/library/xml.etree.elementtree.html
08:38
<@Shiz>
xml.etree.ElementTree
08:38
<@Shiz>
presumably
08:39
<@froztbyte>
yeah, that's fine
08:40
<@froztbyte>
I've never seen that kind of naming, so it was rather confusing ;)
08:40
<@Shiz>
hey, whatever works right
08:40
<@froztbyte>
no, not really.
08:40
<@froztbyte>
specificity is a good thing.
08:40
< Erik>
Yeah, that naming was me being lazy about something that comes with a convenient import statement and not requiring special installation
08:41
<@froztbyte>
haha
08:41 * Erik less than threes that Python comes with so much batteries included.
08:41
<@Shiz>
main reason I use bs4 is because I'm an incredibly lazy fucker
08:42
<@Shiz>
and that I can parse http://stream.salty-salty-studios.com:8000/main.mp3.xspf
08:42
<@Shiz>
and get the current track by just doing data.trackList.track.title.string
08:42
<@Shiz>
fuxk xpath :p
08:42
<@Shiz>
although data.title on its own would work
09:15
< Erik>
gahhh, naming. python.re has a matches.group() function and a matches.groups() function that return very different things.
09:25
<@Shiz>
of course~
09:25 * Erik figures out to convert Perl regex /\b into Python regex \b
09:25
<@Shiz>
PyOpenGL currently has a pretty interesting branch
09:25
< Erik>
See, now I'm having two problems
09:25
< Erik>
Originally my problem was to look for a two-letter code in my title
09:25
<@Shiz>
it automatically generates OpenGL bindings from Khronos' XML OpenGL documentation
09:26
< Erik>
Then my coworker decided to use regex, and my other problem was looking for the problem with /\b
09:26
< Erik>
(word boundary)
09:30
< Erik>
For goodness' sake, if I'm doing a case-sensitive search for "TLA" in a list of titles using string in string, is it really such a problem that I get 3 or so "ATLAS" results that need to be manually pruned? (and incidentally I could fix that with string in string.split())
09:32
<@Shiz>
yes, it is
09:40
< Erik>
I suppose so. And hence I enter the world of regex and its practically read-only character strings like ')}x?$/"
09:40
< Erik>
Admittedly this is a bit unfair because it's the closing end of a line, but at least in Python the worst you'd see of that sort would be more like ]))])
09:54 * TheWatcher drops the Owl Book on Erik
09:54
<@simon_>
owl book?
09:54
<@TheWatcher>
Mastering Regular Expressions
09:54
<@TheWatcher>
http://shop.oreilly.com/product/9780596528126.do
09:54
<@simon_>
I've never read a book on regexes. but then again, I rarely read books on programming.
09:59 * Erik shuffles the Owl Book off to the side and marks it "three problems". :P
10:03
<@simon_>
Erik, http://xkcd.com/1171/
10:21 * TheWatcher meh
10:37 froztbyte [froztbyte@Nightstar-frrora.za.net] has quit [Ping timeout: 121 seconds]
10:39 froztbyte [froztbyte@Nightstar-frrora.za.net] has joined #code
10:40 mode/#code [+o froztbyte] by ChanServ
11:24
< abudhabi_>
Is there any way to edit the signature in Gmail in source mode? I want to use HTML, but the only option so far has been to copy-paste from a browser.
11:24
< abudhabi_>
And this is annoying because it converts relative table dimensions into absolute.
11:27
< abudhabi_>
Nevermind!
11:27
< abudhabi_>
That was a browser-dependant issue.
11:27
< abudhabi_>
(Chrome converted the dimensions into absolute, Firefox kept them relative.)
11:29
<@TheWatcher>
One of these days I intend to get one of those squigy stress toy things with the logos of the major browsers on it in various places
11:30
<@TheWatcher>
So every time I have to deal with their subtle and hilarious incompatibilities, I can crush and punch and twist and hammer it on the desk
11:31
<@TheWatcher>
Actually, I'll probably need a crate of them.
11:32 * Erik sads at how Google seems on course to fuck up their browser the way Opera began fucking up theirs a few years back
11:37
< abudhabi_>
What did they do now?
11:41
< Erik>
Began cramming in G+ and "remembering"/guessing your identity and cologins various places.
11:41 * TheWatcher .. hasn't run into that
11:42
<@TheWatcher>
(but then I don't run chrome logged in anyway)
11:42
< abudhabi_>
Neither do I.
11:42
< Erik>
My workplace uses gmail for work accounts.
11:43
< Erik>
Google is "smart" enough (in the sense of "smart" quotes) that it will try to associate even the Chrome on my home computer with my workplace mail account sometimes. >_>
11:45
<&McMartin>
unatco.org
11:45
<@TheWatcher>
mischan?
11:46
<&McMartin>
Oops, yes
11:47 * Tarinaky grumbles about the common/laptop area being filled with smelly second years doing their group project.
11:47
<@Tarinaky>
So no laptop recharging room for the rest of the week :/
12:07
<@froztbyte>
..laptop area?
12:09
<@TheWatcher>
I always thought the laptop area what somewhere between the knee and the lower abdomen.
12:10
<@Tarinaky>
One of the computer labs has an area with no computers but instead sofas and power bars.
12:10
<@Tarinaky>
For you to use your laptop.
12:11
<@Tarinaky>
Because otherwise people unplug the computers in the lab.
12:11
<@TheWatcher>
...
12:11
<@TheWatcher>
They don't have, like, spare sockets in the lab? o.O
12:11
<@Tarinaky>
They do.
12:12
<@Tarinaky>
The issue is the lab is booked.
12:12
<@Tarinaky>
For second year group projects.
12:12
<@Tarinaky>
It's their 'crunch time' week where they're expected to work 9-5.
12:13
<@TheWatcher>
Go find the second year tutor. Ask him if you can sit in his office and charge your laptop.
12:14
<@Tarinaky>
I should probably go to the library.
12:14
<@TheWatcher>
That'd work too, I guess.
12:14
<@Tarinaky>
The issue there is that food isn't allowed in the library.
12:15
<@Tarinaky>
(food is tolerated in the sofa area... as long as people don't start ordering pizza for delivery there again)
12:16
<@Tarinaky>
So I'm currently just sat in a cafe.
12:16
<@Tarinaky>
Trying to look like a normal human being.
12:19
<~Vornicus>
That last bit you should stop, it doesn't work out for anyone
12:21 Vornicus [Vorn@Nightstar-sn7kve.sd.cox.net] has quit [Connection closed]
12:27
<&jerith>
Tarinaky: I never had a laptop at university, but I used to sit with friends in the middle of a corridor somewhere because there was a power socket.
12:28 * Tarinaky nods.
12:28
<@Tarinaky>
Laptops're pretty much essential kit for Computer Science students these days.
12:28
<@Tarinaky>
And common-enough in other departments that if people had to sit in corridors there'd be chaos.
12:29
<&jerith>
Tarinaky: They weren't a decade ago when I was a student.
12:29
<@Tarinaky>
I know.
12:29 * jerith grins.
12:29
<@Tarinaky>
Hence 'these days'.
12:29
<@Tarinaky>
I was trying not to draw attention to your age.
12:29
<&jerith>
There was a great spot at the end of the corridor past the high voltage lab in the EE building that had two sockets and some boxes to sit on.
12:30
<&jerith>
Tarinaky: I was. :-P
12:30 * Erik managed to sit in corridors too and is about the same age as Tarinaky...
12:30
<@Tarinaky>
Well, go on then. Tell us a story granddad about debugging your punchcard tic-tac-toe program when you could only get run-time for it once a week.,
12:31
<@Tarinaky>
Erik: You graduated though.
12:31
<@Tarinaky>
I had to go back.
12:31 * TheWatcher has this mental picture of CS students huddled around power sockets, like fireflies around isolated lamps...
12:31
<&jerith>
Tarinaky: I'm not *that* old. :-)
12:32
<&jerith>
I just had to use public labs and carry around a 64mb USB stick with PuTTY on it to get anything done.
12:32
<@Tarinaky>
Ah luxury! When I were a student we could only get runtime for our program once a month! And we had to feed it over t'phone line.
12:32
< Erik>
TheWatcher: For me it was more of a slavsquat than a huddle.
12:33
<@Tarinaky>
Well when I were a student we'd only get runtime one week after the project deadline.
12:33
<@Tarinaky>
And we had to write it uphill, both ways, in the snow.
12:33
<@Tarinaky>
But you tell students today that and they don't believe you.
12:34 * jerith returns to trying to write code in a room full of other people and at least two different conference calls.
12:34
< Erik>
You got to write programs? When I was a student, we had to ask the teacher if he'd write them for us! And there were thirty students, three classes a week, all sharing one whiteboard and no eraser.
12:34
<&jerith>
I hate Mondays.
12:34
<@Tarinaky>
And now for something completely different. A man with a universal turing machine, up his brother's nose.
12:36
< Erik>
That reminds me. Anyone who invokes "universal turing machine" or "turing complete" in a computer argument should be sentenced to hard labor.
12:36
< Erik>
Specifically, the labor of digging ditches with a spoon while proving the turing-equivalence of a spoon to a shovel, and long division with Roman numerals.
12:38
<@Tarinaky>
Well that's why we have concepts like P and NP... and Big-O.
12:38
< Erik>
One of those things that should be an xkcd but isn't.
12:39
<@Tarinaky>
But Big-O confuses people because it requires limits and compscis get scared by any math that involves letting Epsilon greater than 0 be given.
12:43
<@Tarinaky>
The difference between compsci and maths is that compscis, as a rule, are quite happy to write and maintain programs that perform integer division over roman numerals.
12:46
<@Tarinaky>
I'm gonna move on to a lecture before I start gibbering any more.
12:48
< Erik>
Gibber!
12:50
<@Tarinaky>
Or I would if it weren't the the class already in there.
12:50
< RichyB>
Erik, eh, "$x is Turing-complete" is actually really useful
12:51
<@Tarinaky>
Turing-completion is, basically, the only definition of computation we have that's any good. (well, except for all the ones that're equivalent like Lambda calculus but that's pedantry)
12:51
< RichyB>
in arguments of the form, "No, we should not use $x for applying styling rules to documents, because $x is Turing-complete and I don't want my document preprocessor to potentially run forever."
12:52
< RichyB>
Tarinaky, btw, there's an equivalent, easy definition of big-O that doesn't involve limits, or calculus.
12:52
<@Tarinaky>
RichyB: IDK. I think that's false-security. You can do malicious code with sub-turing computation.
12:53
< RichyB>
Just a few little EXISTS and FORALLs.
12:53
< Erik>
RichyB: I see your point. I was thinking of arguments that go along the lines of "What do you mean you need (new language)? Didn't Turing prove that you can do all that in (old language) perfectly well since it's a turing-complete language?"
12:54
< RichyB>
f â O(g) â ân, c. âx > n. f(x)Ãc > g(x).
12:55
< RichyB>
Erik, I agree that those arguments are silly. IMO, complexity classes get really useful when you want to talk about restricting power.
12:55
< Erik>
What's a better way of describing that silly class of arguments?
12:56
<@Tarinaky>
Stupid Language Argument.
12:56
< Erik>
It's not exactly a Big-O matter that e.g. Python lets you pass functions directly, Java requires you to pass the function wrapped in an object and then call the object's DoStuff() method
12:57
<@Tarinaky>
Anyone who says "But X is turing-complete, why would you want to use Y?" is a first year student or less and not to be taken seriously.
12:57
< RichyB>
Erik, the matter is expressiveness. The stupid argument against it is the Turing-tarpit. :)
12:58
<@Tarinaky>
Big-O is the difference between diging a hole with a spoon, a shovel and a stick of dynamite.
12:59
<@Tarinaky>
As the volume of the hole increases, you need cubically more spoonfulls. Shovels are better designed for digging, so it only takes quadratically as many shovel-fulls.
13:00
<@Tarinaky>
And the stick of dynamite is either O(1) or O(n) depending on how big the stick is.
13:00
<@Shiz>
what the fuck am i reading
13:01
<@Tarinaky>
Sorry :p
13:01
< Erik>
Shiz: You are reading the Koran in Arabic.
13:01
<@Shiz>
i should go out and buy a new comb
13:01
<@Shiz>
rip old comb 2006-2014
13:01
< RichyB>
Shiz, wtf
13:02
< RichyB>
I am incapable of imagining successfully keeping a comb that long without losing it first. :|
13:02
< Erik>
RichyB: Place comb in bathroom. Use comb only in bathroom. Return comb to shelf immediately after using comb. That's how I've kept a comb for about a decade now.
13:03
< RichyB>
Insufficient vanity.
13:03
< Erik>
Huh?
13:04
< RichyB>
"Use comb only in bathroom" is mutually incompatible with being as pretty as I am.
13:04
<@TheWatcher>
And that explains why your efforts to keep a comb are in vain
13:05
< RichyB>
Yes.
13:06
<@Tarinaky>
Agreed.
13:06
<@Tarinaky>
My brushes tend to migrate in a common pattern.
13:06
< Erik>
RichyB: Now I want pics.
13:06
<@Tarinaky>
WHen I run out I have to buy a new one to find where the old ones ended up.
13:09
< RichyB>
I'd take one now but my webcam appears to have shat itself.
13:10
< RichyB>
Ah, there it is.
13:13
< RichyB>
Erik, excuse the dead eyes http://mitzi.robarr.co.uk/1/pretty01.jpg http://mitzi.robarr.co.uk/1/pretty02.jpg I have recently become a member of the undead horde.
13:14
< Erik>
Are you auditioning for The Lion King?
13:14
< RichyB>
I got fed way the fuck up with cutting my face open every morning⦠about two years ago.
13:15
< Erik>
http://flickfeast.co.uk/wp-content/uploads/2010/06/lion-king-scar_l.jpg
13:15
< RichyB>
Yes, that too.
13:15
< RichyB>
Heh! I love that guy. Disney villains are almost always better people than the heroes.
13:16
< Erik>
And they always get the good lines.
13:17
< Erik>
I watched the Hercules/Aladdin crossover episode recently, a friend of mine remarked that the plot read like a checklist of crossover tropes, and I responded with "well, I liked the thirty minutes of heroes fighting things and villains having all the good lines."
13:17 * TheWatcher eyes delib.net
13:19
<@TheWatcher>
Y'know, there's something vaguely hilarious about seeing homeland security's logo on a page discussing 'digital democracy software', whatever that is.
13:19
< Erik>
(Jafar shows up in the Greek Underworld, makes deal with Hades. Hades sends his minions after Aladdin, hero fighting things, Jafar goes after Hercules, hero fighting things, Hades and Jafar come up with a CUNNING PLAN to set the heroes against each others, heroes fight things...)
13:25 Syka [the@Nightstar-7k6.92b.131.1.IP] has joined #code
13:28
< Erik>
http://downworthy.snipe.net/
13:45
< RichyB>
yessss
14:30 Thalasleep is now known as thalass
14:33 Red_Queen [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
14:34 Erik [8f610223@Nightstar-qtq4f2.mibbit.com] has quit [[NS] Quit: Going home.]
14:56
<@Azash>
http://http2.github.io/http2-spec/#GTFO
15:00
<@TheWatcher>
Ahahah
15:01
<@TheWatcher>
that's awesome
15:02
< abudhabi_>
Indeed.
15:03
< abudhabi_>
Hmm. What are some good options for remote login software? I want something reasonably secure and easy to use.
15:03
< Syka>
like, desktop?
15:03
< Syka>
logmein is okay
15:03
< abudhabi_>
I am currently using LogMeIn, but they went paid-only.
15:03
< abudhabi_>
Oh, yeah, I want free.
15:04 celticminstrel [celticminst@Nightstar-mhtogh.dsl.bell.ca] has joined #code
15:04 mode/#code [+o celticminstrel] by ChanServ
15:05
<@Tarinaky>
abudhabi_: ssh?
15:05
<@TheWatcher>
Why not just tunnel RDP over SSH?
15:06
<@TheWatcher>
(Assuming you have a windows with RDP server on it. If you're using linux, you can just forward the X11 display over ssh, or better still use NX)
15:06
< abudhabi_>
The client machines are Win7. My machine is WinXP/Debian.
15:07
<@Shiz>
abudhabi_: teamviewer?
15:07
<@Tarinaky>
So. I turns out that my supervisor (for my project) talks about changing compiler in terms of Eclipse project types.
15:07
<@Tarinaky>
And changing the project type.
15:08
< abudhabi_>
Hmmmm.
15:08
< abudhabi_>
Free for private use. Pity. This is actually for the company I work for.
15:10
<@Tarinaky>
This concerns me as it means we're really not on the same page in terms of communicating.
15:23
<@gnolam>
Erik: hee
15:24
< ErikMesoy>
gnolam: glad someone appreciates it. me, I never see upworthy in person, only things making fun of it
15:25
<@gnolam>
Bloody everything is using those kinds of headlines nowadays.
15:25
<@gnolam>
And I hate them.
15:25
<@gnolam>
Sadly, that plugin appears to be for Chrome only.
15:25
< ErikMesoy>
Find better everythings.
15:36
< abudhabi_>
Is Chrome Remote Desktop good?
15:43 iospace is now known as frozenspace
15:44
< ErikMesoy>
I think so
15:44
< abudhabi_>
You use it?
15:45
< ErikMesoy>
I have.
15:54
< abudhabi_>
It seems to be pretty straightforward from a tutorial video.
15:54 Typherix [Typherix@Nightstar-n91qrf.lnngmi.sbcglobal.net] has quit [Ping timeout: 121 seconds]
15:56 celticminstrel [celticminst@Nightstar-mhtogh.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
16:00 Typherix [Typherix@Nightstar-n91qrf.lnngmi.sbcglobal.net] has joined #code
16:15 Syka [the@Nightstar-7k6.92b.131.1.IP] has quit [[NS] Quit: lol3g]
18:14 Kindamoody|out is now known as Kindamoody
19:56 Vornicus [Vorn@Nightstar-sn7kve.sd.cox.net] has joined #code
19:56 mode/#code [+qo Vornicus Vornicus] by ChanServ
20:38 Red_Queen [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
21:22 Kindamoody is now known as Kindamoody[zZz]
21:26 celticminstrel [celticminst@Nightstar-mhtogh.dsl.bell.ca] has joined #code
21:26 mode/#code [+o celticminstrel] by ChanServ
22:01 Turaiel[Offline] is now known as Turaiel
22:09 thalass [thalass@Nightstar-bce70i.eastlink.ca] has quit [Ping timeout: 121 seconds]
22:14
<@Azash>
http://www.theonion.com/articles/protect-personal-information-online,35036/
22:17 ErikMesoy is now known as ErikMesoy|sleep
22:40 Derakon [chriswei@Nightstar-cb57nb.ca.comcast.net] has joined #code
22:40 mode/#code [+ao Derakon Derakon] by ChanServ
22:40
<&Derakon>
formatString = "%%0%dd" % numDigits
22:40
<&Derakon>
filename = "%s.%s" % (baseName, formatString % i)
22:41
<&Derakon>
I feel dirty.
22:41
<&Derakon>
(The goal being to generate e.g. "foo.01", "foo.02", etc., but only with as many leading zeros as we actually need.
22:41
<&Derakon>
)
22:51
<~Vornicus>
ew
22:52
< RichyB>
I think that in this one case it might be better to not use sprintf. formatString = '%0' + str(numDigits) + 'd'
22:53
<&Derakon>
You may be right, but I don't think there's a non-ugly way to handle meta-formatted-strings.
22:53
< RichyB>
There isn't, no.
22:56
<&Derakon>
Also, I'm amused that I got to use a logarithm for what I would characterize as a "non-mathematical" purpose (viz determining the number of digits required).
22:58
< RichyB>
Hee. But log() is precisely a function from numbers to their widths. âº
22:59
<&Derakon>
Yep!
23:01
<@Shiz>
&Derakon â I feel dirty.
23:01
<@Shiz>
you should feel dirty
23:01
<@Shiz>
for 1) using camelcase 2) not using advanced string formatting
23:01
<@Shiz>
:)
23:02
<&Derakon>
Oh, what, I should name it "base_name" instead? :p
23:02
<&Derakon>
And ignore an entire half of the alphabet!
23:02
<&Derakon>
Er, character set.
23:02
<&McMartin>
No, you should say %{base_name}s clearly =P
23:02
<@Shiz>
yes, you should
23:02
<@Shiz>
pep8
23:02
<&McMartin>
And then do % locals()
23:02
<&Derakon>
;_;
23:02
<@Shiz>
how horrifying
23:02
<@Shiz>
( I know some code that does that)
23:02
<@Shiz>
(it's terrifying)
23:03
<&McMartin>
About the only place I'm willing to say it's not entire madness is when you're doing parameterized here documents
23:04
<&Derakon>
ISTR __import__ often relies on access to globals() at least.
23:04
<&Derakon>
Then again, if you're using __import__ then there's like, one reasonable use case~
23:04
<&Derakon>
(That being program plugins)
23:04
<@Shiz>
huh?
23:04
<@Shiz>
why would __import__ require access to globals?
23:05
<&Derakon>
Maybe I'm misremembering.
23:05
<@Shiz>
also
23:05
<@Shiz>
there's a way better way to do program plugins, writing import hooks
23:05
<&Derakon>
I definitely remember that my first attempt at Jetblade involved calling a function that wanted locals() and globals().
23:06 * Shiz has a system where if you 'import rave.modules.whatever' it'll look up the plugin in the plugin search path
23:06
<@Shiz>
in the engine VFS, but that's a different story
23:06
<&Derakon>
Shiz: but how do you know that that plugin is present?
23:06
<@Shiz>
you don't
23:06
<&Derakon>
So how do you import it then?
23:06
<@Shiz>
huh?
23:06
<&Derakon>
How does the base program know that it needs to import a plugin that it has no idea exists?
23:07
<@Shiz>
a base program should never import plugins, if it does it has dependency issues
23:07
<@Shiz>
:p
23:08
<&Derakon>
It has to gain access to the code in the plugins somehow.
23:08
<@Shiz>
yeah I get your point
23:08
<@Shiz>
I have a bit of a different situation
23:08
<&Derakon>
FWIW in the microscope control program I wrote, a specific directory is scanned on program start, and the files therein analyzed to see if they look like device driver files.
23:08 * Shiz has an engine which runs user code
23:08
<@Shiz>
and the user code loads plugins
23:08
<@Shiz>
through import
23:08
<&Derakon>
If so, they are __import__'d and objects are created.
23:09
< RichyB>
Derakon, __import__ expects to be passed globals() as one of its arguments so that it can look up __file__ from it.
23:09
< RichyB>
This is imperfectly documented.
23:09
<&Derakon>
Shiz: oh, well, if it's the user code doing the imports, that's a different story of course.
23:09
<@Shiz>
yeah :p
23:09
<&Derakon>
RichyB: righto, thanks. I didn't have the code handy to look.
23:09
<@Shiz>
RichyB: interesting
23:09
<@Shiz>
it's probably passed implicitly
23:09
<@Shiz>
cause I never passed globals() to __import__
23:09
< RichyB>
I've used this fact before in order to work around a stupid import-related bug.
23:10
<@Shiz>
Derakon: that said, you'res till right
23:10 * Shiz 's engine uses __import__ to import 'essential modules' in an early config stage
23:10
<@Shiz>
but the config used to determine that is again user code
23:10
<@Shiz>
:p
23:11
<&Derakon>
Heh.
23:11
<@Shiz>
you can think of stuff like
23:11
< RichyB>
(specifically, Python 2.4 doesn't have any other way to deliberately perform a non-local import, so it becomes otherwise "impossible" to import the global json module from a module foo.bar if a module called foo.bar.json exists)
23:11
<@Shiz>
a hook for the virtual file system that mounts an actual file system folder at /
23:11
<@Shiz>
or something
23:11
<@Shiz>
bootstrap stuff
23:11
<&Derakon>
Part of the goal of my approach was to simplify the process of adding new code to the system. So you don't need to register new modules; they're picked up automatically.
23:11
<@Shiz>
RichyB: maybe your issue is running a python version from who knows how long ago
23:11
<@Shiz>
:p
23:12
< RichyB>
(the correct solution to my problem there is actually "use a newer Python which supports proper absolute imports")
23:12
<&Derakon>
Otherwise you have to do stuff like "modify the __init__.py module in the devices directory to import your module and add it to the "modules" list".
23:12
<@Shiz>
i like my current solution a lot
23:12
< RichyB>
but there are "correct" solutions and there are solutions that don't require you to port your entire company's codebase to an incompatible version of the framework for the sake of making one tiny module more convenient
23:12
<@Shiz>
for the end user it's enormously easy
23:12
<@Shiz>
all they need to do is import rave.modules.whatever
23:12
<@Shiz>
:p
23:13 thalass [thalass@Nightstar-bce70i.eastlink.ca] has joined #code
23:13
<&Derakon>
RichyB: when I came in, the microscope was running Python 2.4, and the main reason I was hired was to diagnose and fix an irregular crash that kept experiments from running for more than, say, a couple of hours.
23:13
<&Derakon>
I never did track down exactly what was going wrong.
23:13
<&Derakon>
But upgrading to 2.5 fixed it.
23:13
<&Derakon>
(And then I later upgraded to 2.7)
23:14
< RichyB>
How much memory did the machine running it have? Python 2.4 has some memory leaks. :)
23:14
<@Shiz>
and then later you upgraded to python 3
23:14
<@Shiz>
riiiiiiight
23:14
<&Derakon>
Shiz: yeah, sure, as soon as our dependencies do. :p
23:14
<&Derakon>
RichyB: I don't recall exactly, but at least 8GB, I'm pretty sure.
23:14
<&Derakon>
(We got a new computer too...)
23:14
< RichyB>
Unlikely to be that, then.
23:15
<&Derakon>
Honestly I am so done with that code.
23:15
<&Derakon>
It's been removed from the repository, even.
23:15
<&Derakon>
It's the source of most of the "Oh my god you guys you won't believe what Sebastian did" stories I had.
23:16
<@Shiz>
I have no idea who Sebastian is but he sounds like a pleasant guy
23:17
<&McMartin>
He was a biologist put in charge of writing software
23:17
<&McMartin>
It turns out software engineering *is* a tradeskill and not an immutable law of the universe after all. Who knew?
23:17
<&Derakon>
Let me put it this way: the old program was a mess of files named e.g. "sebM.py", "sebH.py", etc.
23:18
<&Derakon>
M for motor control, E for experiment runtime, EE for meta-experiments, etc.
23:18
<@Shiz>
sounds like a mathematician programming
23:18
<&Derakon>
Every single import was done as "import foo as F", i.e. reducing the imported symbol to a single character.
23:18
<@Shiz>
reinforced ^
23:18
<&McMartin>
Wasn't sebH the module with "helpful" functions?
23:18
<&Derakon>
(Oh, "H" was for "helpful", i.e. he stuff a bazillion utility functions in there)
23:19
<&Derakon>
But by far his favorite was seb.py, which was imported via "import seb as X".
23:19
<&Derakon>
It's where he stored all the program state.
23:19
<@Shiz>
I always cry a little bit on the inside when I see a util.c/util.py/Util.java
23:19
<&Derakon>
All of it.
23:19
<@Shiz>
well
23:19
<&Derakon>
If he needed state to persist outside of a function, it got stuffed into the seb.py module.
23:19
<@Shiz>
I'm honestly not sure if that such a bad idea
23:19
<&Derakon>
...
23:19
<@Shiz>
I dislike state littered through the entire program
23:19
<&Derakon>
You have never tried to track module dependencies.
23:19 * Derakon eyetwitches.
23:20
<&McMartin>
I still can't get over naming every module after yourself
23:20
<&Derakon>
Where did this variable come from? Who needs it? What will break if I remove it?
23:20
<@Shiz>
( ââ¿â)
23:20
<&Derakon>
Answer: fuck you.
23:20
<@Shiz>
shiz_events.py
23:20
<@Shiz>
shiz_rendering.py
23:20
<@Shiz>
shiz___init__.py
23:21
< thalass>
Wouldn't proper #comments help?
23:21
<&Derakon>
HahahahahahahahahahahahahahahahaHahahahahahahahahahahahahahahahaHahahahahahahaha hahahahahahahahaHahahahahahahahahahahahahahahahaHahahahahahahahahahahahahahahaha HahahahahahahahahahahahahahahahaHahahahahahahahahahahahahahahahaHahahahahahahaha hahahahahahahahaHahahahahahahahahahahahahahahahaHahahahahahahahahahahahahahahaha HahahahahahahahahahahahahahahahaHahahahahahahahahahahahahahahaha
23:22
<&Derakon>
Ahem.
23:22
<&McMartin>
This is less of an issue with statically typed languages because you can do a type analysis of the program and generally be able to tell which "x" is actually ProgramState.x
23:22
<&McMartin>
Python... is not one of those languages
23:22
< thalass>
heh
23:22 * Shiz is depressed so little people write comments explaining the why, not the how
23:23
<@Shiz>
# Add value to list.
23:23
<@Shiz>
YES I CAN SEE THAT VERY CLEARLY MOTHERFUCKER
23:23 * McMartin is pretty firmly in the bin of "if you have to write 'how' comments the code is broken"
23:23
<&Derakon>
Well, usually.
23:23
< thalass>
At my stage "#Add value to list" is /vital/
23:23
< thalass>
But i can see how the why would be important.
23:23
<&McMartin>
With the possible exception of things where you need a paper explaining it~
23:23
<&Derakon>
Sometimes, very rarely, your code actually has to be complicated.
23:23
<@Shiz>
sure
23:24
<@Shiz>
it's just that most people never write the why
23:24
<@Shiz>
and overemphasize on the how
23:25
<&Derakon>
Why is better than how, but how is a hell of a lot better than nothing.
23:26
< RichyB>
McMartin, if you've written something that looks like http://www.coranac.com/2009/07/sines/ then by all means comment the how~
23:26 Turaiel [Brandon@Nightstar-vku52k.resnet.mtu.edu] has quit [Ping timeout: 121 seconds]
23:27
< RichyB>
or, that's a good example of a function for which you'd really want a comment explaining.
23:27
< RichyB>
also: a surprisingly good introduction to the practice of numerical approximation algorithms!
23:28
<&McMartin>
Well, yes
23:29
<@Shiz>
that said
23:29
<@Shiz>
# Find proper mount point.
23:29
<@Shiz>
if provider.relative():
23:29
<@Shiz>
mountpoint = dirname(filename)
23:29
<@Shiz>
else:
23:29
<@Shiz>
mountpoint = PATH_SEPARATOR
23:29
<@Shiz>
this isn't a 'why' comment
23:29
<@Shiz>
but I still think it's needed
23:29
<@Shiz>
:P
23:29
<&McMartin>
In such cases I will also accept "Implement algorithm detailed in (paper citation)"
23:30
<&Derakon>
I have code somewhere that references a specific revision of a Wikipedia article.
23:30
<&Derakon>
From before it got rewritten into a horrible, unreadable mess.
23:30
<@Shiz>
'Implement algorithm detailed in sine.c, Publications of FooSoft, Joe D. Hacker, 2013"
23:31
<&McMartin>
Yeah, I'm not happy about URL-based references unless they're "legitimate"~
23:31
<&Derakon>
It's just the Walking Squares algorithm. *shrug*
23:36
<@Shiz>
# Quick check to see if we need to normalize.
23:36
<@Shiz>
if path.startswith('/') and '//' not in path and '/../' not in path and '/./' not in path and not path.endswith('/..') and not path.endswith('/.') and not path.endswith('/'):
23:36
<@Shiz>
return
23:36 * Shiz thinks this line might be too long
23:36
<&Derakon>
Dude, use os.path.sep.
23:36
<@Shiz>
I would, BUT
23:36
<@Shiz>
the code isn't for the host file system
23:36
<@Shiz>
:P
23:37
<&Derakon>
Ahh, a cunning escape.
23:37 Turaiel [Brandon@Nightstar-vku52k.resnet.mtu.edu] has joined #code
23:47 Derakon [chriswei@Nightstar-cb57nb.ca.comcast.net] has quit [[NS] Quit: leaving]
--- Log closed Tue Jan 28 00:00:54 2014
code logs -> 2014 -> Mon, 27 Jan 2014< code.20140126.log - code.20140128.log >

[ Latest log file ]