« first day (2629 days earlier)      last day (2294 days later) » 

12:00 AM
I know what a C is. I could possibly help depending on what your question is. @BernardoMeurer
 
@PhiNotPi I also know what a C is, it's mostly just about methodology
I need to tokenize a string
using delimiters
So sure, use strsep() (strtok() has been deprecated)
But since the function returns a char **tokens
I first need to go over the original string, figure out how many are there, allocate the first dimension of tokens, then go over it once more setting each element of tokens[k] to be a pointer to the token grabbed by strsep()
Is this correct? i.e. no way to do it in one-pass
 
@BernardoMeurer I'm not much of an expert, but I think you have the choice of either (1) doing two passes in order to use an array (2) do it in one pass by using a linked-list data structure instead.
 
Nah, it's not worth using a linked list for this IMHO
Specially because I need to randomly select items later
which would involve passing thorough the LL anyway
 
12:15 AM
@BernardoMeurer Maybe look into realloc to increase the size of the array by one each loop iteration, as in this SO answer: stackoverflow.com/a/11198630/1122232
 
@PhiNotPi I think multiple realloc() calls will be slower than simply going through the array twice
 
Yeah I agree
Also... I guess I've forgotten a lot of C, probably haven't been of any help.
 
@BernardoMeurer The problem with using two passes is that strsep (like strtok before it) munges the string as it goes along.
 
Oh hey a qualified person.
 
