« first day (1280 days earlier)      last day (3669 days later) » 

12:03 AM
Just a guess..have you tried with something like this?
$.ajax({
url : url,
type : "POST",
enctype: "multipart/form-data",
data : form_data,
processData : false
});
 
@user3546546 This is the same I did
 
@edwardoyarzun It could be that you got the swap between type and method wrong.

So do you have something like this?
form_data.append('file_upload', file);
 
@user3546546 What I was thinking was to, every time a change is made to a tournament, recalculate the statistics page and store it in a html column on the Tournament table. Then the user just requests the html. The only time he might get old data is if he opened the page while a change is being made - which I'm okay with.
 
@user3546546 Nope, because I passed the form object to the FormData parameter
 
Does this make sense?
 
12:06 AM
so I don't need to use append()
 
Another thing I want to do is to have the HTML be in the actual source code of the statistics page. I can't do that if I generate HTML dynamically in the Javascript, but I can if I do that with Jinja2.
Regarding the actual calculating statistics code, I'm pretty sure it's as good as it's going to get. It's just simple iterations through the objects. But I will try the profiling tool to see if I have any major bottlenecks
 
Can anyone help me please?
 
@abacus If you're saving static html you're just moving the problem IO side.
you may also want to check your indexes on the db
but NEVER store them in html in the db!
@edwardoyarzun what does print dir(request) give you?
 
@user3546546 What do you mean by 'check your indexes on the db'?
 
@abacus just don't make the user calculate on his browser, you don't want to give him a bad experience. But anyway if the server side code profiling gives optimal results, you have to check your db, put the indexes on the most expensive queries or switch to a nosql database
 
12:15 AM
No, with the way I'm suggesting, the user isn't doing anything but requesting html.
Changes to the database are made when someone uploads a game or a tournament director changes some settings - that's when server-side code will regenerate the statistics file.
 
@abacus I mean to avoid excessive db IO put indexes on the most expensive queries after you profiled them. Indexes will work entirely in memory
 
I'll look into indexing
 
@abacus It all depends on the time elapsed between a static and dynamic request. How often are these changes done? How many users will you have on average?
 
Every 30 minutes, I estimate around 50 statistics uploads.
 
if it's for a time longer than 2 minutes I can say it is worth to do like you say.
 
12:17 AM
At maximum maybe ten times that, in case multiple tournaments are going on
Yeah, changes won't be happening any time near 2 minutes. So if this is okay for a short-term solution, do you think I should try using websockets in the future?
 
Then go for it.
Well absolutely, if you expect to grow beyond thousand users you should rethink your infrastructure. Gevent is interesting too (asynchronous processing), I'm using it for my current project. I think that Flask + Gevent + MongoDB + Websockets are the perfect combo for performance and scalability.
With Ajax you would poll the server every x seconds/minute to check if the db changed. Websockets instead keep a light persistent connection between the client and the server and updates are instant.
 
12:37 AM
@user3546546 when I print request.POST shows me everything, including files as dataURL. But the problem is that request.FILES is empty, and files should be there
 
@JonClements Not bad, not bad at all!
btw a recommendation from me (also for @Kevin) -- imdb.com/title/tt1675192
and guys, if you watched it, let's talk about it, I really want to hear other opinions about this movie
 
@edwardoyarzun Are you sure you have all necessary fields on the input field? Because it looks fine like this, so the problem must reside in the html. Not sure, but let me try.
Particularly look out for the "form-theme-edit" id in your input. You can also try to do:
print form_data
in order to see what required fields are
 
12:56 AM
PSA: just in case you've been busy for the last week, please change your passwords
 
1:11 AM
guys I'm learning to into flask finally!
 
 
4 hours later…
4:42 AM
I'm trying to insert html directly into a file using Jinja
but when I do render_template('sample.html', text = the_html), I get raw text in the browser
Is there anyway to tell Jinja to treat it as normal html so it can display correctly?
I'm on Flask by the way
 
4:54 AM
okay, I figured it out - needed to use the | safe filter
 
