« first day (1229 days earlier)      last day (3733 days later) » 

2:02 PM
 
i want to match "5th layout" and "balaji layout" in 1 expression.

p = re.compile('\w+\slayout')
q = re.search(p,text2)
 matches balaji layout. to account for both cases , i added an OR

p = re.compile('(\w|\d\w+)\slayout')

but this matches only the last alphabet from balaji. i get "i layout"
 
The arrogance of the man is thinking nature is our control and not the other way around...
 
should i ask it on stackoverflow?? hope it doesnt get marked as a duplicate..
godzilla
Everything happens to USA
if there's anything bad thats gonna happen , USA is at the top of the list
 
@AshwiniChaudhary Recognize him in the trailer??! ;)
 
We've got a lot of Pacific-adjacent coastline, so our odds are pretty high for kaiju attacks.
 
2:09 PM
@Kevin Pacific-rim?
 
do alien attacks also support ur argument?? @Kevin
 
cbg
I have no words.
 
I would expect to see a proportionate amount of south American monster movies, though... I guess they're under-represented
 
(Emphasis mine)
 
I'm fed up of seeing the statue of liberty being vandalized by evil forces so often :(
 
2:11 PM
Aliens would probably attack whatever they deem to be the densest points of civilization. Aliens, y u no attack Bangkok / Buenos Aires / Cairo / etc?
 
Actually.
If I might interject.
 
yeah.. india is crowded .. they could get many there too
 
Aliens, who were aggressive, would probably just nuke us from orbit.
 
even then , Usa would be their target
 
Good idea. Less likely to receive counterattacks by plucky heroes in F14s
 
2:12 PM
If they wanted to take over earth though - they would just send microwave frequencies to fry our brains and cook us.
 
nope , if they do that , then USA doesnt get a chance to save the world :P
 
There is pretty much no scenario in which an advanced-enough-to-interstellar-travel civilization bent on destroying us would actually need to land on our planet.
 
What if the aliens are dumber than us?
 
IIRC our atmosphere reflects incoming microwave radiation, so they'd have to descend pretty low to fry us
 
they are.. thats y they havent reached us
or probably we r discussing species that dont even exist
 
2:14 PM
Where's my "reflectivity of atmosphere by wavelength" chart? Dang, always disappearing when I need it most
 
LOL , i am 5 rep away from getting a chance to upload images in chat
 
There are effectively infinite types of aliens in the universe.
But there is no scenario that exists that we will ever meet even a small portion of them. Therefore they will remain theoretical.
 
And for them, we are also aliens :)
 
Indeed.
Just on our planet alone - see how many strange types of lifeform exist.
 
I'm still holding out for scientific discoveries that will allow for near-light-speed transport, and the instant detection of sentience across interstellar distances
 
2:18 PM
u might want to consider black holes for that @Kevin
 
Too bad we haven't got any nearby :-)
 
even if u travel with the speed of light , it wont be possible for you to even cross our own galaxy in your lifetime
 
Not with that attitude you won't
 
And based on the theory of Convergent Evolution Aliens will most likely be similar to us in some way.
 
2:19 PM
ok, addendum to discoveries list: "... and will extend our lifespans indefinitely"
 
this might interest you all
 
If we are aliens and if we want to take over other planets, how would we plan and attack?
 
@thefourtheye Send down some viruses that can kill them all and we are immune to it, then take over the planet with no resistance.
 
Accelerate an asteroid to 99% the speed of light, and chuck it at the planet
 
@Kevin That destroys the ability to then inhabit the planet.
 
2:22 PM
The ensuing planet-covering cloud of thousand degree ash ought to squelch their defenses pretty effectively
 
@InbarRose But we need to capture somebody from their planet to test the virus, right?
 
Alien abduction, indeed :)
 
Inhabit? I want to dismantle it to build Dyson spheres
 
@Kevin Then just cause some flares in the local sun.
That should kill everyone on the planet and leave it in a good state for disassembly
 