You could count separators first, then use strsep after allocating the appropriate storage.
(Here is a place that strsep is nicer than strtok which didn't return empty fields when two separators occurred side by side which made counting harder.)
 
12:25 AM
This is what I'm talking about when I say that physicists get confused about the difference between variables and functions.
 
@dmckee I guess that's nice, iterating over the string first without strsep(). Cool!
 
Hey Bernardo
Can I get rid of all security protocols that my CPU has
for a few more fps
 
@Phase No, and your CPU is not the bottleneck anyway (for most workloads)
 
They should release PC games as self-contained operating systems for maximum speed.
 
so what i took away from your answer is that I can and that i should
where do I snap the motherboard to get at the security guards inside
 
12:36 AM
@Phase Why would you pick me out of everyone here to troll
I'm always so helpful
 
Like shit you are
Mr "Balarka is 12 and 0celo7 is my brother"
 
@0celo7 is my brother
I don't know why the hell you keep nagging about that
it's the truth
And saying @BalarkaSen is 12 is a well known joke
 
@BernardoMeurer I'm talking to Phase right now
he doesn't believe we're siblings
it's a mental illness of his
 
I don't get it
 
1:13 AM
@BernardoMeurer what?
 
I don't get why he doesn't think we're brothers
 
what on earth does a spin network represent in physics? Does it represent an event between particles, such as a collision, like what a Feymann diagram represents?
 
@dmckee Still around?
 
1:44 AM
@BernardoMeurer Well, I'm back. Does that count?
 
@dmckee Yeah, just want a quick opinion on the resulting function
 
Ah. String processing is full of traps for the unwary and I'm out of practice. But I'll try.
 
/*
 * split_str - Splits a string on delimiters
 * @param str Input string to be split
 * @param delim Delimiter to split at
 * @param dest Destination pointer of tokens
 * @return Number of tokens in dest
 */
size_t split_str(char *str, const char delim, char ***dest) {
    if (str == NULL) return NULL;

    size_t delim_count = 0;
    for (int i = 0; i < strlen(str); i++){
        if (str[i] == delim) {
            ++delim_count;
        }
    }

    char **tokens = calloc(delim_count + 1, sizeof(char*));
@dmckee There ya go, it's a bit weird b/c I haven't done C in a few months
 
Hmmm ... taking '|' as the delimiter should "1|2|\0" have two or three tokens? Your code gives three which is a reasonable answer, but not the only one.
And in principle you should check for a NULL return from strdup.
That's all that I see. And admitedly the NULL return scenario is unlikely on a full service platform. More of a worry in a low-memory embedded context.
 
Nice idea w.r.t. strdup()
I want two tokens on that scenario
I did this b/c I was only getting one token with Bernardo Meurer and ' ' as delim
Let me try again
 
1:56 AM
I think your code will give three in my example. I didn't actually try it.
 
@dmckee Lemme see
 
2:09 AM
@0celo7 do you listen to bones?
 
@ooolb what?
 
dis dude
tbh idek what you listen to anymore
last year your were listening to popular rap but people change
 
2:31 AM
6 hours ago, by dmckee
@Curio In what context do you think the concept of electronegativity can be usefully applied to kaons? Or do you mean potassium?
I will be surprised if subatomic particles have electronegativity
 
 
2 hours later…
4:49 AM
Are there any simple/cheap/easy ways of demonstrating either parity- or charge-symmetry breaking? Obviously the words "simple/cheap/easy" are relative.
I just think it'd make for a really cool physics demonstration.
 
0
Q: Is there a way to tell if someone is sniping me?

Steven HattonI've had questions down-voted for no apparent reason on this site. I am induced to wonder if someone has some axe to grind with me. Or if some person, or persons, simply like to down-vote posts. My education in physics is almost exclusively autodydactic. I rarely talk to anybody about physics...

 
5:32 AM
@JohnRennie I wrote some demo C code just now
That I think will make you proud
also, good morning!
 
Morning :-)
 
Check out 00-name-generator
@JohnRennie @dmckee Thanks for teaching me C!
 
Looking now ..
D:\temp>cl person-generator.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.11.25547 for x86
Copyright (C) Microsoft Corporation. All rights reserved.

person-generator.c
person-generator.c(86): error C2059: syntax error: '}'
person-generator.c(227): warning C4047: 'return': '::size_t' differs in levels of indirection from 'void *'
person-generator.c(236): warning C4047: 'return': '::size_t' differs in levels of indirection from 'void *'
person-generator.c(239): warning C4047: 'return': '::size_t' differs in levels of indirection from 'void *'
Let's have a look at line 86 ...
 
5:52 AM
Works here, hmm
I'm fixing compiler warnings now
 
Different compilers bitch about different things.
MSVC is particularly fussy.
 
@JohnRennie Made a push fixing warnings
And I have a lot of warnings enabled
 
Where do I find strsep? Is it in an external library?
 
set(CMAKE_C_FLAGS "-std=c99 -Wall -Wextra -Wformat-security -Wmissing-include-dirs -Wuninitialized -Wtrampolines -Wlogical-op -Wno-unused-parameter -Werror=delete-non-virtual-dtor -Werror=return-type -Werror=implicit -g")
@JohnRennie The Linux Programmer's manual told me to use it, comes with string.h I think
Since they deprecated strtok()
 
Hmm, there is no strsep in MSVC ...
 
6:00 AM
@JohnRennie It's like that time I used asprintf() which comes from the GNU extensions. The link I sent you has an implementation, just paste it in the code I suppose
 
Also using struct tm xxx = {}; produces an error in MSVC ...
 
Bah
I'll allocate it by hand then
Was trying to avoid that trouble
 
Hmm, it GPFs, presumably because the lists aren't present
 
@JohnRennie Pushed again, replaced the tm's with pointers
see now
You gotta set the working dir accordingly, if you cloned the repo they're in there
in the lists/ folder
 
Hang on, let me create a VS project so I can debug it ...
 
6:14 AM
@JohnRennie Thanks!
 
This is turning into a nightmare :-)
 
O.o
Why??
 
I can't figure out how to make VS create a C app rather than a C++ app so I renamed person_generator.c to person_generator.cpp
But the result is dozens of type conversion errors
 
Lol
Jesus
 
e.g.
 
6:20 AM
How did you use to test my C code?
 
char *SSN = calloc(10, sizeof(char));
Severity Code Description Project File Line Suppression State
Error (active) E0144 a value of type "void *" cannot be used to initialize an entity of type "char *" Person d:\rhs\c\Person\Person\person-generator.cpp 42
 
Bah
::eyerolls::
 
I'd have to go through them all and manually edit in a cast
 
@JohnRennie Nah, don't bother :P
I just wanted to show you the code anyway
Also,by now you should just have a Linux VM :P
 
OK, got it to build and run in the debugger
 
6:27 AM
Woohoo
Wait
Why is main.c not there
 
I give up. For some reason the fopen call is failing and I don't understand why since the txt file is there
 
