« first day (1921 days earlier)      last day (3010 days later) » 

12:03 AM
I also (I think) have thomas' calculus book at my parents from my previous uni study (applied pysics) - but found that book to be slightly annoying to use.
Funny thing is, both books cover the same topics, in (almost) the same order, even using almost the same chapter titles.
 
 
4 hours later…
4:08 AM
cbg
https://gist.github.com/tuanthi/0e62d9c4f1f44e140364/revisions
how to convert this format txt file to ipynb
 
DSM
4:44 AM
@Ajay: that looks like an ipynb file as it is. I just successfully opened it as a notebook in jupyter without any problems after renaming it to have the .ipynb suffix.
 
4:57 AM
thanks @DSM
 
5:13 AM
CBG all.
 
 
2 hours later…
7:01 AM
sht
yesterday 155 rep, maybe I should have reached for 200
 
user559633
Last 20 is the hardest :)
 
7:21 AM
Hello guys,
Whats the ! in python? I mean is that an operator or sometghing?
what does this line do ?
` !../scripts/download_model_binary.py ../models/bvlc_reference_caffenet `
 
user559633
@Hossein context? it's a way to say "not" in some contexts
 
user559633
>>> 1 != 2
True
 
user559633
doesn't make sense for that line though
 
@tristan: Actually I'm trying to compile/run this snippet of code :
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

# Make sure that caffe is on the python path:
caffe_root = 'T:/Caffe/' # this file is expected to be in {caffe_root}/examples
import sys
sys.path.insert(0, caffe_root + 'python')

import caffe

plt.rcParams['figure.figsize'] = (10, 10)
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'

import os
if not os.path.isfile(caffe_root + 'models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel'):
 
user559633
the indentation is off and that's not valid syntax. i assume that's ipython and it's calling out to a shell command that's expected to be there
 
7:27 AM
yeah, thanks, if I want to contact two strings + is the way to go right?
then why would something like this give me an error ?
caffe_root+'scripts/download_model_binary.py' caffe_root+'models/bvlc_reference_caffenet'
(instead of a the relative path, Im actually trying to address a full path,
 
user559633
@Hossein what's the error? you can concat two strings with a plus sign, yes -- it's overloaded. w
 
by the way code snippets are from here, : http://nbviewer.jupyter.org/github/BVLC/caffe/blob/master/examples/00-classification.ipynb
in case you wana have a look
 
user559633
what you really want is os.path.join though
 
user559633
thanks but no thanks
 
'caffe_root+'scripts' is not recognized as an internal or external command,
operable program or batch file.
@tristan Ok, cool, trying this out now, ;)
 
7:37 AM
cbg
 
user559633
cbg
 
user559633
> typeof(1)
'number'
> 1.0 instanceof number
ReferenceError: number is not defined
    at repl:1:16
    at REPLServer.defaultEval (repl.js:248:27)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:412:12)
    at emitOne (events.js:82:20)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:210:10)
    at REPLServer.Interface._line (readline.js:549:8)
    at REPLServer.Interface._ttyWrite (readline.js:826:14)
 
user559633
javascript, but still amusing to me
 
lol
JavaScript, where nothing makes sense.
 
user559633
Just...what is this that typeof doesn't return a valid type
 
user559633
7:52 AM
this language is really "barf-y". strings are global objects, but yet don't have a prototype. i don't understand why things would be this non-standard so late into revisions of the language. or maybe it's just the built-ins: 'meow'.prototype => undefined; Object.getPrototypeOf('meow') =>[String: '']
 
user559633
anyway, sorry, i'll stop talking about javascript
 
8:15 AM
Every time you read deeply about it, you find some reason why it is what it is but still, it's weird
 
Cbg :)
 
user559633
cbg ian
 
user559633
@khajvah yeah, i understand what it's doing, i just disagree strongly
 
o/ Tristan
 
user559633
it's like a tool that exists mainly to fix problems with itself
 
user559633
8:19 AM
tristan's seventh axiom: you can gauge the quality of a language by the popularity of idioms and tools designed to work around limitations of the language itself
 