hey everyone, i need to do research for a speech I will be giving... http://strawpoll.me/1517151
Mostly I need reasons either way that I can attribute as research. (they don't come from my brain.)
Clarification: I mean simple programming, nothing complicated or advanced, or theoretical.
 
 
1 hour later…
6:18 AM
well bye everyone, if anyone has any comments on that poll (which is what I really care about) then please do an @theHeretic or other form of contact that I will see.
 
7:13 AM
umm does anyone know they python equivlant to perl unpack function?
I have the perl code my @pixel_formats = unpack C3 => $buffer
but struct.unpack doesnt take that C3 format with a variable holding 3 bytes
 
7:51 AM
Cbg all
 
8:33 AM
cbg
 
Cbg
@ffisegydd STEWIE!!!!!! Why up so early!?
 
@Jon BRIIIIIIIIIIIIAN!!! I have quite a strong body clock which means I wake up 6.30 pretty much everyday, even weekends/holidays.
Plus I need to make the final push! 48 rep left!
 
You can do it Stewie... you can do it!!!
 
 
4 hours later…
12:29 PM
Looks like a lot of people are taking the day off...
 
Indeed, quiet.
 
Sab
hi all
Anyone active?
 
Day off!? What's that strange phrase you use? :p
 
Sab
I need some help with Python 3
I want to make a program that uses str.replace, nested loops and strip strings but I have no idea what to make
any suggestion?
I'm new to python/programming in general
 
Seems a strange thing to want to do... most people when they start want to build a full blown 3d game or the next twitter or something :p
 
12:38 PM
Hmm, L Systems can be interesting to implement with replace.
Many of them have results that can be visualized with the turtle module.
 
Sab
lol @JonClements Everyone wants to build the next Facebook or Twitter. Why not build the next thing that will crush Facebook or Twitter? :D
 
quiet here,it seems like saturday. :)
 
Sab
I'm having trouble with nested loops. Who can explain the logic behind this>
?
Google doesn't have a good answers
answer*
 
Perhaps a code visualizer would be constructive? Here is an example.
 
Sab
This makes total sense. But what happens when you got like 5 nested loops?
How do you even know you need 5 nested loops to begin with?
 
12:44 PM
That doesn't come up too much.
 
@Sab you probably don't :)
 
You'll come to develop an intuition about when such things are necessary.
 
Sab
Nested loops are confusing me because I can't understand the logic.
 
"Now how do I print the names of all the people in the world... Ah ha, I'll do for country in countries: for city in country: for building in city: for apartment in building: for person in apartment: print person.name"
 
Sab
Some people explain that it's a row and a column
 
12:46 PM
Kind of makes sense for a two level I guess you could view the outer as rows and the inner as columns...
 
row & column iteration is just one possible application, though
 
Sab
I need a good visual of what's happening. I created a table and put the numbers for each iteration, it makes sense.
But the problem is when things get complex
 
And that's generally why the deeper you go, the more you should be thinking, "Am I overcomplicating this?"
 
Sab
So far, I managed to make those fancy patterns using only 1 for loop while most of the codes I read have nested loops.
I want to make use of loops, strings and string strip to make a nice program
But I have no idea what to make
 
11 mins ago, by Kevin
Hmm, L Systems can be interesting to implement with replace.
 
Sab
12:50 PM
I'm reading it, sounds too complex :S
Or it's not?
Is it important to know recursion? (In mathematics)
 
Why string str.strip ? I can't think of any practical example that'd be useful er: nested loops
 
Not in all fields of mathematics, no.
 
Sab
I decided to double major com sci and maths and having a hard time
bleh
I thought I was a maths rockstar till I joined university.
 
Sounds much like my story :-)
 
Sab
That L-system looks awesome
A becomes AB
B becomes A
A fractal is a mathematical set that typically displays self-similar patterns. Fractals may be exactly the same at every scale, or, as illustrated in Figure 1, they may be nearly the same at different scales. The concept of fractal extends beyond self-similarity and includes the idea of a detailed pattern repeating itself. Fractals are distinguished from regular geometric figures by their fractal dimensional scaling. Doubling the edge lengths of a square scales its area by four, which is two to the power of two, because a square is two dimensional. Likewise, if the radius of a sphere...
 