@JohnRennie Added the correct Cmake & main.c
Ah, lol
Yeah
I have no clue how to set up cwd on windows
 
I think you should probably deal with an fopen failure. At the moment it just crashes.
 
@JohnRennie True, let me change that
@JohnRennie Done, and I know the problem :)
unsigned int random_uint() {
    unsigned int r_uint;
    FILE *f;

    f = fopen("/dev/urandom", "r");
    if(f == NULL) {
        printf("Failed loading random generator device /dev/urandom.");
        exit(EXIT_FAILURE);
    }
    fread(&r_uint, sizeof(r_uint), 1, f);
    fclose(f);

    return r_uint;
}
This will obviously fail on Windows
b/c it's not POSIX compliant
Right?
 
Ah, of course, I should have spotted that!
 
6:41 AM
::puts sunglasses on::
 
Rather than exit you could fall back to using one of the tradition workarounds e.g. use the current time as a seed
I like the code though. It is beautifully laid out.
I've seen so much "write-only" C code over the years :-)
 
@JohnRennie Good idea! I wanted to use urandom to learn how to since it's crypto-safe
What's "write-only" C code?
 
@BernardoMeurer code so badly written that even the author can't figure out what it does
 
Ah, lol
static bool HAS_URANDOM = true; // Global

unsigned int random_uint() {
    unsigned int r_uint;
    FILE *f;

    f = fopen("/dev/urandom", "r");
    if (f == NULL) {
        if (HAS_URANDOM) {
            printf("Failed loading random generator device /dev/urandom. Defaulting to rand().");
            srand(time(NULL));
            HAS_URANDOM = false;
        }
        r_uint = (unsigned int) rand();
    } else {
        fread(&r_uint, sizeof(r_uint), 1, f);
        fclose(f);
    }
    return r_uint;
@JohnRennie How does this look?
Hmm, that does not work as expected
Causes broken output like Email: e-do-od-����u-@hotmail.com
Hmm, I can't trigger it anymore
Heisenbug!
 
7:15 AM
I want to reinstall Linux with nouveau instead of Nvidia
But I'm so lazy
 
Meh. If it works it's good :-)
 
That's the thing, it doesn't
My HDMI out isn't working
b/c it's wired to the Nvidia card
 
There's an update you can install to get that working. Hmm, now ... what's it called ... oh yes, Windows 10 :-)
 
If I need to lose my freedom to get HDMI then I'll stick to VGA!
 
7:35 AM
@BernardoMeurer I wonder if it's worth splitting off the random number seeding into its own file. It might be useful for other projects.
 
7:52 AM
@JohnRennie True, it turned out quite neat :)
Also, got HDMI to work
This feels reaaaaally satisfying
 
@BernardoMeurer changed the driver, or just managed to sort the NVidia driver?
 
Changed the driver to Nouveau with PRIME as opposed to Nvidia with Bumblebee
Bad part is I'm stuck with OpenGL 3
:/
 
morning
Duffield is back in 1.5 months
The end is nigh
5
 
I think we've agreed we shouldn't discuss banned members ...
 
John Duffield is a famous personality, though
Physics author and show guest
Sponsored by Geared 4 Bikes
 
8:03 AM
56 secs ago, by John Rennie
I think we've agreed we shouldn't discuss banned members ...
 
I don't think we actually agreed to that
 
I'm being English here. You need to see the the real meaning behind my relatively mild statements.
6
 
you know the french
always rude
Current state of my basement
Getting flooded by a leak
Well technically the flat's basement
Hopefully i'm not the one paying for that water
 
There are advantages to being only half awake and operating on auto-pilot first thing in the morning. The first three hours picking up the debris from the weekend's server updates have absolutely flown by :-)
 
8:41 AM
what do they mean by weak equality here
is it $$A \sim 0 \to \forall B, [ A, B] = 0$$
 
 
1 hour later…
9:45 AM
2 hours ago, by Slereah
Duffield is back in 1.5 months
2 hours ago, by Slereah
The end is nigh
Now that's a good design
 
10:34 AM
0
Q: Improving the quality of canonical resource request questions

knzhouWe currently have a system where there are a bunch of canonical resource request questions linked here, which theoretically cover all the bases; then theoretically almost all questions can be closed as duplicates of them. The problem is that sometimes the scope of the question or the scope of the...

 
10:53 AM
I think this post is violating some rules, but I can't be sure which one
0
Q: Perturbation of relativistic hydrogen