Wow - you have a list - where's the archive of the first six? This sounds like a tome with which I should become familiar.
Morning all!
 
cbg
 
user559633
cbg jrs and pm :)
 
What the yam? I just got an un-accept on an answer from Oct 2014! And the newly-accepted answer (from the same date) is broken. :( stackoverflow.com/q/26500750/4014959
 
Thought the google doodle today was Mondrian. I am shown up by both my male-centric thinking and lack of art knowledge.
 
user559633
8:22 AM
the google doodle here is pretty uninspired
 
user559633
 
Ah, mother Russia, where art is unecessary frivolity ;)
 
My Google is currently doodle-free
 
user559633
@JRichardSnape joking aside, the casually placed art here is amazing. the subways are beautiful
 
user559633
 
8:24 AM
I know - I was always in awe of those stations that look like palaces. Seemed somehow out of keeping in the communist era, but probably just out of keeping with mental stereotypes, really
 
user559633
when i go back to new york, i feel like i'm traveling in a garbage dump
 
Of course I am joking. Most of my favourite classical music and literature is russian. I'm no connoisseur of painted or sculptural art, but the architecture is amazing too.
 
user559633
i'm a total philistine. in case you think i'm kidding, i'm eating sour cream and onion chips with a spoon out of a cereal bowl for breakfast
 
Hello friends, One of my Cython function is not showing much speedup, Please tell me where I am going wrong? (hope I can ask about Cython here too)
 
@PM2Ring That's just very weird. I've upvoted your comment on the newly accepted answer. A reversal might now tip you aver 10,000 ;)
Or, indeed, if anyone else here notes the superiority and brilliance of your answer there...
 
user559633
8:28 AM
@arshpreet asking about cython is definitely fine here. you've compiled this and you're seeing what difference in speed?
 
Thanks, Richard. :) Hopefully, I'll answer a question or two tonight, so I'll pass 10k anyway. (I'm about to have dinner now but I'll be back in a while).
 
user559633
oh whoops i clicked a thing and now you're over 10k
 
Thanks, Tristan!
 
Nothing much, Both Functions come with almost same time, ~ 16 seconds
 
user559633
8:30 AM
no need to thank me -- that's a good answer
 
user559633
@arshpreet to be sure, you are compiling this and importing it, correct?
 
I had my first Algorithm class today. Professor was so boring.
I don't know why I am paying to that university
 
Actually, thinking about it, since sort in Python 3 no longer takes a cmp arg we can't easily track the comparisons it does. So neither my answer nor the newly-accepted one is relevant. I'll have to think of a work-around.
rbrb
 
@tristan Hmm, I am using Ipython, loading cython_magic module, Wrote code under %cython expression and calling function.
Doing same as explained in this tutorial: pandas.pydata.org/pandas-docs/stable/enhancingperf.html
but instead of doing any numpy calculations I am just doing sum of numbers
 
user559633
sorry, i don't know a lot of ipython and its modules, but i'd imagine at least a small speed increase.
 
8:36 AM
yeah it is, I did it without Ipython, there is small change, Now Cython function is taking 11.2 seconds
Yes I am back, but on the other hand If use Generator-expression instead of list-comprehension time is more. Does not generator-expressions should be much faster?
 
9:13 AM
Have I asked something wrong?
 
No? You can't expect instant feedback/answers (or even answers at all).
People are busy, it's either early morning (so they're asleep) or the start of the work day for the majority (not all, but a majority) or our users.
 
9:32 AM
Congrats on 10K @PM2Ring
 
9:45 AM
Cabbage!
 
@arshpreet Not at all. My guess is that no-one who's around knows the answer. There are a fairly large number of possibilities and if no-one can just read your code and happen to know the answer from experience, testing all the options can be time consuming. Here are sum things to try. 1) Change your xrange to range and compare again. 2) Change your return type to int 3) instead of timing 1 loop on a very big input number, test lots of loops on a smaller input
Those are all just guesses and where I'd start, I give no guarantees that any of them will change your result, but it's the kind of thing you need to try.
@poke Cabbage!
How is your domination of the low-res LED TV market progressing?
wonders if there is a market for lo-res as a brand, analogous to lo-fi
 
