« first day (1571 days earlier)      last day (3392 days later) » 

7:01 PM
is it bad practice to use the same controller to handle both GET / and GET /:id?
 
anyone has experience with flask+uwsgi? i am having one really weird issue with uwsgi killing workers after each request and making new ones, which is resulting in some bugs and really slow performance in some cases on my webapp
 
what ? yes ... make things as transparent as possible ... have a routes.py that handles all your rout entry points
 
@Ffisegydd I'm learning the joy of ignoring flags from the JavaScript room
 
:D
 
Flags are tricky because I don't know what the culture is like in the other rooms.
 
Hilarious joke if you tell it at the bar, excommunicated if you tell it at sunday school.
 
2
Q: Web application admin generators ASP.NET

Mr.LamYahooIs there a good admin generator for ASP.NET? Like: http://www.codesmithtools.com/ for .NET Active Admin for Rails ...

hoho
mhmm
1/4 of the generators is not generators
 
Fixing mistagged questions would be a rather bigger job ... there were only 21 in before I cleaned it out.
 
how do you manage to see my questions seconds after it is posted? :-) — sds 56 secs ago
Ninja rules everywhere
 
PHP for Life
 
7:18 PM
Python is better
 
PHP is Better
 
Use the right tool for the right job.
 
@Kevin my man.
 
Python is a hammer which can pound nails. PHP is a sharpened toothbrush which can shank cellmates. Right tool for the right job.
 
@Kevin lol
 
7:19 PM
Omg, 3 answers to a dupe
 
@Kevin Which one is easier?
 
DSM
It's true that most PHP programmers should probably be in supervised custody of one form or another.
 
"Surely a hammer is better for harming your cellmate?" perhaps, but it's not as widely available in the environment. Much like the availability of Python vs PHP on web servers.
 
@Kevin yeah, but which one is easier to use? i already know PHP
 
PHP for simple projects, Python for bigger ones.
Disclaimer: I'm obviously biased.
 
7:21 PM
I mean Google, Facebook they are build on PHP
 
DSM
And simplicity here is relative to project domain; none of the projects I work on would be simpler in PHP.
 
Oh sure, @BrianS. Google uses PHP all the way
 
@Kevin it's scary how good your analogies become
 
I like the ones that I make up on the spot, which become more accurate as I analyze them. Good job, subconscious self.
 
@vaultah Which one??? There are golden people here to close it
 
7:24 PM
I believe the correct response to "PHP is used by Facebook and Google" is to provide a big list of Python projects. Which I don't have on me right now, but I'm sure it exists.
 
Retracted my vote because ninja and brendan gave 3+ answers @BhargavRao
 
I think python is way too easy, just by looking at it.
 
@ZeroPiraeus the most common is
 
is there anything akin to plugins for SQLAlchemy?
 
No such thing as too easy :-)
 
7:25 PM
@vaultah Oh ... You marked a post with an Ninja stamp on it dupe ..... Be scared ... Be very scared
 
If you want a hard language, use Malbolge.
 
@Kevin WordPress is build on PHP thats a lot of sites
 
@corvid plug in how?
 
@BrianS Yeah, and a lot of people drank radium infused water in the 1920s, but that doesn't make it better than Dasani ;-)
 
@Kevin lol
 
7:26 PM
@AnttiHaapala err... I guess I just want the hook of Schema.pre('save', function() { ... }). I might be thinking of things wrong
 
@AnttiHaapala One question?
 
@Kevin Wow, what is this Malbolge?
 
Something googleable, I believe
 
An esoteric programming language designed to be nearly impossible to write useful programs in.
 
0
Q: Generating jigsaw sudoku

John SmithAre there any fast ways in generating 9x9 jigsaw sudoku puzzles? I've used backtracking algorithm and its taking forever to generate. I'm sure that the checking if a number is possible in a particular cell is correct because I've already made a solver and it works just fine. note: My program ca...

@ZeroPiraeus I had 2 or 3 already
@ZeroPiraeus I mean, the real tag should be rails-generate but they put "generator"
 