Noon36Is there anyone that can provide a source for a relativistic hydrogen atom that is placed in a finite potential well? I'm trying to calculate the perturbed ground state using numerical methods.

 
@0celo7 I'm brute forcing this as you mentioned, but I'm starting to think that it may be beneficial to choose an inertial system in which the appropriate derivatives of smooth function $\Omega(x)$ vanish. In this way I just get the answer more easily...
Or is my assumption that this system exists completely false?
 
user228700
11:18 AM
Hello, everyone :-)
 
user228700
@JohnR: Do check hangouts when you get the time!
 
https://physics.stackexchange.com/questions/240636/why-is-entropy-additive
Given the Boltzmann distribution needs the assumption that entropy is extensive (entropy is additive) , such that the third term of Taylor expansion term $\partial ^2 \sigma/\partial U ^2 = 0$, does that mean we *can't* use Boltzmann distribution on system with subsystem that are dependent on each other? (say, ideal gas that gas particles can go anywhere it wants, hence the dividing the system into many "subsystems" is quite useless)
p.s. I mean 1st we limit each particle in a subsystem, then we add the subsystems, and let the particles go anywhere it wants
 
-1
Q: How come when you cover one eye and stare it goes dark?

Mendes550Most of us know that if you're in a dark room and 'stare/unfocus' at the same point everything slowly engulfs into darkness, and any slight moment your vision snaps back into focus. But this is a interesting one and kinda never noticed it maybe you have - it's also got me abit worried to be fair....

biology is biology
 
11:36 AM
1
Q: What is the Clifford/geometric product in terms of the inner and exterior product

SlereahThe geometric product is defined generally as the algebra on the space of multivectors $\bigwedge \Lambda(V)$ $$ab = a \cdot b + a \wedge b$$ with $\cdot$ a product on the vector space $V$ and $\wedge$ the exterior product. But how do those definitions extend to general multivectors? That is, f...

plz halp
 
11:58 AM
"Entropy is only additive in systems without interaction" -- I was reading this comment in the question I posted above, but it doesn't make sense to me. Entropy is not additive even for systems without interaction -- say in ideal gas if we 1st limit each particles in small subsystems, then we let all particles go free. the sum of all entropy in all limiting subsystem will be smaller than the total "free" system.
 
The number of microstates in two systems $W_1$ and $W_2$ is the product of the two
Hence the entropy is $S = k \ln (W_1 W_2) = k (\ln (W_1) + \ln (W_2)) = S_1 + S_2$
 
ohai
 
@Slereah but let's consider two identical particles in two boxes: $\sigma_1 = \log 1$, $\sigma_2 = \log 1$. We add two boxes together and remove the well between the,: $\sigma_{total}=\log 3 > \sigma_1 + \sigma_2 = \log 1$
 
What are the three states here
Also if you're removing walls you might have interactions you're not saying explicitely
 
@Slereah both two in the right box; both two in the left box; and each one box contains one particle'
 
12:09 PM
I think the sum of entropy is only if you consider everything without changing the systems, though
If you consider the system of two box without removing the walls you obtain the correct entropy
 
@Slereah yeah it seems we can't change conditions when we add system together for entropy to be additive.
 
This is fairly easy to see because then the Hilbert space is just the product of the Hilbert spaces
 
statistical physics is hard... I worked the problem-set and get the correct answer, but I often can't convince myself my method is justified. say, I still don't understand when i can use Boltzmann distribution (and it seems turning out not quite trivial: physics.stackexchange.com/questions/253231/…)
 
Do like me and only study systems of 2 particles
it's much easier
or even 1 particles
Or even 0 particles, if you're doing the vacuum
 
ha, okay, thanks for the advice, I will try this for sure :)
 
Anonymous
12:30 PM
@Shing Gibbs paradox deals with that case
 
Hi all
 
Hello John 🦌
 
Does anyone know why the following is true: "The information extracted by two classical measurements, made in sequence, is always
less than or equal to the sum of the information that each would extract if it were the sole
measurement."
By "made in sequence" does this maybe mean 'made simultaneously'?
 