@JRichardSnape It’s delayed, quite busy with other stuff at the moment, so I haven’t been able to continue anything.
 
@arshpreet By the way - the other thing I'd heartily recommend is ensuring that you can replicate the example you are working from first (i.e. the pandas example you linked) before you try to alter it or simplify it. If you can't - it probably indicates a problem in your setup / environment somewhere.
@poke I know that feeling. Feels guilty, switches to work application window
 
:D
 
F4z
hello, I keep getting confused with TypeError and ValueError, can someone kindly simplify for me what those two are?
 
9:59 AM
I just found out psycopg2 converts list to ARRAY but it doesn't convert tuple
for some reason
 
@F4z TypeError: you gave something of wrong type. ValueError: type was right, but value was not.
 
F4z
thank you, sometimes the explanations on the website don't cut it, i like it 'explained like i'm 5' :D
 
for example 5 + 'a' is a type error since 'a' is of outright wrong type,
there is not a single x of type str that would make 5 + x valid
 
10:04 AM
@AnttiHaapala hah, in JS it's not
 
F4z
and TypeError would be, L where L is a list, I try to use L as a dictionary L['key name'] would raise TypeError because L is not a Dictionary
 
no, it would raise type error because 'key name' is not an integer
 
Ok, you go to bed and see another girl instead of your gf - that's ValueError. You see a raccoon - that's TypeError.
36
 
TypeError: list indices must be integers, not str
lol :D
 
@bereal Nice.
 
F4z
10:05 AM
hahaha. That was awesome @bereal
 
mmm stars are bugging or @poke is removing my stars :d
 
@AnttiHaapala Chat was not responding to me for a bit. Starts seem to work now.
(mine also wasn’t accepted at first)
 
lol twitter is still down
 
it's not?
 
@khajvah doesn't work for me
works for you?
 
10:08 AM
yeah, works for me
Let's write a JS library that defines a method, because apparently, there are 6 ways of doing it.
 
10:27 AM
I've made a small application in PyCharm and I'm trying to deploy the code on a linux vm. I'm using XRDP to connect through windows RDP but I can't find a way to get my code to the vm... You guys know of any good tools/guides to help me with this?
 
user559633
ha ha i am not brave enough to leave this my girlfriend has eyes everywhere
 
10:39 AM
> I've made a small application in PyCharm
How is IDE relevant?
 
user559633
@khajvah don't nitpick
 
Don't be mean...
 
@HjalmarZ ok, push your code to a repo
and then pull from the VM
 
I'll try it, thanks
 
user559633
@HjalmarZ How comfortable are you with Linux? Can you mount a shared folder? Are you comfortable with SCP?
 
10:43 AM
You can also setup Jenkins, which will automatically sync with the repo.
 
user559633
you're making some pretty heavy duty recommendations to "how do i move a few files into a local virtual machine"
 
Not at all comfortable :/ My first time working with Linux
and Python
I can just drag and drop files if i'm using a windows vm. That's what I'm used to so far :P
 
user559633
@HjalmarZ I'd say get comfortable with Linux basics, then either look into mounting a shared folder with your VM software or look into either rsync or tar + scp
 
user559633
because python runs on a VM, your program should work if you copy over the source files and try to run it on the same python version
 
@tristan We are talking about a Python application, not just a file(which would be off-topic here), which is much better to host in a repo and integrate the VM with it.
 
user559633
10:47 AM
@khajvah nope. it's just files.
 
user559633
and you don't decide what's on or off topic here @khajvah. he's asking about a python application and best practice and if i say it's fine, it's fine.
 
re-cbg
 
What happens if he decides to delete one unneeded print?
@tristan I am just following your own rules buddy.
 
user559633
@khajvah this isn't a discussion.
 
