« first day (2229 days earlier)      last day (2719 days later) » 

user559633
12:00 AM
@s_mart The HTTP 104 is what made me curious. That's a strange status code.
 
user559633
I'm on 10.11.6 Mac OS -- once this vagrant box comes up we can check if it's something specific to that disk image (hah, well, as long as I can make disk space for it to launch)
 
@tristan thanks. I tried on 16.04 and 14.04 images -same things
python 2.7 /python 3.5 - same
 
DSM
I really don't want to be doing certain errands..
104? Weird.
 
user559633
I'm waiting on "a start job is running for Raise network interfaces", which is an error message that tells me nothing and I've debugged networks for a living.
 
user559633
They're finally making Linux perfect for no one.
 
user559633
12:06 AM
If this is systemd, lol. An unskippable warning that made it take >5 minutes to boot (suspiciously close to 300 second DHCP + a few seconds because they don't trust computers to count correctly).
 
DSM
Unfortunately since that command works for me and I'm not sure I've ever seen a 104, i can't be of any help. :-(
 
thanks to everyone. I also first time faced up with such error, and now even do not know where to find bug/error or what to look next to find it
 
user559633
an unskippable wait for DHCP. systemd is hilariously worse than i had previously had mocked it for being
 
DSM
Does the same problem happen across bare http?
 
good night
 
DSM
12:15 AM
:-) Rhubarb, Andras.
 
for host adwords.google.com - also
 
user559633
vagrant@vagrant:~$ python3
Python 3.5.2 (default, Sep 10 2016, 08:21:44)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib.request
>>>
>>> url ="https://adwords.google.com/api/adwords/mcm/v201609/ManagedCustomerService?wsdl"
>>> f = urllib.request.urlopen(url)
>>> print(len(f.read()))
127657
 
user559633
can't reproduce
 
user559633
 
user559633
relevant network settings
 
user559633
12:17 AM
I'm on virtualbox 5.0.10. Sounds like something on your local network.
 
DSM
@s_mart: just to be clear, does it happen if you try http://example.com? https://example.com? http://adwords.google.com/etc?
 
@tristan thanks, will be searching in my virtualbox settings, maybe some error with configuration network there
@DSM example.com, facebook.com (both http,https) work ok. just anything (http/https) related to adwords.google.com
i found that, when trying to use their sdk library
 
DSM
Huh. Well, there goes my one theory.
 
user559633
@s_mart That doesn't sound like it's related to your local machine then.
 
user559633
I'd reboot to clear the machine state, then try again. If it's still happening, I'd connect to another network and try again (e.g. try from a coffee shop if you can).
 
12:21 AM
@s_mart you may also try tcpdump
I've been playing around with it a bit myself
 
user559633
If you go that route, use wireshark.org instead of trying to make sense of the command line output.
 
(that's what Julia recommends in her post ;)
 
user559633
This screams "work network admin using a setting he/she should have on the router"
 
user559633
Well, that's what I'm recommending not having read the post.
 
user559633
I know Julia and know her to be a very smart person, so I'm not surprised we agree on tools :)
 
DSM
12:24 AM
Okay, let's see if the second time is the charm. Rhubarb!
 
user559633
later DSM, have a good night
 
so, at the moment I destroyed again my box and waiting creation of new one )
 
pros of using a raspberry pi as your wifi router - I can actually debug the thing
 
downloaded also Littlesnitch to check output connections
 
user559633
@s_mart Are you on an employer's network?
 
12:25 AM
@s_mart not sure if you've looked at docker containers, but they do make life a little nicer/speedier when you're doing stuff like that :P
 
user559633
lol docker.
 
(rkt might also be suitable)
 
no, at airb'n'b host. But I'm working here for last month, so didn't see anything like this before.
 
I'm going to tether network from 3g
 
user559633
12:27 AM
@s_mart And, to be totally safe, you're not using DNSmasq or anything to block ads, are you? (and don't have a host entry specifying something else as that domain name)
 
> a person who can procure, train, and then throw snakes at my enemies
More evidence that life in room 6 is a valuable skill for the post apocalyptic world
 
user559633
@WayneWerner I want James Mickens to just summarize life for me.
 
