« first day (1286 days earlier)      last day (3645 days later) » 
01:00 - 18:0018:00 - 23:00

1:21 AM
Hi guys, I don't know how to solve the problem with this code
import csv
with open('myfile.csv', 'rb') as csv_file:
csv_read = csv.reader(csv_file)
for row in csv_read:
if row[4]=="Connect":
for row2 in csv_read:
if (row2[4]=="Disconnect" and row[5]==row2[5] and row[6]==row2[6]):
print row[4],row[2], row2[4], row2[2]
break
 
user3444876
@user1653150 What's the problem with the code?
 
every time it reaches a connect it start searching for disconnect
that works
but the problem is that it starts searching for the next connect on the line after the last disconnect ignoring all the lines in between
Jan 15 9:02:22 2014 Connect user1 cven-arb5-3
Jan 15 9:02:23 2014 Connect user1 cven-arb5-3
Jan 15 9:02:55 2014 Connect user1 cven-arb5-2
Jan 15 9:02:55 2014 Disconnect user1 cven-arb5-3
Jan 15 9:03:43 2014 Disconnect user1 cven-arb5-2
so if the data is like that , it will get the time for the first connect with user1 an ap3 and it will find the disconnect correctly for that one, but it will ignore the second and third line, and start searching for connect again after line 4
I don't know how to fix this issue
import csv
with open('011514_30lines.csv', 'rb') as csv_file:
    csv_read = csv.reader(csv_file)
    for row in csv_read:
        if row[4]=="Connect":
            for row2 in csv_read:
                if (row2[4]=="Disconnect" and row[5]==row2[5] and row[6]==row2[6]):
                    print row[4],row[2], row2[4], row2[2]
                    break
so any idea why it is not working correctly, please?
 
user3444876
2:06 AM
hmmm.
 
3:33 AM
anyone know how can I copy files from linux to a shared folder in windows using python?
any library for that?
 
 
1 hour later…
4:33 AM
Is there any one who can help me in resolving groups.google.com/forum/#!topic/erpnext-developer-forum/…
0
Q: Getting pip install error on installing frappe

keshu_vatsI am trying to install erpnext 4 on a user account but I am getting the below error. subprocess.CalledProcessError: Command '/home/erpnextvertax/erpnext-bench/env/bin/pip install -e frappe/' returned non-zero exit status 1 After debugging the printed error I found that the below command is gen...

 
@keshu_vats: the error is very simple, there is no directory frappe/ under the current directory OR the directory frappe does not contain instllable packages I guess
 
frappe is their
let me send you the screen shot
@AnttiHaapala as you can see frappe is their in the directory
but i donot know why it is not getting that
 
No I cant
it needs t obe in the current directory
not in pips bin directory
 
So what should be the path ?
 
you need to run the command from command line
 
4:45 AM
@AnttiHaapala actually i am trying to install erpnext for last 2 weeks
as you can see here
the command is in the script
of erpnext
when i use it in root folder everything works fine
but at this time i put the code in erpnextvertax directory
 
now copy this information to your question
your question in SO is all wrong
then notice the line about mysql_config
that is your error
'nuf said
 
on SO my question is about /home/erpvertax/erpnext-bench/env/bin/pip install -e frappe/ only
pip and frappe both are in env/bin directory
but all the time i am getting frappe/ should either be a path to a local project or a VCS url beginning with svn+, git+, hg+, or bzr+
Storing debug log for failure in /root/.pip/pip.log
 
5:27 AM
cabbage
 
Question
 
Cabbage
 
when i run this
class Button(pygame.sprite.Sprite):
def __init__(self, frame, text, command, **kwargs):
pygame.sprite.Sprite.__init__(self)

self.frame = frame
ugh
class Button(pygame.sprite.Sprite):
	def __init__(self, frame, text, command, **kwargs):
		pygame.sprite.Sprite.__init__(self)

        self.frame = frame
NameError: name 'frame' is not defined
I get that error?
 
obviously, the self.frame is misindented
the reason being taht your stupid text editor has tabs at 4 spaces.
tabs are at 8 spaces in python :D
 
thats my fault its correctly indented in my code
 