Hmm, not sure if harder or easier than the asteroid plan
 
2:24 PM
any1 interested in answering my question??
0
Q: Regex Or Expression , Python

SwordI have many sentences and i need to have a regex expression that accounts for extracting "5th layout" and "balaji layout" . To simply put it as a word followed by layout and combination of digit-word with layout."text2 is a string". This code below gives me the regex "balaji layout" as required....

hope i dont get downvotes for this
if its a duplicate , tell me , ill remove it
 
But really, if we can manipulate stars, does it really matter if the locals put up a fight? Their puny nukes will never penetrate our unobtanium shields
Just head on down and take what we need
 
i guess Halo would be a better option to fight with aliens..
or dead space 1,2,3
 
Challenge the aliens to Mortal Kombat for their planet. (If no one gets this reference I will shoot myself)
 
its so easy, get a console or ur pc will also do. install the game and start killing.. It doesnt even hurt if they attack us.. we can enjoy a dinner after that
ohh yeah 2 upvotes.. :)
i can upload images now.. :D
 
The first Doctor Who episode starring Tennant?
 
2:29 PM
"Once every generation, there is an inter-dimensional martial arts tournament known as Mortal Kombat, designed by the Elder Gods to limit invasions between the realms of the universe. If the realm of Outworld wins Mortal Kombat ten consecutive times, its Emperor Shao Kahn will be able to invade and conquer the Earth realm."
 
No, that was mortal combat with a c...
 
Mortal Kombat is a 1995 American fantasy martial arts film written by Kevin Droney, directed by Paul W. S. Anderson, and starring Robin Shou, Linden Ashby, Bridgette Wilson, Christopher Lambert, Cary-Hiroyuki Tagawa and Talisa Soto. Based on the early Mortal Kombat fighting games, the film was the first part of the Mortal Kombat film series. Its plot follows the warrior Liu Kang, actor Johnny Cage, and soldier Sonya Blade, all three guided by the god Raiden, on their journey to combat the evil sorcerer Shang Tsung and his forces in a tournament to save Earth. The main inspiration for the...
Gawd ....
 
Oh, well, I recognized the franchise, but didn't know about the backstory
I didn't know there was one
 
Haha.
 
Besides "ninjas want to disembowel one another"
 
2:31 PM
Know you know.
Now* ....
 
It's arguably a valid sentence. "(I command you,) Know (that) you know"
Because sometimes you know something but don't know that you know it
 
@thefourtheye y is swapping required?
 
@Sword You are using re.search, it will try the first part of or to find the match in the string, if it doesn't find in the first char, it moves to the second it finds a match. So, it retains only the \w+ part, the other part is never reached at all. But when you swap it, it first checks with \d\w+ part and finds a match.
 
ohhh. thanks man
 
2:49 PM
is "instantiated" a real word? Spellcheck is telling me I am wrong
I thought it meant "make an instance of"
 
It's real in the computer industry, yes
might not find it in Webster's though
 
It's in merriam-webster. I just googled it
 
I'm mistaken, Webster's has it
Sorry I thought you were a dusty relic of the past, Webster!
 
Just googled it as well
lol
 
2:52 PM
All programmers share a love of correcting other people :-)
 
Didn't know instantiating had a meaning other than in the CS field
True Kevin haha
 
I blame the debugging process. Simple Pavlovian conditioning makes us feel happiness when we identify and fix a typo.
Github is making a text editor. Some people say that it's a lot like Sublime Text
An open-source sublime text would be quite nice :-)
 
cbg
 
hmm I don't think I quite get how unit testing is meant to work. Instantiate the class and test that your assertions are true, at its very basic level?
 
Unit tests test the smallest units of code in your program.
E.g. if you have an “add” method, you would test it with some values to make sure that with known parameter, you get the expected result.
Usually, you would test multiple things, depending on how the control flow should work in the function
Note that these are implementation-unspecific tests, so you shouldn’t test something because of certain elements in the concrete implementation.
 
