« first day (4118 days earlier)      last day (821 days later) » 

5:39 AM
@Aran-Fey @Aqua4 @ParitoshSingh @MisterMiyagi A few days ago I asked about parametrizing pytest tests, so different values of environmental variables are tested.
I was able to refactor my code so now changing value of environment variable inside test function have an effect on tested objects. (Before environment variables were cached)
As for pytest code, I just shared solution I used here: https://stackoverflow.com/questions/70829370/how-to-use-fixture-and-parametrize-to-set-environmental-variable-for-pytest/70829371#70829371
 
5:55 AM
@avv AST has a tree structure, so you should work with that structure. Trying to parse AST with regex is as bad as parsing HTML with regex, especially when you already have that tree structure.
When you asked about online visualizers for AST last week, I found a module on GitHub that uses Graphviz to make a tree diagram from AST. Sage can use Graphviz, so I adapted that code to make a Sage version. However, the resulting graphs get complicated very quickly! A good visualiser would be able to hide & expand nodes, as needed.
 
6:11 AM
@AndrasDeak Perl is like a dialect of regex that mutated into a full programming language, so it's inherited the property of being a lot easier to write than to read. ;)
I'm very cautious of using advanced tricks with regex: Kernighan's maxim applies with full force. If I'm writing regex every day, it's not so bad, but if I don't do regex stuff for a month or so I tend to forget the subtle stuff, and it can be very hard to read & modify regex in old code.
Whenever I write regex code I always have the regex docs open so I can double-check stuff. Otherwise, I'm bound to make a silly mistake, or to write a complicated regex when a simpler (& hopefully more readable) option exists.
@MisterMiyagi A week or so ago we were discussing random numbers. I forgot to mention that Professor Melissa O'Neill, author of PCG, the new default PRNG in Numpy, has some great articles on her blog, although it hasn't been updated in a few years. Here's a good one on the topic of implementing randrange: pcg-random.org/posts/bounded-rands.html
 
Avv
6:29 AM
@PM2Ring. Thank you.
 
To shuffle N items, the standard Fisher-Yates shuffle algorithm has to call randrange(i) for i in range(2, N+1). On average, each randrange(i) call needs to call the underlying PRNG twice, unless i is a power of 2. In principle, it can loop indefinitely, with the worst case being when i is of the form 2^k+1.
@Avv No worries. It was fun to write, and it was nice to learn that I can use Graphviz in Sage.
 
Avv
I will tell you why I said to use RegExp with AST. One used it to obtain specific information from AST tree (count of specific nodes). So it's used to obtain metrics for certain features from the AST
I will read about Sage. Thanks.
 
It's quite easy to make a tree class in Python when you need to represent & process tree data. But we quite often use dicts & lists, eg for JSON. I have a bunch of code that shows how to process such data. You might find it helpful. stackoverflow.com/a/41778581/4014959
 
Avv
Wow! Thanks. I will read it.
You mean since AST is in JSON, it's better to read with as dicts! You are right!
 
@Avv Sage is a vast mathematics system built on top of Python. The basic Sage language is almost Python, but with some important differences. It's a free alternative to things like Mathematica. But there are some things in Mathematica that aren't easy in Sage OTOH, there are things that are easy in Sage that are hard in Mathematica.
 
Avv
6:39 AM
I don't know why the post I saw used RegExp :/ Your approach is much more efficient as we can keep track of all features we want easily. As you said, RegExp will comlicates the process.
@roganjosh. Thanks. Sorry I did not know how to add links, but I added title instead :(
 
You can do algebra in Sage. It can do symbolic integration & differentiation. You can solve sets of simultaneous equations using matrices. It can work with various abstract number fields and rings. Etc.
 
Avv
Wow! Never know such tool exists
 
 
2 hours later…
8:19 AM
@PM2Ring Thanks a lot! I've been meaning to read up more on PRNG for a while, this looks like a fantastic resource.
 
 
2 hours later…
9:51 AM
Gosh, my ISP is driving me mad. Randomly dropping my connection during meetings, fine. Lying to me when testing my connection, fine. Not lying to me when testing the connection and then being like "yeah, it's fine" for the final result... 😡
 
10:39 AM
@MisterMiyagi hey... I got really excited earlier downloading some stuff and it showed an average of 130MB/s - then I realised I was on one of my servers... I'd love that speed at home though :p
 
sounds like a simple fix. relocate homes to your server room.
 
10:58 AM
@JonClements That reminds me of The Good Old Days, when I used to take my gaming laptop to university to pull in Steam updates – now that was a network...
 
The wifi in my university is pretty poor, they chose to lower the bandwidth so people dont stream videos :/
 
11:29 AM
^^^ made me chuckle ;)
 
