« first day (1328 days earlier)      last day (3618 days later) » 
00:00 - 17:0017:00 - 00:00

12:52 AM
woo. finished second part of flask tutorials
 
1:09 AM
HelP!!!!!
 
with what?
 
How do I access a line in an array?
If there is nothing to call the line from (names etc.) how do i call a line from a array?
 
what do you mean? Like you have [1,2,3,4] and you want to access 3?
 
Yeah?
 
>>> l = [1,2,3,4]
>>> l[l.index(3)]
3
 
1:12 AM
what if I have something like sentences and every line has its own sentence?
Actuall I am really trying to make the line print out
 
I'm not entirely sure what you mean by line...
 
Okay here is something: onedrive.live.com/…
 
>>> s = ['this is a sentence', 'gaze upon it', 'behold its glory', 'despair.']
>>> for line in s:
...   print(line)
...
this is a sentence
gaze upon it
behold its glory
despair.
 
Now you will see what I am doing but accessing a line and printing that same line out is something I don't know about.
 
you have a list with a singly nested list inside of it
 
1:16 AM
Thats what the gys wanted me to do but they want me to access at least one of the lines.
It all is good but how to make sure the line I want prints out.
 
Which line do you want?
 
my_map_string = """
wwwwwwwww
w            w
wwwwwwwww """
 
The first line you see in the array
 
do my_map_string[0][0].split('\n')[0]
 
@PsychOPhobiA are you aware that what you've got there is a list containing a list (and why that's a mistake)?
 
1:20 AM
It is not a mistake if other programmers told me to write something like this. Maybe they don't realize it yet. For now I am not worried on that because I am worried on printing a line from my array.
 
here's a better way to go about it. Start with my_map, then do one_d = my_map.split('\n')
that will give you every row of the string in the variable one_d
 
@Crow SO YOU HAVE experience with blender ?
What was your question ?
 
I love blender but game enige want import
Thanks crow for the help i figured it out
 
next, you can do two_d = [[x for x in line] for line in one_d]. This will give you a two-dimensional representation of your item which you can then reference like a graph. Eg, two_d[1][2]
 
I had to add print with () to my line
 
1:23 AM
@PsychOPhobiA I mean YOU have experience with blender
 
Oh yes^
Were you talking to me ?
 
@PsychOPhobiA That's the thing ... it is a mistake to have a list (they're called lists in Python, not arrays) nested inside another list for no reason. If you can't see that, you really need to learn a litle more about Python before taking on a big project. I recommended the official Python Tutorial earlier today ...
 
So how can I finish this project?
Besides I finnished it anyway
Thanks for the help though
I also got rid of the doubled list
And yes I can see that ^.^
 
 
1 hour later…
2:43 AM
@PsychOPhobiA I saw your gameco.blend. Nice work
 
 
1 hour later…
3:59 AM
@Jon gratz :-)
 
4:20 AM
Cabbage guys!
 
Buenas noches, @Lucio :-)
 
haha, thanks :)
Buenas para tí también!
 
Where are you based? (saw from your profile you do English/Spanish translation)
Ah, I've just been informed it's bedtime ... hasta la próxima ...
 
@ZeroPiraeus que descanses!
I have problems with Django + Nginx + Gunicorn serving static files; I should have errors on my config file..
If someone have a server with such configuration running fine, please share the nginx.config file with me so I can compare it :)
 
user3444876
4:58 AM
Django??
 
user3444876
I LOVE DJANGO!
 
