« first day (1411 days earlier)      last day (3530 days later) » 

12:01 AM
Wow - a song long forgotten: youtube.com/watch?v=YG9otasNmxI
 
12:25 AM
@Peter this one reminds me of you: youtube.com/watch?v=3Tth-lt1TvI
 
@JonClements how exactly?
 
how you come across sometimes ;)
 
@JonClements if you want something that is me -- and not jazz -- then here you go:
this track is one of the OST of Moszkva tér -- IMHO one of the most important hungarian films of all
 
I like it :)
think the lyrics in S&G describe you better though :)
 
:D oh those lyrics..
 
12:30 AM
@PeterVaro That's really good :-)
 
@ZeroPiraeus I'm glad you like it -- I would recommend you to watch the film as well, even with subtitles only, however, I think it won't mean anything to you
if you are not raised in a post-communist country
 
@Zero I'm sure you've seen @Peter in some of his "what is life" moods... I reckon "Cloudy" covers that :)
 
@JonClements oh, now I see, why the lyrics may reminded you about me ;)
 
The film's called Moszkva Tér? The only thing that comes up on TPB is apparently an Easy Rider concert.
 
hmm.. let me check
 
12:33 AM
@PeterVaro No ... although I live in a country that was briefly Socialist about forty years ago ...
 
the one that always identified me was: youtube.com/watch?v=oZdiXvDU4P0 - but that's getting close to identifying @Peter too
wb @MartijnPieters
 
@Peter is it on Hungarian netflix ?
 
@JonClements I think you showed me this one before
 
@PeterVaro Thanks :-) I'll just go learn Hungarian then ...
 
12:35 AM
@JonClements is there a hungraian netflix? ;)
 
@Peter indeed... I just hope you listened to it ;)
 
@ZeroPiraeus wait a few minutes, let me check
 
How hard can it be?
 
(still searching for Moszkva ter..)
 
12:51 AM
I need to take a few piano lessons again me thinks
not sure where the hell I'd fit in the time, or buy a decent but not expensive piano again... but
 
@ZeroPiraeus nope, there is no torrent for it..
and sadly all the inline version I found was without subtitles..
 
@PeterVaro np, thanks for looking :-)
 
1:07 AM
@Zero I have some very nice lamb shish left ofter?
 
@JonClements Mmm, lovely. I'll wander over in a bit.
 
If you could fly/walk very quickly on water to the east England coast... I'll leave the backdoor open - it's in the mic.
Still don't have your bacon sandwich though...
thought you promised to post that to me :(
Have you been reading up on: bbc.co.uk/news/health-28939550 ?
 
@JonClements The Chilean postal service is notoriously corrupt ... possibly I didn't use enough tin foil and they smelled it.
 
CBG
How can I get the binary representation of an int? Like the 0's and 1's?
 
>>> bin(23)
'0b10111'
 
1:13 AM
either bin(your_num) or format(your_num, 'b')
one with give you the leading prefix to eval it back, the other is probably more natural
 
@ZeroPiraeus @JonClements Thanks a lot!
 
@PeterVaro I was going to point you in the direction of ¿Quién mató a la llamita blanca? as a thankyou for your efforts, but sadly it doesn't have any active torrents that I can find either.
 
@Johnston the more interesting question is actually why you want that :)
 
@ZeroPiraeus ahh thank you => added to my watch list, maybe some time in the future there will be a working torrent ;)
 
@JonClements I am doing some bit and byte stuff. I need to see the results.
 
1:25 AM
@Johnston fixed-sized or arbitrarily sized?
 
anyway, I have a question: how are these bitwise OR arguments passing working? I mean, I know the theory (70%) but how is it designed? what is the math behind choosing the proper integers for each value, so that no matter how you bitwise-OR them, they always be unique?
 
I am actually working with ObjC,C and Swift
and I just need my binary back.
Fixed
 
@Johnston have you looked at struct and array and ctypes? I'm not sure of your actual use-case though
 