@The6thSense Thanks, Vignesh!
 
10:50 AM
@tristan I am not trying to be room owner here. I honestly don't care. My assumption that it's more than just transferring files is because he is asking in a Python room (hence the off-topic part) and I made a suggestion to have better solution for a remote app deployment.
 
user559633
@khajvah Great, thanks for your input.
 
:)
 
@arshpreet I don't know Cython, but sum(i*i for i in xrange(number_range)) may be a little faster than sum([i*i for i in xrange(number_range)])since it doesn't have to allocate and free a list, and of course the generator expression will use less RAM. However, generator expressions can be slower than the equivalent list comprehension since there's extra setup time involved in creating the generator function.
But that time difference will generally only be noticeable if the loop size is relatively small.
Not wanting to re-start the conversation on the flaws of JavaScript. But I just wanted to say that JS is a perfect example of a language that developed in an environment where the contributing parties had a vested interest in not co-operating; I see it as a major casualty of the Browser Wars.
 
@tristan Ok, cool. I was looking for a way to set a shared folder through VMM but couldn't find the option to. I'll give rsync or scp a try :)
 
@PM2Ring that's true, I Used generator expressions takes more time than list comprehensions, asked same question on comp.lang.python let's see what I get. :)
 
11:07 AM
Ha - got distracted and learnt to read a bit of Go and some Javascript for a nice bounty question. I'm not sure it adds anything to the conclusion, but it's a fun trawl through code execution paths in multiple languages.
 
@arshpreet If the loop size is large enough the setup time of the gen exp or the malloc / free time of the list comp should be swamped by the core processing of the loop. So if the loop's big enough the gen exp should win.
However, there are some situations where the gen exp will always be slower, the most common example being with str.join, since it has to scan through the items twice, first to determine the final string length so it knows how much memory to allocate and then again to do the actual joining. So if you pass it a gen exp it has to build a list from it before it can start work.
 
Yes I got this str.join problem when I was using Pypdf2 to convert pdf into txt file, But is there any other solution for str.join problem?
 
Not really. You can pass any iterable you like to str.join, but if you have a choice it's better to pass it a list or tuple rather than a gen exp or similar iterable that forces str.join to create a list.
stackoverflow.com/questions/34857144/… OP's edited code in response to comments, but it's still got indentation errors, and the question lacks clarity.
 
11:32 AM
cbg
 
resource request stackoverflow.com/questions/34875483/… Quick please, before we get more link-only answers featuring the same link. :)
 
PM so you could see all those deleted question and their votes?
 
Yes. I can see dead deleted answers now. :)
 
I want that power :P.
 
11:48 AM
Top of the morning cabbage to you
@JRichardSnape Shyeah, yeah.
Maybe I should python up a chat monitor that monitors for the word intrepid :P
 
@The6thSense Plus I have a few other handy powers. Like the ability to rapidly edit tags without having to edit the whole question. See stackoverflow.com/help/privileges/moderator-tools for further details
 
how to get me angry:
 
@PM2Ring Okay, Thanks for great tips!
 
start a new open-source project with coding guidelines that dictate that long lines are not to be wrapped and maximum line length is unlimited; all contributors must use soft-wrapping. Cutting long lines by reformatting is forbidden.
and we're talking about 200-300 character lines
 
Nice.
 
user559633
11:53 AM
just get a big monitor
 
user559633
things i earnestly like: when i accidentally leave interesting problems for myself in otherwise tedious parts of a project. thought it would be a simple case for getters? nope, that's a tree problem
 
@tristan github gets a horizontal scrollbar
that is at the bottom of the page
 
user559633
github is not very great, especially for freedom, and we should all stop using it
 
user559633
just so convenient
 
also git diff is pretty much unreadable
 
user559633
11:58 AM
then passive aggressively maintain a fork that only does long-line reformatting
 
user559633
just add a pre-commit hook that calls a sed script, have every needed message be "replaced VLL", and watch upstream :)
 
