« first day (2807 days earlier)      last day (2145 days later) » 

5:41 AM
Sometimes I think I'm the most professional web developer (at least in Iran) ..! Specially when I catch/debug a bug all in less than 5 min.
 
 
1 hour later…
6:58 AM
mornin
 
7:43 AM
posted on June 23, 2018

New Cyanide and Happiness Comic

 
mornin
 
mornsko
 
8:00 AM
backstairs secret, underhanded, or scandalous: backstairs gossip.
 
 
2 hours later…
10:16 AM
how can I go from a binary string to a byte array so that is possible to perform bitwise opearions?
 
you want to perform bitwise operations on individual bytes or what?
 
publicKey[31] &= 0x7F;
like this for example
 
$byte = $binaryString{31};
 
ctrl+k
 
pack("H*", $publicKey);
this is how I get the string from hex
 
10:21 AM
essentially hex2bin()?
you could use unpack() to decode the string
 
Mornings
 
good morning
 
Uncaught Error: Cannot use assign-op operators with overloaded objects nor string offset
so you think that is better to use unpack instead of your other method?
 
well it seems you are not allowed to use assign-op operators with a string offset.
I'm guessing you were trying $publicKey{31} &= 0x7F;
 
yes
 
10:29 AM
$array = unpack("C*", $publicKey);
$array[31] &= 0x7F;
$hexString = pack("H*", $array);
 
Mornhaa
 
I have a Steam Coupon 25% OFF The Mage's Tale valid til EoM. Game is also currently on Steam Sale, so that should make it about 80% off (if they can be combined. IDK). Anyone interested?
2
 
@webmaster777 thank you very much
there is just one last error because of pack
 Array to string conversion
$string = implode(array_map("chr", $bytes));
maybe this?
 
10:46 AM
Very bad, I can't even click it
 
check it now
 
While we are on the topic of games
Pointing at the bundle. Escape was mehish iirc
 
11:20 AM
SO should really improve the ORDER BY clause of tag autocomplete (while asking). It suggests "PHP" when you search for "htm"
 
 
1 hour later…
12:41 PM
1000010 & 1111111 = 110000
how is this possible?
  echo base_convert(bin2hex($binPublicKey[31]), 16, 2)." & ".decbin(0x7F).PHP_EOL;

  $binPublicKeySign = ($binPublicKey[31] & 0x7F);

  echo base_convert(bin2hex($binPublicKeySign), 16, 2).PHP_EOL;
 
1:22 PM
do I need both operands to be in the same base to perform a bitwise operation?
 
