« first day (2080 days earlier)      last day (2862 days later) » 

12:35 AM
Oh shite, I just learned that fortran doesn't short-circuit logical operations in an if. That should explain a few odd bugs in hindsight.
OK, maybe not, but it's sad
 
12:52 AM
That is the same in VB(.Net) and caused me problems once
 
which would make sense as it is based on FORTRAN
 
ah:)
 
as far as I remember, the last time I had to look at VB was 4.5 years ago and not for much (though I did use it once upon a time to build GUIs)
 
sounds painful:)
 
1:05 AM
not really, it was in early 2000s and 90% of code (backend) was done in C++
with plenty of Perl mixed in as glue all over
 
:)
good night
 
night Andras
 
 
4 hours later…
DSM
4:46 AM
@AnkitSrivastava: generally we don't accept solicitations here. Anyone looking for freelance Python gigs is already checking all the main sites, freelancer included, and so they'll find it.
 
5:08 AM
also SO.jobs
or whatever we're calling it
Also, insomnia sucks
I was gonna count sheep until I fell asleep but that seemed tedious so I built a script to count lists of sheep until I got tired....it is not working for some reason
 
DSM
5:29 AM
itertools.count makes it almost too easy..
 
itertools makes a lot of things too easy
 
 
1 hour later…
Sup brahs
 
Jes
good morning
Need help with regex, could somebody help if possible
 
6:49 AM
@Jes sopython.com/chatroom -- you might ask your question without preamble.
(and dv pls)
 
Jes
I am trying to extract strings from a log file string. I have tried to extract part of it but not 100% hence need some help.
this is my log
this is my LOG
Jun 10 14:08:52 gvsansw03 raslogd: AUDIT, 2016/06/10-14:08:50 (EDT), [ZONE-3001], INFO, ZONE, admin/admin/192.168.250.18/ssh/CLI, ad_0/gvsansw03/FID 128, 7.3.1d, , , , , , , Event: cfgadd, Status: success, Info: Zone(s) "CDSFabA_Failsafe;CDSFabA_gvicv7k04" added to Zone configuration "CFG1".
i want to extract the work AUDIT , [ZONE-3001],INFO, ZONE, admin/admin/ as individual strings
this is the regex i have done so far
(^.{0,15})\\s\\w+\\s\\w+:(.*)\[(.*)]\\,(.*?),(.*?),(.*?)
 
@Jes all this depends on how you're putting this in a string
 
Jes
means
 
did you use r'' or '' for the regex...
if you want to get AUDIT, then why wouldn't you just start your regex with raslogd:\s*(\W+), which would capture the AUDIT as the first subgroup
e.g. why do you even have c
(^.{0,15})
 
Jes
no want the first group as the timestamp
second group will be AUDIT
 