3:04 PM
generally you're testing functions/methods, not classes
 
Ideally, in test driven development, you create tests first, so you create your functions to fulfill the specifications made by the test.
 
unit-testing functions is straightforward; classes have the complication that they encapsulate state, so you need a setup operation to build an instance before you can test its methods
 
is there different contexts of these unit tests? For example, would web-based unit tests be different than, say, java unit tests?
and for that matter, how do they scope up? For example, could you do a unit test on a json, or perhaps a class? Saying I click x, I expect JSON to look like y
 
well, depends a bit on what you are testing. Web-based, or interface tests in general have the problem that you’re testing the actual visual representation. So you’re sort of testing the full stack—which isn’t really unit testing then anymore
 
web based unit tests?
 
3:09 PM
for example, some web tests may make a request through your web framework’s controller and you then run the test on the HTML output.
 
i tried almost all kind of things to do browser testing, is a real pain
the only one that worked more than less was selenium with webdriver
 
@Crowz In that case, you would probably have some “generate JSON” function, so you would test that first.
 
if you are talking about "nerd" testing is ok with that, but what happens when some low profile user tells you about a some strange bug you don't know how to reproduce?
 
@poke well, my model grabs a JSON, then in my controller as you change inputs, it changes around this json. Should I instantiate my controller and see if I do x,y, and z that the json reflects those changes?
 
then with selenium and the firefox addon you can record a macro for that weird bug
sorry, just dumping my 5 cents here
so BTW @poke did you saw my saladizer plugin for the SO python room chat?
 
3:12 PM
for unit tests you would certainly avoid going through the full stack. So if you have a controller doing that stuff, then just unit test that controller
 
@Crowz in your setup you would mock out the model
 
@markcial I’m not sure?
 
oh sorry thought you two were done
 
controller gets thing from (fake) model, does stuff, returns JSON
test that
 
Heyo all
 
3:14 PM
@roippi what do you mean by "fake" model? In that sense, where does the JSON come from?
 
I have a quick question, if anyone minds.
Is there any advantage using pickle over json to store a single dictionary?
 
@Crowz you just fake one in your setup. Like you don't have test data sitting somewhere in your database. Your setup makes a new entry, you fetch that, and then when you're done with your tests your teardown cleans up the fake entry.
 
Pickle works on more types of objects than json
 
banana
 
3:18 PM
@markcial Bind the cabbaging to a new “send as cabbage” button (next to the current one) and make a userscript out of it.
 
@Owatch you may get some space/performance benefits
 
I see, but the file size is pretty much the same when storing a 64 element dictionary.\
 
i was thinking in a checkbox with a text that says, use salad
lettuce? do you think?
oops, some bugs XD
 
oh, for something that small just use JSON
or shelve, I kind of love shelve
 
@roippi wait isn't that the whole point of grunt? I am only handling for front end so I made a static json to fetch for my model.
 
3:19 PM
I thought shelve was used in conjunction with Pickle>
?
 
@Owatch Depends on what else you are working with. If you just want to dump it for your own use alone, you can use pickle (or others) to save space. If you want to use it with something else though, or if you want to consider being able to look at it with a text editor, use JSON or another common readable format
 
yes it uses pickle on the backend but its API is sweet
 
@markcial “Salad this!”
Or “I’m a vegetarian”
 
@poke Currently I'm just storing a single dictionary. It acts like a cipher. So If you wanted you could go in (When using JSON to store as .txt) and edit stuff in there.
 
3:21 PM
hahaha veganize
 
Maybe that's preferrable?
 
I suggest "use the first thing that works"
 
Well. JSON worked just fine
 
If that works fine, then just use it.
 
I just am on a chapter about Pickle and Shelve
 
3:21 PM
The user won't care what you use as long as the program fulfills its task
 