7:28 PM
@Kevin Whats the use of it?
 
@BrianS "Esoteric" implies that it exists just for fun.
 
@Kevin Just by looking at it, gave me anxiety lol
 
DSM
Aargh, I'm in the user group and the developer group but not the administrator group, so I can't fix something. :-/
 
user559633
PHP is the best. So there.
 
7:30 PM
@tristan Yes, Thats what i say.
 
DSM
That's the most malevolent thing you've said in a while.
 
user559633
It keeps the hordes of newbies busy and out of our community.
 
@BrianS Switch to Whitespace, it's much more aesthetically pleasing.
 
user559633
7:30 PM
REVERSAL OF FORTUNE
 
@Kevin look like wordpress shortcode lang.
 
user559633
PHP going from 5 to 7 is the most PHP thing I've read all week
 
Yeah, well, it takes most Python users seven-plus years to count from 2 to 3...
 
@tristan Do you know PDO or OOP?
 
user2555451
7:36 PM
@Kevin - And then after they get to 3, they keep going back and adding decimal places to 2 for some bizarre reason.
 
@iCodez lmao
 
@Kevin It's only going to get worse - the base is increasing: 1.5, 1.6, 2.0, ... , 2.7, 3.0, ...
 
My God. /me dramatically removes glasses, a la scientist type characters from natural disaster movies
 
And if more and more time elapses between each release... Then the Day After Tomorrow, we're looking at an Armageddon-level Perfect Storm. Sharknado.
 
7:44 PM
@ZeroPiraeus I think more than 1/3 is wrong :D
 
Yeah, was just looking at stackoverflow.com/search?q=%5Bgenerator%5D+rails-generate ... not sure how I feel about raiding SORuby / cleaning up their mess though.
 
DSM
How can code I wrote last week bitrot by today?
 
user2555451
Ugh. Why do so many people misuse the stack snippets??
 
Both of the messages above this one are unfortunate.
 
7:50 PM
Haha
 
I want SO to do some UI analytics to see which of "code block" or "code snippet" is more frequently clicked first by users unfamiliar with markdown.
 
user559633
@BrianS yes. why?
 
I think the snippet button must have a more attractive icon or something.
 
@AnttiHaapala on that open file from anywhere I dont think he was ask for across users
 
user559633
i'm not sure if you're trolling or what your angle is here
 
7:53 PM
@tristan Where did you learn it? i have a little problem with understanding PDO and OOP
 
@tristan He just wants to know if you like Panzer Dragoon Orta and Order Of the Phoenix.
I haven't played the former, but the latter is pretty good.
 
@JoranBeasley ah now I got what you mean
 
@tristan he may not have noticed that this is the Python room, not the PHP room, it's easy to miss
 
user559633
Are you talking about php data objects @BrianS? i have literally 0 interest in teaching you how to make Pretty Home Pages
 
@davidism Oh i know
 
7:53 PM
@BrianS this is the Python room, go elsewhere for that
 
@JoranBeasley so why do you call that "multiplatform"?
 
@tristan Np
 
because os.path.expanduser("~") will give you the home directoy on any OS
oh interesting
I was not aware of that ... does it work with os.path.expanduser(u"~") ?
I know that os.listdir(".") will ignore non-ascii stuff ... but os.listdir(u".") captures them
@AnttiHaapala
 
hmmm ... dunno, I do not use windows
for obvious reasons :D
 
7:59 PM
it seems like if you set your system codepage properly it will work (per @MartijnPieters comment on OP)
ok so 99% of the time you can get the home directory that way :P
although on that answer I really should have just done
os.path.expanduser("~/rest/of/path")
 
8:20 PM
Cross posting from Hacker News which cross posted from reddit: Nethack beaten by a bot for the first time.
This is quite an achievement. For the uninitiated, Nethack is a turn-based RPG with 40+ randomly generated levels and dozens of ways to kill you
Inevitably, people are going to call the bot cheap for employing the "slime farming" technique, which provides an unlimited amount of powerful items. But even still, (1) getting to the point where you can being farming is difficult, and (2) winning the game even when packed to the gills with protective gear and superweapons is difficult.
 