@AnttiHaapala Alternatively: “Start a new programming language that does not allows hard line breaks but only inserts them (virtually in the IDE) at statement separating tokens (;).”
 
user559633
alternatively: "create javascript"
 
Why would anyone want super-long lines? Sure 79 chars is sometimes a bit too narrow, but 300 chars is crazy. And having to horizontal scroll to read stuff is evil. FWIW, the C community decided ages ago to just let everybody using the coding style they wanted and to use a program like indent to reformat sources to local requirements.
 
user559633
the longest lines i'm cool with is 200 chars for non-data lines. which is to say if there's just some line that's 2k chars long, but it's just some input/stub data, i'd prefer for it not to take 10 lines
 
12:15 PM
I try to have maximum length of ~120, but I allow myself to go up to about 140 or maybe 160 in exceptional cases.
 
user559633
>>> Unauthenticated
 
@tristan I guess that's tolerable for data that you really don't need to read. OTOH, I hate SO questions that have (for example) a huge JSON object on one line when you need to see the data structure in order to see if the program logic is doing something stupid.
 
user559633
@PM2Ring Oh, totally. Like for what I'm currently doing, I have this n,000 lines long json blob, but it's fixture data. i'd rather have it just live in one line than flood my screen as i'm stemming it anyway
 
user559633
seriously loving javascript today
 
user559633
> [] == false
true
> [] || 1
[]
 
user559633
12:19 PM
o...kay
 
Sure, that makes sense. And for stuff like that it'd be nice if Python had the equivalent of C's #include mechanism so you get the best of both worlds.
 
@tristan how about...
 
user559633
i'm actually kind of enjoying the brainfuck -- i'm about 10 lines away from being done with frontend for another month and it's like trying to trick a feral cat into being cool for a few minutes
 
Trick feral cats often, do you?
 
user559633
12:26 PM
Y..es...
 
Respect.
 
@arshpreet I got a bit of time to have a play with your cython problem - it seems to me that even on your example, cython gives a ~2.5 times speedup. Run on Jupyter online "try out our notebook service". Python 3, so using range not xrange. i.stack.imgur.com/0UDyo.png
 
12:53 PM
Speaking of JavaScript:
FWIW, asking a question that implies that Python is inferior in some way to JavaScript may not be well-received by many Pythonistas. :) — PM 2Ring 10 mins ago
 
1:10 PM
cabbage
 
@tristan let me find for ya
@tristan Array(24).join("lol" - 2) + " Batman!";
 
actually it should be Array(24) :D
@MitchPomery it is javascript
 
@AnttiHaapala I was referencing destroyallsoftware.com/talks/wat
3 minutes 35 seconds in
 
@MitchPomery :D
 
1:16 PM
Woah since when does percent-style formatting have named parameters
 
sorry I didn't find it
@Kevin let me find for ya
 
user559633
@AnttiHaapala NaN NaN Nan ? :)
 
run it
 
I'm looking at this spot in the 2.7 code and I assume this is where percent formatting happens but at a glance I don't see how it can parse parenthesized identifiers
 
@Kevin hint: it doesn't
you're in wrong place
 
user559633
1:19 PM
Heh, yeah. That's not a 'wat' for me -- maybe a little as it's just rolling up the type into an array and joining, but that's not really "bad"
 
user559633
Not "gets confused and returns false lvalue on an OR" bad
 
I can never find the source of built-in operators :-/
 
@Kevin named formats have been in 1.4
so you're kinda late
@Kevin I suggest that you too would read the Python 3.5 manuals through :D
I did ...
 
This is just a curiosity for me because I never actually use percent formatting. Gives me nasty flashbacks to my days using printf
 
user559633
1:26 PM
I prefer percent formatting because it comes with free coercion.
 
I like % formatting because I've been using it for decades so I can do it in my sleep. :)
But I understand that it must be a pain to read for people who haven't used it before.
 
I like % formatting because it gives me a windmill to tilt at.
It even looks like a windmill if you squint.
 
Still, it's not as unreadable as regex, IMHO.
 