in python?
 
@Johnston yup
 
@PeterVaro not sure what you mean about uniqueness ?
 
Aha. Cool thanks for that
 
@Johnston if you're working with fixed sized/unsigned integers/floats, look at that
 
@JonClements Thanks
 
I mean there is A, B, and C (for this dummy example) and then: A | B, A | C, B | C and A | B | C are all unique values << none of them is equal to the other
 
1:29 AM
And check array if you need to do computation on such things
 
and they are different from their components
 
user559633
@PeterVaro are you talking about the XOR trick?
 
if that is the name of it @tristan -- then yes, I'm talking about that one ;)
(I did not know the name => I could not search for it)
 
XOR is exclusive OR ... I don't know how that relates
 
@tristan is the trick that all values has to have different binary reps, which the other one does not have?
 
user559633
1:32 AM
@Johnston if this is related to your question, i wasn't trying to answer it.
 
user559633
i just remembered this tab was open and saw PV''s question
 
like: 0, 1, 2, 5, 8... etc
 
user559633
@PeterVaro I don't think we're thinking of the same thing.
 
umm.. then I'm curious: what were you thinking?
 
user559633
I thought you were mentioning associativity on a en.wikipedia.org/wiki/XOR_swap_algorithm with another value.
 
1:35 AM
my example was wrong, the right one should be simply: 0, 1, 2, 4, 8, 16, ...
 
@Johnston an answer of mine that might be useful... don't forget that Python will automatically promote ints/floats to massive amounts anyway
 
@tristan that's super nice, but I wasn't talking about that one
 
@Peter I'm staying stumm... cos I know it'll come to you after some thought :)
 
I was talking about for example this one: glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@JonClements I think I got the idea now.. just have to prove it..
 
there's either a const int= or a #define for those?
 
1:38 AM
@JonClements those are const ints
but that's not important right now => there are 5 values of them
and you can combine them as you like (as long as there is no duplicate)
and the function will know what to do
(and it still only takes a single int as argument)
 
@tristan No I was more thinking of peters thing.. I was reading up on XOR recently and I couldn't possibly think of how it related.
@JonClements Thanks.
 
it appears @Peter is talking of inclusive or
 
user559633
Oh @Johnston, I've seen it from someone that I was helping learn programming in which the student will do the xor swap and then go back and add another var/swap iteration
 
@JonClements so basically, the trick is, that a bitwise OR is actually "merging" the two number (or any) and if both are 0 => 0 if one or more is 1 => 1, which means, if all the different value options have their 1s at different places it would work
 
1:42 AM
0000
----
1248
Treat the first level as the "yes/no" flags
the below for the integers representing the on/off options presented as an integer
So let's say the all available options are A, B, C, D, each represent, 1, 2, 4, 8 each as integers
Passing A | B | C is 7
that turns the first 3 bits on in the received integer
 
@JonClements so:
  | 16  8  4  2  1 |
--+----------------+
A |  0  0  0  0  1 |  1
--+----------------+
B |  0  0  0  1  0 |  2
--+----------------+
C |  0  0  1  0  0 |  4
--+----------------+
D |  0  1  0  0  0 |  8
--+----------------+
E |  1  0  0  0  0 | 16
--+----------------+
 
Yes... but you're OR'ing the bits
so it's either 1 or 2 or 8 or whatever
 
and?
 
@tristan aha
 
then the receiving function AND's the flags
 
1:48 AM
@JonClements you are starting confusing me ;)
 
okay... just start with Python here
what's 1 | 2
 
Explain to me why that's 3
 
  0 1
| 1 0
------
= 1 1
 
And those 11's in decimal are
 
1:50 AM
those are binary..
 
1 + 2 = 3
 
^
umm: actually 2, 1
 
Well. ... Yah
 
ignore endian format - let's not get into that
 
little endian schmindian
 
1:51 AM
so what's 4 | 0 ?
 