1:33 PM
@tereško Probably the hardest thing is just learning how certain things should be built. I dug the ground away to reveal the water and place a pump only for the surface tension of the water (I'm guessing) to allow for it to come over the sides and soak the floor. Messed up power and wiring (keeping it tidy) a few times as well. This game satisfies my OCD and ADHD compulsions. Great recommendation!
 
:D
you are welcome
 
I'm at work now- watching a stream of the game and having a lot of "Ohhhhh..." moments.
Do you have a screenshot of your current build? Actually I think you posted that the other day. Let me see if I can find it.
Oh well... I cannot find it.
 
1:50 PM
which game?
 
@Tiffany Oxygen Not Included
 
On the note of giving stuff away: I have one copy of Blockland, one copy of Bunch of Heroes, one copy of Deponia, two copies of Fight the dragon, one copy of Postal and one copy of Rise of the Triad. Not the best of games, but they're free.
though Deponia might be good
 
I'll check it out after I go to the DMV
I finally remembered on a Saturday morning to get my title put in my name... I've had it in my possession for .... three years .... and haven't switched it to my name
 
That sounds like... fun!
 
2:05 PM
Good evening
 
Hey Linus
 
o/
 
Wes
yo
 
yo @Wes
 
Wes
watching french GP formula 1 qualifying. already better than all the world cup football games i've seen :B
 
2:11 PM
lol
How much is left in the World Cup?
 
Wes
a lot, half of it
 
I've never really followed it. Just catch a few games here and there.
 
Wes
they mostly were unbalanced games
except portugal-spain and arg-cro
 
Sounds like I might have liked those. That's the main reason I like watching College (American) Football is the level of disparity between the teams.
 
Wes
you like unbalanced games? :B
 
2:18 PM
When it comes to American Football it's fun to watch one team dominate.
I don't watch professional. The teams are so evenly matched and the players have seemed to arrive so they don't seem to try as hard as college players so I only watch the Super Bowl.
Also I just don't have the time to invest in watching a lot of sports.
 
Wes
watch one team dominate is shit. after a solid 3-0 i turn off the TV
not sure about american football though, never watched that.
 
Soccer(Football) is different.
hmm...
@Wes This was a great game. Was not total domination and in championships you don't want that: youtube.com/watch?v=ZQU9QhzQAvc?x
@Wes Watch from the last drive of the game: youtube.com/watch?v=ZQU9QhzQAvc&t=180m0s
 
Wes
2:34 PM
oh i don't get it, i am like this all the time youtube.com/watch?v=W6oQUDFV2C0 (might be nsfw)
 
Wes
but what really confuses me is baseball
i have literally no clue what's going on there
 
lol- baseball is too slow for me.
I'll watch the World Series- but that's it.
 
2:50 PM
@StatikStasis lol..... it was already in my name...
 
I just meant being at the DMV sounds like fun.
 
DMV here isn't too bad
they're nice at least
 
3:02 PM
Guys, I need your help.
I'm making a presentation on TypeScript, the Future, and Jake Weary.
I'm at the Jake Weary part. I need to think of some nice Jake Weary facts to put in
Any ideas? :D
 
That's funny.
 
100 | 1000 = 10010 ?
and not = 1100 ?
 
@MadaraUchiha I guess you're looking for fun comparisons and/or puns?
 
why does php computes the or like that?
 
@StatikStasis Yup
@Aurelius I'm guessing you're literally trying 100 | 1000 ?
Because those aren't binary literals.
 
3:20 PM
That's punny.
HA
bye
 
  $signatureSignNibble = base_convert($signature[126], 16, 2);
    $publicKeySignNibble = base_convert($publicKey[62], 16, 2);

    $publicKeySignNibble &= 0x7;
    echo base_convert('C', 16, 2).PHP_EOL;
    echo base_convert($publicKeySignNibble, 16, 2).PHP_EOL;
    echo base_convert(($signatureSignNibble & 0x8), 16, 2).PHP_EOL;

    $publicKeySignNibble |= ($signatureSignNibble & 0x8);

    echo base_convert($publicKeySignNibble, 16, 2).PHP_EOL;

    $signatureSignNibble &= 0x7;
    $signature[126] = base_convert($signatureSignNibble, 2, 16);
@MadaraUchiha that's what I am doing
such a simple thing has to be so hard
 
@MadaraUchiha Maybe you can figure out something along the lines of Jake Weary is often confused with Joshua Jackson just as JQuery is confused with...
 
@MadaraUchiha I can't come up with anything else... Jake Weary needs to become more famous. Not a lot to go on.
 
3:41 PM
$sig = hex2bin($signature);
$byte = $sig[63];
echo bin2hex($byte).PHP_EOL;
$byte &= 0x7f;
echo bin2hex($byte).PHP_EOL;
do you guys know why I always get "30" if I use either pack or hex2bin ?
I mean after $byte &= 0x7f;
 
4:16 PM
@Aurelius byte is a string, and the 0x7f is cast to the string "127", which means the actual operation performed is $byte &= "12";
you either want to convert $byte to an integer with ord() or do $byte &= "\x7f";
when you do $var = $string[$index]; the result is a 1-byte string, not an integer as you might reasonably expect
you can do bitwise operations with strings (although not shifts), but you need to make sure both operands are strings, otherwise they will be converted to strings, and in the case of an integer it will be converted to a decimal string
@Aurelius I suspect you don't want those base_convert() in there either, rather you work on the whole thing as a binary string
 
4:48 PM
@DaveRandom thank you very much I spent the entire afternoon on this. And this is the result:
  $signatureSignNibble = $signature[126];
  $publicKeySignNibble = $publicKey[62];
  $publicKeySignNibble &= 0x7;
  $publicKeySignNibble |= ($signatureSignNibble & 0x8);
  $signatureSignNibble &= 0x7;
  $signature[126] = $signatureSignNibble;
  $publicKey[62] = base_convert($publicKeySignNibble, 10, 16);
  $signature = hex2bin($signature);
  $publicKey = hex2bin($publicKey);
I know this isn't the best implementation but it works, how can I make it better?
 
$publicKeySignNibble &= 0x7; <-- this only works because 0x7 is the same as decimal 7
and it probably doesn't do what you want
it's actually doing $publicKeySignNibble &= "\x37";
 
$ecPublicKey = "F1F5AC76CC3BCA543DBF7DEBFE77101343B72ABE582FF1D2E8767916EA792F32";
this is what I am starting from
 
you should start by converting all the strings to binary
even if you want to work in nibbles, you should do it on the level of bytes
when they are printable hex, you are doing bitwise ops against ascii codepoints, and while ascii is very cleverly laid out so that stuff often works, it's really confusing to do it that way
 
I would love to do it with bytes
but it seemed so hard
 
where did $signature come from?
@Aurelius I promise you it's easier than what you are doing
 
4:54 PM
$ecSignature = "4D363B793632444DC36FCB78F7993FC1C04FCA43F498ABC883DE772A7E616C98290D326306ABC77‌​2370E73338FD34D24B207F0F69F8652004001909B6907E986";
(string $signature, string $message, string $publicKey)
paramters of the method
 
$message doesn't seem to feature in that code
also... what are you actually trying to accomplish?
 
so it's complicated
but I'll try to explain
 
it looks suspiciously like you are trying to roll your own crypto...
 
no
not really
take a look
      ed_pubkey[31] &= 0x7F;
      ed_pubkey[31] |= (signature[63] & 0x80);
do you see that line?
java uses Curve25519 and converts to Ed25519 to verify the signature
however PHP sodium also needs Ed25519 to verify signatures
 
OK, so all you actually need to do is copy that one bit from the signature into the key?
 
5:01 PM
Yes because If I send the Curve25519 publicKey and signature to php then sodium can't verify them
so wha I do is
*what
convert the publicKey to Ed25519 in java
      fe_frombytes.fe_frombytes(mont_x, curve25519_pubkey);
      fe_1.fe_1(one);
      fe_sub.fe_sub(mont_x_minus_one, mont_x, one);
      fe_add.fe_add(mont_x_plus_one, mont_x, one);
      fe_invert.fe_invert(inv_mont_x_plus_one, mont_x_plus_one);
      fe_mul.fe_mul(ed_y, mont_x_minus_one, inv_mont_x_plus_one);
fe_tobytes.fe_tobytes(ed_pubkey, ed_y);
basically this piece here
 
$key[31] &= "\x7f";
$key[31] |= ($signature[63] & "\x80");
That php code does the exact same thing as the two lines of java
the only difference is that index access of PHP strings (which are byte arrays) returns a string, not an int
 
/* Copy the sign bit, and remove it from signature */
I also think I need to remove it from the signature
verifybuf[63] &= 0x7F;
which is what this does
I believe
 
$signature[63] &= "\x7f";
I'm not sure what they are doing with the extra buffer
you might just need to make a copy of $signature so you still have the unmodified version
what you absolutely definitely do not want is to try base conversions, bitwise operations are binary, do them in binary
 
What's weird is that publicKey and signature are tied together
I mean you have to modify each time
 
not really, the key pair was used to generate the signature...
 
5:06 PM
the publicKey according to the signature
yes you generate a keypair, than you sign a message
however after you store the publickey
and you sign another message with its private key
 
yes, without looking into the signature algo I don't understand why this is necessary but at a guess this is some sort of 32/64-bit portability thing
 
you need to temporarly modify the publicKey by adding the sign bit of the signature
 
since it's talking about the "sign bit"
anyway I need to go make some dinner
 
 Uncaught Error: Cannot use assign-op operators with overloaded objects nor string offsets
this is what I always get
I tryed to use this
  $publicKey[31] &= "\x7f";
  $publicKey[31] |= ($signature[63] & "\x80");
  $signature[63] &= "\x7f";
Okay have a nice dinner!
and thank you very much
 
@Aurelius Ah right, I forgot you can't do
(dinner is pizza, forgot I just needed to put it in the oven)
It might be worth having some sort of class for this actually
 
5:26 PM
Oh nice..
what do you mean by class?
 
give me a minute
 
sure don't worry
function verifyEd25519Sig(string $signature, string $message, string $publicKey) : bool {

  // $signatureSignNibble = $signature[126];
  // $publicKeySignNibble = $publicKey[62];
  // $publicKeySignNibble &= 0x7;
  // $publicKeySignNibble |= ($signatureSignNibble & 0x8);
  // $signatureSignNibble &= 0x7;
  // $signature[126] = $signatureSignNibble;
  // $publicKey[62] = base_convert($publicKeySignNibble, 10, 16);
  // $signature = hex2bin($signature);
  // $publicKey = hex2bin($publicKey);

  $publicKey = hex2bin($publicKey);
even more weird, this is allowed $signature[126] = $signatureSignNibble;
but this is not $signature[63] &= "\x7f";
 
basically a byte array class
 
wow
thanks
all that stuff just to change a character
 
well yes and no, there's a simpler way to do that specific job but having a proper data structure will make it easier to do other stuff as well
you can still do it in 3 lines if you want, but it would be hideously unreadable and having a class like that enables you to write more readable code where logic is concerned, with clearer types in signatures
you could also e.g. just convert the input string to an array of ints with array_map('ord', str_split($data)) but that doesn't give you any guarantees that other code won't e.g. accidentally assign a string to one of the elements
what something like that gives you is a type which gives behavioural guarantees and lets you write more expressive code that uses it
 
5:45 PM
Okay I feel like I am always in debt towards you
If I can do something for you let me know
why do you use all these "\" ?
 
oh, just a slightly ridiculous habit, don't worry about it
it's an epic micro-optimisation
 
lol
where can I learn more about it?
 
I used to write my functions like that too but wound up stopping because I was tired of explaining why :P
 
yeh but there's some case, I forget the specifics, where using an fqn reduces the number of opcodes
 
Yea, at the time it was just I like explicitness (maybe to an anal-retentive degree) and wasn't aware of any potential optimization.
But part of that desire is to make code raise fewer questions not more ;)
 
5:55 PM
look at the VLD output of 3v4l.org/Q3Hpo vs 3v4l.org/Y0iRq @Aurelius
basically if you use the fqn of a function within namespaced code, it avoids a hashtable lookup
it's a ridiculous micro-optimisation
but it's now a habit
 
  public function getBinary() : string {
    return $this;
  }
I just had to add this
to make it work
 
@Aurelius thats why I added the __toString(), so you can just do (string)$buffer
 
@DaveRandom Oh okay, nice
however that's like 4 function calls vs 1 right?
@CharlesSprayberry thanks!
 
Wes
i thought "that can't be a man hugging a dog"... then i zoomed in and it was
congrats, best avatar ever :B
 
It is more me trying to restrain him from jumping all over the photographer
 
Wes
6:08 PM
lol
 
 
2 hours later…
Wes
7:40 PM
english ppl
wouldn't be better if ...
wouldn't it be better if ...
equivalent? which sounds better? thanks
 
@Wes actually not equivalent, they can mean the exact contrary
 
Wes
woa
 
"it wouldn't be better if" vs "wouldn't it be better if". former is affirmative (the world would not be better) latter is question (would the world be better if)
 
hi all!
why that is not working?
$font_path=some;
$size = 16;
$color=array(255, 255, 255, 0.5);

$img->text($signature, $left, $top, function($font, $font_path, $size, $color) {
$font->file($font_path);
$font->size($size);
$font->color($color);
});
Too few arguments to function App\PhotoHandler::App\{closure}(), 1 passed in [..] expecting 4
 
possibly because there is a syntax error
.. or not
 
7:55 PM
1 give
i try to use last example from here, but in my own function image.intervention.io/api/text
and the callback seems to ignore the variables
if I replace them with values, it works...
 
8:16 PM
@BoteaFlorin the example clearly states that the callback only uses one argument. are you aware of how to pass outer scoped variables to the scope of the callback? Don't hesitate to ask for clarification if what I'm saying means nothing.
 
afternoon
 
@bwoebi so you remember the question about SoapClient having that dynamic property, and what the behaviour would be if I declared it explicitly in a descendent class? Turns out it doesn't work as expected, even if I declare them public, the internal code doesn't read the value from it any more
 
8:33 PM
ugh
 
about the response I expected
 
Wes
@FélixGagnon-Grenier thanks
 
Wes
8:58 PM
i always wanted to know why seemingly no server on the internet supports pause/continue downloads
i just had to restart my computer and obviously i can't recover a download, i have to restart it from 0
 
@Wes "pause/resume" is usually implemented client side with chunked requests
 
The issue is that very few people bother to implement ranges
and not enough people use x-sendfile so they don't have to
 
Thankfully, most people put nginx or Apache in front of static assets so it usually works
 
where it usually matters is things that have an auth layer that isn't implemented at the web server level
I have a thing
oh, a thing with a broken build apparently
 
I'm going to need to keep a lint roller near my computer...
for my mousepad
 
Wes
9:11 PM
@DaveRandom whats ranges
 
the way that resumable downloads work
Unless the server sends Accept-Ranges: bytes in the initial response then the client won't let you attempt tome
when the client resumes, it's supposed to send Range: bytes=123456- (where 123456 is how many bytes it has already stored)
so the server knows which data to send back
iirc recent versions of mod_sendfile and the xsendfile nginx module deal with that for you though
@DaveRandom "attempt to resume"
 
evenin
 
Wes
9:27 PM
oh i see. tyvm for that, didn't know about it
 
10:18 PM
I need cat deterrent for my mousepad -_-
 
How can I access to a variable define in an external file in class
 
There is this very famous and very old restaurant in the more ancient part of my town, today I went there for the first time, I arrived there and saw that there were literally over 10 different restaurants with that exact same name, even the same font was used.
Then I just randomly picked one and went there.
 
franchise maybe?
 
Food was still amazing though.
 
@th3g3ntl3man fopen?
 
10:21 PM
@Tiffany No, all competitors and copycats.
 
Hello, hope everyone is having a pleasant weekend.
 
@mega6382 sad
@LeviMorrison hope yours is going well too :)
 
