« first day (1578 days earlier)      last day (3595 days later) » 

00:12
it looks like @J.F.Sebastian came up with a pretty good solution
00:52
Does anyone have any experience in integrating Zurb Foundation wtih Django? I'm not sure how to go about it. If not Foundation, any advice for using front-end frameworks would be a great help! :D
ummm front end frameworks are usually just css/javascript you include
in the head of your html doc
Hmm okay. Maybe I'll go with just the CSS/HTML then. Foundation has the option of using Sass and Compass too or something like that but it's probably too complicated for what I need anyway
Thanks
Guys
I have established that a folder is a file.
Celebrate!
 
4 hours later…
05:52
cbg
So I spent 3 hours working on one of my side jobs after my 9-5 today.
I'm now 3 hours behind where I was when I got there.
struggling through installing a new server for a non-profit I volunteer for. Got halfway through the server install last time I was there and realized they didn't have room on their switch for another device
they have room now, so I wanted to finish the install, set up SSH and etc and get the VPN running so I could work on it from home
instead I realized I didn't remember the password to the encrypted LVM I set up on the server, the box doesn't have a hard drive and I forgot my Live USB so I can't just re-wipe it and there goes an hour of my time trying
Figured I'd at least set the VPN up -- oops I redirected the modem to the router and vice versa. Locked out of both now and had to factory reset them. Router didn't survive the factory reset and is now bricked.
 
1 hour later…
07:05
I need some advice , i have a daemon process which uses a log it also wants to rotate. So the file descriptors are open and my attempts of rotation by os.rename doesnt work.

We are using only basicConfig, I added another handler and it started printing duplicates
so is there a way i can rotation using the handler of basicConfig?
07:58
@Sandy which operating system?
windows?
have you considered using these: docs.python.org/3/library/… ?
0
A: Flask Sessions - Storing Connection to Rserve?

davidismWe need some common location to create an rserve connection for each user. The simplest way to do this is to run a multiprocessing.Manager as a separate process. import atexit from multiprocessing import Lock from multiprocessing.managers import SyncManager import pyRserve connections = {} loc...

good thing for that user that I couldn't sleep
08:14
Go to beeeeeeeeed.
Cbg btw
@Ffisegydd would it be safer if we checked he hadn't run some form of script before @davidism goes to bed? :p
My schedule's so messed up, I took a 4 hour "nap" after work today yesterday. :-/
Anyway, rbrb, sleep.
rbrb - rest well
 