because the 3rd bit is set to true
 
100
000
----
100
 
yepp -- that's what I'm saying
so my theory is correct -- that's why I don't understand what you are trying to explain right now :)
 
So, by having constants that are powers of 2, it reflects the bits
 
1:52 AM
yepp
which means, ORing any two or more will lead to a unique number
 
so... err... must have completely misunderstood your question about how it worked then :)
 
as a unique binary repr
@JonClements you just gave me enough time to figure it out my own
:)
 
Yes... because all the constants are unique
 
it also has to be the power of 2
otherwise even if they are unique their OR won't be
 
yes.... to set a unique bit
 
1:54 AM
yepp
okay -- thanks ;)
 
the receiver of the call then using AND operations to deduce what flags were set
 
now that's new to me -- how is that working?
 
So it'd be perfectly plausable to call a function something like somefunc(912)
@Peter what's 1 & 0 ?
then try 1 & 1 and 1 & 2
 
one mo'
back
@JonClements so, AND is: 1 if all are 1, otherwise 0
@JonClements so, with ANDing which number will I have back my original inputs?
that is the thing I don't understand now ;)
 
no......
AND is all if bits match
 
2:05 AM
?
 
I'm about for another hour (maybe), read this first:
In digital computer programming, a bitwise operation operates on one or more bit patterns or binary numerals at the level of their individual bits. It is a fast, primitive action directly supported by the processor, and is used to manipulate values for comparisons and calculations. On simple low-cost processors, typically, bitwise operations are substantially faster than division, several times faster than multiplication, and sometimes significantly faster than addition. While modern processors usually perform addition and multiplication just as fast as bitwise operations due to their longe...
 
I'm reading that one
and especially this one:
In the C programming language, operations can be performed on a bit level using bitwise operators. Bitwise operations are contrasted by byte-level operations which characterize the bitwise operators' logical counterparts, the AND, OR and NOT operators. Instead of performing on individual bits, these operators perform on strings of eight bits (known as bytes) at a time. The reason for this is that a byte is normally the smallest unit of addressable memory (i.e. data with a unique memory address.) This applies to bitwise operators as well, which means that even though they operate on only one bit...
@JonClements but what I don't understand is how you disassemble the ORed values with an AND?
 
Right, say you've received an integer to your function - let's call it 33
 
good, it is 33 then
let it be 31 -- if that is not a problem
 
for the sake of this, let's just say it's an unsigned short (okay 31)
 
2:11 AM
we are all saying: It is an unsigned short
 
right... so what bits are set on it ?
 
Thus sayith the lord
 
user559633
i'm short and my sign is aries, gentlemen
 
Everytime I walk to the mailbox... I think to myself "hey, your an outgoing male too"
 
@JonClements all are 1: 11111
 
user559633
2:13 AM
lol @Johnston walks up to the mailbox winks me too buddy, me too
 
@PeterVaro okay, so you want to check if the 3rd one is ON
 
why the 3rd?
 
it's arbitrary ...
okay... let's rephrase this... you want to check certain bits are on to perform certain actions ?
 
@JonClements let's create an example: I have these: SOUP=1, RICE=2, MEAT=4, SALAD=8 and COKE=16
and I have a function called food()
 
good eg... go ahead
 
2:16 AM
now I want to build my breakfast menu, so I say: food(SOUP | COKE)
 
So food receives 17
 
now, inside food I want to check what to send back
yepp it is 17
now, you said, with AND I can decide what values were sent to food
now, I'm curious, how should I do that?
 
yes
because SOUP & value will be true
RICE & value won't be
etc....
COKE & value will be
 
wait a minute..
@JonClements I think I got it!
if you AND it with itself
 
If you take away the binary, and just call it 1, 2, 3, 4 options
if you're doing is clever binary reps of saying zero or more options of the above
 
2:22 AM
I mean: BREAKFAST & COKE => true; but BREAKFAST & RICE => false
and BREAKFAST & SOUP => true
(BREAKFAST is the input)
 