dumb luck ... can it beat it consistently?
 
No, it's only done it once.
In its defense, Nethack is a game where you can literally die on turn 0, before you are able to make any actions.
 
But how good is it at Dwarf Fortress?
 
thats why I say just dumb luck it didnt run into some instakill thing
 
There are many possible YASD "Yet Another (Sudden|Stupid) Death" scenarios, that even champion human players can't avoid consistently
 
8:27 PM
yeah Ive played nethack ... I cant make it far at all ...
 
Although their success rate is more like 80%, than the bot's 0.1% (or whatever it really is)
@ZeroPiraeus Tricky question. How do you win at DF?
 
user559633
champion humans
 
user559633
the champion of mankind (of playing single-player rogue-like video games)
 
@Kevin From what I've read, DF is more about losing in a manner which can be epically recounted ...
 
I guess "dig too deep, awakening the invincible monsters from the center of the earth" could be a conceivable win condition for dwarf fortress
 
8:31 PM
@tristan Just wait until Ready Player One happens in real life
 
Although this may encourage "dig for victory" strategies where players ignore base infrastructure and beeline for the deepest deposits
Fun fact, Nethack also has a "dig for victory" strategy. You rapidly delve to level 30, way past the level of monsters that you could actually fight, so you can acquire the superweapon stored there, and run away
 
user559633
it's like neuromancer mixed with willy wonka
 
user559633
neurowonka, if you will
 
I'd watch that.
 
I liked ready player one ....
 
user559633
8:34 PM
Oh, me too. quietly coughs to conceal moving neurowonka.txt to a folder
 
DSM
The URL seems free..
 
Ready Player One is Sword Art Online written well.
 
DSM
"without using pickle or other alternatives": doesn't that pretty much rule everything out?
 
user559633
I've never read the ipython docs. There's some neat stuff in here. Thanks reading!
 
user559633
@DSM actually lolled
 
user559633
8:45 PM
laughing at set jokes. living life.
 
DSM
Do people still say "winning!"? Well, who cares. Winning!
 
user559633
HASHTAG CHILI FRIES
 
I think KevinScript will crash if you use 1000 if or for blocks nested within one another. I wonder if I should go to the trouble of rewriting the interpreter so this doesn't happen.
How often do you guys use a thousand for loops?
 
Daily.
 
:-(
 
DSM
8:55 PM
Never underestimate the ingenuity of fools.
 
Do separate frames count? I don't think I actually do, but I could see it happening with recursion/deeply nested calls within blocks.
I think rather than fixing it, you should detect it and abort with the message "Stop that, you're killing me!"
Always good to anthropomorphize technology.
 
At least I fixed it so that it doesn't crash when you have more than a thousand statements.
Yes, in version 0.001a, one thousand and one print "Hello, World!";s in a row was sufficient to kill KevinScript.
 
If you get to 900 statements, you could emit a warning "Stop, that tickles."
 
can anyone help me with this ?
 
DSM
@Kevin: you can give CPython the fits if you have too many parentheses in the same line, so you can cut yourself some slack.
 
8:59 PM
@AkhilNadhPC only if you don't put a space before punctuation
 
Laurel
 
but seriously, just read the rules then ask: sopython.com/chatroom
 
While source diving through CPython, I noticed that the names of classes will clip down to 256 characters when they're printed in error messages. I tried making a thousand character class name to see if it would buffer overflow or something. To my disappointment, it doesn't appear to have done so.
 
DSM
>>> s = '('*1000 + ')'*1000
>>> eval(s)
s_push: parser stack overflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
MemoryError
 
Alternatively, it did buffer overflow, but not into any memory space that held important things.
 
9:01 PM
@davidism i didnt get u
 
@DSM That brings me some comfort :-)
 
Not sure what you don't get: a) there are no spaces before punctuation in English, b) read the rules, c) just ask
 