> The systems programmer has written drivers for buggy devices whose firmware was implemented by a drunken child or a sober goldfish.
ZPL, anyone? Anyone?
 
user559633
I want James Mickens to also describe systemd.
 
> “THERE ARE NO MODAL DIALOGS IN SPARTA.”
Also reminds me of my first job - we were part of the SARP (Systems Analyst Resource Pool)
 
user559633
12:35 AM
You'll find that you will want to copy and paste every line of that article if this is your first time through it.
 
user559633
> However, when HCI people debug their code, it’s like an
art show or a meeting of the United Nations. There are tea
breaks and witticisms exchanged in French; wearing a nonfunctional
scarf is optional, but encouraged.
 
taught COBOL in our month or so of training
we did some kind of ... I think i was PIC-X(500)? With a line art drawing and the caption, "Madness? This is SARP-AAAAAA!"
 
user559633
nerd
 
@tristan This is very true so far.
As is that :D
 
This is probably a noob question, but the Python code at on this GeeksforGeeks website prints out the length of a longest increasing subsequence, but not the actual subsequence. I'm not sure how to print the actual subsequence itself (not just the length).
# Dynamic programming Python implementation of LIS problem

# lis returns length of the longest increasing subsequence
# in arr of size n
def lis(arr):
    n = len(arr)

    # Declare the list (array) for LIS and initialize LIS
    # values for all indexes
    lis = [1]*n

    # Compute optimized LIS values in bottom up manner
    for i in range (1 , n):
        for j in range(0 , i):
            if arr[i] > arr[j] and lis[i]< lis[j] + 1 :
                lis[i] = lis[j]+1

    # Initialize maximum to 0 to get the maximum of all
 
user559633
12:40 AM
@WayneWerner Yeah, his writing makes my face do this thing where my mouth is open and smiling, yet tears are slowly forming
 
That sounds like it should be a line from Welcome to Nightvale
 
user559633
Would you recommend that show? One more on top of the pile might be the thing that gets me to actually start enjoying it (shades of OverWatch come to mind)
 
oh man, it's so good
It's this blend of horror and snark and delightful surprises
 
user559633
I...will let you know what I think in a month
 
I mean, I listen to it on 1.6x speed... though I do wish I could automatically slow down when it's time for the weather.
I look forward to your impressions :D
> to write directly to network ports using telnet and an old copy of an RFC that you found in the Vatican
I'm not saying that I've done that exact thing, but I'm also not saying that I haven't done something asymptotically approaching it
 
user559633
12:48 AM
I'll do regular speed. I should get an exercise bike and just close my eyes and have a moment where I'm not staring at a screen during the day
 
user559633
I once debugged a custom network protocol for which the source had been lost using netcat and strace on the other end
 
@tristan yep, I do not use DNSmasq. I restarted macos, re-created vagrant box, same issue. Via Littlesnitch Ive see attempt to connect to adwords.google.com via 443 port, same as curl
but still curl - works, via python script - not
 
user559633
@s_mart What does that URL show when it's working?
 
user559633
Does it expect some sort of auth token or secret? Actually, sorry, that's right, I couldn't verify on my side.
 
some xml data. that url I took from exception from googleads-python-lib, trying to use some of their examples
 
user559633
12:57 AM
@s_mart Yeah, the weird part is the HTTP 104.
 
user559633
I'm leaving for the night. Good luck! (and later, Wayne)
 
rbrb tristan
 
 
3 hours later…
3:40 AM
I'll never regret that German is my native language http://t.co/aEHWJdVi6T
 
4:13 AM
Number = raw_input("enter your Grade in numbers :")
if (Number >= str(8.5)) or (Number == str(10)) :
print ("your Grade is A")
elif (Number == str(7.5)) or (Number <= str(8.49) and Number >= str(7.51)):
print ("your Grade is B")
elif (Number == str(6)) or (Number <= str(7.49) and Number >= str(6.01)):
print ("your Grade is C")
elif (Number == str(5)) or (Number <= str(5.99) and Number >= str(5.01)):
print ("your Grade is D")
elif (Number == str(0)) or (Number <= str(4.99) and Number >= str(0.01)):
My else statement is not gonna work? Whats the reason?
Else statement should execute when the input provided is not an integer
 
 
1 hour later…
5:21 AM
[int(num) for num in string.split() if num.isdigit()]
What is this kind of inline loop called again?
 