user559633
local storage question -- would the idea be to present the data to store on an endpoint or script block and then use javascript to assign it to local storage? (answer: yes. localstorage is only accessible client-side)
 
@PeterVaro now you're losing me...
 
@JonClements gimme a sec!
FOOD = {'SOUP'  :  1,
        'RICE'  :  2,
        'MEAT'  :  4,
        'SALAD' :  8,
        'COKE'  : 16}

def breakfast(menu):
    for food, value in FOOD.items():
        if menu & value:
            print(food)

breakfast(FOOD['SOUP'] | FOOD['COKE'])
@JonClements here it is ^
and the output is:
SOUP
COKE
so, was this the ANDing that you were talking about?
 
no...... that's ORing still
oh no - missed the AND
 
OR is how you put the data in, but AND is how you get it back
 
2:30 AM
yup
 
yay -- I figured it out :D:D
this is just super cool ;)
I (still) love programming
thanks @JonClements for the small feedbacks! :D
 
Change your code to do a range from 0 to 31
print the outputs, that'll make it perfectly clear (I hope)
 
it is totally clear now -- omg.. it's full of stars!
 
+1 for the Arthur C Clarke ref :)
 
actually in this case, it's full of pipes and ampersands -- but still
okay, I have to get back coding ;)
 
2:34 AM
Can I sleep now please sir?
 
I have to implement a super bitwise API now :)
 
No no no... please don't
 
oh, sure @JonClements -- as Mr. Filch says: nighty night!
@JonClements why not?
 
is this a C layer you're talking about?
 
it is C, yes, with enums
 
2:36 AM
most likely acceptable though...
 
oh, wait a few days (now I'm truly almost there)
and you will see the wonders I made
 
I look forward to it... I'm also looking forward to what you asked my time for the other day :)
 
beautiful designated initalisers in arrays, generic APIs and other tasty stuffs
@JonClements that and this are the same thing
 
can't wait then :)
 
anyway -- rhubarb mate
~
 
user559633
2:40 AM
rb puppyman
 
has now solved the "flatmate who hasn't seen Blade Runner" problem :-)
 
user559633
And? Thumbs up? Down?
 
Very much up.
 
user559633
The sequel is going to be awful
 
Also, with no prior knowledge or prompting: "So he's a replicant, right?"
@tristan Couldn't agree more ... I will just pretend it doesn't exist.
 
user559633
2:47 AM
Exactly and exactly.
 
user559633
Which is why having Deckard step out of a freshly nuked refrigerator makes no god damn sense.
 
I think I might have to get hold of a copy of Dark Star next ...
 
user559633
I have not seen Dark Star.
 
It shows its age, but lots of fun ... especially if you're a fan of the first two Alien films.
For now, though ... a bit of Ali & Toumani :-)
 
3:06 AM
one of my favourite radio presenters I'm going to fall asleep to
 
user559633
 
LMAO -- both images made laugh..
 
user559633
3:24 AM
 
Name two things you can add together?
Besides numbers
 
Gin & Vermouth?
 
user559633
"vodka and ambien" - texted from my children's nanny's blackberry in connecticut
 
Hmm I kinda meant quantity wise..
But those are also good..
@tristan hanging with the nanny?
 
user559633
wait, so you want numerical values that can be mathematically added that aren't numbers
 
user559633
3:31 AM
@Johnston i don't actually have kids :)
 
Oh that kind of nanny..
Yah like a vector2d.... Whatever that would be...
 
user559633
i want out of this joke ;____;
 
but something more creative
 
user559633
 
I know.... but.. ahhh. nvm
Good use of that gif
 
user559633
3:39 AM
 
3:54 AM
G_d I hate Microsoft. They've just sent me a second, identical, wrong email that I'm using an outdated version of Skype and it's about to be retired.
Skype is, of course, also the reason every damned package in the Ubuntu repos is listed twice on my machine. After all, a company with Microsoft's resources couldn't possibly put a 64-bit package together: much better to force me to add a whole extra architecture to my package manager.
 