11:58 AM
@MisterMiyagi what exactly is that last part about?
 
Looks like they're basically saying "yeah, we can see your connection dropping and that's the expected level of service. Won't fix. Is there anything else I can help you with today?"?
 
oh, amazing
wait, you're not Miyagi
but that sounds like a reasonable interpretation
he should threaten them with a bad yelp review
 
For a few blissful seconds I was mistaken for Miyagi
 
not enough time for the asyncstential dread to kick in
 
Ha, indeed. We know he gets at least 3 or 4 seconds of respite every now and then, at least
 
12:17 PM
@AndrasDeak They'll happily show me a real-time view of the measurement, including how bad it actually is. Then they just keep on measuring until it hits the throughput they are supposed to provide and stop right at that value.
 
haha, even better
 
When it doesn't reach the required throughput, the measurement just aborts with an error.
 
Why are you even using their speedtest?
I assume that's the only one that's sorta binding for them
 
Yeah. :/
@roganjosh There's no pub anywhere near me, so be careful what you wish for. :P
 
Surely there's a biergarten or two within a stone's throw :P
 
12:25 PM
Afraid not. The next brewery is more than 5km away from where I live!
 
that's savage
 
0.0004 Schnitzel restaurants per capita. Practically indistinguishable from the Apocalypse.
 
Oof, I don't know whether I could cope with that!
I've just realised that today is an auspicious day indeed; I think I'm due to get to reset my Apple password in the next couple of hours! Those gracious Gurus
:O "Geniuses". I meant Geniuses! Oh man, that's thrown a spanner in the works
 
12:43 PM
@MisterMiyagi as long as it's a high-throughput schnitzel restaurant
@roganjosh took them long enough to ship your new mac
 
The payment was processed super-quick though, I was really impressed with their efficiency there
 
 
2 hours later…
2:15 PM
If I expect a tuple of length 2 but get a tuple of length 3, is that a ValueError or TypeError? Considering that a static type checker could catch that mistake, I'm tempted to throw a TypeError
 
For tuple I'd say TypeError.
 
TypeError seems fair
 
Alrighty then
 
You could define a TypleError just to be sure.
 
>:|
class InvalidTupleLengthProblem(BaseException): pass
 
2:24 PM
Man windows is just weird. I'm checking the available dhcp ips with: Get-DhcpServerv4FreeIPAddress -ScopeId 192.168.254.0 -NumAddress 80 Then I set the range of the dhcp server to go to .42 it shows me the last available one is 42, I go to 46 it shows 46, 47=>47. But for 48 it just stays at 47 and I checked no other device has that ip. It's just windows weirdness.....
uh rubber ducky, maybe the ip is taken, but the thing doesn't respond to pings, which in any case is so rude and devices should always respond to pings
 
@AndrasDeak Is that a problem with an invalid tuple or an invalid length?
 
problem with an invalid tuple length, duh
@Hakaishin it could also be something with a statically allocated IP
 
ah it was a reservation, which I added as DHCP_END with the ip 48, that's why it didn't want to take it. That's actually kinda neat, so the reservations list is not just a cumbersome list, the server actually honors it and doesn't give ips out which are reserved, even if they are in the middle of the dhcp range, cool
 
@Hakaishin Thank you for the mental image of an angry Hakaishin android who is angrily ranting "people these days have no manners anymore" because he greeted a fellow android with "ping" and they didn't respond with "pong"
 
:D
also me adding a start/stop reservation shows how bad ux can lead users to misuse tools. Like this I immediately see where the dhcp range is when adding a new reservation, before I had to go to the config to check and so I unknowingly lost 2 ips in the range until now. Now I modified the start-1 and stop+1 reservation to includ dhcp_start/stop in the name
 
2:34 PM
Hey all I am looking for a good course to learn devops and AWS any suggestions?
 
2:48 PM
@AndrasDeak ugh, if only I didn't have colleagues which unironically love suggesting code like that
except they'd call it
class InvalidTupleLengthProblemException(BaseException): pass
coz otherwise you'd never know, right? -.-
 
blurit.io lol, oh I have privacy concerns, how can I blur my videos? By uploading them to the internet to a random website, sure that seems about right :D
 