Hey everyone. I am looking around but ot no avail, maybe someone can help me with pythons datetime module, when use %x it will show in local format, where do I get the local formats date splitter? ex: some places use / to split mm/dd/yyyy and some use - like mm-dd-yyyy. any way to learn what the locale uses (/ or -) ?
 
they say Finland has a debt problem. Now Finland is paid 0.065 % per year for every single € that Finland owes to its creditors. So why not ask for like 10000x times the current debt and keep it for 1 year, then pay back, problem solved :D
 
1:41 PM
Oh boy, here I go killing source diving again.
 
@Kevin did you get yesterday off?
 
We Need To Talk About Kevin - Why Kevin? Why do you kill source dive?
 
@Programmer Yeah.
 
Wow, lucky. I think I get 4 holidays a year where I work lol
 
@Ffisegydd I like taking things apart to see how they work >:-D
 
1:46 PM
:D
 
By counting the days marked in red on my calendar, I reckon I get 10 days off for "official" holidays.
 
jots down Kevin = NSA confirmed
 
Next one is Feb 15, Washington's Birthday. Wait, really? Do I get off for that? That doesn't sound right.
This red day heuristic needs tuning.
 
Maybe you've been taking if off and no one noticed you weren't in.
Do you even work at BigCorp?
 
@Kevin di dyou have a day off yesterday?
 
1:49 PM
I like to think that if I was in a Milton-from-office-space-esque scenario, I would know about it.
@AnttiHaapala Yeah.
 
What's special about yesterday?
 
Martin Luther King Day. It's a federal holiday
 
yeap
figured that out because Gnip was fscking things up
 
"Birthday of Martin Luther King, Jr. (Observed) </red>"
 
all the competent guys were observing
 
1:53 PM
Lol that wording "Hey his birth is actually true, cause you know - there has been observational evidence..
 
No one has anyone idea?
 
Sorry @inbar - I don't know that.
 
@InbarRose I've been looking since you asked
 
@InbarRose Good question. I can't find a simple answer. But here's a kludgy way to do it.
import locale
import datetime
localename = 'ru_RU.utf8'
locale.setlocale(locale.LC_ALL, localename)
d = datetime.date(2000, 1, 1).strftime('%x')
print([c for c in d if not c.isdigit()])
 
I got as far as timemodule.strftime at github.com/python-git/python/blob/…, which seems to perform some checks and then... Call itself???
 
2:01 PM
My code outputs: ['.', '.']
 
Or, hang on, is strftime a C method...
Yes it is. Ok.
In that case I can delve no deeper.
 
I had a look in locale and calendar, both of those have some useful stuff, but not time or date separator chars. Maybe it's hiding somewhere in gettext, but I ain't trawling through that labyrinth!
 
The closest I got to something useful was
>>> import _strptime
>>> _strptime.LocaleTime().LC_date
'%m/%d/%y'
 
Morning cabbage.
Apparently the heat in the office is broken, because it is 90F in here right now. Nothing like coming to work in a sauna.
 
Incidentally, _strptime.LocaleTime.__calc_date_time is amusingly hacky.
Doing string replacement on a magic date in order to extract formatting data.
 
2:07 PM
hmmmm
@PM2Ring I suppose that is an interesting method.
@Kevin So this will get me the formatting string of the %x ?
@Kevin this might be better than what I hoped for. hold on....
 
I'm 90% sure it will.
Since that string is calculated directly from a %x formatted time, by the function linked in my above message.
Or possibly a %c formatted time. It does both.
No, yeah, it's definitely %x.
 
awesome. that is exactly what I needed. Now I can play around with it. Thanks! :)
It is strange though that there is no way to access the local datesplit char.
 
@Kevin Nice.
import locale
import _strptime
localename = 'ru_RU.utf8'
locale.setlocale(locale.LC_ALL, localename)
a = _strptime.LocaleTime()
print 'time %r date %r datetime % r' % (a.LC_time, a.LC_date, a.LC_date_time)
prints
time '%H:%M:%S' date '%d.%m.%Y' datetime '%a %d %b %Y %H:%M:%S'
 