5:41 AM
NO
it is not
if it is correctly indented it would work
also, put the first line of your python main script as
#!/usr/bin/python -tt
then your program will not start if you use tabs for indenting. See PEP8
 
class 4 spaces, init 4 spaces, code
 
no
your first line has tabs and second line has spaces
set your text editor settings correctly, also show whitespace
 
I got it
that was stupid
very, very sorry
 
stackoverflow even saves your ws, so you can see by selecting that the first line has 2 tabs and second has 8 spaces
anw, such an editor sucks for python
 
@AnttiHaapala you was right my question was wrong
Thanks for helping me out
 
6:01 AM
cabbage!
 
6:16 AM
cbg
 
 
1 hour later…
7:20 AM
Cbg
 
cbg
 
7:49 AM
@JonClements @Jerry Cbg
 
potato @thefourtheye
 
Cbg all
 
@Jerry Cabbaging Banana :)
@Ffisegydd Cbg, the new overlord :)
 
Bananas
cbg @Ffisegydd
 
8:16 AM
Hi good morning
 
Hi @Reegan
 
8:40 AM
cbg
shortest lived question ever (Check the time differences) stackoverflow.com/questions/23263878/…
between posting and being put on hold
 
cbg
 
9:19 AM
Another quiet day it seems ;-)
 
Really quiet I must say.
 
All the better to eat you with.
 
Oh my. What big ears you have, grandma!
 
9:43 AM
cabbage everybody
 
10:36 AM
cbg
 
10:49 AM
Cbg
 
11:12 AM
That sad moment when the IT guys don't know how to transfer data from Oracle DB to MS SQL Server. Which ofc puts the whole project on hold.
 
11:55 AM
@Jon BRIIIIIIIIIIIIIIIIIIIIIIIIIIIAN!!!
 
Anyone know of a pastebin-like service that supports markdown?
 
Thanks :-)
 
12:15 PM
I'm thinking of writing another canonical Community question... This time I want to make it public somewhere before actually posting it on SO.
 
What's the question on?
 
"Asking the User For Input Until He Gives a Valid Response". We seem to get that question fairly often. Here is one from this morning.
 
Cbg
 
Yeah that question does come up quite often, have you put it together yet?
 
Here is my first draft. I want to add more to the answer, like, what if we don't want the user to enter nonsensical integers like "-1"?
 
12:29 PM
Hmm yeah. That obviously needs to be in the while loop but it'd also be nice to have it with the if statement. Why not bring the if statement inside the while loop and then have it break out after printing one of your messages?
while True:
    try:
        age = int(input("Please enter your age: "))
        #if the last line ran successfully,
        #we're ready to break out of the loop.
    except ValueError:
        print("Sorry, I didn't understand that.")

    if age < 0:
        print("That isn't a valid age.")
        continue
    elif age >= 18:
        print("You are able to vote in the United States!")
        break
    else:
        print("You are not able to vote in the United States.")
        break