@Blue thanks for telling me, I will check this out
Hi John
 
Sequence means one after the other
 
12:40 PM
@Slereah Okay but does the initial statement make sense to you?
 
I don't remember much information theory
So I dunno
 
1:21 PM
@user55789 that definitely doesn’t exist
Omega is a scalar, you can’t make it’s partial derivatives all zero by a change of coordinates
 
0
Q: A greyed answer

XcoderXI recently came across Solving the problem. Although the user who posted a completely off topic post about cooking, which garnered 6 down-votes in 5 seconds has removed it. However, I noticed that the answer was sort of greyed, and only when my cursor went on it did it become normal. Went back...

 
@JohnRennie ughhhhh
I made a Thai soup and ate too much of it
It's killing me
 
@0celo7 the really hot clear soup?
 
@JohnRennie a green ginger soup
 
That'll learn you :P
 
1:31 PM
it wasn't spicy enough
I must be allergic to something in there because a day later and my throat still feels weird
 
Hmm, what went into it?
 
@PhysicsMeta so I hear @knzhou is going after my position as the king of giving rep away?
good luck
with that
 
In bounties?
 
carrots, cabbage, zucchini, jalapeno, ginger, garlic, honey, cashews, celery, spring onions, cilantro, and vegetable stock
 
Hmm, nothing there looks like an obvious allergen
 
1:35 PM
@EmilioPisanty sadly, I'm still too poor to set 250/500 rep bounties.
 
Actually that looks really tasty :-)
 
@knzhou ::grin::
 
What about the jalapeños?
 
I also baked a chicken breast covered in olive oil and thai red curry and it was pretty darn good
 
don't worry, the bounty-setting opportunities open up considerably at 20k+
 
1:36 PM
Have you ever had chicken with jerk seasoning? (Silly name I know - it's a Jamaican spice)
 
So, question.
 
I do resent that ^%&*%^* @tparker, though
 
If a nuke went off at 1,500 km above the Earth's surface, what would someone down here on Earth see?
 
@JohnRennie Yes
 
Visually?
 
1:37 PM
used to be my given-away rep scored a place on the first page of all-time rep
no longer, though
tparker is hard to keep up with
 
@0celo7 that's probably my favourite way of spicing chicken
 
while also keeping ahead of ACM
 
@FutureHistorian a bright white light presumably ...
 
Oh.
So..........
 
The spectrum would depend on the temperature of the fireball
 
1:38 PM
Is this accurate?
 
@JohnRennie there wouldn't be a fireball
 
It looks plausible ...
 
As in: even from a 1,500 km altitude?
 
the fireball is caused by absorption of x-rays in air
 
@EmilioPisanty the material of the bomb would vapourise and emit BB radiation
 
1:39 PM
NOTE: This is from the Starfish Prime High Altitude Nuclear Test.
 
@JohnRennie yeah, but at a much higher temperature if you don't have the thermal mass of air to heat up
 
And this is Honolulu when the explosion happened at around 23:00 hours local time.
 
is this from the nuclear threat the other day?
 
@EmilioPisanty it would cool pretty quickly though as it expanded
 
@JohnRennie yeah, but I don't think it qualifies for 'fireball' though
 
1:40 PM
@JohnRennie gonna make my patented bell pepper, onion, spinach, and cheese omelette to hopefully fix my stomach
 
@EmilioPisanty when did I use the word fireball?
 
2 mins ago, by John Rennie
The spectrum would depend on the temperature of the fireball
 
sadly I don't have any mushrooms
@EmilioPisanty lmao
 
It's a fair cop :-)
 
::coughs quietly::
::grins::
 
1:42 PM
I just mean ball of hot gases
 
someone give me a password please
@JohnRennie oh we know you like hot balls
 
@JohnRennie yeah, but there's no gases in space
@0celo7 root
 
@EmilioPisanty ::raises eyebrow::
 
All my passwords are obscene and would get me suspended :-)
 
@EmilioPisanty that hurts
 
1:43 PM
square root
 
@0celo7 ok then
r00t
 
@EmilioPisanty there are when the material of the bomb has been vaporised
 
@JohnRennie why am I not surprised
 
@0celo7 it makes them easy to remember
 