12:56 PM
Here's the catch: you can't just apply the replacement rules in whatever order you want.
If you just do x = "A"; x = x.replace("A", "AB"); x = x.replace("B", "A"); print x;, you'll end up with "AA" instead of the expected "AB"
 
Sab
This fractal thing. A guy at stanford did that as his project
That's why a loop is needed?
 
Yes, that's one possible solution. Looping over each letter in the string, applying only the rule that is relevant to that character.
 
Sab
Lemme try and make that
Atleast if it works I'll gain some experience applying all of these
What about string strips?
 
I luv fractals. I will now use this conversation as an excuse to post this thing I made:
 
Sab
waiting for the thing to be posted
:D
 
1:00 PM
 
Sab
Ilerminaty
This thing is awesome. Did you make that pic using programming?
 
Yeah
 
Sab
How did you turn it to a .gif then?
There is so much to learn. I don't think I'll learn all of these in Com sci.
 
I used Python Imaging Library to make the individual frames, then used ImageMagick to smush them all into one gif.
 
1:03 PM
Haha. Oh, that tragic villain
 
Sab
The eyebrows though.
 
That reminds me, I wanted to share this article, which interviews the Adventure Time team
 
have you watched the film I linked to you earlier @Kevin?
 
I don't think I got all the stuff about beauty and the sublime, but it's interesting nonetheless
Take Shelter? No, but it's on my list under Submarine and Sunset Limited
 
wow, super cool article, thanks, I will read it later on
@Kevin :)
 
1:07 PM
Hmm, it seems someone is recommending movies to me in alphabetical order...
 
that's pure accident I guess
 
We finally got Netflix streaming at my house. Hopefully I can catch some of these on there.
 
My next movies are: Mud, Nebraska, Heartless and Ghost World
and I totally missed the 2004 Der Untergang
so I have to watch that too
damn you @JonClements I'm still listening that track.. :)
 
hrmph. Anyone have problems with zip module in python?
 
No.
Sounds like you're asking if anyone else has had a problem, in the hopes that they had the same problem you have, and also have the answer. It may be more productive to provide a minimal test case of your problem directly.
 
Sab
1:25 PM
this L-system is hard to implement
:/
 
@Kevin I tend to err on the side of just that I am doing something very stupid
 
@PeterVaro I thought I'd take a stab - pleased you like it though :)
 
can you format a timedelta like a datetime?
 
2:02 PM
The JavaScript room have just told me that the Python room ate the Haskell room. How dare you!
 
did we?
 
I dunno. One doesn't simply contradict the opinion of The JavaScript Room.
Was it tasty at least?
 
we don't haskell, afaik, we prefer snakes
and cabbages ofc
 