@AkhilNadhPC It is generally customary to wait about a day in between posting a question, and posting a link to it in chat.
 
1 message moved to Trash can
 
The reasoning being, most people in here are already watching the new questions queue, so advertising it again immediately doesn't increase awareness by much.
 
9:02 PM
Plus that question doesn't seem to be your question anyway?
 
But reminding them of it a day later may give them a fresh insight.
 
wow, my eyes had completely blipped over the post
 
DSM
To be fair, it's AkhilNadhPC here and Dhanya M who asked the question a few minutes ago, which is a little surprising.
 
Ask again tomorrow ;-)
 
1 message moved to Trash can
 
9:04 PM
But seriously. I don't know much about the Google drive API, so I have nothing to contribute
Oh hey, while we were talking, someone posted an answer to the question.
 
It's almost like the system works! /s
 
Let's be fair, moving a onebox message to Trash is fine because they can be annoying, but moving someones message? (Even if it's "can u help us")
 
This is another reason for the waiting period: it may end up that asking in chat is unnecessary entirely.
 
@Ffisegydd that space :-[ but yeah ok, that was a bit much
 
DSM
Sometimes we forget that the sopython room is only a tiny fraction of the Greater Python community.
 
9:05 PM
$ python3 k.py
  File "k.py", line 101
    for x100 in (0, 1):
                      ^
IndentationError: too many levels of indentation
 
DSM
@davidism: it's common in some languages.
 
@ZeroPiraeus Wow! Python is surprisingly terrible.
 
KevinScript wins this round.
 
Wish I hadn't bothered writing a thousand-line program to test now ...
 
KevinScript wins every round* [* in the KevinScript competition]
 
DSM
9:07 PM
The winner, and undefeated champion OF THE WORLD: KevinScript!
 
function foo(){return 23;} is legal syntax in KS, but not in Python. Score one point for KS B-)
 
DSM
(Years ago, when trying to recruit people to play racquetball, I used to advertise myself as undefeated in tournament play..)
 
... Having never played in a tournament? :-)
 
In KevinScript could I chain some methods like this though:
foo()
.bar()
.baz();
 
Possibly. Please hold.
 
DSM
9:10 PM
"Operators are standing by." (which may not be a stock phrase for our non-NorthAm members)
 
I know of this saying from the moving-picture-box.
 
DSM
Huh. The docs for or are worded unfortunately: "This is a short-circuit operator, so it only evaluates the second argument if the first one is False.", with False linked to the False object page. It's unfortunate because is False is a thing in Python, and isn't what's meant here..
 
Which one is correct: "use X operator" or "use the X operator"?
 
The latter.
 
@Ffisegydd It's syntactically valid, but I wouldn't call it "chaining".
function foo(){x = object();x.bar = function(){y = object();y.baz = function(){print "Hello, World!";};return y;};return x;};

foo()
.bar()
.baz();
 
9:15 PM
@ZeroPiraeus thanks :)
 
result: Hello, World!
 
DSM
You capitalize W in "Hello, World!"?!
What heresy is this?
 
It's like we don't even know you anymore.
Is your name even Kevin!?
 
I was about to say, "I'd like to implement a dedicated chaining operator, such that a~b()~c() is equivalent to a.b(); a.c()", but thinking about it, my interpreter design has rather changed since I first had that idea, and now it would be pretty tricky to do
Sorry, wibble operator, your time may never come.
 
DSM
Wibble wobble chainy wainy.
Wow, I really need to get out of here.
 
9:18 PM
That reminds me of my plan to get some hella reps actually.
 
@DSM ...Oops.
aw man, I capitalized it in hello_world.k as well, and that's where it really counts :-(
 
I always capitalize "World", have I been doing it wrong all this time?
 
user2555451
@vaultah - Funny when the solution is less characters than the pseudocode.
 
I leave out the comma so it's "Hello world!"
 
@davidism Wikipedia is inconsistent in its description - the page title has a lower case w, but the first and second instances in the text itself are upper case Ws.
 
DSM
9:23 PM
Customs vary among the peoples of the Earth.
 