@Arne That seems excessive, but for the most part I'm a fan of using more custom exceptions. The whole idea of passing a message string into the Exception constructor is silly; exceptions should accept arguments, store them in attributes, and generate the message on the fly. Y'know, like every other class does. For some reason, Exception is the only class that receives its str text as a constructor argument.
 
I like the message part, that's where I put the text that I write in the log, too. And since the consumer for that is a human, I like writing prose over having a class, even if it conveys the same amount of information
I mostly use custom exceptions when I need to wrap the exceptions from 3rd party libraries, so that a user of my code doesn't only needs to import from my code
 
I certainly wouldn't mind if there were some useful data in addition to the error messages. Knowing which key triggered an error can be useful...
 
Is the consumer really a human though?
Pretty sure the vast majority of exceptions is caught and handled and never seen by a human
 
3:00 PM
 
That's not the direction I was aiming for, but thanks for the backup anyhow! :D
 
Well... I haven't seen that in ages... so figured it needed posting anyway :p
 
 
2 hours later…
4:51 PM
Hmm, my while True: do_thing(); time.sleep(1) loop is running faster than I want it to, whenever I unplug my charging cable. I wonder what's going on there.
> The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following execution of that signal’s catching routine.
Maybe when the OS sees the cable is unplugged, it pings every process with "hey, if you have a power saving mode, now's a great time to use it", and this disturbs my script's peaceful slumber
 
Hello, I was working locally and 3 Create View worked perfectly for me to upload data. I passed it to Heroku and sadly out of the 3, only one CreateView works for me, any idea what it could be?
 
Hmm, so as of 3.5, time.sleep tries very hard to stay asleep for at least as long as requested. So it would be unexpected for my sleep(1) call to wake up every 0.8 seconds, for example. Maybe my subjective perception of time is off.
Possible explanation: suppose sleep(1) sleeps for 1.1 seconds when my program is operating normally, and it sleeps for 1.01 seconds when the power cable comes unplugged. I observe a 10%ish change in speed, and incorrectly conclude that the frequency dropped from 1 per 1 second to 1 per 0.9 seconds
 
How did you notice this small change though..
 
5:10 PM
do_stuff() plays a beep sound effect in addition to its other duties.
Maybe I'll log the timestamp in each iteration. That will give me objective data.
 
Oh but still, 0.1 second difference is noticeable?
 
Maybe it's more. I don't have particularly good rhythm or anything.
 
I'm pretty sure even an untrained ear will find a 0.1 second perturbation in a regular rhythm, especially at a 1 second frequency, and I'd bet even up to a 5 second frequency
You could easily write a script to test this yourself and put the random "short" beep in somewhere with your eyes closed, then check whether you correctly identified the beep that was off
I guess you'd need to leave the first ~3 beeps alone to make sure you catch the rhythm
If it's not already been done (I bet it has, but no time to search), I feel a paper on a parametric study coming on...
 
Just make sure your cable is plugged in while you do the challenge
 
5:26 PM
I wouldn't bet on the 0.2 Hz frequency. 1 Hz probably.
 
I wonder if you can improve your Hz discernment by training. Play the perturbation script for five minutes every day, and become the master of periodicity estimation.
 
I bet you can, and drummers and other musicians already do that
conductors too
 
I want to be able to draw perfect 30 degree angles
 
also some old-school technician gurus who just walk into the main hall of the factory and tell you that a nut is loose in the press one level below
 
"We know, he's been running around in a tin foil jumpsuit all morning"
 
6:04 PM
@AndrasDeak Granted I play the piano, but I have a feeling I could do that, provided that enough time was given to establish the regular frequency and I bet others could too, though you'd have to be be pretty isolated and tuned in
At least a hunch better than random chance on identifying the beat
We could probably answer that by the rated tolerance of acceptable metronomes for musicians and see whether it's orders of magnitude higher
 
it probably is, but that's not conclusive
 
Hence my parametric study. I wonder if tenure is a thing in business? :P
 
you can start up a startup around "listening to metronomes'
 
6:19 PM
I was thinking more around:
Bad-Cop Boss: "roganjosh!! You're 3 weeks late on the client work looking at how their promotion worked!"
roganjosh: "I'm sorry? It almost sounded like you spoke to me like I _wasn't_ the person that conclusively proved the relationship between frequency disruptions and the consequent Brain-Jarring Effect (TM) intensity. Don't lecture me about timing"
 
6:39 PM
roganjosh: "I am a creative, an artist, man - don't hassle me about... time!"
 