6:43 AM
java -cp /opt/jars/*:/tmp/MyProject-0.2.2.jar com.examples.JavaExample
i am running this from command line ubuntu.
can i call this from python program?? if yes how ? and i also want to call some method written in JavaExample.java file from python program.
 
Look into Jython possibly
 
Val
@Bharatkarotra How is this different from running any other process?
 
i went through from stackoverflow post and in some post told me we can use subprocess also or py4j
 
Have you googled those terms?
 
@Ffisegydd yes i have googled. and i am new in python. so confused about what can we use and is it possible or not
 
6:56 AM
If you're new to python then I would suggest the official tutorials
Then I would suggest you Google and look up tutorials for those terms
If once you have done this and written some code but it fails for some reason, then please come back
Until then you have all the information you need to proceed
 
I am already googling it but just wanted to confirm whether such kind of implementation is even possible
 
Surely you would get that from your searches, you must not be trying very hard.
 
ok thanks. i have tried hard. now let me try very hard. if i stuck somewhere in code will get back to you guys.
 
@Bharatkarotra well I just typed a simple search term into Google and got 1.8 million results. Obviously I don't have time to go through all those results but the top 10 certainly look promising.
 
nnk
7:25 AM
any one have idea about newfies-dialer survey module?
 
7:44 AM
Lo lo lo
 
8:04 AM
Cabbage!
 
cbg all (in the office now)
1 message moved to Trash can
@nnk please see sopython.com/chatroom for the chatroom rules. Please don't post your newly-asked questions here, anyone that is interested in answering questions from the main site is already paying attention to it.
 
8:40 AM
I am cpb2, coder of apps and bedder of women.
 
8:55 AM
@cpb2 Welcome to the room. I am Fenikso and neither of those. And the rest of the silent patrons are my crew... Eh, I am kidding in at least two of the statements :D.
 
9:11 AM
@Peter you may find this interesting
 
@Ffisegydd Amazing.
 
9:32 AM
@Fenikso haha
Thanks
 
Cabbage Paolo.
@Ffisegydd Is the thing he is using some common library (like PIL), or is it something he is building? I do not recognize it.
 
10:00 AM
@Ffisegydd have you watched the "Don't draw dead fish" lecture I posted a few weeks ago?
 
Hmmm, it seems to be NodeBox, which is OS X only. Pity.
 
Don't think so?
 
@Fenikso then try Processing / PyProcessing
^ although I love IDEO I prefer these generative artists
 
Some of those are amazing
 
anyway, there are two kinds of usage of the computer: automation and simulation/interaction
well, while the first one gives us amazing power over complexity in art
it is nothing more, than a "copy of a medium" slightly differently
however, the computer can and should be a new medium, and that is when simulation/interaction comes in
like AI, genetic algorithms, and such
and that's what the don't draw dead fish is about -- and actually this is what I'm working/thinking of lately
so thanks for the link @Ffisegydd sadly I have to run now, I'm going to teach for the next three days on a 3D design workshop
 
10:08 AM
Oooh lovely.
 
but bbl -- and we continue this discussion ;)
(ofc only if you want to too :P)
 
10:29 AM
Hah beat @Martijn by (literally) 1 second
Though I've deleted my comment now as both weren't necessary.
 
cbg all
 
11:28 AM
Hello everyone
Just for curiosity, anyone know if there's an alternative of m2crypto for Python 3 ?
 
ar me mateys
 
@PeterVaro Looks nice. I have to try some of those.
 
Wish we still had "lacks minimal understanding"...
3
Now he's spinning some conspiracy theory about ICANN and "forbidden" knowledge
 
Good morning folks
 
@Kevin "lacks minimal grip on reality" might be better in this case.
5
 
Is it ever a good idea to terminate a process from python using Popen.terminate() or Popen.kill()?
 
It must be. If it was always a bad idea, they wouldn't have made those functions available for use.
 
11:59 AM
@MukulGupta Does "last resort" qualify? :)
On Posix OSs I would not hesitate, on Windows I would think twice.
 
Okay, so maybe I should clarify my question. How does UNIX handle the command, "cat filename | head -n 10" on a big file?
I want to do something similar in python where in I would kill the "cat filename" subprocess as soon as I communicate with "head -n 10" subprocess.
UNIX handles it very efficiently. ie. as soon as it gets the first 10 lines it returns
 
Hey, can someone here suggest me a debugger for python?
On Linux
 
That is actually a good question for superuser.com maybe? "How does UNIX handle the command, "cat filename | head -n 10" on a big file?"
@CodeBot3000 Do you use an IDE?
 
For Python no, I just learned it.
But yeah for Java I use Intellij and Eclipse and all that jazz. I heard Python devs don't need IDEs so much?
 
@CodeBot3000 pdb
 
12:05 PM
@CodeBot3000 Some of the popular IDEs have debugger included. I am usually good with print.
@CodeBot3000 Well, Eclipse with PyDev plugin is what I use. It has a debugger, but I have no idea which one, as I do not use it. It is nicely integrated with Eclipse.
@CodeBot3000 BTW: I love how I can have my Java, C++ and Python projects all in one Eclipse IDE seamlessly next to each other.
 
Huh, ok. So I guess you don't need a debugger so much then?
Yeahh, I'm considering going that route. I don't like eclipse all that much, and the JetBrains IDEs run at ungodly slow speeds in my machine for some obscure reason
 
@CodeBot3000 Nope. I just print what I need. I have used it like twice in 7 years? But I also may not be the right hardcore Python dev :).
 
@Kevin Thanks, will check it out!
@Fenikso Alright, well thanks. I'll look about and see if I can find something basic I can use once in a while.
 
Or maybe I am so good that I do not make that many bugs. Haha, that was a good one :-D.
 
Heheh
 
12:12 PM
Good morning
 
yay, part 2
 
I use pdb as "print on steroids". Sometimes I'll put a print statement just before the crashing line, if I have a good idea of what I ought to print. putting pdb.set_trace() instead of print lets you explore all visible variables.
Tutorial is longer than two minutes; did not watch
 
tl;dr
:P
 
@Crow did you make that?
 
that's good cause neither did I!
@Johnston yep
 
12:16 PM
@Crow NICE!
 
@Kevin That is something I have to try. Sounds like my way of doing things. Hmm.
 
I wasn't saying I didn't hah - I was saying about Kev's commment
Watching now :)
360p?
 
@Crow I just found this great couple of vids on swift. youtube.com/watch?v=c8BGQ3CfPBs
@IanClark Maybe it takes time to get to 720 and 1080
Prob still processing
 
Yeh figured after I posted
 
I exported it as 720, not sure why youtube was being weird
 
12:18 PM
I uploaded a video tutorial yesterday after a couple of hours it was available in 4k. I didn't realize I could do that
 
@Crow GJ :)
 
cbg all
 
@Ffisegydd cbg :)
 
mornin'
 
@Crow should you really be importing other than at the top of the module?
 
12:26 PM
@IanClark in the case of the blueprints they should be imported after the application is made
 
Not sure I understand what you mean by "made"?
 
app = Flask(__name__) is the line where the app is instantiated, or an instance of flask is made
 
OK, so they need to be imported after that line?
 
Probably not
 
Debugging a colleague's third party software. Damn thing supports tabs but not spaces.
She's been trying to work it out for a day.
Also in other news: pistachio nuts are amazeballs.
 
12:34 PM
you know what else is?
 
12:49 PM
Anyone have any idea what OP thinks they want here?
Thanks very much! I haven't been responding because I was studying next, iter and list comprehension as I haven't came across those before. It works well but there's one catch, what if I wanted infinite loop_ instead of while list_of_iters to use while True ? it gives me ValueError if I replace it with True: raise ValueError , "empty range for randrange() (%d,%d, %d)" % (istart, istop, width) ValueError: empty range for randrange() (0,0, 0)user3056783 13 mins ago
 
right mates, anyone good with sqlalchemy? Trying to do something fairly simple but it is throwing me off...
 
Nobody was good with it when you asked yesterday or the day before
I admire your optimism.
and/or insanity. There's a lot of overlap in the category of "doing the same thing multiple times in the hopes of getting a different result"
 
mostly insanity
 
@Crow I am ok with it
what is the question
@Crow This is in Flask correct? So Flask-SqlAlchemy
 
sorta. I have a script outside of my application and want to use that to populate my application's database
sqlite
 
1:00 PM
and what is the question
 
either: how do I correlate a cron to my application, or how do I make a file that will be read by my separate app?
 
@crow I answered it
@Crow you could also consider celery beat if you have lots of tasks
 
ah Davidism, yeah that makes sense... for some reason the whole 'create_app' idea seems rather weird in certain situations. I guess I'm too used to an app running when it's made
 
I was gonna say @davidism is the man. Can you link to the question?
 
0
Q: creating a database outside the application context

CrowI have an app factory like so db = SQLAlchemy() def create_app(environment): app = Flask(__name__) app.config.from_object(config[environment]) db.init_app(app) # ... etc return app then, I have a script which fetches CSVs outside of the context of the application. This script is a...

 
1:07 PM
Thanks
 
watermelon
 
1:23 PM
is there any way to say "if you see this inserted into a table here, do this to it before adding it to the table"?
 
triggers?
 
I suppose. Like imagine I tried to insert '02/20/2013' into the table, and REALLY wanted it to insert datetime.strptime(mything, '%m/%d/%Y')
 
Where have you gotten this date from?
Can't you convert it to a datetime object as you get it from the user?
 
trying to make a database in part from CSV files
 
@Crow listen for the attribute set event
But really, you should probably read in your data and format it first, then add it to your models
 
1:38 PM
okay, can you also define methods to fetch from the database by? Eg, give me all of these, but find only the ones with unique this field
 
@Ffisegydd here is the pastebin link pastebin.com/ZxXeSZQh
 
@Srivatsan thanks let me take a look
@Srivatsan when you created noise = margin*(np.random.random(N)) you did not take 0.5 away as I did in my example:
noise = margin*(np.random.random(N)-0.5)
np.random.random(N) will create an array of N random numbers between 0 and 1
You subtract 5 so the random numbers are between -0.5 and 0.5 (otherwise you'd only even add to your distribution).
 
@Ffisegydd I also tried with different margins
 
Yes but did you subtract the 0.5?
 
0.5
 
1:41 PM
@Ffisegydd yes I did, but the same results persists
I can show you the image if possible of my plot, but don't know how
@Ffisegydd here is the image that I get when i plot plt.hist(yran). This is after subtracting 0.5
 
So the green bars in that plot are the randomised numbers?
 
yes, the green bars are the randomised numbers
 
Ah well I see your problem.
 
I also tried to generate unifrom randoms of 500000 values and then tried to remove all those below the curve, but could not do so using any loop because my data has only 25 values
 
You're plotting using plt.hist which is converting your data into a histogram and summing how many times the data falls into that binning.
 
1:46 PM
why is my cube so cold. Put a thermometer there today and next to the window is 35 degrees, when it's 70 outside
 
yes now it works fine!! But how can I represent this as a histogram to compare my data and randoms?
 
So the plt.hist is saying "How many times does the data (y value) in this array fall between 0 and 100? 200 times? then the value I'll plot is 200.!
You could create a bar chart rather than a histogram. matplotlib.org/1.3.1/api/pyplot_api.html#matplotlib.pyplot.bar
In that case you give the position of the left hand side of each bar and the height of the bars.
 
which would be plt.bar(x1,y_ran)
 
You'd have to subtract half of width to get it as the left side of the bar
But I don't think a bar chart is really the clearest way to show this data.
 
the reason I need a histogram is because as you can see in my question, the second plot that I have showed, you can clearly see that the randoms are following the exact representation of my data.. I need to show that
 
1:51 PM
You could do a bar chart then but you'll want much less than 5000 data points
You'll also need to adjust the bar width yourself to fit them in
 
in any case, thanks for the answer.. I shall fiddle with it for sometime and if I get a solution shall post it in the comments
 
No problem :) good luck!
 
I am beginning to dislike posts that are tagged python-perl-bash. Seems to be the catch-all for "please write me a script to process some files in this way, thanks in advance"
 
2:14 PM
Cba
Cbg:)
 
using drop_all() makes me nervous ._.
 
DSM
2:35 PM
Cabbage, all.
 
so here is something I don't get... if you subclass another class which uses arguments, and your class uses arguments too, how does that work out?
 
DSM
Can anyone remember the word for dropping unnecessary words in casual speech? Someone just edited "Much easier to x.." in a post to "It's much easier to x..." which I think was a silly change.
 
Example involving cute animal classes?
 
You manually call the parent class' init method with the arguments you think it should have.
@DSM I want to say "elision"
 
DSM
What does it mean for a class to use an argument? Methods accept arguments, but I'm not sure that classes do.
 
2:37 PM
An argument on a class?...
 
That's just how we speak up t' North of UK...
 
class App(Toplevel):
    def __init__(self, root, widgets):
        Toplevel.__init__(self, root)
        self.widgets = widgets
 
An argument on the *constructor of a* class, or
Class inheritence
?
 
Or maybe "ellipsis" is better
> In linguistics, ellipsis (from the Greek: ἔλλειψις, élleipsis, "omission") or elliptical construction refers to the omission from a clause of one or more words that are nevertheless understood in the context of the remaining elements.
Not to be confused with "...", which has the same name
 
I did something like that
class StaticBlueprint(Blueprint):
  def __init__(self, csv_name):
    Blueprint.__init__(self)
    self.csv_name = csv_name
 
2:40 PM
That's very common in the North of UK. For instance "Going shops" rather than "I'm going to the shops"
 
bp = StaticBlueprint('bp', __name__, 'my_csv.csv')
TypeError: __init__() takes exactly 2 arguments (4 given)
 
In west PA they say "this car needs washed" instead of "this car needs to be washed". I try to stay away from them.
 
DSM
@Kevin: yeah, ellipsis works for me. I was reaching for "holophrasis", but that's a little different. (And to find that word I had to dig up the text of a novel where I knew it was used in a section. I could remember the scene, but not the word. My memory works oddly.)
 
For six months I couldn't remember the word "oubliette" until I saw it in the title of a Magic: The Gathering card.
 
DSM
@Crow: StaticBlueprint.__init__ does take exactly two arguments. self and csv_name. You gave it three arguments + automatic self = four arguments.
 
2:44 PM
The irony is not lost on me that it literally means "forgotten place", and I forgot about it
 
DSM
I would've guessed forgotten thing. So much for my French.
 
@DSM what about Blueprint's arguments? How do I pass those into __init__?
 
If you require the subclass' arguments to come first, you can do
class StaticBlueprint(Blueprint):
    def __init__(self, csv_name, *args):
        Blueprint.__init__(self, *args)
        self.csv_name = csv_name
 
@WalleCyril Thank you
 
@PsychOPhobiA I made a dragon in Blender
flying and shooting fireballs
 
DSM
2:57 PM
@Kevin: we don't say "this car needs washed" where I come from, but we do say "this car needs washing", "this book needs reading", "this verb needs conjugating", or "this man needs killing". You know, everyday stuff.
 
@WalleCyril Cool. I can't design creatures or humans because it takes a lot to do and I don't know where to start. I have made some ships and stuff.
 
Yeah, same here. "this noun needs verbing" and "this noun needs to be verbed" are common.
 
DSM
D'you think "car needs washed" is "this car needs to be washed" with words missing, or "car needs washing" with "-ing" -> "->ed"? Probably it's already answered on EL&U..
 
@DSM My teachers taught me to say "this car needs to be washed"
 
3:02 PM
There is a post about "needs verbed", but it doesn't discuss its origin, just that it's not correct (insofar as any language construct can be "incorrect")
 
DSM
@WalleCyril: yep, that's standard.
 
@Kevin shouldnt you use super instead of hardcoding?
 
@Ffisegydd I'm vaguely reminded of the little blue people in Terry Pratchett novels. I could never understand what they were saying.
 
DSM
@Kevin: I've grown more descriptivist in my dotage.
 
@bendtherules Probably.
 
3:03 PM
But as your name is bendtherules just accept that Kevin has bent said rules.
 
@WalleCyril Hey blenders game engine want import
As if the engine doesn't exist
 
@Ffisegydd I so wished I could type out your name.. :D
 
DSM
@bendtherules: I type "@F" and then tab, which scrolls through the possible completions.
 
It's easy it's two f's, an i, an s, an e, a g, a y, and two d's!
:P
 
"g, a y," - part of your prev explaination
 
3:07 PM
@PsychOPhobiA Hey, I m not a blender pro, it was my hobby when I was 13 years old, now I forgot alot of things, and now there is Blender 2.5+. You can start the game engine if you press "p" in the 3D scene and exit with "esc".
 
hope you dont mind though
 
@bendtherules what if I do mind?
 
@WalleCyril Hehe there is now Blender version 2.7+
2.70a
 
@Ffisegydd I would die of guilt
 
2.71 is in its second test build and besides I am still a nooob
 
3:08 PM
That would truly be a shame.
 
@WalleCyril You havn't seen what amazing stuff I made yet.
I have some tanks
 
@PsychOPhobiA Yes I know about the latest Blender versions, I m still looking the release notes, here is my latest blender game, it took me less than 45 min to do. I hope you can discover the basic of game production in Blender by exploring it.onedrive.live.com/…
Use p to start and arrows to moove, 2 player game
 
DSM
I just read the "all digit domain name" question. That's one I hadn't seen before.
 
3:29 PM
Cabbage. Anybody here wish to win US $25000 ?
 
Sure. I'll trade you for my "one weird trick from a mom that makes your teeth whiter (dentists HATE her!)"
 
Body builders HATE him
Cambridge scientists have discovered a revolutionary new muscle builder
 
DSM
If this is about the 2011 Eppendorf and Science Prize for Neurobiology, I have some unfortunate news.
 
haha
 
4:18 PM
Cython question (again)...
I'm getting a TypeError: Required argument 'name' (pos 1) not found error with the following code:
from myclass cimport MyClass

cdef extern from "Python.h":
    cdef class MyMetaType(type)
    ctypedef MyMetaType NewClassBase "MyMetaType('NewClassBase', (RealClass,), {})"

cdef class MyMetaType(type):
    def __cinit__(mcs, name, bases, attrs):
        print name

cdef class MyNewClass(NewClassBase):
    pass
Why is this?
Sorry...that should say from myrealclass cimport RealClass
 
cbg all
 
DSM
@Hyperboreus: cabbage.
 
4:47 PM
When a post has nine separate instances of "enter code here", I truly wonder if anyone actually reads their post before submitting.
 
Hello
 
@Owatch cabbage
 
I noticed that france24.com accepts socket connections on port 9090.
I was wondering why on earth that might be. (I was trying to connect to random websites I knew for the purpose of testing the "loading" and "No host reply" screens on my application.
 
what does @before_request in flask do, is that before ANY request is made?
 
@Crow yes, as it says directly in the docs: flask.readthedocs.org/en/latest/api/…
 
00:00 - 17:0017:00 - 00:00

« first day (1328 days earlier)      last day (3618 days later) »