If using 3.4 you could even have with contextlib.suppress(ValueError):... (though that won't let you print out a message)
 
The except there would also need a continue, or else you'd get a NameError on the if. But other than that, yes, that works
Although, I feel like it would be nice to keep all validation logic inside the while, and all non-validation logic outside. So my version would look like:
while True:
    try:
        age = int(input("Please enter your age: "))
    except ValueError:
        print("Sorry, I didn't understand that.")
        continue

    if age >= 0:
        break
    else:
        print("That isn't a valid age.")

elif age >= 18:
    print("You are able to vote in the United States!")
else:
    print("You are not able to vote in the United States.")
 
Yeah I see your point (you need to change the elif to an if though)
 
oops, yeah
 
yar me mateys
 
12:46 PM
I'm imagining a generic function for validation, and all sorts of bells and whistles you could put on it. Like
age = validated_input(
    "Please enter your age: ",
    transform_func = lambda raw_data: int(raw_data)
    exception_messages={
        ValueError: "Please enter a valid integer",
        KeyboardInterrupt: "Sorry, this is important. ctrl-C won't help you here!"
    },
    validation_rules={
        lambda age: age >= 0 : "It is impossible to have a negative age",
        lambda age: age < 100 : "There's no way you're that old",
    }
But that may be super duper overkill...
 
when a SQL query is run, does it usually come with the headers?
 
Yeah probably :P that would be ok if you had to have dozens of different validations over a project but most people who come in asking for this type of question are barely starting to learn the language
 
You're absolutely right.
I'd better link to documentation on try/except and break as well, considering the audience probably hasn't seen them before...
 
Yeah
 
1:02 PM
I wonder if it would be better to not put break in the try?
while True:
    try:
        age = int(input("Please enter your age: "))
    except ValueError:
        print("Sorry, I didn't understand that.")
        continue
    break
But then you need a continue... Although the next section would introduce continue anyway
I would prefer the form that requires the least amount of modification to get the version that also validates age >= 0. break outside the try seems to have the smallest difference.
 
cpx
Would there be another way to end the infinite loop without break?
 
You could return, if you're inside a function. I intend to mention that at some point.
 
age = -1; while age < 0:... would be a dirty way of fixing it :P
 
You could also use a flag like while not satisfied_with_input: instead of a while True: loop
 
cpx
You have the break outside of try not in the try.
 
1:09 PM
 
@cpx Yes, but that's OK. break will break out of the loop, whether it's in the try or outside of it
 
subprocess.call(["tx", "pull"]) - this is correct syntax?:)
 
Looks good to me!
 
Please have a look on it : stackoverflow.com/questions/23133365/…
50+
bounty
 
Draft #2. Next, I want to mention that you can put the whole construct within a function. Not sure whether it's better to directly replace break with return, or just stick the return at the end outside the while
@Arya I don't know django, so I can't provide much help on that question... Looks like you've put in some good effort, though, so I upvoted you. I think that will give you a more prominent spot on the Featured page :-)
 
cpx
1:21 PM
With break a continue statement is required but with return won't you need continue as well? But what is wrong with having break?
 
You'd need continue either way.
"replace break with return" is one line shorter than "stick return on the end"... But the latter has a smaller difference compared to the non-function version
 
cpx
I had two windows of chat opened.
 
1:46 PM
Draft #3. I decided to have separate sections for "exception handling with no custom validation", and "custom validation with no exception handling", since dupe question askers might need either one.
 
Hello
 
Greetings
 
:)
 
I think I need to add a disclaimer that 2.7 should use raw_input, not input. Hmm, where should I put that?
 
knowing the os library better makes life so much easier .-.
 
1:54 PM
@Kevin I'd put it in comments by the input so it's obvious
 
Yes, I agree
 
2:05 PM
Ok, I'm pretty satisfied with what I've got. I'm gonna pin a request for comments, and then post to SO it if nobody objects after a while.
I have drafted a Community Wiki of a commonly asked question. Let me know if it can be improved, or if a dupe already exists.
 
2:21 PM
@Kevin looks good. Would you consider putting the break in the first example in a try...except...else... clause or do you think it's better leaving it just within the while? The only reason I mention it is that in the 3rd example you have the break in an if...else
Also this looks very shiny...
 
can you create a separate instance of an app and configure it on a different port? (testing purposes)
 
@Ffisegydd Yes, I think I will do that... Looks nice and shouldn't confuse the newbies more than I already have :-D
 
@Crow yes though I don't remember how off the top of my head
I think you can give a keyword argument via app.run(port=1100)
 
ooh okay that's it, I'm dumb
 
@Ffisegydd Yeah, I only wish the name was more descriptive. You rarely click anything when using a command line.
 
cpx
2:28 PM
Can I find the factorial of 260 in Python?
 
I think that's possible, yes. Shouldn't take too long.
 
cpx
Factorial of 100 is: 93326215694181250000000000000000000000000000000000000000000000000000000000000000‌​000000000000000000000000000000000000000000000000000000000000000000000000000000
 
Yep, I just calculated 260! in about a second. No problems there.
This demonstrates the plain superiority of Python over all other languages: built-in seamless support for arbitrary precision integers :-)
 
and here's a dumb question; how do you import something from the same directory if it is an __init__.py file with no classes in it?
 
cpx
I think C++ doesn't have support for numbers taking a space larger than 64 bits.
 