@Oleg... sorry... I was peckish and err.... shops were shut... ya know how it is... :(
Just looked at a website as it might offer services I require, it started playing a video with audio, I closed the website - next!
 
Ugh, I'm sick of this guy that has asked like five "linked list" questions
Each time, failing to link to the List module his instructor gave him
 
2:16 PM
Ahhh... I think I saw that earlier... was it the one with "eval(input(...))" and would like to make a linked list from an array and print each array item one per line (or something equally - I've got as far as this... do the rest please?)
 
It's the old "ask ten questions, each of which will do 10% of my homework for me" trick
 
Except they're not quite pulling it off :)
heya @Josh
 
I do feel bad for him, since the instructor's module is crap and will only teach him poor practices
 
Learn Python The Java Way - no one ever wrote...
 
how do you get the basedir of an app in flask? Also, is it possible to open a resource like a CSV for writing?
 
Sab
2:23 PM
@JonClements Here is the Java way O.O
public class LPTJW{

public static void main(String[] args) {
System.out.println("Learn Python The Java Way");
}

}
 
Voting to reopen: I was wrong to close this as a dupe of the slice notation; your question is not about what the syntax means but about how the language treats the notation. — Martijn Pieters 40 secs ago
 
Good enough for me, voted
 
Sab
Is there a way to split a word in python?
ABCD => ["A", "B", "C", "D"]
str.split() only works with words
 
list(myString) will give you a list of characters
 
Sab
I want to split them
put them in an array
loop through it, check each part, and replace
then finally join them back
I'm doing the l-system thing
 
2:30 PM
>>> list("ABCD")
['A', 'B', 'C', 'D']
 
Thanks everyone.
 
Sab
Trying it @Kevin . Thanks
 
terminology nitpick: the collection object created with square brackets and commas is called a list. Arrays come in their own dedicated module, and are used much less frequently.
 
Sab
@Kevin But how do you join the list again then? since join works only with str.split
 
Join can take any list as an argument, not just ones created by split
>>> x = list("ABCD")
>>> print ".".join(x)
A.B.C.D
 
Sab
2:35 PM
Poop. I forgot the "". before join
lol Ty :D
I'm pretty confident I'll make the l-system work by tonight
 
I have the utmost faith in you.
 
Sab
Thanks :)
It gets better when the angles are added and it makes those patterns, but I guess I'm too new to do this for now.
 
.^_^.
 
Not necessarily. the turtle module is fairly user friendly.
 
cbg
 
2:39 PM
Greetings
 
cbg @Aaღirkhan - long time no see... you just escaped from somewhere? :p
 
Nope, I am here only on my office, generally i am online on Smart Developer's Lab Chat Room Daily :)
I have finished Today's Task and now Just reading news of election :)
 
ahhh okie dokies :)
 
@Sab also you don't have to do the list() on strings, since a string itself is iterable:
>>> '.'.join('ABCD')
'A.B.C.D'
 
how can you get all .sql files within a directory?
 
2:53 PM
When i get time , i am trying to help people on SO chat room
 
os.listdir, and throw out the ones not ending in .sql
Maybe something with glob, although I've never used it myself
 
Sab
Thanks @PeterVaro I'll keep that in mind. It could potentially make the code simpler
 
that's why I suggested ;)
 
os.listdir returns a list, correct?
 
have you tried @Crow ?
(even if you have not, feel free, to RTFM docs.python.org/3.4/library/os.html#os.listdir as the first sentence of it will answer your question)
 
3:04 PM
ah I was just doing something stupid
 
okay then :)
 
this did what I wanted in my app CSVs = [x for x in os.listdir(basedir + CSV_PATH) if x.endswith('.csv')]... that should be reliable? Ah actually, not quite, want a list of the absolute paths
 
"basedir + CSV_PATH" -- I highly recommend you to use os.path.join
 
why's that? I always see join being used, is it just because strings are immutable? Or is it the regular expression of trailing slashes?
 
because it is cross-platform, yes
 
3:08 PM
I feel like I should do this with multiple things... I have variables like CSV_PATH = 'static/csv/'. It might be useful to make everything an absolute path...
 
3:19 PM
Bye Guys, Time to leave, Have a great weekend @JonClements
 
@Aaღirkhan you too! rbrb
 
3:44 PM
I gotta stop answering posts that are just copy-pasted riddles
But I just can't resist the opportunity to show that I am a smarty pants
 
@Kevin but we all know you are - so who are you trying to prove it to? :p
 
The subconscious manifestation of my father. Are you proud of me yet, papa? ;_;
 
/me backs away slowly
 
Cabbage.
Todays' task: How to get my iCloud contacts to sync with microsoft outlook in windows.
 
@JonClements :P
 
3:56 PM
The OP of this hextuple nested if block needs some gentle guidance, I think
 
@Kevin provided!
 
flagged as duplicate.
 
Oh, you can’t close yet – thanks ^^
 
only 1K rep.
how do I increase it?
 
4:02 PM
Answer stuff and get upvotes, or suggest edits
 