user559633
4:16 AM
Yeah, well, what makes you think they care?
 
user559633
Do you also have skype installed on a tablet/phone/vm?
 
4:36 AM
@tristan I don't currently have a smartphone ... since the last one got nicked I'm waiting for the Moto G LTE to become available at a sensible price in Chile. No tablet either, and no VMs with Skype installed.
And no, I know they don't care, but that doesn't stop me being annoyed.
 
user559633
4:49 AM
time for sleep, rb
 
rbrb
 
 
3 hours later…
7:52 AM
is this right conversion from ruby to python code?
math.log( max(abs(4),1), 10 )
from ruby
Math.log( [4.abs, 1].max,  10 )
 
Why would you call abs() on a constant integer?
 
@DanielRoseman thank you for noticing that. I tested it without calling abs() and it works the same. I just assumed I had to copy the algorithm exactly like it was in ruby
 
Yo yo yo
 
cabbaje Ian
 
Cbg @Moderateur :)
 
8:04 AM
:)
trying to understand if "epoch_seconds(date)" is the same as python's "time.time()"...
oh wait there's an online ruby interpreter
 
0
A: HackerRank "Manasa and Stones" in Python

Antti HaapalaWrite the algorithm as a generator so that it outputs the numbers in monotonically increasing order, as required by the answer. Then you can drop successive same counts by using itertools.groupby. itertools.groupby returns a generator where successive values are pairs (k, g) where k is the key f...

 
8:34 AM
cabbage
 
@IntrepidBrit cabbaje
do you think I should cache the result of the ranking values returned from the following ranking algorithm which takes no noticeable time?
def rankit():
        displacement = math.log( max(6,1), 10 )
        return int( (displacement * 1) + (time.time() / 45000) )
it's simplified just a little ;-)
 
9:22 AM
Sorry about that, was having network issues
 
@MartijnPieters I am now polyglotting relstorage :P
trying to make it support 2.3->up
with even old zope interface that does not have implementer decorator
 
@Moderateur Depends on so many things - but I always believer that pre-optimising is the devil ;). Depends on how much traffic you have, what frequency they arrive at, how powerful your server is, how many servers you have etc etc
 
@Moderateur how do you cache time.time() ....
 
@JonClements Fun times & long story shortened - Client shenanigans have meant that I have to suddenly squeeze 2-3 weeks worth of work into 5 days work so I'm not going to be able to go over the code sample. I'll get to it, but if it's important to update then I shan't in time. I presume it's not though ;)
 
@IntrepidBrit ofc I'm not going to waste time pre-optimising stuff but this is far from pre-optimising or maybe not. let me explain it. I've been given the task to rewrite a website written in PHP to Python and that site is at this very moment on an average load of 400 requests per second. the ranking algorithm is the first to be affected because it's used both in the main page and the "hot" page where the real CPU utilization occurs
 
9:36 AM
Ran 133 tests in 0.876s

FAILED (errors=29, failures=7)
 
@AnttiHaapala well, instead of calculating the rank of each post every time, I'd run a cronjob every x minutes updating a db table dedicated to rank values
that's what I mean by caching :)
 
@Moderateur And what's your feeling for it? And why wouldn't you cache it?
 
@AnttiHaapala W00t!
 
@IntrepidBrit I actually do have diverging feelings about it.. in one place I don't want to run a cronjob on potentially 1.000.000+ items at once every x minutes having the possiblity to make the site unavailable for that time, in another place I still don't know if the server will handle ~400x10/20 execution of "ranking" function
that is 4000-8000 execs per second
 
@MartijnPieters again, the hardest part is the damned "i give you some strings, now here be bytes"
 
9:43 AM
@Moderateur To be honest, I think "caching" is the only sane way forwards, especially when you're considering the number of requests and scalability. And then you need to start worrying about multiple servers...
 