2:31 PM
@Crow I don't think I understand the situation... Please provide an example
@cpx Not in their standard library, I don't think. I'm sure there are plenty of third party libraries for it.
 
cpx
>>> import math
>>> math.factorial(260)
3830195860836169235117497985604491875279556752309096960191300817480651475135399533485285838275429773913773383359294010103333339344249624060099745511339849626153802980398232848965472622820196848860832049579523313702327662760125732592551956622024712475139889122106940319324041688318583612166708334763727216738353107304842707002261430265483385206376839110078156900663427220806900528365808580136352143713956803295894115605151395493267411709188354023557693440000000000000000000000000000000000000000000000000000000000000000
It went outside the window :P
Almost.
 
57% of my last few messages have contained the phrase "I think" in them... I'm self-conscious about that kind of repetition.
 
@Kevin I think you're okay there. ;)
 
cpx
But then immediately a scroll bar appeared to handle it.
 
I think no one notices but me, but I'm not sure
 
2:34 PM
@Kevin I noticed, but I think I am the only one. Carry on.
 
A while ago, basically all of my messages would start with "Hmm,"
 
cpx
I'm self-conscious of every word I type.
Sometimes just not.
 
I have no shame. makes life easier.
 
It's hypocritical of me, because I'm annoyed by people that end all their sentences with ellipses... Like they're trying to sound deep and thoughtful... But I'm doing the same thing with "Hmm"...
 
I use ellipses to denote pauses. like,
stop.... HAMMERTIME!
 
2:36 PM
@rlemon That's probably a good approach :-) Better than having all shame all the time
 
works out well most days, and the days it doesn't don't bother me due to my lack of shame :)
win/win
 
cpx
Cheers for python for handling larger numbers. Nothing else does like it.
 
var a = [];
function factorial (n) {
  if (n == 0 || n == 1)
    return 1;
  if (a[n] > 0)
    return f[n];
  return a[n] = factorial(n-1) * n;
}
factorial(260)
>> Infinity
js handles it fine ;)
 
haha
one, two, skip a few, 260!, infinity
 
First gold badge :D
 
2:39 PM
You are a super user :-)
I've got a Famous Question over on SU, but I pine for a true Stack Overflow gold badge
 
@GauravGhosal its a sparse language that compiles to javascript, ur something like that
never gave it much attention
 
@Kevin har har har
 
compiling stuff to a interpreted languages is just plain stupid
 
be jealous of my 4~
 
@Kevin was it this that inspired you to this community wiki user input idea?
 
2:42 PM
rlemon, Ontario, Canada.
10.1k 4 32 72
 
not to mention it fucks up the way javascript scopes variables
 
wait, how do you not have a gold badge yet?!?!?!
 
@Ffisegydd No, I've just wanted an answer for this question for a long time. And that question posted today confirmed that, yes, people are still looking for a good solution to this.
 
or at least, thats what ive been told
 
CoffeeScript compiler isn't that bad
the devs are the problem.
you can make LESS spit out some ugly CSS, but that isn't the fault of the compiler.
with that said, I hate CoffeeScript
 
2:44 PM
Reading the article now... Hopefully it will give me some ammunition against the commenters who will say "why are you answering your own question, you rep hog?!"
(The whole pinning thing is part of that too. I'll be able to say, if you object to this, why didn't you say anything in chat during the probationary period? Which is specious reasoning, but might silence them anyway)
 
Well if you're doing a Community Wiki then you get no rep anyway, so that silences one possible criticism.
 
@rlemon i totally agree on that, like i said: compiling stuff to a interpreted languages is just plain stupid...
its like somebody saying that python needs to compile to php
 
Python compiles to Python bytecode, which is then interpreted... :-)
Same for Java
 
@AlexanderMeesters ahahaha, WHY DOES THIS EXIST.
 
2:48 PM
cause of: reasons... i think... maybe he had taken acid or something
 
\o/ just froze Ubuntu
like FROZE froze. had to hard boot
 
never have that problem on arch
 
Install Windows, problem solved. /s
 
remember BUSIER backwards
 
I'm dd'ing 4 4gb sd cards at once.
might have caused something
 