someone has replied ot it.
 
1 cv left
 
i do about 2 - 3 edits a day.
some get accepted others dont.
 
cbg @poke
 
That connect 4 code is… interesting…
 
4:12 PM
Cabbage everyone :D
 
Cabbage!
 
Just making a change log for TigaMail, what's everyone else up to?
 
def shut_down(*s): <-- does the asterisk do anything special there or is that a typo?
 
An asterisk unpacks a list as arguments if I remember correctly.
 
@Jerry unpacks s into positional arguments
 
4:14 PM
^
 
okay
that's something new to me o.o
 
f(*[1,2, 3]) is f(1, 2, 3)
 
melon
 
>>> def test (*args):
        print(args)

>>> test(1, 2, 3, 4, 5)
(1, 2, 3, 4, 5)
 
Ah, so it can pack as well as unpack?
 
4:15 PM
Hooray, you're one of today's lucky 10,000
 
Also related to that, keyword arguments:
>>> def test (*args, **kwargs):
        print(args)
        print(kwargs)

>>> test(1, 2, 3, foo='bar', bar='baz')
(1, 2, 3)
{'bar': 'baz', 'foo': 'bar'}
 
@Kevin Ahhh :D
 
@Kevin I don't think that's so special to be the 10,000th :D
 
@Poke Why does a little thing like that seem to be the coolest thing about python at the time?
Singing to python: LITTLE THINGS, THAT YOU DO, MAKE ME FEEL, SO IN LOVE WITH YOU!
 
The actual number is smaller because argument unpacking isn't something "everyone" knows. Since it's local to the Python community, you're more like, in the lucky 100
 
4:19 PM
hmm, from that syntax, you have to make sure that there is no non-kwargs after the kwargs
I almost thought that the def would pick them apart automatically xD
 
@Jerry That’s part of the syntax for function calls anyway.
 
I see, thanks for that @poke :)
 
test(1, foo='bar', 2) is a syntax error, regardless of foo’s definition.
 
Just out of curiosity, would foo-bar be accepted by Python as a variable name?
 
seems not
 
4:21 PM
I'll test it.
 
>>> foo-bar = 1
  File "<stdin>", line 1
SyntaxError: can't assign to operator
 
foo-bar? That would be foo - bar, an expression.
 
Ah.
What does the - operator do then?
 
4 - 2 = 2
for example.
 
I'm a fucking moron, ignore me xD
 
4:22 PM
xD
 
OOOHHHH MY GOD.
I feel like such a twat now.
;-;
 
it's okay to have those moments xP
 
Today's lucky 100, etc, yadda yadda
 
xD
I didn't find out, I just didn't think xD
 
You know what grinds my gears? People that use "minus" as a verb.
I haven't encountered that since high school math class, but I have never forgotten.
 
4:23 PM
uh that was a horrible typo...
 
Gimme an example :P
*It's
xD
 
"I minused 10 and 6, and got 4"
 
Ah.
I though so, was just checking.
 
@Kevin I got -4
 
I've made myself appear as a cretin enough today.
 
4:24 PM
@Jon lol. +1
 
I minus, you minus, he/she/it minuses. minusology? The study of minus? Come on
 
Minuologist?
 
PSA: The operation that the minus symbol signalizes is a subtraction. The verb is “to subtract”. :)
 
Micro-minuologist.
 
Old Macdonald had a sign... e i e i o.... and with that sign he had a subtract, e i e i o, with a minus here and a minus there, here a minus, there a minus, everywhere a minus minus... Old Macdonald had a sign, e i e i o!
/me takes a bow
 
4:27 PM
The changes from v.1 to v2.1 in TigaMail are pretty noticable.
Anyone got any good royalty/copyright free background music?
 
Please don’t put music into an email client…
 
For the video on it xD
Eugh, music on an email client ._.
Throws up
Rbrb guys.
 
Good xD
incompetech.com seems somewhat famous though @Iplodman
 
I was going to suggest the ubiquitous relaxing music, but it's a mere 50 years old, so probably not free to use.
 