5:35 AM
Cabbage
@SterlingArcher It's a list comprehension
 
That's it, thanks!
 
BTW, string isn't a good choice for a name since there's a standard module with that name.
 
good to know, ty :)
 
Shadowing the names of modules isn't as bad as shadowing built-in stuff like list or str, but it can be kinda confusing to people reading your code. And if you had import string at the top of you script then did something like string = "1 2 3" later in your script then you wouldn't be able to access the stuff in the module.
And if you're running Python 2, it could be even more confusing, since in the very early days of Python the str type didn't have all of the handy methods that the modern str has. Instead, you had to import string and call the string manipulation functions it defines.
Python 2 has kept those functions for compatibility reasons, but the docs have been advising people not to use them in new code for quite a while. In Python 3 all of those old functions have been removed from the string module, and it's mostly just used for a few handy string constants that it defines.
 
5:51 AM
cbg
Just wanted to share a random thought. Not relevant to the previous discussion subject.
 
6:57 AM
cbg
 
user6568562
Hey Antti [ :
 
@WayneWerner the reply in there, you can say in English: to come together :D
@randomhopeful wotcha
 
7:29 AM
cabbage
 
Evening, Antti and random. Feeling nervous Bhargav? :)
 
user6568562
Hey PM2 [ : What you did in that list comprehension is crazy ! The python 2 scope thing feels super weird
 
@PM2Ring Kinda
 
Good luck!
 
Thanks :)
But yeah, If I don't become a mod, I'll be taking up another project under a prof from UofT (Toronto). So it's a win-win situation ;)
 
7:41 AM
Is there a way to get rid of the for loop in this code
AP_list = ["AP" + str(y).zfill(2) for y in range(1, 38)]

for i in AP_list:
    q_list = [i+z for z in LETTERS]
 
Lol, I like that video :D
@Wally What is LETTERS?
Is it an array of strings?
 
Alphabets
I want to scrape vehicle number data from RTO of Andhra Pradesh
LETTERS = "ABCDEFGHIJKLMNOPQRST"
 
This is where string formatting becomes useful again...
>>> ['AP{:02}{}'.format(i, j) for i in range(1, 5) for j in 'ABC']
['AP01A', 'AP01B', 'AP01C', 'AP02A', 'AP02B', 'AP02C', 'AP03A', 'AP03B', 'AP03C', 'AP04A', 'AP04B', 'AP04C']
just add the extra loop inside your original list-comp
 
LETTERS = string.ascii_uppercase
 
7:44 AM
@Wally Your for i in AP_list: loop is weird. It makes a bunch of lists & throws them all away except for the last one.
 
This'd be easier for you.
 
@JonClements I tried to get Wally to use format the other night, but he finds my "AP" + str(y).zfill(2) solution easier to read.
 
@PM2Ring Yeah saw that - what can I say? shrugs
 
Hmm, I am not able to understand about that q_list there @Wally, Can you explain as to what it needs to be?
 
I need to generate numbers of all combinations strting with AP01 to AP37 and then add all permutations of alphabets for example AP36q2708 AP24QB5467
Those are vehicle codes
 
7:50 AM
Jon's code can be adapted to use the zfill method like this:
["AP" + str(y).zfill(2) + z for y in range(1, 5) for z in 'ABC']
 