And wanted to practice with it
 
It’s probably easier to use than pickling too
 
Pickle is great.
 
@Crowz well you want to test all parts of your function - if your controller fetches something from the model, make sure it can fetch things from the model
kind of getting derailed here, talk is too abstract
 
testing banana
sprouts :P
good
banana
 
3:27 PM
cabbage :)
 
Cabagge
 
@roippi so I see qunit has "code coverage" as a unit, but how would that be defined?
 
@ShikhaShah Are you not in India?
 
Cabbage!
 
Nope ..hot and cool Florida
 
3:29 PM
:)
 
How about you? Where are you from?
 
@Crowz it's essentially the ratio of lines of code that are "touched" by unit tests to total lines of code
so if I have a function
def do_thing(*args,**kwargs):
	if kwargs.get('admin'):
		...
	else:
		...
 
you would need to test both when admin=True and when it's not for 100% coverage
 
Okay, so .sync is pretty much more or less useful when you're going to be swapping lists, tuples, and dictionaries actively during your script.
 
3:34 PM
lets see, good bean
 
(shelve.sync())
 
banana bean
 
@thefourtheye Bryan Cranston nice :), IIRC he was completely missing from the first trailer released a while ago.
 
@roippi oooh I see that makes perfect sense then. Ideally, there should be 100% in all cases?
 
banana
 
3:35 PM
@Crowz yup 100% is the ideal
 
cbg
seems that my plugin needs some readjustments
 
@Owatch you only need to worry about that if you're worried about data loss from catastrophic script failure; shelve does a sync when you close
 
Yes, it did mention that .close
Also saved the data
 
bean
 
huh. Well this is odd. Some of my things are already at 80%+ code coverage. I suppose someone already did my work for me...?
 
3:51 PM
@Crowz you're on 80% coverage of your unit testing?
From what I've seen it's quite uncommon to actually achieve 100% coverage, some programs just don't lend themselves to that kind of coverage
 
@Ffisegydd the one thing that I made on something that was existing on github that I did a fork off of
 
Honestly speaking, coverage is not the best metric, especially for a dynamic language, which often has runtime errors.
Testing has to be pretty thorough.
 
You're testing the coverage of the unittests right? Not the coverage of the actual program? There's a difference between "80% of my program is tested" and "80% of my program is ran" :P
 
nah, I just went to this qunit shenanigan this project is using and looked at my addition. It already said it had 80% coverage. Although... really, it is a pretty common function so maybe it was just generic enough to be covered
 
@Ffisegydd True, that was what I was trying to get at.
Although a friend of mine, who's working on evolutionary algorithms wants to do away with human created tests altogether.
 
zmo
3:59 PM
oh my, there's a bunch of questions I went through that are just non-sense
 
@Ffisegydd that should read “most programmers are just too lazy”
 
zmo
did someone forgot to turn off the improbability engine?
 
That's cool. You can except errors as variables. Or rather, store them as variables.
 
zmo
I'm having the 4th or 5th "unclear what you're asking" in 15 minutes
I guess that's a sign I should close SO :-)
 
4:16 PM
I just invented my own programming paradigm.
 
teach us the ways of the poke
 
Exception-based programming. Or exceptional programming in short.
Here’s an example of the GCD:
def gcd (a, b):
    try:
        raise Exception(a, b)
    except Exception as e:
        while True:
            try:
                try:
                    1 / e.args[1]
                except ZeroDivisionError:
                    raise StopIteration(e.args[0])
                raise Exception(e.args[1], e.args[0] % e.args[1])
            except StopIteration as ex:
                raise Exception(ex.args[0])
            except Exception as ex:
                e = ex
When used, it will raise the result as an exception.
 
@poke ewwwww
 
>>> gcd(27, 6)
Traceback (most recent call last):
  File "<pyshell#20>", line 1, in <module>
    gcd(27, 6)
  File "<pyshell#17>", line 13, in gcd
    raise Exception(ex.args[0])