Yes. Deva Premal has some good sounds.
 
4:33 PM
I know... we should set up a community sopython radio station.... that'll help people with their insomnia!
 
@JonClements Insomnia if not treatedin time could result ot heart-diseases.
 
See.... sopython to the rescue of the community :p
 
But... What if I'm kept up at night worrying about heart disease? :-(
 
@Kevin That would irony, but dying of heart-disease would be a tragedy.
 
4:46 PM
Since when does SO have chat rooms?
 
@OphirPrusak it always has had chat rooms.
 
I'm amazed by how few people know about the chat rooms on SO
 
wow - I never realized. I wonder what else it has that I'm missing :)
 
The first post on meta with the "chat" tag, that wasn't just "should we have a chat system?", was in 2010
 
@OphirPrusak You're missing everyone's shining brilliance in these rooms. :-)
and we were missing yours.
Welcome aboard! or as they say in these parts -- CABBAGE!
 
4:50 PM
We're so bright, you gotta wear shades B-)
 
What's up with the cabbage? is it something python-ish?
 
Cbg :d
 
Yeah, room in-joke. See sopython.com/salad
 
@Kevin Beat me to it.
 
(rewm)
 
4:52 PM
xD
 
Just a little over a year ago... Ah, we forgot its birthday!
 
Damn.
Well, speak for your self :P
I got it a gift voucher for Game.
 
@Kevin omg... how did we let that happen
 
Well, birthday parties for one year olds aren't that great anyway... The guest of honor doesn't know what's going on, and will likely make a tremendous mess of things
Much like birthday parties for 80 year olds :-D
 
Badum tish
 
4:55 PM
Ok. Time for me to call it a day. rhubarb!
 
@abhi rbrb
@Kevin LOL
 
Rhubarb Abhi :D
 
5:20 PM
_
 
Awwww
 
I think I'm going to be listening to incompetech for the rest of the day
 
I'm going to be staring at the wittle white wabbit
 
QUICK POLL: Camel backing or underscores, as in fooBar and foo_bar respectively?
 
@Iplodman I only use lower case single letters - so can't say :)
 
5:25 PM
Wait, really? As in x, y and z?
 
underscores for ordinary variables, PascalCase for class names
So sayeth the Python Style Guide
 
Intresting :p
 
and errr... ц for instance @Iplodman
 
I'm a camel backer my self.
 
Nothing wrong with a bit of Ꙝ either
 
5:27 PM
@Jon I hope you're joking xD
 
Who needs to type out names when you've got unicode!!! Muhahahahaha
 
I mean, each to their own but still.
 
I use camelCase for all my non-python code, but I bow to the convention here
 
**Evil giggles**
@Kevin butLookHowMuchEasierThisIsToRead than_this_method,_but_I_guess_it's_personal_prefrence.
 
I prefer not having to guess where the hyphen key is on my keyboard... I can only touch type on the letter rows
 
5:30 PM
I can touch type on every row, but only if I'm not thinking about it.
 
Typing class was probably the most useful part of my education :-D but you just can't fit the number row in a one-semester curriculum!
And I haven't learned it myself in the ten years since then because... uh... so how about that local sports team, huh?
 
@Kevin errr, you say sports team hey? Err.... what ya think of the weather, huh?
 
Pretty good by astronomical standards. No thousand mile per hour dust storms, no sulfuric acid clouds. Can't complain.
 
YEAH, GO SPORTS!
I would have had football, but I didn't want to look like an idiot if you wanted to watch something else.
Anyone who gets that reference gets 10 brownie points.
 
I was going for Caber tossing, but okay...
 
5:43 PM
I wish it was possible to make multiple variables global on one line.
 
You can
 
Really? Seems not for me.
 
global a, b, c, d, e
 
I just tried that ._.
Sods law, thanks :p
 
5:59 PM
Interesting question:
> Does python need to deal with copys[sic] similar to python does?
 

« first day (1280 days earlier)      last day (3669 days later) »