I think you need to change the positions of the two for loops, to match the exact logic. (But, It's the same anyway)
 
@Wally That's a lot of combinations. Do you really need to put them into one giant list? It would probably be better to create them one at a time with a generator. What do you want to do with all those vehicle codes?
 
For scraping an entire db of vehicle codes.
From a govt website
 
But @Wally, Most of them might not be valid codes, right?
 
I tried scraping AP36Q series and got only a few invalid ones
 
7:55 AM
Atleast in my state, the alphabets are quite quite restricted. The only legal ones are A, F, G, H, J, M
 
I guess when you to 2 alphabet it may cause problems
I didn't know that. I need to look that up.
 
A -> Public transport owned by private, F -> Public transport owned by govt, G-> Government transport owned by govt H&J -> Private 2 wheeler M -> Private 4 wheeler.
That's how it's organized here
 
Laterz.
 
any python code to split the addrress
 
7:59 AM
cbg
 
addrress.split()
@AndyK cabbage
 
for example i have an address and it has street address zipcode,city and country like this 10-20 Kingsland Road, Hackney, London, E2 8DA, United Kingdom
 
>>> from itertools import product
>>> [str(a)+b+c for a,b,c in product((1,2,3), 'abc', '456')]
['1a4', '1a5', '1a6', '1b4', '1b5', '1b6', '1c4', '1c5', '1c6', '2a4', '2a5', '2a6', '2b4', '2b5', '2b6', '2c4', '2c5', '2c6', '3a4', '3a5', '3a6', '3b4', '3b5', '3b6', '3c4', '3c5', '3c6']
@Wally That kind of combination is called the Cartesian product, and you can use itertools.product to make them efficiently.
 
like street will go to street zipcode will go to zipcode field
 
@PM2Ring How do I get 4 digits instead of 1 using itertools poduct ?
 
8:09 AM
@SohaibAsif Making a general-purpose address parser is hard because there is so much variation in the possible address format. And even if you're just getting addresses from a single source that tries to keep things neat you may have to deal with addresses that don't fit the general pattern. But for starters, I suggest using .split to get components, and .strip to remove leading & trailing whitespace.
 
I got it add another digit string
 
i am getting address in two formats
10-20 Kingsland Road, Hackney, London, E2 8DA, United Kingdom
Maestro Ekithai Ahn - Cala Estancia, 07610 Can Pastilla, Spain
 
@Wally Give me a minute or two & I'll show you an example
 
and the list goes same i have heard about python library 'usaddress' it split in probability
@PM2Ring give me example too
 
@Wally Here's an example using format that will produce all the codes of the form AP36Q2708:
letters = "ABCDEFGHIJKLMNOPQRST"
for t in product(range(1, 38), letters, range(10000)):
    code = 'AP{:02}{}{:04}'.format(*t)
 
8:15 AM
Wow you can use multiple for loops in list generator []. I didn't know that.
 
@Wally Yes. But it's neater (and more efficient) to use product if you want more than 2 or 3 loops. Of course, product is still doing a bunch of nested for loops, but it hides the messy details, and does as much of the work as it can at C speed.
And the really neat thing about product is that you don't even need to know how many for loops you want in advance! Eg, you can do a=['abc', 'de', 'fgh'];z=list(product(*a)) and product will make 3 nested for loops.
 
@PM2Ring Your code is returning only AP37T9999
Not all combinations
@PM2Ring Your code is returning only AP37T9999
I need to append to the list. Oh!
 
@Wally It's making them all, and throwing them away.
 
from itertools import product
letters = "ABCDEFGHIJKLMNOPQRST"
for t in product(range(1, 38), letters, range(10000)):
    listy = []
    code = 'AP{:02}{}{:04}'.format(*t)
    listy.append(code)
print(listy)
 
As I said before, it's better to make the combinations one at a time and use them as you make them, rather than saving them into a giant list.
 
8:25 AM
Ok
 
@Wally Close. Put listy outside the for loop.
Or do this:
 
cbg
 
listy = ['AP{:02}{}{:04}'.format(*t) for t in product(range(1, 38), letters, range(10000))]
 
Wow! This is the hundredth time I've done that mistake
 
Everyone makes mistakes, even the experts. We just tend to be less likely to make them, and we get faster at noticing them, and remembering how to fix them.
 
8:28 AM
@PM2Ring yeah, as an expert, I notice my mistakes so easily... because there are so many of them :cries:
wait, why is sublime text so expensive?
 
Not more expensive than Pycharm if I remember correctly
 
except that pycharm is a full IDE
 
@randomhopeful I grew up with computers early on (70s and 80s), I loved hacking on my MSX and, later, my PC. I went to study computer science and to fund a holiday, I took a part-time job as web designer / developer (shortly after the CGI interface was invented), and when a full-time job was up for grabs, I went for it.
 
@SohaibAsif This should get you started:
data = [
    "10-20 Kingsland Road, Hackney, London, E2 8DA, United Kingdom",
    "Maestro Ekithai Ahn - Cala Estancia, 07610 Can Pastilla, Spain",
]
for s in data:
    a = [u.strip() for u in s.split(',')]
    print(a, len(a))
#output
['10-20 Kingsland Road', 'Hackney', 'London', 'E2 8DA', 'United Kingdom'] 5
['Maestro Ekithai Ahn - Cala Estancia', '07610 Can Pastilla', 'Spain'] 3
 
Back-after-Monday-off cabbage to you all
 
8:33 AM
cabbage
 
user6568562
@MartijnPieters You mean you were born in it, molded by it. :D
 
user6568562
Cbg holden [ :
 
The OP of this question I hammered a while ago is still confused about Python's scoping rules. I linked him to the scoping explanation in the tutorial, and the answers in the dupe target look good to me, so I'm not sure what else I can say that will help him.
 
I have a doubt in this line of code. 'AP{:02}{}{:04}'.format(*t) {02} Is this slicing. Why is there a zero if it's slicing
 
lol municipality of Lohja ran out of original ideas for street names, so now they will have "Emoji Street" and "Meme Street"
 
8:44 AM
@Wally No, it's not slicing. The : (colon) is just being used as a separator there. We have nothing before the separator in that example, but we could have field names or numbers before the colon. If we put field numbers in, it looks like this: 'AP{0:02}{1}{2:04}'.format(*t)
 
@Wally There's a full explanation, with lots of examples in the link I posted the other night: Format Specification Mini-Language. There's a lot of info there, so don't expect to absorb it all at once. It's pretty easy to learn the most common formatting commands, but whenever I need to do anything fancy I check those docs first.
 
There's a website about format. lol!
 
@AnttiHaapala Do you want to help Scope Guy? I give up.
@PM2Ring "If the definition occurs in a function block, the scope extends to any blocks contained within the defining one" outer is a function block, inner is a function block contained within it, why isn't the scope of outer extending to inner as described? — Matthew Trevor 6 mins ago
 
@PM2Ring I woudln't, python 2 :D
but.. let me see
ah let me reopen...
@PM2Ring the answer is correct, it is more a problem of x is not local
 
8:57 AM
cbg
 
@AnttiHaapala I'll re-open if you want to write another answer. FWIW, you have an answer at the dupe target: stackoverflow.com/a/23471004/4014959
 
@PM2Ring no I don't want
that is unclear and unable to reproduce
 
I don't blame you. :)
 
lets reopen when the question makes sense
--Return--
> /.../foo.py(7)broken()->None
-> import pdb; pdb.set_trace()
(Pdb) x
1
so the first part doesn't make sense, but it is just the X to a Y, and Y is not reproducible.
 
\o @manuzi1
 
9:00 AM
Why don't you use your actual code, the locals behaviour is different from your actual issue. Just try printing locals()['x'] in the working function. — Antti Haapala 4 mins ago
I had cv'd that question but it never got to 5 votes
doesn't have the full error in the question, thus not useful
 
@AnttiHaapala Closed as dupe
 
@AnttiHaapala i deleted it, because you were faster :D
 
just downvote and flag to close... otherwise they never learn :D
 
(y)
 
9:14 AM
ah but you can't flag or downvote yet :D
go write more posts!!
 
and you can't vote in elections also :D
 
Do we have a canonical for stackoverflow.com/questions/40737472/… ? The OP isn't even making copy of their dict that they modify & append to a list in a loop, but they're still surprised that all their dicts are identical.
 
@AnttiHaapala haha, i have to work :P but i can flag hehe
 
@manuzi1 at 125 rep you're much more useful :D
can downvote all those crap questions
 
ok i will go for it, sir :D
 
9:18 AM
@PM2Ring Hmm, Wait.... Isn't the expected output same as the actual output if they remove the print there? (Atleast that's how it looks on the first glance)
 
@BhargavRao downvoted that type - self-qa :D
@BhargavRao no
@BhargavRao they want different dictionaries, but there is only one
a totally clueless newbie, and Python 2 FFS :/
 
Ah, Ok.
I didn't read the Q properly
 
@BhargavRao Look at the last line of output. I guess it must be a bit bewildering to the poor OP. They see what they expect from the the prints that happen inside the loop. But then they print the list of dicts and its wrong.
 
Hi guys, I've got a problem. I'm using a tool that will take my src/lib1/lib1.py and make it available under import toollib.extras.lib1.lib1. This gives me problems in my unit-tests since I have some code that does the import toollib.extras.lib1.lib1, but that is not really where it is when running the stand-alone unti-test. So my question is: Is there a good way to make it such the toollib.extras part point to my src folder when unit-testing. Hope there is enough context :)
 