@JohnRennie the only problem I have with the recipe is the amount it makes and that the seasoning isn't enough
 
1:44 PM
@JohnRennie yeah, but how much gas is that, and how efficiently can it absorb the energy before it whizzes away in the form of high-energy gamma rays?
I dunno, maybe 'a good bit' and 'quite efficiently', but it's not obvious to me
 
@EmilioPisanty have you looked at the pictures from when the experiment was done?
They show a ball of glowing hot gas.
God preserve me from skeptics
 
@JohnRennie a nuke at 1500km altitude?
 
@0celo7 the root of the square
 
I'm extremely suspicious that that experiment was actually carried out
 
Starfish Prime High Altitude Nuclear Test
Starfish Prime was a July 9, 1962 high-altitude nuclear test conducted by the United States, a joint effort of the Atomic Energy Commission (AEC) and the Defense Atomic Support Agency. It was the largest nuclear test conducted in outer space and one of five conducted by the US in space. A Thor rocket carrying a W49 thermonuclear warhead (manufactured by Los Alamos Scientific Laboratory) and a Mk. 2 reentry vehicle was launched from Johnston Island in the Pacific Ocean, about 1,450 kilometres (900 mi) west-southwest of Hawaii. The explosion took place at an altitude of 250 miles (400 km), above...
And Wikipedia describes it as a fireball so yar boo sucks to you!
 
1:46 PM
So, did I get it right?
Or not?
 
@JohnRennie that's...
surprising
and not in a nice way
they actually did that?
that's ridiculously irresponsible
 
fuck yeah we did
what are you gonna do about it
america, bro
::flexes::
 
Wiki is popsci
 
@JohnRennie though note the actual altitude is 400km, not 1500km
not that it changes much w.r.t. the gas density, though
 
Actually, mostly written by pop-scientists.
 
1:51 PM
Am I a loser for thinking the godfather isn't that great
 
Nah
I didn't like it either
 
I love gangsters though
 
What about scar face?
 
@0celo7. In this case, I am thinking of using such a nuclear device to destroy a hostile extraterrestrial spacecraft.
Or multiple in this case.
Most of them get vapourised and one manages to detonate.
The spacecraft survives, though.
Albeit damaged.
 
that's the plot of Independance Day
 
1:59 PM
Well.......not really.
ID4 does not nuke the spacecraft in orbit.
And that thing was already bombing Earth from space before any ICBMs left the surviving silos.
So............
And besides, Earth fell in four days anyway.
Not like the nukes had any hope of succeeding, as point defence laser batteries blast most of them left and right.
 
Help
Seems like saying that electromagnetism is invariant under $U(1)$ globally but when you make the symmetry local you get $SU(2)$ (???) is a nonlinear realization...?
 
2:38 PM
What
 
page 4 between equation 10 and 11
Some field $\psi$ transforms under $U(1)$ globally, but if you make it local then it transforms under $SU(2)$ nonlinearly, whatever that really means!
Is there an example of this we already know but not in this language, like electromagnetism or something
 
That's a lot of bundles
I'm not sure I have enough caffeine in me to read this
 
The bundles only make it more complicated
page 27 physics.wayne.edu/~ablechman/eft/… has a nice example of non-linear sigma model, why they do what they do is a mystery, but the end result is supposed to be this simple
 
I did do one of my master thesis on the nonlinear sigma model
What do you mean by p. 27
Page of the document or page of the pdf
 
Oh page 21 of the actual doc, pdf page 27
They got the non-linear sigma model from the $SU(n)$ Klein-Gordon action by allowing weird symmetries and doing what you do when going to the VeV in the standard model
 
2:50 PM
I don't see the link with $U(1)$ though
The symmetry is $SU(N)$ because you have $n$ fields
where does $U(1)$ factor in
 
The other pdf gave $SU(2)$ and $U(1)$ as an example and talked about going from local to global symmetries, this newer pdf is taking $SU(N)$ as an example
 
Oh
 
Seems like the general formalism for spontaneously broken symmetries, i.e. translating that dance you do of deriving goldstone bosons into formal mathematical language
What is a Maurer-Cartan form
 
derivative of the left translation operator
why can't the subtitle all of the italian in this movie
only half of it is
 

« first day (2629 days earlier)      last day (2294 days later) »