I think this is one of those situations where it would be a nonzero amount of work to expose the datesplit character as an attribute, and not enough people have asked for it, so they haven't done it
And I'm guessing that it would be especially nontrivial to make the attribute assignable, ex. so that datetime.local_split_char = "!" actually has an effect on future strftime calls.
... Since they're offloading most of the work onto C's built-in strftime, which I expect has a pretty rigid interface.
 
Well, the date separator by itself is a bit useless. You also need the order info, so you know whether its (day, month, year), or (month,day,year) or some other thing.
 
2:22 PM
This is true.
 
I guess one common use case is when you want to make filenames from dates so if the separator is / you need to replace it with something else. Or just use ISO 8601 dates. :)
 
Yeah when I use dates in filenames I'm inclined to just stick to a format with lexicographic-temporal ordering.
 
It's the only sensible way.
 
Is there a reason why python classes never write copy constructors? Instead either relying on factory methods/copy.copy?
 
I hope not because I write my own all the time :-I
I suspect the justification is "better to have one copy.copy that works the majority of the time, than to have an enormous number of copy methods for each individual class"
 
2:31 PM
Just for some context, the reason I need this is for windows schtasks. when specifiying a /SD (starting date) it must be in the locales format, but also it needs to be 0 padded, and the locale format %x sometimes returns months that are not zero padded (ie: 18/1/2016 instead of 18/01/2016)
in other words, thanks Microsoft for making the worst parameters ever :P
 
One last comment on the date formatting issue: since the module and method in my code snippet both start with underscores, I wouldn't expect either of them to be stable. Expect this code to stop working the next time you upgrade.
 
Well I'm creating a find_all_solutions(basic_obj, limits_and_requirements) Which should create updated copies of "basic_obj" to get a list of all objects that fit the requirements. So internally I need to create copies, wondering which route to go.
 
... Even though this source file has been sitting unmodified for eight years >_>
it's stably unstable. Or perhaps vice versa.
@paul23 If my justification is correct, then there shouldn't be any harm in writing your own copy method.
 
@InbarRose Ok. Those format strings returned by _strptime.LocaleTime() should give zero-padded days and months in ay locale. But I haven't played with locales much.
 
On the other hand, if copy.copy works on your objects, then why reinvent the wheel? On the gripping hand, maybe writing your own copy implementation would result in more efficient code than copy.copy? Benchmarking is required.
 
2:40 PM
@Kevin hmm it won't be that performance critical (well the find_all_solutions is, but what is critical is simply going over all possible iterations & testing those). Only thing I have against copy-constructors is that I would have to add so many checks in my inheritance tree (and currently I have only keyword arguments).
 
@PM2Ring Yes, which is interesting because %x does not. (in my specific case)
 
cbg
 
Hmm, is it even possible to have a non-zero-padded month using strftime? It isn't %M because that's "minute"
 
@Kevin well, using %x on a computer who sets their locale date to nzp
@Kevin But otherwise you can use %-m (strftime.org )
 
Ok. Yeah, my code snippet will definitely not return %-m even if that is the actual format.
 
2:46 PM
Indeed.
Which is exactly what I needed, as it turns out.
 
There's a good reason that they haven't exposed an attribute describing the format of %x: because it may expand into a string that works if you pass it to C's strftime, but not Python's.
 
Its always interesting to me to find solutions to these strange problems that you are almost certain that no one has ever had before, and no one will ever have again.
 
Or, they could serve the sanitized version that would absolutely work with Python's strftime, but which wouldn't necessarily give you the same output that %x does.
Rock, meet hard place.
 
@AnttiHaapala Why /python-git/?
 
@poke that was that kevin linked to :d:D:D
 
2:53 PM
@Kevin Why /python-git/?
 
Because I'm more comfortable with its search capabilities than the official mercurial repository.
Or have they migrated already?
 
That was not my question :P
I’m asking why you are not using the official organization
 