Gitcha, The color value changes. Yeah, I think there's a dupe for that. Just a sec.
 
9:25 AM
@mortenvp eww.
that doesn't sound right
 
Ok :) tell me - where did I go wrong?
The tool copies my folder lib1/lib1.py into it's own folder structure.. that is why - when I run the tool I have to import from that toollib/extras thing
 
so why wouldn't you have the same directory format there?
what's this with changing the layout :?
 
Yeah, that's not within my control :)
 
so you have a big problem :D
 
He he, ok that bad?
 
9:28 AM
yes, you need to do something stupid and it is not in your control :d
how is that not a problem
I wouldn't change package layout like that, or at most, it could be lib1.lib1 but perhaps located in toollib/extras directory...
and you say: it is src/lib1/lib1 but it refers to itself as toollib.extras.lib1.lib1?
 
Mornnnning
 
is anybody using Emacs here?
 
@khajvah Welcome to the python chat, See our rules sopython.com/chatroom. Don't ask "does anyone use this ..", ask your question directly.
 
9:38 AM
cabbage Bobby and Withnail
 
@khajvah I am using neither e-Macs nor mechanical ones
 
@BhargavRao that was my question :P
 
Yes, so I have my source in src/lib1/lib1.py but when the tool builds itself (basically) it copies it to another location - it is like a plug-in I'm making.
 