Exception: 3
 
@poke - I am simultaneously amazed and horrified...
 
4:22 PM
:D :D
 
This is very evil.
Never use exceptions unless they're exceptions.
 
I got a second interview with Amazon. ._. I don't get it
 
But it’s exceptional programming! ;P
 
@poke what is this I don't even
 
If I were to keep some work on a public repo in Github (say a Flask app) is the standard way to avoid sensitive information from going public (say my secret key) just to add the file to .gitignore?
 
4:30 PM
@roippi Isn’t it beautifully exceptional? :D
 
certainly is!
 
@Ffisegydd Yeah, just don’t commit it
 
Ok cool, ta folks.
 
4:52 PM
Help
I just had to code PHP
GET IT OFF GET IT OFF!
 
my condolences. :P
 
The unfortunate side-effects of working in a startup company... random jobs in PHP... :( gag
 
Hello! I'm trying to get a local branch of a project to send e-mails...only works on the dev server right now. I created my settings_local.py file and used this to successfully send a message to myself using python manage.py shell. Trouble is, it doesn't work in the site. I don't mind troubleshooting a bit on my own but I'm not sure where to start!
 
I've never used PHP, mostly because I've heard it was awful from everyone
 
that is because it's awful
 
5:00 PM
what's bad about it?
 
@Brendan any error message?
 
cbg
 
@Inbar I'll get the bazooka!
 
@poke yay for the japanese: distractify.com/culture/japanese-turkey-sweater-man ..umm.. not.. :P
 
5:02 PM
Is there a policy on deleting comments - I gave two irrelevant comments on a question - should I delete them or leave them up? stackoverflow.com/questions/22047671
 
wb @JonClements
wb @Bibhas
 
@MichaelBurns comments are meant to be transient and for discussion about forming a good question/answers... it's fine to remove your comments... ultimately anything important should end up in the question/answers
 
@Bibhas Not in the two places I usually see errors. The terminal where I ran server didn't show anything out of the ordinary and the page itself didn't throw an error. The context is a confirmation e-mail that sends after an order is placed...the order goes out successfully but no e-mail is sent. (I'm a front-end guy so a lot of this is learning on the fly for me!)
 
@JonClements but I do hate when I see comments that are replies to another comment and that comment itself has been deleted. x(
 
5:04 PM
@JonClements Thanks
 
@roippi oh, the stance alone kind of details what I was expecting. If I was to say a programming language was bad, I'd say unreadable and inconsistent
 
@bibhas yes... but on very recent posts it's likely the person making counter comments will be checking their answer, and notice that missing comments.... they then clear up their comments
 
@Brendan Did you try from the django shell on server?
 
@Michael having said that - keeping the comments may potentially have stopped this answer being posted :)
 
@JonClements Hey. You're alive!
I am just leaving work though.
 
5:09 PM
@Inbar did you get my reply email?
 
@Crowz inconsistent doesn't scratch the surface. The language is a mess, hard to describe it without diving into the nitty gritty
 
yeah that'd be unbearable. That's a big reason why I like python, it seems fairly consistent
 
@JonClements Yes.
Anyway, tata.
 
@inbar catch you later
 
@Bibhas is that something different than the python manage.py shell that I tried?
 
5:12 PM
@Brendan no. the same. Didn't you get anything when you executed email.send()?
 
Woo hoo.... someone that didn't fall into the count vowels by using a == 'a' or 'e' trap
 
@Bibhas Yeah. Like I said, the e-mail worked fine there. It returned 1 and I got an e-mail. But e-mail isn't working in the actual site I'm working on.
 
@Brendan I meant try python manage.py shell on server and see the output there
 
@JonClements Very True
 
@Bibhas Ah, sorry, I don't have access to the remote server. I just push to GitHub.
 
5:21 PM
Anyone familiar with embedded python in C
 
@Brendan clearly the issue is on server. So you need to debug it there.
also check the spam boxes
 
@Bibhas I checked spam, no good. You sure it's a problem with the remote server? It works just fine there; the problem happens when I run things on my local server
 
Ummm. You said
> Trouble is, it doesn't work in the site
Doesn't that mean it doesn't work on the remote server?
And you just said it works fine on remote server
/me is confused
 
Cabbage
 
@miny cabbage
 
5:32 PM
Rhubarb!
 
@Bibhas - sorry that we're miscommunicating :/ I'm probably mixing up my terms a bit. Thanks for your patience. I am trying to get my local server to send e-mails. The remote server works fine, but since I don't have push access to the remote server, I want to work things out locally. So I used the question I referenced earlier to get settings_local.py configured, and then I used the shell to successfully send an e-mail. Trouble is, it doesn't work in the actual web page on localhost
 
@Markcial rbrb
 
@Brendan oh. got it. Then we should look at the code of that page. Also, how do you run the site on local server? python manage.py runserver? or do you have it setup with apache or something else?
 
@martijn cbg
 
5:39 PM
@JonClements: Sorry you didn't get voted in. You had mine, if that's any consolation.
Do run again next time!
 
@Martijn I was very inspired by all the support I received... so it was worth while in that regard :)
Besides, we might even have sopython and all the analysis tools builts by then and everyone here will be famous :)
 