Because this is the one I have bookmarked :-P
 
user559633
that's semi-official/something just some people do afaik
 
Fix it
 
2:55 PM
The answer to "why did you bookmark it?" is probably "because it's the first thing that turned up on google". Get your SEO in order, Python Foundation!
 
user559633
yes, that's the optimization python should focus on
 
indeed
not only that, search any python term in google and you get 2.7 docs
so definitely
 
I do have github.com/python/cpython bookmarked under "3.X source"
Does the official organization have a 2.7 repository? At a glance I didn't see one.
 
what they did with postgresql is that there is a way to link to /current/
 
@Kevin There are Python 2 branches
 
2:58 PM
though seo still does not work... but from now on if you get the latest docs, they're /current/
 
@tristan The mirror is “semi-official” but I think the organization is official, or not?
 
I interpret "semi-official" to mean, they're the official organization, but they make no promises about when they update this repository and with what.
 
user559633
@poke no way of knowing. some of the more social-network obsessed python contributors are in the members list, so official as "guido can't be bothered with this bollocks" as it can get
 
user559633
that's maybe unfair, there's also some major names in the python community that i heavily respect in the members list as well
 
@poke Ok, found it and updated my bookmark :-)
 
user559633
3:17 PM
bobby grant, we see you lurkin'
 
rhubarb
 
@tristan :)
 
3:33 PM
Finally got my hands on some resistors, so I can hook up red LEDs to my Arduino without making them pop.
I made a little program to illuminate red, green, and blue LEDs at varying levels of intensity to see if I could simulate a wide range of colors.
Problem is, the blue one is so much brighter than the others, it washes everything else out.
Maybe I should attach a resistier resistor? Do more ohms make dimmer lights?
 
3:46 PM
Less current should make them dimmer, but it's pretty non-linear. Or, for added fun, you can dim them by pulsing them. I think that's better and gives you more control.
 
Yeah I suspect I will ultimately need to toy with PWM until they look mostly even.
 
hi guys
 
I could also add more non-blue LEDs to the circuit. That'll give me more lumens or whatever.
 
Has anyone used much? I'm trying to expand my horizons a bit. I started playing around with , but GUI programming isn't really my thing, and I strongly dislike bloated IDEs like XCode. Any other ideas for new languages to play with?
 
I hear Python is pretty hip these days.
3
 
3:50 PM
Yeah it's totally marvy fab clutch phresh good.
 
Totes
 
That's actually another option - digging deeper into bioinformatics or learning a new framework like Flask or something...
 
My canonical project suggestion is a raytracer. You should write a raytracer.
 
I have thought about writing a raytracer but I don't know how I'd develop it from first principles.
 
Combine your joy of Calc 3 with being able to show off your work to people who don't care about programming.
 
3:54 PM
So rays come out of the light source and bounce off surfaces until they strike the viewing plane, right? Wouldn't I have to emit a whole lot of rays to ensure that every pixel of the view is struck?
Or do rays go out of the viewing plane and bounce off surfaces until they strike a light source? But what if they bounce around forever and never hit their destination?
Do I just color that pixel black? I guess that's what I'd do.
 
It sounds like you're describing global illumination, which is a little advanced.
 
cbg folks
 
The rays come from the viewer, and hit the objects. You only need one ray per pixel (unless you want to do anti-aliasing or something).
 
I guess you could just make everything a light source and just draw the color of the first object you strike. But then you don't have reflections and shadows and such.
 
Unless you show your work to someone who understands programming, they won't be wow 'd unless you have awesome gifs or something. I learned that yesterday
 
3:58 PM
@Kevin That would be devloping from first principles.
 
hmm, maybe I'll take a crack at it the next time my boredom cycle lines up with my gumption cycle. Right now I'm at high boredom low gumption so I'm in no shape to start a project.
 
Once you have that, you can add light-source based illumination (diffuse illumination) or reflection. They're related concepts because they both depend on the angle of the surface you're viewing.
 

« first day (1921 days earlier)      last day (3010 days later) »