:D ... I've stored that as a frequent message :D
 
I can't get jedi autocompletion work on custom modules
 
9:39 AM
@mortenvp so why is it in src/lib1/lib1.py, why is it copied, why are plugins contained there?
shouldn't they be plugins, not embeds
 
The tool is not mine.. I'm just extending it. When I build the tool it makes itself stand-alone.. By copying all dependencies into it's own folder structure
 
When are the election results done?
 
@Withnail stackoverflow.com/election?cb=1 election ends in 10 hours
 
Are they instant after that?
 
Takes 3-4 mins. But there's a bot in the election room that immediately tells the results.
 
9:49 AM
Noice.
 
vote counts are public too after that
so one can play "what-ifs" :D
 
ok, now I need an error checker for my emacs and 5 more years to get used to it.
 
I'd not be surprised if I'm not elected, There are a few other capable contestants.
The amount of support that I've received in the last few days has left me stunned though, and I'm really happy bout that.
 
@BhargavRao that's really democratic
 
10:02 AM
make stack overflow great again!
 
@AnttiHaapala ops
 
10:35 AM
Is declaring a length better for SQLAlchemy. Or is it just something you do to restrict length for yourself
For columns I mean
Is it for performance or security and restriction
 
it depends on database
in postgresql varchar is not any different from textfield
so its only for integrity reasons
 
What about sqlite
 
not sure, but according to some SO answers sqlite uses TEXT for all character types
 
@marxin the datatypes in sqllites are dynamic sqlite.org/datatype3.html
 
@tristan @DSM @WayneWerner guys, thanks for yesterday help and support. I reproduced that bug on other project with other system version and actually with PHP stack ( but still with google host(recaptcha api)).

And for that stack trace I googled bug in Virtualbox https://github.com/mitchellh/vagrant/issues/7946
that reffer to my question stackoverflow.com/questions/40703458/…
 
10:50 AM
Cabbage!
 
sqlite does indeed store all values as text
Cabbage, poke
 
\o
 
@holdenweb “all values”?
 
As far as I know, yes
 
But isn’t that what those five-ish storage types are for?
null, text, blob, integer, float?
 
10:56 AM
Ah, you mean section 2.1 in sqlite.org/fileformat.html ?
I guess that means I'm wrong
 
I’m opening a hex editor as we speak :D
 
Fortunately that's a situation I'm pretty comfortable with, having become accustomed to it over the years
 

« first day (2229 days earlier)      last day (2719 days later) »