1 hour later…
09:28
@AnttiHaapala oh yes i did and they actually work well but the whole application is using the basicConfig so adding this extra handler gives me duplicate records
and im looking for a quick patch .. another friend suggested copying the file and emptying the current one , what do you think
so dont use basicconfig
no not that one either
worst idea ever :D
yeah thats the whole point but fixing it will take me more than a day to change everywhere so i am wondering if there is any quick temp workaround for some days
re-cbg
@AnttiHaapala I will eventually have to fix the logging for the whole application, do you suggest i work the proper way
I was just looking for something quicker to just get some rotation started for some time
@Sandy stop the daemon for rotates :D
or copy the contents but who knows what happens since this is windows
truncates might not work at all
09:37
@AnttiHaapala this is going to be on linux :)
"going to be on linux"
yeah
on linux you can os.remove everything all the time (though it is not reopened unless you use watchingfilehandler"
none of those will work because os will keep the file even if it is deleted till all file descriptors are closed
yes, but watchingfilehandler will close it outright
09:40
yeah , have you used watchingfilehandler? i don't think it worked for me not sure why
i created a handler and added it then renamed the file and created a new file
for some weird reason it still wrote to the old file
sorry did you say watchingfilehandler or watchedfilehandler :o
watched or whatever it is called
watchedfilehandler doesn't work on windows at least
09:59
im on linux but this adds another handler on same file :/ so looks like migrating to TimedRotatingFileHandler is my only solution :D
cbg
@Sandy dunno what kind of config you have, seems like you indeed have 2 handlers writing to the same file, so obviously not going to work
logging.basicConfig(filename=settings.LOG_FILE, filemode='a', level=LOG_LEVEL, format=LOG_FORMAT)

this is all i have in a __init__ which is what all the files using
i guess that has his own handler because with basicConfig i havent seen anyone adding any handlers
was it possible to do custom str hook in JSONEncoder py3.4
need to weed out all \0 in strings
that is do s.replace('\u0000', '\u1234')
I guess it is not possbile
seeing the encoder source code
def substitute_nulls(value):
    if isinstance(value, list):
        keys = range(len(value))
    elif isinstance(value, dict):
        keys = list(value)
    else:
        return

    for key in keys:
        v = value[key]
        if isinstance(v, str):
            value[key] = v.replace('\u0000', '\uFFFD')
        else:
            substitute_nulls(value)

def null_substituting_json_decode(s):
    rv = json.loads(s)
    if '\\u0000' in s:
         substitute_nulls(rv)

    return rv
this kind of stuff
(top level is never a string)
we're dead if it is in key :D
s/value/v/ in substitute_nulls and it works
>>> null_replacing_json_decode('{"foo":"\\u0000","barf":{"bar":"\\u0000","baz":["\\u0000",{"bar":"\\u0000"}]}}')
{'foo': '�', 'barf': {'bar': '�', 'baz': ['�', {'bar': '�'}]}}
Hi everyone need some linux related help
I form a classic example of hardpressed Windows user trying out stuff on Linux.
Just came across export command in hadoop example.

read and tried more about it from [this](http://stackoverflow.com/a/7328289/1317018)

but now facing some more variations of command which I am not able to understand, may be due to lack of enough bash scripting knowledge.

I understand that `$ export FOO="bar"` will export the variable `FOO` to the environment of subsequently executed commands

but then what does this means:
Those ** are just to emphasize what confuses me
10:34
not your linux shell forum, but:
export HADOOP_CLASSPATH=$(bin/hadoop classpath) = execute command: bin/hadoop classpath and everything that the command prints out to the stdout, and EXPORT_CLASSPATH variable is set to that value
so if it prints foo:bar:baz, then HADOOP_CLASSPATH is set to foo:bar:baz
the latter one means:
concatenate the value of the PATH variable with ":/usr/local/bin" and set this as the new PATH
the shell equivalent of pythonic PATH += ':/usr/local/bin'
You typed EXPORT_CLASSPATH by mistake right?
yes
HADOOP_CLASSPATH ^
thanks thats quick, great and very handy...and sorry for asking non python stuff
@Mahesha999: unix.stackexchange.com is generally pretty good for bash questions. Some really top-flight bash users hang out there, including Stéphane Chavelas (discoverer of the Shellshock bug in Bash). And of course you can ask Bash questions in SO (using the tag), but I find U&L a little bit more laid-back.
was this one worth to ask as a separate question?
that was purely lack of experience stuff
nyways next time I will straight hit on unix.stackexchange
10:47
Maybe not in SO, but you could get away with it on U&L. :)
yeah, at least find the relevant dupe fast
the problem with shell sytnax is that it is very difficult to search on SE or google :d
You should bookmark BashGuide. It has tons of excellent info, and they practice what they preach with their example code, so if you imitate their examples you'll be following best practice. Also see shellcheck.net
also note that /bin/sh can and often is and should be different from bash :D
% dir /bin/sh
lrwxrwxrwx 1 root root 4 Apr 15  2014 /bin/sh -> dash*
Yep. Although on many systems sh is a link to bash. But bash is supposed to act exactly like sh when you call it by sh.
well, but it does not, it has the extra features that are not in POSIX compliant shells
how it works is that "for every feature that is in POSIX try to work like sh"
"for every feature not in POSIX do whatever we do anyway"
and such program then does not work in dash
10:56
Well it's supposed to operate in POSIX-compliant mode when called as sh, but it's a bit sloppy in that regard. :)
not that it would be really common for newbies to come up with the differing syntax...
ah :D
[[ ]] is a "bashism" (kshoism"), /bin/sh could possibly even not support [[ ]]
Oh, we get questions quite regularly on U&L from newbies who've accidentally run a script that uses bash syntax on sh, mostly due to copypasted shebang lines. BUt such scripts generally just abort with an error, rather than doing something different to what the user expects.
yeah
I use zsh always, even on my scripts :D
I infect every computer I use with zsh :d
Yeah [[ doesn't work in sh... unless you have a command of that name in your path, I guess. :)
[[ would be an evil command
[[ works in dash but prints a warning
11:01
I've never used zsh myself, but from the examples I've seen on U&L it is intriguing.
as an interactive shell it is super
since I have used it for 15 yrs, it has grown on me
it has some cool features for scripting too though
I thought we better get back to talking about Python. :)
That pretty fellow spent winter in a rock wall in our garden a few years ago.
Try it again. I yamming hate PhotoBucket. It used to be so easy to use...
11:28
Our Australian Pythons might be a little safer to eat, but they are a protected species. And they are (mostly) appreciated by the locals around here because they're good rat catchers.
Is that a Children's Python?
Doesn't match the Shield Python species as far as I can tell.
But those are the only two groups of Pythons native to Australia, I think.
They're quite timid. I tried to get a bit closer for a better photo but he slid into his hole in the rock wall.
Eventually he kind of got used to my presence, but I never got the opportunity for a better photo.
11:45
trying to use python 1.0.1 here
can't override CFLAGS
builds 64-bit version that crashes all the time :(
python 1.0.1 ? Wow. Why so old? FWIW, I've got a folder with some Python 1.4 demo scripts here; IIRC, they were originally on my Amiga.
12:19
0
Q: Is it possible to get the mountpoint of a pendrive knowing its serialnumber using python?

arvindhI have 2 PC's(a Linux and a Windows) connected to a local network which is on a different floor. People on that floor connect their USB Pen-drives to either one of the PC and I am suppose to copy different specific set of files to different people. Previously, what i did was so hard (get to t...

@PM2Ring ah, cool, I indeed missed that that genus is also native to Australia; I scanned the table only quickly.
@PM2Ring can't able to find his head..
No, his head's hiding in the wall.
And so's his tail
> “Everglades Pizza,” which also contains alligator meat and frog legs, has become an attraction at a number of Florida locations
OMG.....
alligator meat is good and so is frog
12:34
@AvinashRaj: They're not exactly what you'd call staple items of a sattvic diet. :)
never had chance of eating python though :(
While you people enjoy reading on exotic food I'm stuck in my lonely apartment eating a bowl of ramen noodles.
Unfortunately, I forgot to eat the noodles before the bowl, so it's a mess over here.
There are countries which enjoys food like that @AvinashRaj, even some has "dog food festival" IIRC
been a ovo-lacto-vegetarian for 3 yrs
then dumped it, then now I have followed the vietnamese diet:
I've been a lacto-vegetarian for a little over 30 yrs
eat everything that has 4 legs, unless it is a table, if it flies excepting an airplane and swims underwater, submarines notwithstading.
@MartijnPieters Zephyr is dead because you edited that message to add in the cv-pls tag.
@Unihedro Yay?
@PM2Ring how old were you
12:38
@AnttiHaapala 3 years is pretty good. I don't expect vegetarianism is that popular in Finland - all the Finns I've met were pretty heavy meat eaters. And I guess that makes sense in colder climates.
@AnttiHaapala I'm 55
I got fat
because there are not THAT many options that fill and/or are widely available...
it is like "what to eat today... well, a pizza"
@Unihedro Ahh, really?
please leave the food topic.
Making you hungry already? :p
today's fasting period there?
12:40
Yeah. It's easier these days in Australia than it was 30 years ago, but it still takes a bit more work & planning to have a well-balanced vego diet, especially when you're surrounded by a culture geared to meat eating.
I'll leave you some peace then, while I close some questions.
if i was living in say india, no doubt i could be vegetarian :D
yep, it's based on the living environment.
not only but here the choices in vegetarian food start to repeat itself quite soon... (and the indian/nepali/bangladeshi restaurants)
12:46
@AnttiHaapala Alternatively, make friends with Indians who are good cooks. It worked for me. :)
anw now that is not possible, wife would stop cooking for me :D
Is it possible to convert my neat little paste() function to use with?
@AnttiHaapala I can see that would be a major drawback. :)
re-cbg
cbg
@PM2Ring about the paste, don't see that directly...
the contextlib nested is deprecated
How come code blocks and backticked code in Chat don't have a dark background, like they do in SE posts & comments? It's a bit annoying, IMHO.
12:51
chat is a second class citizen anyhow
Unclear.
Normally I'd give the OP a little more time, but I think he might be trolling. He got like seven comments asking for more detail, and he edited two minor words in his post, as if that answered all of them.
I have a problem to ask the group, I will write my problem up as a wiki post to make it easier to digest.
@AnttiHaapala Ah, ok. I've never used contextlib explicitly, only via with. I'm happy with that code as it is, but I just thought I'd check in case there was some contextlib trick I didn't know about.
@PM2Ring: @contextmanager
def tag(name):
print("<%s>" % name)
yield
print("</%s>" % name)
use with that:
open, then yield the list of filenames, finally close all
Hmm, I think I have a legitimate need for the Factory design pattern... Don't get to use that too often.
12:59
@Kevin factory design pattern is all the time in python
except the factory is: just a callable
@PM2Ring python 3.3+
@PM2Ring also you could use itertools.zip_longest
@AnttiHaapala Ok. I'll bear that in mind for when I start using Python 3. :)
and when do you intend to start using python 3? when python 4 is released :d
The most popular day to start a new diet is January 1. The second most popular day is "tomorrow".
Python 3 works the same way.
@AnttiHaapala Yeah, I though of that at the time I was writing my code, but for that particular application it's not necessary, since the input files are all supposed be the same length.
python 3.5 is a must when it comes
13:03
Does 3.5 have any cool new features?
yes, it fixes EINTR.
like perl did from year 0, and ruby and java and everything else
OTOH, why anybody thought it was a good idea to put the X, Y, & Z coordinates in separate files is a total mystery to me. :)
no need to worry about separators: d
Maybe each one is handled by separate departments in the company, and they're just writing the code to reflect that.
@AnttiHaapala Um... not sure. :) But I realised a few days ago that I've slowly been picking up Python 3 knowledge just hanging out on SO.
@Kevin ROFL
13:06
import time
import signal

def foobar(*a, **kw):
    pass

signal.signal(signal.SIGTSTP, foobar)
time.sleep(1000)
try that in linux, suspend with ctrl+z and ...
did you know that, we (me and 4thi) are from the same state.
well the program dies.
4thi?
.D
parse error
understood already
no expand that.
13:07
tamil nadu?
clue: a dog sitting on his profile.
nandu :D:D
@AnttiHaapala It's Nadu.
In Tamil(language), Nadu means a separate country.
Ramanujan was from around there, wasn't he?
yep.
i want to hear about the great peoples from your region.
13:13
I read en.wikipedia.org/wiki/The_Man_Who_Knew_Infinity a decade or so ago. But I first heard about Ramanujan in the early 1980s when I read Godël, Escher, Bach
i think your age is above 40..
@AvinashRaj 55 ^ just a few lines above in scrollback ;)
In 1980s, I read too... barely...
Wow! There's going to be a Ramanujan movie! Dev Patel's a great actor, but I wonder if he'll be able to do the Ramanujan role justice.
This Aussie bloke was a pretty good scientist & humanitarian.
Mm, the satisfaction of deleting a comment saying #todo: it would be really nice if...
"it would be really nice if" is now "it is really nice that"
And I only had to refactor an entire module to do it.
Although if I wanted to do it right, I would have refactored this other module too.
@AnttiHaapala Oh dear. So sometimes bash beats Python.
I guess I'll have to add another #todo there, then
13:58
The title of this question reminds me of the old "man-eating dog / man, eating dog" joke.
Does he want a url-containing dict? Or a url, containing a dict?
14:10
@Kevin Maybe the title should be edited to something like "How to build a URL that contains a dictionary"...
I have a data structure/algorithm/design problem for anyone interested
After a quick scan, my first impression is, a tree structure is unsuitable because an object can have multiple children and multiple parents. This sounds more like a directed graph.
I was also thinking graphs.
But was not sure.
In which case, the simplest representation would be a dict mapping each node to its connecting edges. Ex.
parents = {
    A: [B],
    C: [D, E]
    D: [E, F]
}
appears to be in a snarky mood today ... stackoverflow.com/questions/28433855/…
14:22
As I don't believe that SO allows cyclic dupe closures.
Constructing such a dict would be straightforward.
parents = {}
for question in so:
    parents[get_node_name(question)] = get_parents(question)
This is all davidism's fault btw. He put me onto it. Blame him entirely (if it fails, blame me if it works).
Also - the networkx module is fairly useful :)
I've used networkx a little bit in the past for an unordered graph.
And some of the analysis on nidaba related stuff should really go into a proper graph database... but some puppy still hasn't had time...
14:26
Ideally we'll have a graph of questions that can be used to find super awesome dupes that are commonly used (i.e have lots of children, grandchildren, etc) but may not be in out canon list.
@Ffisegydd well... you should be able to find that using map-reduce in the mongo db
Inverting parents to then get children can be done like
children = {}
for node in parents.iterkeys():
    for parent in parents[node]:
        children.setdefault(parent, []).append(node)
@Jon that sounds scary though.
@Ffisegydd but scary is good?
No. Scary is not good. Scary is scary.
14:29
Mongo? The hunchback that answers the door of my opulent yet dusty mansion? He's not qualified to do DB work.
And yes, he is scary. That's why I hired him.
Speaking of graph stuff, the tag is badly in need of cleaning up, but I fear it's a hopeless case - a very high percentage of questions with that tag have nothing to do with graphs, GraphViz or the DOT language.
@Kevin I'm never sure whether such comments are 1) you haven't take your medication, 2) you have taken your medication, 3) taken someone else's medication...
@JonClements Umm, all of the above.
That seems simple enough. Can just iterate over every closed dupe, add a node, then add a node for it's parent(s) and edge(s).
14:46
I don't think this guy could have asked "how do I define syntax for custom numeric literals?" in a more confusing manner
@Kevin in python3.5 you can do __rmatmul__
then you can do from units import ft, m, and
(5 @m + 3 @ft) @ inch
14:51
@Antti that's an awesome use of the matrix multiplication actually.
Can I have another solution that uses string slicing, — user3459178 5 mins ago
sighs
@user3459178 no. — Ffisegydd 8 secs ago
err... try not to mince your words or anything :p
@ZeroPiraeus wasn't the thing some minutes ago that if the google search does not come up with the result in SO as the first hit, then you should ask it on SO
regarding unquote_plus
@AnttiHaapala google.com/search?q=urllib+unquote+plus+space gives an SO question with the answer in the title of the question as the first hit for me ...
15:01
12
Q: Unescape Python Strings From HTTP