The first known occurrence is hello, world, so one might regard that as the canonical version.
 
> peoples of the World.
 
ISWYDT.
 
> the first non-trivial Malbolge program printed "HEllO WORld", this having been determined to be good enough.
Oh Malbolge, you lovable goof.
 
Considering I woke up around 4am, I should probably go to sleep soon.
 
9:26 PM
@Kevin, one may regard hello, world! as the first version, if you accept the fact that it didn't print a single string literal.
 
Also is anyone not free on Feb 17th for a quarterly meeting? Don't think there will be much to discuss in any case.
 
@Kevin, I don't accept that as valid and you know it.
 
as we know Ctrl+C make a copy of text in OS , is there any way that access that text in python ? :)
 
Paste it?
 
user559633
i didn't know that
 
user559633
9:27 PM
control+c always kills programs for me :(
 
@KasraAD Tkinter has a function to get text from the clipboard. It requires a bit of work to get to, though.
 
@Ffisegydd NOOO :P
 
I suspect Googling "clipboard Tkinter" will give you all the information you require.
 
Ask a question, get an answer. That'll be all of the reps please.
 
user559633
@Kevin NOOO :P
 
9:28 PM
@Kevin thanks , what about python and handling signals ?
 
I consider it quite the dirty hack, but it's hardly Tkinter's fault that there's no better alternative.
 
I can't win. There are no spaces before punctuation, but no non-native speaker listens.
 
... Other than accessing the clipboard through win32api, but again, Windows only.
 
user2555451
If you are on Windows, you can access the Win32 API from Python. There's more on that here: stackoverflow.com/q/579687/2555451
 
no im in linux
 
9:29 PM
@davidism good, it's good you've given in.
 
@davidism I feel your pain.
 
DSM
Pandas embeds pyperclip for cross-platform powers.
 
"Hope" is for losers.
I always forget about that pandas method.
 
@tristan do you know the meaning of that ? :D
 
Winter GM. February 17th 15:00 UTC. Be there or be pickled.
 
user559633
9:32 PM
@KasraAD NOOO :P
 
@tristan bravo !
 
user559633
Is "make tristan a RO" on the list of topics to be agreed on?
 
inb4 "hehe...I uhh...don't support pickling! snigger"
 
user559633
the correct nomenclature is safrican-american @Ffisegydd
 
Re-cabbage!
 
9:40 PM
I've got two files, A.py and B.py. B contains a class, B_data, that creates and populates lists with data from text files. On B_data.__init__, they are populated. If multiple instantiations of A call "import B", I assume they're multiple instantiations of B being called, right?
 
DSM
Late-afternoon-EST recabbage for Fenikso.
 
@tristan For perhaps obvious reasons this isn't a widely circulated fact, but promotion to RO is by the "dead men's pointy shoes" system.
 
Stupid question, I know, but I'm trying to find a way to only load data centrally and let all the instantiations use it without duplicating it.
 
@Befall no if a module is already in scope it will not be re-imported
 
DSM
@Befall: it's a little strange to talk about "instantiations" of modules, because they're singletons.
 
9:41 PM
See, I did not know that.
 
unless you call reload(module)
 
So the first time it's imported, it executes the file, right?
But the following times, it does not?
 
DSM
Correct.
 
So would you consider that the best way to have centralized loaded data for multiple parallel processes to get data from?
 
unless you explicitly ask it to with reload
 
9:42 PM
Interesting.
 
I dont understand your question
its easy to share data ...
especially if it is read only
 
What do you mean "share data"?
I'm just wondering if that's a smart way for a bunch of parallel Python scripts to access the same data without having to load it into memory more than once.
 
if you say import A , and then fork all forked processes will get a copy of A ...
 
Like if I did the list loading in each, it'd load it however many times there were parallel Python scripts running.
 
if you fork and then import, each process would import ...
 
9:44 PM
I'm not forking, I'm creating multiple Python processes with a batch file and passing in whatever parsed info to each.
 
it also matters what type of "parallel" we're talking about: threading will share existing memory, while multiprocessing cannot
 
Which is something I could probably just do all in Python.
 
why not just use a database
 
so since you're talking about multiprocessing, you might want one process to be the "master" that will divide up and collect data
 
Raz
hello all
I am a bit confused RE my code and would appreciate some help
is it ok to post it here or would it be rude?
 
9:46 PM
he is talking about using a bash script it sounds like ...
 
I see what you're saying. The "master" currently is the Bash file that splits and creates the Python files.
 
@Raz please read the rules first: sopython.com/chatroom
 
Ergh, splits the data and passes it to each.
 
wow, do not use bash as your multiprocessor
 
I'm brand new to Bash.
 
9:47 PM
just execute a python script directly and use the multiprocessing library
 
or just use a high concurrency database as your shared memory
 
It's just what someone else was doing so I figured out how to do it.
 
the multiprocessing library has all the shared controls and data structures you're looking for
 
sometime shell scripts simplify things ... if it is over complicating things then switch to python
 
What's so bad with Bash? It's on an 18-core Unix box, so they made it seem like that was fine to handle 1-16 concurrent Python scripts running in unison.
 
Raz
9:48 PM
ah ok thanks
 
anyone here used flask-restless? I finally got to doing some more advanced stuff, got a small problem here
 
there's nothing wrong with bash, but using it to do what python can do natively is wrong
 
I often build a make.sh that build a distributable for example
 
DSM
It can certainly get them all running. If you want them to be talking to each other and sharing memory, you're going to have to be working Python-side anyhow.
 
@davidism not always
 
9:48 PM
I meant in this case
 
I'll look into doing it all in Python, I'd prefer that anyway.
What's the library I should look into?
 
multiprocessing
.Process
probably
 
Does that take advantage of multiple cores on a box?
 
9:49 PM
just read the docs
 
Okay figured as much.
 
threading is locked by the gil
 
Will do.
Thanks gents.
 
DSM
It's a lot easier than it sounds at first glance, and it'll make keeping track of things as they become more complex a lot easier.
 
its actually really easy
 
DSM
9:50 PM
Wait, "sounds at first glance"? Way to mix metaphors, DSM.
Stupid synaesthesia.
 
@DSM thats why we were not english majors
 
forgot the period with a space before it at the end
 
10:22 PM
 
user559633
Found it
 
user559633
Didn't take long either -- i'm a professional cat looker-atter
 
approximately give the coordinate
:P
 
there is no cat there is only zuul
 
user559633
vertically: middle horizontally: 3/4 from the right
 
10:25 PM
@tristan (Y)
 
user559633
?
 
LIKE !
 
DSM
I had to zoom in before I could find it.
 
user559633
I only gave you the answer for one of the two cats though
 
@DSM without zoom no one could find it :D
 
user559633
10:27 PM
I did, so patently untrue.
 
@tristan yes there is 2 cat !
lool
 
Found both
 
DSM
Secret cat!
 
user559633
Not a secret cat, just follow the first cat's line of sight
 
DSM
:-(
 
user559633
10:30 PM
meow meow meow
 
user559633
hard mode: find the mouse
 
find the owl :P
@DSM there was just one cat ;)
 
user559633
no, there were 2.
 
(O|o) ?
 
DSM
Now I don't know what to believe. I'm just going to sit here and get my data to reconcile instead.
 
10:44 PM
There are 5 owls, locations: around that cat. Don't know what you guys were having trouble with.
218 reopen queue?!
 
DSM
Someone's been busy.
 
user559633
reopen?
 
user559633
jeez.
 
user559633
that's just asking for unaccepted answers
 
probably opinion so stay closed
wow, someone voted reopen on a ton of old too broad/opinion/recommendation questions
 
user559633
10:49 PM
trollololol.
 
user559633
i'm 300 rep away from having a say in that queue, sorry
 
I think it's basically just you and corvid from the regulars who can't vote yet.
Anyway, that's the first time I've used all 20 reopen queue actions in a day.
 

« first day (1571 days earlier)      last day (3392 days later) »