It's been great so far :)
 
\o/
 
Wes
how do you write "you are all wrong" kind of blog posts without being attacked by fanboys
 
10:27 PM
I have been having a weird weekend, the light at my house was out all day, some fault with the wiring. So, I spent the whole outdoors, while they fixed it, I wen't to all the places in my town that I had never been to before. And then I went to watch the new Jurassic World movie at imax, even though I hate dinosaur movies.
 
Wes
last time i wrote "what i dislike about php" and i got lectured by 15yo people that advised i should follow SOLID principles instead
i am not sure if people really is naturally patronizing or if i sound like an absolute noob
given my english it could be
 
@Wes I think you should write it like "all y'all bitches are wrong!!" :P
 
Wes
i also wrote "don't give up on flexbox"
an imbecile answered that i am "telling bad practices and i should be using grids"
like, he completely ignored what i have written in the article and derailed the conversation in the comments
at the point that the article was of no use, so i deleted it
that is partly because i didn't finish writing about traits @mega6382
 
You see, you should have done that first, I have been waiting for that for a long time now.
:P
 
Wes
the most successful articles are those that confirm people's point of view on something "a shot of reassurance"
 
10:36 PM
@Wes Then just write in the title "Laravel is the best thing that ever happened" and leave the body empty, it will be hugely successful, :B
 