7:01 AM
so something like `raslogd:\s*(\W+),[^]]*?[(.*?)],\s*(\w+),
also, the timestamp is of fixed size? e.g Jun 9, right?
one option, since this seems to be comma-separated stuff would be to actually split at raslogd:, then split/resplit the latter part with ,
 
Jes
raslogd:\s*(\W+),[^]]*?[(.*?)],\s*(\w+), what would this give me ?
 
sorry
should've been [^[] there.
that is for AUDIT, ZONE-3001, INFO
 
Jes
gettign pattern syntax error
\\s*(\\W+),[^[]*?[(.*?)]],\\s*(\\w+)), is this what you meant
 
ah no, stupid stackoverflow eat some of the \
raslogd:\s*(\w+),.*?\[(.*?)\],\s*(\w+),
but also, do not try to do too much in a single regex
gets just spam answers
 
Jes
7:17 AM
sorry to bug you
i have escaped the \
this worked when i checked online but in my eclipse its not
this is what i have done
(^.{0,15})\\s\\w+\\s\\w+raslogd:\\s*(\\w+),.*?\[(.*?)\],\\s*(\\w+),
did i miss something @AnttiHaapala
 
"eclipse"?
 
Jes
i m running this regex in my eclipse as part of java
 
then why are you asking about it in Python room??
there is a java room after all
 
Jes
sorry.. apologies.. wanted the regex it would be common i guess
 
7:21 AM
regex (mostly) is, but escaping issues aren't
 
And wow. Yeah, please ask in Java (or the regex room).
 
Jes
7:37 AM
@AnttiHaapala how would i split this one in regex
admin/admin/192.168.250.18/ssh/CLI
 
@Jes as has been said, you should go to the Java or Regex room for help.
 
Jes
sure
thanks though
 
7:56 AM
:d
 
8:21 AM
hi
anybody is here
@AnttiHaapala
 
someone at least
 
:D
I just get confused about inheritance and aggregation and composition
aggregation shows the relation between object or class
 
Sarah inherits generic behaviour from Human
Purse aggregates coins
Car is composed of parts.
 
show i have to show it when i want to design class diagram
 
usually only one of these is right for a given context.
a car doesn't inherit from parts,
a purse isn't composed of coins, it just contains them.
 
8:28 AM
so iheirtance is a and aggregation has a do i understand right
 
sort of.
aggregation is for "coin is in a purse"
association is more generic of aggregation...
but aggregation is usually one-at-a-time...
a coin can be only in one purse at a time.
composition means that the part is pretty much fixed in it, an essential part, like a motor in a car.
it is normal for a purse (aggregation) to move coins in and out
it is not normal operation with car to take engine in and out.
 
thanks a Kuadrylyun
 
Cabbage
 
cabbage is a vegetable
:D
i just finished Lynda Foundations Of Programming Object Oriented Design. so can i start Design pattern or it is soon or should have to pick up another course
 
@Sarah Cabbage is also a greeting in here. :) Please see sopython.com/chatroom It's ok to ask generic questions about OOP here, but be aware that OOP in Python works a little bit differently to OOP in Java.
 
8:37 AM
really Cabbage is greeting. can i use it in daily speaking
 
@Sarah yes, here.
soon 3M names (though anyone can sign that :P)
 
Hey @AnttiHaapala, did I say anything dumb, or leave out something important, in this comment?
(cont) As well as the speed difference between a C loop and a Python for loop that I mentioned previously, there's also the overhead incurred in iterating over the generator expression. A gen exp is syntactic sugar for a generator function, and Python function calls are relatively slow compared to C function calls, due to the time taken to create the Python stack frame. — PM 2Ring 22 mins ago
 
@PM2Ring you did.
the function is not called again when the generator is resumed
so there is only one function call overhead.
afaik...
 
Oh, ok. So there's just a one-time cost in setting up the stack frame?
 
but it is not to say that there wouldn't be overhead
yes
 
8:44 AM
Ok, I'll delete that comment.
 
the generator stackframe is a malloced area of memory; python bytecode knows what is the maximum stack size in a function.
when the generator yields, the stack frame and instruction pointer for that frame is stored.
 
Ok. So each time the generator is re-entered it's kinda like a goto back into the generator's context?
 
yeah I guess
 
Yes, thats what my understanding as well.
 
I have not looked into the generator details for toooo much but I know a lot about the stack frames and bytecode'
 
8:47 AM
Sorry, my terminology was a bit sloppy, but you get what I mean. :)
I might ask Martijn, if I remember next time I see him here.
I was surprised that the speed difference between not any(count) and all(not c for c in count) is so high. I was expecting a time ratio of maybe 2 to 4, not 10 or more. There's also a difference between Python 2.6 vs 3.6, but it's not very significant.
 
I couldn't open the pastebin link, but can you also check if all([not c for c in count]) makes any difference?
 
of course
not any(count) doesn't even need to execute any bytecode in between.
 
@AnttiHaapala any still has to get the iterator and iterate it, right?
 
  1           0 LOAD_FAST                0 (.0)
        >>    3 FOR_ITER                12 (to 18)
              6 STORE_FAST               1 (c)
              9 LOAD_FAST                1 (c)
             12 UNARY_NOT
             13 YIELD_VALUE
             14 POP_TOP
             15 JUMP_ABSOLUTE            3
        >>   18 LOAD_CONST               0 (None)
             21 RETURN_VALUE
@thefourtheye who knows, in any case a list/tuple iterator in CPython is fast...
but there might be even a faster path
which wouldn't need reference counting
 
For a list object, reference counting is still there. github.com/python/cpython/blob/master/Objects/…
 
9:12 AM
@thefourtheye That's an anti-pattern. The list comp has to complete before all can work on it, so you lose much of the benefit of all short-circuiting. It still short-circuits as soon as it hits a False element of the list, of course.
 
@PM2Ring Yup. But I just wanted to see if passing a list makes any difference. But if count is already a list, it would not make any sense.
 
@thefourtheye Yeah, count is a list of (mostly) zeroes.
 
Hmmm, then leave it :)
 
lol :D newspiece from Swedish newspaper: "A policeman stopped a car, goes to talk with him about careless driving. Policeman first thinks the driver is Danish, but then realizes that he's just drunk."
 
@thefourtheye It's weird you can't see the pastebin. I'll post a condensed version here. The full version also prints dis stuff, and verifies that the commands produce the same values.
from timeit import Timer
count = [0] * 256
commands = {
    'any': 'not any(count)',
    'all_genexp': 'all(not c for c in count)',
}

def time_test(loops, reps):
    ''' Print timing stats for all the commands '''
    timings = []
    for name, cmd in commands.items():
        setup = 'from __main__ import count'
        t = Timer(cmd, setup)
        result = t.repeat(reps, loops)
        result.sort()
        timings.append((result, name))
    timings.sort()
    for result, name in timings:
        print('{:10} {}'.format(name, result))
 
9:19 AM
@PM2Ring I am at work and they block a lot of websites :-/
 
@thefourtheye Ah. I suppose you could post all sorts of weird stuff to pastebin...
@AnttiHaapala Classic!
 
which made me comment the opposite.
Usually when I see Danes speaking in TV I assume they're drunk.
 
@PM2Ring there is overhead for itering over the genexp but it is not related to a function call (a function call would have even greater overhead.
 
Ok.
 
starts from here for "next"
this is where it enters the generator
there is LOTS of code for the generator send
it is not related to setting the frame though
 
10:26 AM
Ok. I think I get it. A generator keeps the same "gi_frame" alive so that on each iteration the overhead is fairly minimal, there's basically just the overhead of those C function calls.
 
"fairly" :D
 
Man, there is no way to really destroy the Daleks it seems. Now they are in all kinds of colours.
 
but that is much more C along the way - and it needs to execute python bytecode as well, for each iteration, than in github.com/python/cpython/blob/master/Python/bltinmodule.c#L262 say, which calls tp_next() which in case of list objects is directly slotted from github.com/python/cpython/blob/master/Objects/…
 
I'm getting quite a few upvotes on this Meta comment. :)
I tend to interpret "urgent", "ASAP", etc, as "I am a Help Vampire: Feed me NOW!". — PM 2Ring Jun 21 at 13:58
Hang on. I think I mentioned that here the other day. Sorry for the duplication.
 
cbg
 
10:39 AM
Evening, Cam_Aust. Is it chilly in your part of the country? It's rather brisk here (just north of Coffs Harbour).
I hope this OP is not a programming teacher: stackoverflow.com/questions/38037578/…
 
@PM2Ring Well hi ya, blow me over with a feather - so close. And yes, snow expected tomorrow. I have entered the Twittersphere on behalf of the village here at the top of the range to better manage snow events and visitors @BenLomondSnow
Unix, python, OK, OSX, fine, HP calcs, RPN, fine. Astrophysics easy, divorce tough but can do ..... Twitter, Facebook and video remotes - impossible, no idea!
World unto their own.
(albeit popular with many other humans) - go figure!
 
Twitter & Facebook are alien worlds to me. :) Although I do occasionally browse twitter posts that are linked on the home pages of some musicians I like.
 
@PM2Ring I was thinking about your help vampire comments. I think many just beginning to explore programing in one environment or other, get stuck, do a google search, discover Stackoverflow - have no idea, and they imagine a thousand programming geeks keen to help them. So yes.. help vampire, but out of lack of understanding, not malice (most often)
Well been learning the twitter ropes this morning.
 
Sure, most new help vampires don't realise they are doing anything wrong. So if you get to them quickly they can be re-educated.
 
Interesting SO post. Teacher of ... life, child raising perhaps??
Lets hope.
 
Having a read. Excellent and so relevant to community group processes as well!
 
@Cam_Aust I don't think so. It looks like the OP is an actual secondary school teacher who's just been told that they have to start teaching computer science and Python programming:
Yes, I would love to find the time to do this. Computer science and Python programming was sprung on us, and I have until September to teach myself, whilst holding down a full time job. Sorry if my questions irritate you. Let's hope you are never in the position where you have to learn a whole new language in limited time, under pressure, and if you do find you are, you find supportive helpful people, and not one who treats you like an idiot. Thanks for the link, I have hundreds of links. — A.Teacher yesterday
@Cam_Aust Sure. Help vampires have always been with us, they're just a bit more obvious in the online world.
 
OK, well of honorable intent and teacher victim of our modern highly funded education system - arts teachers having to take maths classes, and our government administrators wonder why student maths scores are dropping.
I think some links to some good teaching resources on Python would be a good response. And perhaps they do need an answer to work it out. They are going to be teaching the next generation, or inspiring some I hope to 'discover' the joy of programming.
@P
@PM2Ring Thanks. Oh how I feel I narrowly missed falling into that behaviour. So easy when you start, just want to do this one little thing, seek help, just want it sorted so you can move on, and so the easy unthoughtout-on-the-run-question.
 
@Cam_Aust Well, they already "have hundreds of links". From the look of their code they aren't already proficient in another programming language, so the official Python tutorial may not be suitable for them. I guess I could post the link to our Recommended Tutorials page, but I suspect that they've already got some book / tutorial they're working through.
What they probably need is a mentor that can help accelerate them through the early stages of learning to program & learning Python. SO can help, but it's not quite the same.
 
11:10 AM
@PM2Ring Yes. Thinking, is there a local group, python or coding or computer buff group that can offer some mentoring.
 
I suppose one advantage of learning to code in the pre-internet days is that programming experts were a scarce resource, so you made sure that you'd done everything you could to solve the problem yourself and that your questions were as clear and succinct as you could make them.
You didn't want to waste the experts time, and you didn't want to annoy them because you'd probably need their help in the future. But in the online world it looks like there's an unlimited supply of experts for the plundering. :)
 
@PM2Ring Yes. I suggest its the instant accessibility factor and home comfort zone.
 
@Cam_Aust I guess that's a possibility, but they may not have the free time to invest in attending a group.
 
@PM2Ring There is the other side of the help vampire, particularly as a user with some large software companies. (Yes, but thought it worth a try, I've asked as you will see in comments).
Other side of help vampire: (With software company or telco) Observe issues, diligently research, spend hours, days. Carefully document. And your efforts overwhelm the help people (anything more than a paragraph). If you can not walk away and need things to work its a long hard slog.
I think my record is with Macspeech and their iListen mac speech to text product. Sort of worked, but not to be useful. Constantly told I was the only person with a performance problem. I kept trying to solve my set up, ended up testing, upgrading, never right. After years I went the whole hog, 100's of hours and finally determined it was their speech engine (Phillips) and others were just not using it.
Sent them my data, and told them if they did not switch to the Dragon engine they would go broke very soon. 6 months later they switched. We now have Dragon Dictate with much better accuracy (actually useful), and possible the OSX integration that enables Apple to develop Siri for all I know. In the end I knew more about the performance of their product than they did. That was very clear at the end.
However that took 4 years on and off when I had time to keep problem solving, plus 2 laptop upgrades on their recommendation to get it to work better. A few thousand $. No thanks either from their side. Still have all the emails. This just one example of this other side.
It is hard to know when you are about to crack a problem! So, if no alternative you keep going.
 
Speaking of voice recognition... youtube.com/watch?v=sAz_UvnUeuU
 
11:23 AM
I am rambling tonight.
 
That's ok. It's a quiet night. And if we get sick of you, we'll just tell you to shut up. :)
 
Impressed with how fast you found that video.
@PM2Ring Cool, that is actually reassuring. I don't get out much.
Yes, that captures the feeling.
So how long have you been active on SO
 
@Cam_Aust That video's a standard reference on the topic. :)
 
OK.
 
@Cam_Aust I've been a member for 1 year, 9 months, but I was getting info from SO for a couple of years before I finally decided to join.
 
11:40 AM
OK ta, was interested as you seem very informed, aware of issues, finger on the pulse so to speak and I was wondering how long that took. I am really just beginning with programming. I have not been asking any questions as been to busy with other things to get back to some more learning. I figure I have a fair way to go before it is relevant to be asking questions. I will though when I come to it. So I guess I have intuitively worked out the help vampire trap before I feel in so to speak.
Good to drop in and chat. Value the 'jovial sensibilities' of participants. Reassuring all is not mad in the world.
 
I have been programming for quite a few years. But I do spend a fair bit of time on SO, and I try to keep up with the Hot Meta Posts, which is a great way to find out how the site is working.
 
11:56 AM
@PM2Ring Thanks. The chat helps me understand SO as an expectant long term participant. Looks like I am going to have to go. Phone calls. Lots happening in life outside net activities. So thanks. Alias and rubrb.
 
See you next time!
 
 
2 hours later…
1:57 PM
@Zero thoughts on the resignations?
 
Several :-)
 
@Ffisegydd The political landscape is burning like a forest fire. Let's hope it leaves fertile ground for new seeds to germinate?
 
Care to share? :P I've been moving things today so only just catching up.
 
Have to admit some surprise, first, although in retrospect this is the obvious moment – it's an open secret that the Bitter Arsehole wing of the party were planning something similar for after the local elections, but were stymied by the better-than-expected results.
 
I'm hoping this is the start of a Serotic renewal..
 
2:01 PM
With Chilcot coming up, they were unlikely to get an opportunity again for some time without tainting themselves.
 
I know my kids are talking about becoming politically active now. How many others are?
 
One way or another, the party will split now. As much as I despise them, they're not idiots and will already have planned either to start SDP Mk. II if they lose, or a purge leading to a Syriza/Podemos breakaway if they win (which, realistically, they can only do if they prevent Jeremy getting on the ballot).
In either case, the unions will overwhelmingly side with the left, so I can only assume their war criminal hero has promised to bankroll them.
If I were in the UK, I'd be planning to run for office. This is tempting me to return, I have to admit.
 
At what level, parliament?
You could start the SDP Mk III, Sopython Democratic Party.
 
I had expected that they'd start the ball rolling over Trident in a few months (more chance of getting some unions on side), but with an election maybe coming up, it's vital for them to cause as much damage to the party as they can and prevent any chance of a non-Tory government for a few years.
No way I could run for parliament and win ... I suppose it's possible that the field of talent is small enough for a suicide run to be worhtwhile somewhere impossible. I was thinking council though.
 
Friend of mine ran for council on a Labour ticket, came 2nd narrowly.
 
2:11 PM
Funnily enough I got pressured to run for (and therefore automatically win, given the landscape in Sheffield) a council seat about ten years ago. Wasn't interested at the time.
Where'd your friend run?
 
Cambridgeshire
Sawston in particular.
Oh it wasn't as narrow as I first thought :P
He got 27.7% of the vote though, and it was his first run, and he's only 28 or so.
Tory won with 43%
 
Based on a 30-second skim of the Wikipedia page for Sawston, I'd say 2nd is pretty good :-)
 
@Ffisegydd: an improvement over the previous election there then: scambs.moderngov.co.uk/…
 
Indeed, he did increase the labour share. Bloody leftists.
:P
 
A spectre is haunting Cambridgeshire ...
 
2:32 PM
Last three paragraphs here very important:
That's a warning shot: no more money for any party that ousts Corbyn undemocratically, and moves to deselect MPs who go along with a failed coup.
Interesting tangent: Hilary Benn owes his career, at least to some extent, to Unite. He started out in the legal department of ASTMS, one of its predecessor unions.
(which also happens to be the union my dad worked for before he retired ... and I think I might have once met Benn as a result)
 
 
2 hours later…
4:48 PM
Just decided zero-indexed arrays are dumb. We're counting things, not measuring them!
@Ffisegydd I got Oxfordshire
Which probably isn't even the constituency name. Vale of the White Horse?
 
I call shotgun on being Earl of Cheltenham.
Or maybe Baron.
I don't know.
Earl is higher in terms of hierarchy, but Baron sounds cooler.
I'm gonna go with Baron. Baron Fizzy.
 
Your counting sequences of things so it could still be a zero counting base
 
I can call my land my fizzdom.
 
The most fizziest place on Earth
 
Like a fiefdom, but more bubbly.
 
5:00 PM
 
5:34 PM
cbg
hi. I had a question regarding performance that I encountered. I have posted the question at - stackoverflow.com/questions/38041175/…. Can you guys have a look. I am sure you will find it interesting
 
@RobertGrant ObXKCD
 
:)
@JGreenwell isn't everything 1-based apart from if you're measuring something? E.g. a ruler starts at 0cm, but the number of $things I have starts at 1
 
@ChahatUpreti Please don't link your fresh questions in here. Give them a day or two. It's in the room rules...
 
oh, ok!
 
@RobertGrant The number of Lear jets I have starts at 0.
 
5:41 PM
If you had an array of Lear jets, you wouldn't put one in bucket 0, though
 
pythong
 
@RobertGrant Yeah, ok. But I'm kinda used to 0-based indexing, and if I change now I'm bound to make a bunch of off-by-one / fencepost errors.
 
BOOM! Convention smashed! Long live the same convention.
Here's the followup: things we do measure, such as seconds of time elapsed, we pretty much never put in arrays.
 
If I am counting the number of jet types I have encountered (frequency) I may start as zero (not at an airport) so with frequency zero can make sense - though I will note that whenever I work with discrete mathematics I use 1-index not 0-index
 
@JGreenwell that's a pretty specialised case I guess, where you actually want to record interval data that always starts at 0, and somehow a hashmap isn't better
But I agree in that case it technically makes sense
 
6:37 PM
@RobertGrant yeah, I was mostly just playing devil's advocate - I'm so used to switching from 0 to 1 (Math to CS or early in career VB to C-based) that I rarely think about it - but I do on rare occasion have temporary interval data which still needs to be cleaned/altered before adding to a map/table/dict type
 
In an industry that does try reasonably hard to make its pretty weird intricacies very user-friendly, compared to say the medical profession's terminology being in Latin, 0-based indices do seem to be an oddly obfuscatory exception :)
 
well, at least nobody tried to say that arrays are 0-indexed because it was inherented from mathematics systems (vectors)....that always makes me a little sad
the last person to say that to me was trying to figure out "why matlab didn't follow the mathematical model for vector indexing while python did?"
or matrix...actually, I remember being a little screwed up when first learning matrix with Python (not using numpy) cause of (0,0) vs. (1,1) - not hard to fix but was annoying at the time
 
you know what? Forget devil's advocate - stupid 0-indexing
 
7:09 PM
@JGreenwell I think matlab directly follows fortran's convention
cabbage
 
one would assume
also cbg\
 
7:23 PM
@JGreenwell YEAH!!!
 

« first day (2080 days earlier)      last day (2862 days later) »