@Bibhas I'm on a Mac, but I do python manage.py runserver out of a Ubuntu VM (we've found it's easier to troubleshoot Python on Linux :P), so it turns into python manage.py runserver 10.0.2.15:8000, and then we match up ports in VirtualBox
 
@Martijn for some reason I've agreed to re-write a product that's based on PHP... I feel traitorous just looking at the code I've been sent :)
 
@JonClements Good luck with that!
I just finished a project wrapping a PHP site.
 
My beautiful white vneck has blue spotches from the laundry!
NOOOO
 
5:42 PM
@Martijn that would possibly be more livable with...
 
They keep the CMS in PHP, but a Python Flask site using their internal API provides the public view.
It still required reading their templates to translate to Jinja and Flask though.
 
@Martijn but on top of that - I don't think the original code was done by someone that understands PHP either....
 
The taste PHP leaves in my mouth..
 
Being a puppy. I can throw up and happily re-eat it... PHP is worse :(
 
if it wasn't for other people's code... I would be such a bad programmer
 
5:46 PM
@Bibhas just tried running server out of my Mac side though, and same problem
 
@Brendan IMHO, you don't want the mail delivery feature on localhost. You can setup a the console mail backend for testing on localhost. You have nothing to worry if it works on the server
@Brendan console mail backend will print all your mails to your console rather than sending them to the target
 
@Bibhas interesting! Is that hard to set up?
 
@Martijn not even separate templates/orm/framework here.... just everything in rather large source files sighs
 
oh dear.
You have my sympathies! I had trouble enough following the rabbit down some of the PHP rabbit holes in my project, and that was mostly clean.
 
5:54 PM
@MartijnPieters Its the ==s, they always mess something up.
 
@Bibhas I'll check that out. Thanks for your help.
 
@Martijn got some style sheets, but appears others are embedded inside the php files
 
facepalm
 
I feel safe in highly encouraging this be re-written - christ - even re-writing it properly in php would be a major improvement
 
At the first ever PyCon India I attended, I had a personal card that had some PHP code on the back of it (Yeah, I worked on PHP back then). I just started learning Python at that point. Met a really experienced developer there, who took my card, saw the PHP code and said "Nice card. Shitty language." Six months down the line, all my personal projects had moved to Python and being so far away from PHP, I understood a part of what he meant.
@JonClements I can't stop laughing when I see PHP codes that echo HTML/CSS/JS. :D
BTW, anyone here visiting PyCon US this time?
 

« first day (1229 days earlier)      last day (3733 days later) »