Wes
laravel tweets are so funny
look i can sum two numbers with laravel!
827 retweets 23872 likes
 
its literally ridiculous..
 
Wes
they totally have an army of bots
which attracted the stupid people
or rather, the noobs
 
@Wes People somewhat disagree with this, especially @Gordon, but I think the laravel community is exactly like that part of the wordpress's community, who believe that you can do anything with it, that you don't need to learn the underlying technologies, that you don't need to understand difference between good and bad practices etc
 
<h2 onClick="alert('hi');"> </h2>

how to remove this event using javascript ?
may be the html is large and have other events
i want to remove all events
 
Wes
10:51 PM
h2.onclick = null;
you cannot
 
51
Q: Javascript/DOM: How to remove all events of a DOM object?

Florian MüllerJust question: Is there any way to completely remove all events of an object, e.g. a div? EDIT: I'm adding per div.addEventListener('click',eventReturner(),false); an event. function eventReturner() { return function() { dosomething(); }; } EDIT2: I found a way, which is worki...

i tried this solution but doesn't work
 
@Bassem That is essentially cloning the element without the events and then removing the original
 
so why it doesn't work with <h2 onClick="alert('hi');"> </h2>
 
you can do something like this with jquery though $("h2").attr('onclick', "");
 
i have unknown HTML , i need to remove all events from it like <h2 onClick="alert('hi');"> </h2>
 
11:02 PM
I don't know but try $(document).find("*").off();
 
11:35 PM
@DaveRandom eewww
@DaveRandom If all else fails, you can extend the class and overload every single method with thin shims calling into your own instance of SoapClient
That's not nice, but it'll work...
 

« first day (2807 days earlier)      last day (2145 days later) »