2:49 PM
en enable the sysrq button
saved my arse a dozen times
 
so who here wants to learn Javascript or get their feet wet with HTML5 Canvas?
I'm looking to trade JS tutoring for some Python hand holding
 
hell, i'm still looking for how to implement a very basic shopping cart in django
 
@AlexanderMeesters ಠ_ಠ
 
@Ahmad how do you produce the Unicode eyes so fast?
 
My senior design project in college was basically 100% messing with the canvas. I haven't done anything with it in the years since, though
 
2:53 PM
;_;
 
I googled for look of disapproval
 
cabbage
 
(╯°□°)╯︵ ┻━┻
 
@Kevin Keep in mind, I might just be retarded. gist.github.com/DarkCrowz/1fce0a358c51e7bc6ad6
 
@Ahmad ooo do I have the user script for you then
 
2:54 PM
user script?
 
@Kevin rlemon.ca
@Ahmad what browser do you use
 
Nice lil' swimmers :-D
 
Safari and chrome @rlemon
 
IE6 is the best browser eva!
If you want a short lifespan, that is
 
OMG, the 90's called, they want their browser back
 
2:55 PM
gist.github.com/rlemon/11198858 this is a userscript to add tab complete 'snippets' to the chat input.
 
Lynx 4 eva
 
@Kevin indeed!
 
Tss, really cool people use netscape navigator
 
netscape4eva
 
so I type o_o and hit TAB and get ಠ_ಠ
 
2:56 PM
hahah nice!
thanks :D
 
@Ahmad Ice FTW
 
@Ahmad No kidding, we actually still support a system at work that MUST support Netscape Navigator
 
what.
lol
 
worst I support is XP desktop apps
 
2:57 PM
@Ahmad That was my reaction as well
 
We draw the line at IE7
 
err. actually. QNX4 is the worst we support
 
@Terfin let me guess, you just finished the upgrade to windows2000 too?
 
Actually we might just as well start migrating into Windows Server 2008 soon.
So you weren't that far off :P
 
OMG
well thats better then my fedora core 3 NAS i have at home
still got 2 500mb ide disks in that baby
 
3:00 PM
But seriously, our major codebase supports IE8 and later. We might as well advance into supporting only IE10+ if we get all the workstations upgraded from XP to at least WIN7
 
well i'm off to home, goodnight
 
@Crow ok, now the question makes more sense.
My first guess is, would import __init__ work?
Or from __init__ import *, I suppose, since you seem to want to call create_app without qualifying it with a namespace
 
cpx
>>> n = 926336713898529563388567880069503262826159877325124512315660672063305037119488
>>> while (n != 0):
	n-=1
any guess for how long it will take?
 
2.9 * 10^64 years
So, after all baryonic matter turns into photons and leptons, but before black holes are the only things left in the universe.
So, practically speaking, your computer won't survive long enough to finish executing.
Unless it's a really elaborate turing machine made out of black holes
 
cpx
3:17 PM
I should exit the shell and stop waiting for it to complete.
I was trying find the combinations using a formula for this large value.
I commented it out with # cannot be calculated in this life time.
 
blehh. I can't see why this doesn't work
 
node doesn't like that.
 
Crow try from. import create_app
 
been running for some time now
 
There should be a space between the from and the .
 
3:32 PM
ran a smaller test and did the math. that would take 3.2164469232587834e+66 days to complete
:/
 
would there be any reason for a log displaying on console, but not actually logging to a file?
 
Cabbage!
@Martijn Lies! D;
 
@poke Cabbage! Potato?
 
Banana
 
I’m banana, melon! Potato?
 
3:37 PM
might I suggest another term?
Lemon === Legendary ;)
> dude, that is so Lemon!
 
Le… wait for it …mon.
 
hahahaha
Marvin
wait for it.....
Eriksen!
 
@poke banana, melon!
 
Yam Yammmity Yam Yam! I just Yamming unpluged the Yamin card writer.
Imagine someone using salad language offensively and you flagged them.
> why don't you go Yam yourself.
imagine what other rooms would think
 
Salad language cannot be used offensively.
 
3:44 PM
@poke Carrot! One can tell another he's a tomato
 