I'm pretty sure that's how all my colleagues see me, tbh... (I can't keep a straight face with that one)
 
Boss: "You're three weeks late!"
rj: "Wrong. I'm three weeks, one hour, seventeen minutes, and one point two seconds late. This only proves the importance of my frequency work"
Boss can't measure time spans with an accuracy of 1.001%... It's a miracle anything works around here
You may as well try baking a cake by mixing well first and then cracking the eggs
 
It's why adorn my office with quartz crystals of increasing size on the company budget. Somebody has to fix this mess
 
7:00 PM
Every Friday, in the morning standup, we have the Fail of the Week, and I've got my biggest yet lined up for the coming one. It's interesting how enthusiastic the rest of the team is to find out what it is. That's in addition to another colleague's highlight of their week just before New Year being that they found a bug in one of my solvers. I can't think what I've done to generate this atmosphere :P
I mean, I guess it could be the unsolicited slack messages of "btw, there's a bug here" at 11pm on projects I'm not even on, but that's just being a team player, right? I don't see how that would contribute
 
7:15 PM
Fail of the Week, as in presenting a fail from someone else?
Or your own?
sounds really weird either way
 
Our own fail
It's all light-hearted but it's to a) highlight something that might save someone else from falling down the same trap or b) make it less impactful on yourself when you screw up, especially when we're mostly back working in isolation, to show you're not alone in making silly mistakes
I guess it might sound kinda brutal from the outside, but really it's something of a comedy therapy group where we all sit around, someone stands up and says "I spent 3 hours fighting x, called in help and they fixed problem y after 2 minutes because I had typo z" and we all collectively facepalm, then move on. We have weekly highlights too
I just happen to be a little more outspoken during the week, so people enjoy "payback" (again, not so serious) and, meh, that's fine. I dish enough out, so my humble pie slice is usually extra-large
 
8:01 PM
@Aran-Fey hmm.. feels about half-half to me, I log a lot ^^ I think I prefer
except ValueError:
    # happens randomly
    ...
over calling it class Random(Exception). Unless I need to catch it more than 3 times, at which point it gets to have a class. That scenario might have happened maybe twice in the last few years.
 
8:40 PM
Hi I am getting following error, when calculating rmse "ValueError: y_true and y_pred have different number of output (1!=32)"
import math
from sklearn.metrics import mean_squared_error
math.sqrt(mean_squared_error(y_test,test_predict))
from keras.models import Sequential
from keras. layers import LSTM, Dense, Dropout
from keras. utils.vis_utils import plot_model

model= Sequential()
model.add(LSTM(32, input_shape=(1, trainX.shape[1]), activation='relu', return_sequences=False))

model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(X_train, y_train, epochs=100, batch_size=8, verbose=1, shuffle=False)
train_predict=model.predict(X_train)
test_predict=model.predict(X_test)
Is it because the model has 32 output ?
 
@YatShan what is the shape of y_test and test_predict?
 
y_test shape is (211, ) and test_predict shape is (211, 32)
 
8:57 PM
In pytest when you use more than 1 fixture, how do you decide about order of them? For example two fixtures here are used (request and monkeypatch):
@pytest.fixture(scope="function")
def my_variable(request, monkeypatch):
    """Set MY_VARIABLE environment variable, this fixture must be used with `parametrize`"""
    monkeypatch.setenv("MY_VARIABLE", request.param)
    yield request.param
 
@YatShan That says that your ground truth has only 1 value per sample, but your predicted data has 32. Right? In which case, yeah, seems like the problem is that the model has 32 outputs.
 
@AndrasDeak Thanks, Do you have any idea how to overcome ?
 
I don't know any ML, sorry.
I would assume that you need a model that gives you a single predicted value at the end.
 
@KarolZlot Pretty sure it usually doesn't matter? If it matters, it's probably a good idea to document why...
 
@AndrasDeak Alright, I will have a look. May be adding Dense layer to the model. Thanks
 
9:00 PM
@Aran-Fey Yes it doesn't matter, just I need to decide. I guess my perfectionism come back and I need to stop it. ;) Thank you
 
alphabetical
 
(Started reading a book recently about this topic, very helpful: "How to Be an Imperfectionist")
 
9:15 PM
If I see one more function documented like "gst_player_set_video_track_enabled(bool enabled) - Enable or disable the current video track." I'm gonna blow up the GNOME HQ
 
9:40 PM
If I recall, the Smurfs took a heavy beating in most episodes. Are you suggesting war against gnomes? This is quite a development
 
Yes. I will team up with Gargamel to end them once and for all. And maybe create some gold in the process
 

« first day (4118 days earlier)      last day (821 days later) »