IanI've got a string from an HTTP header, but it's been escaped.. what function can I use to unescape it? myemail%40gmail.com -> [email protected] Would urllib.unquote() be the way to go?

In a directed graph of parents/children, is there any convention for which way the "direction" should go? Does one way make more sense than the other? Or is it just "be consistent and document whichever you pick"?
close as dupe of this
@Ffisegydd mhm?
@Antti related to sopython.com/wiki/Fizzy's_Question_Time, if I had a parent A and a child B in a directed graph, should the edge go towards A or towards B?
I suppose it depends on whether you're asking the question "Is B a parent of A?" or "Is A a child of B?"
so build a proper tree with proper nodes with parent backlinks
where you can travel the tree in forest at any point
@AnttiHaapala Works for me :-)
I think I should eat some cake now :-)
15:18
@Ffisegydd Depends on the needs of the algorithm.
What direction do you need to traverse the graph in?
0
A: Unescape Python Strings From HTTP

Antti HaapalaIn Python 3, these functions are urllib.parse.unquote and urllib.parse.unquote_plus. The latter is used for example for query strings in the HTTP URLs, where the space characters () are traditionally encoded as plus character (+), and the + is percent-encoded to %2B. In addition to these there ...

upvotes accepted :D
@Martijn Ideally I'd like to get the parent with the most children/grandchildren/great-grandchildren etc. Basically I'm looking at dupe questions and trying to find the Python questions which have the most influence with the most questions, then we can add these to the canon if appropriate.
And it's me vs. two long standing respected moderators.
Whadayathink, sabers or pistols at dawn?
Any reasons I am getting intermittent 10600 error in MySQL when connecting with python? Most querries work but then randomly, cant connect. And then goes back to normal... intermittent is the worstttt
15:21
@MartijnPieters that upvoted answer is pure human excrement
the +10 answer has no info, a linked graph and total nonsense about intersections
Exactly. I disagree that the answers are anywhere near helpful.
Certainly not when the bar has been set high for the topic.
it has nothing notable except being upvoted +10
if it was under another q it wouldn't get any
*though
there is 1 big problem with the other q
there are no graphs.
maybe should make a new answer there
user559633
i hate when i think i have time to write a real answer, then someone else swoops in and gets an accept on a crap answer stackoverflow.com/questions/28434619/catch-ctrl-d-in-ksh/…
hem you have accept there?
user559633
edit: nevermind! got the accept now
15:33
@tristan I see you're close to being a useful member of the group finally having 3k rep. Be able to close stuff soon!
user559633
:] yeah, it's like you can tell that i started actually kind of caring in september
Mine looks remarkably similar in the 2k-3k region stackexchange.com/users/3602083/ffisegydd?tab=reputation where you can see I had a spurt and then let it die down a bit.
You can also see where me and davidism started racing to 5k and I suddenly started getting more rep :P
user559633
haha yeah. i feel like i really need a dupe-target/canonical answer for something newbie
user559633
15:37
i just can't seem to hit the right question and prefer the more..esoteric/pointless ones
Looks like you will cross 3k with the help of that ques alone
user559633
crosses fingers
user559633
i want to be over 10k by EOY
i want to be over 10k by EOHY
(Half year)
user559633
i'd like to be at 5k by EOHDY (end of half dog year)
15:52
@tristan when you get to 10k, you will want to get 9k next :D
user559633
@AnttiHaapala what's at 19k? (i don't see anything between 15 and 20)
That question is quite broad.
@tristan no, 9k, that can't see deleted posts
user559633
I don't follow.
15:57
you think 10k in terms of privileges
but seriously you can lose your eyesight at 10k
think about, every single piece of crappy code you saw disappearing from the site will suddenly become visible again.
user559633
one of us is having a stroke
user559633
OH. Haha, got it.
I get what Antti is saying. He's saying that once you can see the deleted posts, you'll want to unsee them.
user559633
I'll offer a 500 bounty on a "how does i ruby these rails" question
And he's broadly correct, you do see a lot of crap (especially on high-rep questions).

« first day (1578 days earlier)      last day (3595 days later) »