Oh right
nvm me.
 
 
1 hour later…
4:47 PM
would there be any reason for the csv writer not including headers by default?
 
A recent question here ends with, "Awaiting response"
Oh, you don't say? I thought this was one of those questions where you don't want to get an answer.
 
5:02 PM
nevermind, found it out. Turns out it was oracle db causing the problem. Should have probably expected that...
 
DSM
cbg, all
 
cbg @DSM - potato?
 
@JonClements @DSM cbg
 
DSM
Better. Was both (1) insanely busy dealing with a model which refused to behave, and (2) very, very sick.
Bad combination.
 
5:10 PM
@DSM indeed.
 
Doesn't sound like fun at all... you feeling better now?
 
DSM
Still coughing up a storm, but I'm no longer getting wide swings from feverish to freezing. True story: not only did I faint at the Vigil, but I fell asleep -- with eyes open -- and started snoring during a conversation with a colleague.
Between one sentence and the next..
 
Wow... that's really not good - you got the doc to check you out?
@Kevin how come you used notehub and not a temp. sopython wiki entry? :p
 
DSM
Bah, those quacks? I have enough problems.
@Kevin: I read your draft. I might add a line or two explaining why putting the question outside as well (DRY violation) and using recursion (unnecessary stack loading, possible crash) are antipatterns.
 
Looks much nicer: sopython.com/wiki/kevin
Could even throw in something with iter in there for completeness :)
Also, probably over kill, but could also hack wtforms or similar and build a model with required validation...
 
5:22 PM
Subclass int to throw an exception when it is outside of the correct range :p
 
So who noticed click? click.pocoo.org
 
I did earlier, it looks cool
 
Nope - hadn't noticed that... umm... just reading the "why click?" - as really not sure another one is needed...
 
@Bibhas nice! thanks
looks nice
 
It's already got 11 PR's to fix typos in the docs :)
 
5:27 PM
:D
 
@JonClements I didn't think of it.
Might be nice to use it next time, so members can make comments directly on the page instead of pinging me in chat
 
@Kevin fair enough... the wiki's still locked down to only certain people still... so it'd be safe :)
 
Would it be possible/useful to flag certain wiki posts so they don't appear in the table of contents? Just have them accessible via url
 
@DSM Yeah, I see the recursion antipattern pretty often... Whenever I tell them "this will crash if the user stupidly enters bad data 100 times in a row", they never seem especially concerned
 
So ideas like this could be whipped up without temporarily cluttering the toc
 
5:36 PM
@Ffisegydd umm.... possibly...
I'm a little worried I have starred posts which seem to indicate I dislike clients and doing any work... :p
 
Or possibly have a url like /private/mywikipost which simply won't be added, so everything in private is ignored
 
@JonClements Haha. Well, if you want to take down libelous pinned messages, I don't think anyone will mind :-)
 
@Kevin what messages? :p
 
Hmm, must have been my imagination
These aren't the droids we're looking for. Move along, please.
 
@Ffisegydd it's something to consider, but won't be at the top of the todo list for the site :)
 
5:46 PM
What's the usual max recursion limit? 1000?
 
so I'm trying to write a zipfile, but it puts the files in a very long line of directories. Am I doing something wrong?
oh der.
 
>>> import sys; sys.getrecursionlimit()
1000
@Kevin looks like it
 
Thanks :-)
Trying to write a section for the antipatterns DSM mentioned...
 
@Kevin could even expand upon something like:
validators = {
    'loud': str.isupper,
    'quiet': str.islower,
    'email': re.compile('.*?@.*').match
}
(that email one is completely rubbish no doubt... but just a concept!)
 
Yeah, me and Ffisegydd discussed that this morning. It'd be fun for me to write, but probably would be a bit too advanced for the intended audience
(e.g. people that started learning yesterday)
 
5:58 PM
Do you folk use UML when designing a large system?
 
I use boxes with lines drawn between them. Nothing formal.
But then, my large systems tend to go kaput more than I'd like, so that may be a sign to not follow my example...
 
01:00 - 18:0018:00 - 23:00

« first day (1286 days earlier)      last day (3645 days later) »