Is it considered to be Pythonic to do for x in (some_value or ()): pass?
 
Yup; you still need to mix and match with if PY2 guards all over the place.
 
there are surprisingly few things here...
 
@vaultah I sometimes do that, yes.
 
@MartijnPieters I made relstorage.compat with b()
not a single py2 yet
 
9:44 AM
If you can swing it, great!
 
Okay, thanks.
 
I am sure will hit some corner cases like
@MartijnPieters the code does not use dict.values() consistently
there are lots of things that use dict.values() to iterate over values without any change to the dictionary...
but I guess some of them will do it :P
ah not really
 
I haven't touched the codebase in eons, cannot comment on such details.
 
there are only like 5 lines with .values and
 
example of bytes vs. unicode strings pain in unexpected places:
 
9:46 AM
and 10 with .bytes
 
Breaks only for Python 2 protocol 0. E.g. the default protocol in Python 2.
 
self.assertEqual(data.get('myprefix:state:50:2'), p64(45) + b('abc'))
AssertionError: "b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00-'b'abc'" != b'\x00\x00\x00\x00\x00\x00\x00-abc'
this is 1 thing that I need to solve
 
@IntrepidBrit yup. I'm going to do like this and do a bunch of testing. gonna try Redis too if that helps
 
the cache vals are concatenations of str(a) + str(b)
 
particularly sorted sets look promising
 
9:48 AM
:P
 
maybe bitwise operations are even better.. let's see
 
@MartijnPieters surprisingly few cases so far,
byte+string confusion, then missing iteritems, itervalues;
python 2.5 compatible except a, e: is the most annoying
 
@AnttiHaapala Are you kidding? It looks beautiful ;)
 
which one?
@IntrepidBrit you mean it looks so beautiful when one needs to write:
    try:
        import ZODB.blob
    except ImportError:
        e = sys.exc_info()[1]
 
Was meaning the AssertionError :)
 
9:54 AM
TypeError: 'DistributionNotFound' object does not support indexing
:D
the stupidities in python 2 pay off, or not.
@MartijnPieters this one is hard:
self.assertEqual(f.__class__, file)
 
@AnttiHaapala Switch between file and io.IOBase?
and use type(f), not f.__class__ perhaps.
 
@MartijnPieters io.IOBase not in python2.3
I made it test that file.fileno() returns an integer
minimal changes
but I am not sure if it is right
 
hrm, not sure what the test needs to accomplish there.
 
martijn: the other is BlobFile
 
and I meant for you to use io.IOBase only if using Python 3.
Right.
 
10:09 AM
>>> import ZODB.blob
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ztane/work/relstorage/venv/lib/python3.4/site-packages/ZODB/__init__.py", line 28, in <module>
    from ZODB.DB import DB, connection
  File "/home/ztane/work/relstorage/venv/lib/python3.4/site-packages/ZODB/DB.py", line 23, in <module>
    from ZODB.broken import find_global
  File "/home/ztane/work/relstorage/venv/lib/python3.4/site-packages/ZODB/broken.py", line 20, in <module>
    import zope.interface
hmhm
now why's that happening?
 
10:38 AM
Finally got a copy of my academic paper @Jon
 
@Ffisegydd that CCCP?
 
Hah no this is one I've published
I did eventually get an Russian copy of that paper though :P
Got the British Library to send me a photocopy of it
 
11:14 AM
@MartijnPieters hmmh but I was just running unittests, now with postgres tests not so fancy :p
Ran 258 tests in 36.579s

FAILED (failures=43, errors=190)
 
11:27 AM
hmhm
@MartijnPieters for some reason the doctests do not work as before
there are lots of implied globals to the doctests
 
Back in a bit; my daughter has been named in a Ice Bucked Challenge, we are about to film her getting doused in icewater.
 

« first day (1411 days earlier)      last day (3530 days later) »