4 words poetry challenge
Four words, no exceptions.
Four words, no exceptions.
In an effort to make these weekly, I present a new programming challenge.
The challenge this week is to compress some text using a prefix code. Prefix codes associate each letter with a given bit string, such that no encoded bitstring is the prefix of any other. These bit strings are then concatenated into one long integer which is separated into bytes for ease of reading. These bytes can be represented as hex values as well. The provided prefix encoding is as follows:
| char | value | char | value |
|---|---|---|---|
| ' ' | 11 | 'e' | 101 |
| 't' | 1001 | 'o' | 10001 |
| 'n' | 10000 | 'a' | 011 |
| 's' | 0101 | 'i' | 01001 |
| 'r' | 01000 | 'h' | 0011 |
| 'd' | 00101 | 'l' | 001001 |
| '~' | 001000 | 'u' | 00011 |
| 'c' | 000101 | 'f' | 000100 |
| 'm' | 000011 | 'p' | 0000101 |
| 'g' | 0000100 | 'w' | 0000011 |
| 'b' | 0000010 | 'y' | 0000001 |
| 'v' | 00000001 | 'j' | 000000001 |
| 'k' | 0000000001 | 'x' | 00000000001 |
| 'q' | 000000000001 | 'z' | 000000000000 |
Your program should accept a lowercase string (including the ~ character), and should output the formatted compressed bit string in binary and hex. Your final byte should be 0 padded so that it has 8 bits as required. For your convenience, here is the above table in a text file for easy read-in.
Here is an example:
$> tildes ~comp
10010100 10010010 01011010 10111001 00000010 11000100 00110000 10100000
94 92 5A B9 02 C4 30 A0
Previous Challenges (I am aware of prior existing ones, but it is hard to collect them as they were irregular. Thus I list last week's challenge as 'Week 1')
Week 1
Is it self-inflating to label one's own work as graphic? (It is kinda graphic, clickbait title aside.)
This doesn't even really capture the right imagery I was trying to go for.
Might just have to re-write this idea into a completely different piece, I'm not sure. (mfw literally "felt creative idk might delete later")
The "ball" was supposed to really be a watermelon, because we've all seen that YouTube video where they explode a watermelon with rubber bands, but I didn't leave myself enough space to develop that transition from ball to melon properly. (Brand new sentence?)
Why am I even posting this if I feel its unfinished?
Who knows.
Anyway let's get to the thing here it is vvvvvvvvv
slip.
twist.
smack.
10 rubber bands on a ball
all hold each other taut
the inception of a toy
that will quick be left for naught
but brings a momentary joy - its only cause.
.
work.
stoa.
sweat.
hustle on, man, that's your call
you gotta love your boss.
it's the struggle of a boy.
that you never would be caught
while feeling tears or overwhelm - lest you be mocked.
.
smack.
stretch.
strain.
100 rubber bands slap
starting slightly straining
its appearances are coy,
the ball slowly rolls to stop.
picked up and bounced against the floor - it doesn't pop.
.
work.
stare.
grind.
expectations are my all.
you dream of taking off -
escape makes you overjoyed
daily grind just puts your off.
your brain it strains against the skull - stressing nonstop.
.
pop
waste
spill
500 rubber bands smack
crushing and constraining
such a carnage to enjoy
they start rolling out the mops.
the ball explodes onto the floor - as if a prop
.
rip
slice
tear.
my fists crash into the walls.
my skin, just rip it off
rip out the bone, leave me void
naked muscle growing moss.
wrap rubber bands around my head until it pops.
Its been a while since we did one of these, which is a shame.
Create a program that takes is an input of the type: "d6 + 3" or "2d20 - 5", and return a valid roll.
The result should display both the actual rolls as well as the final result. The program should accept any valid roll of the type 'xdx'
Bonuses:
As a side note, it would be really cool if weekly programming challenges became a thing
When Edge died, I got worried about loosing competition to the Blink engine and as such, I went exploring other alternatives to realize.. there's not a whole lot, there's blink, gecko and webkit.
So with that, I decided to try epiphany - Gnome's web browser. It uses Webkit which is what Blink was forked from so it's not terribly different in theory but the years apart has made that more apparent. It's fairly elegant in my opinion and it lacks some features, sure.
Anyways, to get to what I wanted to do this week, well, I'd like to challenge you all to use it for a week, mostly for bug hunting purposes and possibly to throw ideas at the project. Worth mentioning, I'm not affiliated with the project, just a user.
So to make sure we're all on the same page, we'll use the development Epiphany flatpak, this way we can be sure that the problem is in the current codebase. So, to install it :
Let's install the gnome-nightly repos as per instructions here :
flatpak remote-add --if-not-exists gnome-nightly https://sdk.gnome.org/gnome-nightly.flatpakrepo
flatpak remote-add --if-not-exists gnome-apps-nightly --from https://sdk.gnome.org/gnome-apps-nightly.flatpakrepo
Then, let's install the development version by doing so :
flatpak install org.gnome.Epiphany.Devel
Then just launch it and have fun with it!
if you run into any bugs, look at the contribution guide here and report the bugs in the repo after checking that the bug is not already present of course!
Whether it's for for school, work, or a hobby, share a project or goal that you are working on and how it's going. If you're trying to accomplish it, it fits here. Writing a book, making a program, perfecting a recipe, beating a challenge in a video game, fitness PRs, etc. - all is welcome.
EDIT: I just realized there's a monthly thread similar to this in ~creative, so I probably won't post like this again. But feel free to keep sharing here! This one I suppose is a bit more open ended.
In Euro Truck Simulator 2 you start off as a driver with no truck or money, take jobs, save up, get your own truck, buy/upgrade garages, buy more trucks and hire a fleet of drivers to work for you. There is little to spend the money on, other than more garages and more trucks, which means means more employees and more money coming in. Once you get a certain amount of employees it becomes so unbalanced that money becomes pointless.
There is a config setting `g_income_factor' that affects how much jobs pay. Set it to 0.5 and all jobs pay half as much as they normally do. There are mods that set it to various values to make it more challenging. The problem with setting it to a low value is that it makes the early game too hard. It can take way too long to buy the first couple trucks and start hiring people.
So my strategy is to change `g_income_factor' as I play. I start out with it as 1 (full income) and every time I buy a new truck I change it. I set it to 0.85^(the number of trucks in my fleet) . That way the more employees I have the less each makes and the less I make from my own driving. It also introduces a trade off to hiring new drivers. Is the new driver going to be worth the reduced income from the rest of my fleet? It reverses the dynamic where in normal play the more employees you have the easier it is to get more to a dynamic where the more you have the harder it becomes to grow.
week five begins with another page worth of links, a big presidential announcement, and the long creep of this cycle that will make us all go fucking crazy by the end of it. the [LONGFORM] tag continues, but i don't think there's any longform this week either, so c'est la vie.
the usual note: common sense should be able to generally dictate what does and does not get posted in this thread. if it's big news or feels like big news, probably make it its own post instead of lobbing it in here. like the other weekly threads, this one is going to try to focus on things that are still discussion worthy, but wouldn't necessarily make good/unique/non-repetitive discussion starters as their own posts.
Week 1 thread • Week 2 thread • Week 3 thread • Week 4 thread
from FiveThirtyEight: What The Potential 2020 Candidates Are Doing And Saying, Vol. 15. if you're curious what candidates have been up to, FiveThirtyEight has you covered with this week's roundup.
from FiveThirtyEight: Who Might Make The Democratic Debate Stage?. this is probably the most important question now that the field is basically set: how many people will qualify for the debate stage? the DNC has said the cap is 20 candidates, and we have at least 21 running with potentially more on the way. a lot of them meet at least one criterion for being included. the DNC seems to have prepared extensively for that possibility, so it's not like they're on the backfoot here, but i suspect the politicking surrounding this for some of the smaller candidates is going to be pretty wacky.
from The Atlantic: The 2020 U.S. Presidential Race: A Cheat Sheet, like CBS News's roundup, this extensive piece covers every candidate currently declared, why they're running, and what they're running on. pretty good resource for those of you needing to cite something.
from The Atlantic: The Strategic Move That Gave Bernie Sanders a Fundraising Edge. despite its title, this article mostly focuses on fundraising and how it's been either lackluster for democrats or not been, depending on who you ask and under what criteria, and whether or not that even matters in the grand scheme of things. it's an interesting discussion.
we begin with two words: HE'S RUNNING. The Atlantic first reported this in a piece on the 19th called Joe Biden Is Running for President, and he was expected to announce yesterday but curiously, something (Biden's team was warned about announcing 2020 bid on same day as forum focused on women of color) seems to have interfered with that master plan that joe biden should have known about, so he announced this morning instead.
here is his announcement video:
and nobody was really surprised. anyways, onto articles covering his announcement. take your pick of source:
moving on to analysis:
from Time: Joe Biden and the Hard Choices for Democrats in 2020. this article mostly focuses on biden as a living example of the wedge between the progressive, youthful faction of the democratic party and the older, more traditionally moderate wing of the party. whether or not he gets selected is probably mostly going to come down to what voters prioritize, since the next biggest frontrunner is sanders who is on the literal opposite side of the spectrum from biden. for an alternative perspective on this angled more with respect to biden and #MeToo, you may refer also to this Vox article: The Joe Biden culture war - There’s a split among Democrats on #MeToo and more. Biden might have picked the losing side..
from The Guardian: Biden brings broad appeal in battle for 2020 – but don't expect a revolution. biden's appeal as a candidate is definitely not going to be for his progressive chops. aside from his... frankly odd ideas and not-ideas of what "progressive" means in the modern discourse (and his identification or lack thereof with the term), it's pretty obvious he's not going to be approaching this race with the intent of radical change. whether that endears him to voters or sinks him also remains to be seen.
from Buzzfeed News: Bernie Sanders Isn’t Fighting The Wars Of 2016, His Campaign Says — The Democratic Establishment Is. in case you haven't noticed, we're still religitating the bullshit that characterized the 2016 primary because nobody can drop it. nowhere is this more clear than with the sanders campaign, who feel like they're still having to defend themselves from the same lines of attack they did back then. whether or not this is accurate is probably debatable, but it's pretty obvious that this isn't going to just go away, so expect it to continue to be a fracture point this year.
from The Guardian: Sanders dares Democrats to stop him – but is he the man to beat Trump?. in a similar vein, the sanders campaign seems to be contending with the prospect of the democratic party trying to meddle in the primary and anoit a non-sanders winner, as they were accused of doing in 2016. this is going to also likely remain a fracture point, because the democratic party no doubt feels it has reasons to step in here--but also, it would absolutely be inviting trouble if sanders is the leading candidate when everything is said and done at the convention and they step in, given 2016.
from Vox: Republican strategist Karl Rove says Bernie Sanders could beat Donald Trump in 2020. whether realpolitik or genuine concern (and in contrast to rick wilson in the above piece), karl rove seems to think that sanders is the exact sort of candidate who would beat donald in 2020.
In a statement about her and Malitz’s departure to BuzzFeed News, Bond said it was “time for us to move on to other challenges.”
“Launching a presidential campaign without a big staff or even a campaign manager was no easy feat and it took everyone pitching in,” she said. “We’re proud to have been part of the team of deeply dedicated staff and volunteers who nearly pulled off a historic upset in the 2018 Texas Senate race and broke records launching Beto’s campaign for the presidency.”
O’Rourke ... sa[id] he preferred interacting with voters “eyeball to eyeball” rather than by doing TV, as evidenced by his dozens of events where he regularly takes questions from the audience and reporters alike. But he acknowledged “at some point, I may have to give in” to doing cable television.
it's a bold strategy for certain, but i do suspect that he's going to have to at some point get his voice out nationally. he's been slightly slipping in recent polls, mostly to candidates like buttigieg, and it suggests that he's lost a bit of his lustre with democratic voters.
from TIME: Elizabeth Warren Calls for House to Start Impeachment Proceeding Against President Trump. warren decided to become the first democratic candidate to stake her claim to this particular idea. as far as i'm aware, nobody has gone out on this limb with her, but i'd be shocked if she isn't eventually joined by someone else.
from NBC News: Warren's plan to wipe out student debt (and how she'd pay for it). another one of warren's seminal policies is wiping out student debt, which NBC News helpfully has a piece on (and of course, how she intends to pay for it since the question is literally inescapable). to save you some trouble: she pays for it with her wealth tax.
from Buzzfeed News: Pete Buttigieg’s Presidential Run Has Many LGBT Democrats Eager For Their Obama Moment. buzzfeed has a piece on the significance of pete buttigieg to LGBT americans and how he's been able to leverage that to tap into a donor network that's usually pretty splintered. it's unclear to me that he's going to be able to parlay that untapped base into success, though, and more recent polling seems to have buttigieg sorta stalling out around 10% with the logjam of other sorta-kinda-frontrunner candidates.
from CBS News: Pete Buttigieg on the presidency as a "moral office". this is mostly a personality piece on buttigieg and both his history in afghanistan and his electoral history, and how that has influenced his current candidacy and what he views as priorities. it's kinda straightforward and the title sorta speaks for itself, so there's not actually that much to be said for it.
Harris said she would mandate universal background checks on anyone selling more than five guns a year, ending a loophole that allows private gun sellers to bypass background checks on 1 in 5 gun sales nationwide, bar people classified as fugitives from buying guns. She would also, her campaign said, close a loophole in federal law that allows perpetrators of domestic violence to keep their guns if they are not married to their partner.
from the Guardian: Joe Biden is the ultimate centrist Democrat. Is that a liability or strength?. this oped mostly focuses on whether or not biden's whole centrism thing is actually good, or whether or not it's just going to end up splitting the party now that biden is in the race. this is a legitimate question, and i'm not sure anybody really knows how it's going to shake out.
from NBC News: Cory Booker wants to be the nicest Democrat running for president. But his own past makes that difficult.. this one, i think i'll just quote directly since the last paragraph kinda summarizes the whole thing:
For voters, Booker's Wall Street ties and his T-Bone stories are part of the same problem: Authenticity. Can you be a liberal Democratic willing to take on billionaires, entrenched corporations and the deregulation unleashed by the Trump Administration after years of cozying up to Wall Street and pharmaceutical donors? Can you address the racial divides in America — not just what's in people's hearts, but the problems of differential education, mass incarceration and inequality of opportunity — if you can't bring yourself to call Trump a racist? And can you be trusted to tell the truth of why you've arrived at your liberal politics if you made up a T-Bone to explain to white people a cartoon version of black intergenerational trauma?
from NBC News: Kamala Harris' candidacy requires a nuanced debate about her record, race and gender. Is the left ready?. this op-ed focuses on the issue of parsing out where harris is being actually held accountable for things she genuinely took a "bad" stance on, and where she's just being held to a standard that nobody would expect of a non-minority, non-female candidate. it's a tough question, of course, and it's also not exactly one you can have with soundbites and hashtags--but that's probably not going to stop people from continuing to do that.
from NBC News: Bernie Sanders' 2020 presidential campaign will face the scrutiny Clinton got in 2016. Here's what voters missed.. this op-ed mostly focuses on the not-exactly-perfect record of voting and policy positions of bernie sanders prior to the 2016 election, and how that will likely come to the forefront this time around since it was barely focused on in 2016 and sanders wasn't running against literally 20 other people.
from NBC News: Elizabeth Warren, Hillary Clinton and the sexist hypocrisy of the 'likability' media narrative. Here we go again.. this op-ed is not necessarily about elizabeth warren in the same way the other op-eds are about candidates--rather, it's more of a piece that uses warren as an example of how the standard of "likability" that tends to be assigned to female candidates is kinda arbitrary and usually bullshit, and how the narrative of warren's candidacy has changed as she's gone from a sort of outsider-looking-in to a near frontrunner.
finally, from NBC News: Elizabeth Warren's ideas blow rival 2020 Democrats away. Her public lands plan is no exception.. this other warren op-ed is more candidate focused, and basically makes the case that warren's plans are super good and that literally no other candidate comes close to having policy like it.
anyways, feel free to as always contribute other interesting articles you stumble across, or comment on some of the ones up there.
It's time for another coding challenge!
This challenge isn't mine, it's this challenge (year 5, season 3, challenge 3) by ČVUT FIKS.
The task is to design a network communication protocol. You're sending large amount of bits over the network. The problem is that network is not perfect and the message sometimes arrives corrupted. Design a network protocol, that will guarantee that the decoded message will be exactly same as the message that was encoded.
MESSAGE => (encoding) => message corrupted => (decoding) => MESSAGE
Transmitting the message might corrupt it and introduce errors. Each error in a message (there might be more than one error in a single message) will flip all following bits of the message.
Example:
011101 => 011|010
(| is place where an error occured).
There might be more than one error in a message, but there are some rules:
Minimum distance between two errors in a single message is k
Number of bits between two errors is always odd number
According to these rules, describe a communication protocol, that will encode a message, and later decode message with errors.
Guarantee your protocol will work always - even when errors are as common as possible
Try to make the protocol as short as possible.
week three brings a deluge of essays and pieces long enough that i'm going to break this week down by the candidate. news today is sorted by candidate, while opinion will remain unsorted for now since there's not much going on there worth talking about. i've also, for clarity's sake, added a [LONGFORM] note to the longer pieces in this slate for those of you on a time crunch.
the usual note: common sense should be able to generally dictate what does and does not get posted in this thread. if it's big news or feels like big news, probably make it its own post instead of lobbing it in here. like the other weekly threads, this one is going to try to focus on things that are still discussion worthy, but wouldn't necessarily make good/unique/non-repetitive discussion starters as their own posts.
from the Huffington Post: Bernie Sanders Says Felons Should Be Able To Vote While In Prison. bernie sanders called for the end of felony disenfranchisement over the week, which is a thing that almost all states do currently in some form. iowa in particular has possibly the most severe such law, something that the republican governor kim reynolds has been (unsuccessfully) trying to change, making it a fairly large issue there. this currently is not a litmus test for the Democratic Party, but don't expect it to go away, because the ACLU is pushing for candidates to adopt it as a plank.
from Jacobin: Votes For All. for a leftist take on the above, Jacobin has you covered. this article mostly focuses on the historical push by socialist and socialist-adjacent movements in america to do away with felony disenfranchisement and achieve universal suffrage, and sanders in that broader context.
from Slate: The Favorite: Can Bernie Sanders finally start acting like the one thing he’s never been?. slate mostly focuses on sanders's curious status as a genuine goliath in this race here, in contrast to the underdog status which has characterized basically the entirety of his political career previously. in many respects, this is unprecedented territory for sanders, and it is a genuine question whether he'll be able to adapt to that fact (or if he'll need to at all).
from TIME: Sen. Bernie Sanders Unveils New 'Medicare for All' Plan With Support From Some 2020 Rivals. policy wise, sanders unveiled his idea of what medicare for all looks like. this appears to have the support of gillibrand, warren, booker, and harris, who signed on to it (although they've also signed on to less things like a public option), so at least for now, you could probably say it's the leading healthcare reform option on the table.
from CBS News and TIME: Buttigieg challenges Pence on LGBTQ rights: "Your quarrel is with my creator"; Pete Buttigieg Criticizes Vice President Pence in Speech About LGBTQ Rights: 'Your Quarrel, Sir, Is With My Creator'. buttigieg is the first person i'm aware of to take shots at either of trump or pence besides sanders, who has led with it the whole of his campaign so far. it's not surprising that the inflection point here is LGBT rights--buttigieg is gay, obviously--but for a presidential campaign, this is fairly unprecedented.
from NBC News: Pence: Buttigieg is attacking my faith to stand out in 2020 crowd. pence responded to buttigieg's remarks this morning by the way and basically called it a political ploy. i suspect this is not the last we will hear of this particular issue between the two.
from Slate: How Astonishing Is Mayor Pete’s Rise?. slate has an article on the meteoric rise of buttigieg--although it does note that it's not all roses for buttigieg, who is still only polling about as well as cory booker and amy klobuchar despite basically becoming a media golden boy in the past few weeks. still, buttigieg is doing an order of magnitude better than you'd expect of someone whose mayorship presided over a city of a little over 100,000 people. (compare this guardian article which i highlighted in the last thread).
from Buzzfeed News: [LONGFORM] What Happened When Pete Buttigieg Tore Down Houses In Black And Latino South Bend. of course, pete also has skeletons which are bound to come out, and his redevelopment plans in south bend probably count as those. officially they were successful, but some people do (understandably) contend that came at the cost of people and essentially led to gentrification in parts of south bend. whether that's a knock on him or just the cost of doing business as mayor of a rust belt city, i leave to you.
from The Atlantic: [LONGFORM] Kamala Harris Takes Her Shot. this is a pretty comprehensive piece on harris, who made a big splash early but is now mostly trying to tread water without losing further ground to bernie and biden or giving up position to warren, buttigieg, or o'rourke. it's humanizing, but it also covers a lot of the criticisms and contradictions of harris's political history, and some of the nagging questions surrounding her political positions as she bids for the white house. if you're curious about or unfamiliar of what some of those criticisms people often launch at her are, this piece is probably for you.
from Buzzfeed News: Kamala Harris Wants Her Teacher Pay Raise Proposal To Bring Young Black Americans To The Profession — And To Her Campaign. as far as policy, harris has been staking her wagon to teachers in the form of pay raises. those of you who pay attention to the news might have heard her bring this up previously, as it's been an early feature of her campaign so far. it'll be interesting to see if other people take up the beat if she finds success with this issue--so far nobody really has, explicitly speaking, which might be because it's gotten relatively little attention.
from TIME: California Rep. Eric Swalwell Announces Candidacy for the 2020 Presidential Race. just in case the race wasn't crowded enough for you, eric swalwell decided to become "significant" candidate number 19 in the clowncar of a race that this is. i have no idea what he's running on or what he's angling himself to be, i'm afraid, but i'm sure CBS has it over at the 2020 contenders page.
from Dissent Magazine: [LONGFORM] Yang Gang Education: If Andrew Yang’s fans are this excited about UBI, imagine how they’ll feel when they learn what socialism can do for them.. this piece is a fairly straightforward critique from the left of andrew yang's UBI proposal and some of the problems that will likely inhibit it from doing what yang wants it to do; however, it's also a general discussion of yang's supporter base and how their support for him is perhaps indicative of receptiveness to more leftist ideas than just UBI.
from NBC News: Warren targets big business with $1 trillion 'profits' tax. warren has remained mostly on the policy beat so far in her campaign, and this is just the latest of the big sweeping policies she's seeking to sell to the american public. in case you've missed out on her other big policies, see her WaPo op-ed on her proposed Corporate Executive Accountability Act, and her Medium post on her proposed farming policy.
from Vox: Kirsten Gillibrand used to have moderate positions on immigration and guns. Voters want to know why she’s changed.. kirsten gillibrand is running a pretty sleepy campaign so far, of which this might be the biggest recent headline. she's repositioned herself a bit in the trump era, and she's currently the senator who votes with him least often according to 538, but previously she's been a more moderate voice in congress. people haven't let that slide, and it does suggest her efforts to sell herself as the "resistance" candidate probably aren't helping her campaign much. maybe things will change, but things aren't looking great for her so far.
from the Huffington Post: Senator Cory Booker Announces He’ll Offer Bill To Study Potential Reparations. cory booker is pushing the reparations litmus test into some form of actual legislative action, signalling that we're probably going to have that become a wedge issue in this primary on top of some of the other stuff. that'll be a fun conversation.
from the Huffington Post: Amy Klobuchar Says She’s Raised More Than $5.2 Million For Her Presidential Campaign. amy klobuchar's fundraising numbers are about where booker was, so behind beto, sanders, harris, and buttigieg. given where she's polling, that's probably about what you'd expect. there will definitely no shortage of money in this primary.
finally, from The Atlantic: Mike Gravel’s Plan to Rock the Democratic Primary. those of you who read the first week of this may remember the Buzzfeed News piece on mike gravel's then newly-launched campaign to make the democratic primary stage. he might not make it, but so far it's not for lack of trying--his campaign has 8,000 donors, and the american left is putting a decent amount of weight behind him so far. i think most of us can at least agree it'd be pretty entertaining to see him on stage, so on some level i do hope he makes it.
from In These Times: The Case for Using Ranked Choice Voting in the 2020 Democratic Presidential Primaries. this article makes the case for the primaries using ranked choice voting which, to be honest, would probably really help when there are literally going to be like sixteen people in iowa next year (especially given the fact that the democratic party has a 15% popular vote threshold for attaining any delegates in a state). this will definitely not happen this year, but maybe we'll see movement in the future toward something like RCV being used.
from The Week: The Democratic Party Is Not Going Nuts. It's Coming to Its Senses.. this piece by The Week puts foward the argument that the lurch to the left by the Democratic Party isn't some sort of weird mirroring of the lurch to the right in the GOP, but rather the Democratic Party realizing that centrism isn't really what people want. whether or not that's an accurate assessment, i'll leave to you.
finally, from The Guardian: Barack Obama is stuck in the past. He represents the old Democratic party. this piece is by bhaskar sunkara, who you may know as one of the figureheads of Jacobin. his case here is mostly that obama's remarks last week about cautioning the party to not become a circular firing squad are motivated more by his desire to continue to hold power within the party than by genuine desire to see the party succeed. again, whether or not that's an accurate assessment, i'll leave to you.
anyways, feel free to as always contribute other interesting articles you stumble across, or comment on some of the ones up there.
edit: some minor grammar stuff
@the_happy_hob: We Did It!!!!! All 5 Soulsborne games back to back, No hits taken. Just in time for Sekiro. #destinyrun @sekirothegame @DarkSoulsGame
Hi, I was originally meaning to write a whole thing about my personal low waste challenges with a new born, but...Yeah the new born part is making it kind of impossible right now.
So, before giving birth, we did get some reusable diapers used. I really wanted to commit to them, but was honestly afraid that they would be too overwhelming. And I had no plan for replacing disposable wipes. I had some little towels, but considering a new born goes through about 8-10 diapers a day and I have used up to three disposable wipes while changing my nephew's diaper - I wasn't sure how feasible reusable wipes were. (I don't have 30 little towels and wasn't planning to run out and buy anything).
Sometime in the last year, the postpartum ward of my local hospital dropped their disposable wipes and now use little orange face towels. And they were surprisingly easy to use. Quick wetting with warm water and they work better than disposable cloths, so you really don't need as many as I previously calculated. Using them in the hospital really encouraged me to use them at home.
I honestly think we've grown really use to a disposable mindset, especially for sanitary items, and find it interesting and a little sad how things like disposable diapers and wipes are the default. Reusable diapers for most people aren't even a consideration. Hope to see more changes like this in the hospital amd elsewhere to remind and encourage us to evaluate out options.
Hi, it's been very long time from last Programming Challenge, and I'd like to revive the tradition.
The point of programming challenge is to create your own solution, and if you're bored, even program it in your favourite programming language. Today's challenge isn't mine. It was created by ČVUT FIKS (year 5, season 2, challenge #4).
You need to transport plans for your quantum computer through Totalitatia. The problem is, that Totalitatia's government would love to have the plans. And they know you're going to transport the computer through the country. You'll receive number N, which denotes number of cities on the map. Then, you'll get M paths, each going from one city to another. Each path has k traffic controls. They're not that much effective, but the less of them you have to pass, the better. Find path from city A to city B, so the maximum number of traffic controls between any two cities is minimal. City A is always the first one (0) and city B is always the last one (N-1).
N
M
A1 B1 K1
A2 B2 K2
...
On the first two lines, you'll get numbers N (number of cities) and M (number of paths). Than, on next M lines, you'll get definition of a path. The definition looks like 1 2 6, where 1 is id of first city and 2 is id of second city (delimited by a space). You can go from city 1 to city 2, or from city 2 to city 1. The third number (6) is number of traffic controls.
Single number, which denotes maximum number of traffic controls encountered on one path.
Hint: This means, that path that goes via roads with numbers of traffic controls 4 4 4 is better than path via roads with numbers of traffic controls 1 5 1. First example would have output 4, the second one would have output 5.
Example:
IN:
4
5
0 1 3
0 2 2
1 2 1
1 3 4
2 3 5
OUT:
4
Solution: The optimal path is either 0 2 1 3 or 0 1 3.
I'd gladly pay a reasonable price for professional packages/support for programs like Emacs/Melpa, Debian, and Xfce. As a user, I empathize with the complaints by developers that are constantly overworked. Even if this doesn't generate enough money to pay for everything, it might be enough to hire someone to handle the issues and communities, something that clearly drains their efforts, especially because programmers tend to prefer technical challenges rather than dealing with people.
I understand that many projects accept donations, but I think providing an actual reward (even if its something minimal, like an updated package instead of having to build it from source) might be a good way to get resources and avoid developer burndown.
First, I apologize if this is inappropriate.
I wouldn't be surprised if some folks here saw my mention of the "Momo Challenge" and roll their eyes, but after my brother asked me about it, I looked it up last night, and found some interesting stuff happening around it. I guess it's going through a second iteration right now, with supposed images of "Momo," a sculpture of a Japanese witch, and a voice saying to do really graphic stuff. The previous iteration was supposedly messaging a number via WhatsApp, and getting challenges, and threats that if you tell your parents (it's supposedly targeting kids), Momo will get you. The Guardian has a nice write up about the current issue with a picture, you have been warned if you scare easily. Now, she'll tell you to do stuff in a manipulated video. There's even themomochallenge.tk (also spooky if you're sensitive to uncanny sort of stuff like I am), which seems to exist as a way to fluff the story, and asks for what I assume is a requested cryptocurrency transaction (how a kid is going to get crypto to send, I don't know). I may seem like I'm writing something absurd, but this is not in ~creative on purpose, and I feel the propagation of this sort of thing speaks to several problems that may or may not be solvable.
My fascination is with the spread of the idea, and its possible effects. As somebody who occasionally reads the SCP Wiki (not to do with Secure Copy Protocol), I noticed something interesting in the rapid spread of this meme, and am sure sociologists would describe it differently. It behaves (insofar as a meme is an entity with a life or intelligence) in a way SCP would describe as "infohazardous" or "cognitohazardous." They don't mean the same thing: The information is a hazard (infohazard) because you know have this bomb sitting in your lap. You can warn people, but they may go out, see the supposed deaths, and believe it, or you can get a chain of people warning others. In either case, you pass the ball. The meme grows.
It is cognitohazardous for the reason that this hoax, by design, preys on fear. Just typing this, the face is burned into my vision (again, I'm sensitive), I'm home alone, and becoming rather shaky as I jump to look behind me at random noises. The chosen image of the sculpture was selected for this reason, it is deeply unsettling, shakes your rational mind, and you're potentially induced into believing it. I have, in a way, fallen victim to this.
The question comes, going back to my SCP reference: How can this be contained? I'm not looking to start a task force, or enlist people's help, but this is obviously not the first time this has happened with things from Satanic rituals and 2016(?)'s Blue Whale. My mom got swept up by the Satanic thing in the 90s, I watched a video about satanic sacrifices before Halloween 1997, I think, that she got from her church, so I have some experience from the other side. My primary concern is not that children are being compelled to kill themselves, but that the ensuing panic moral panic alone can cause psychological trauma and rampant misinformation. Is it possible to convince believers that something like this isn't real before copycat stuff comes out?
Is anyone here taking online courses e.g. Udacity, Coursera, Udemy, etc.? I just finished the Udacity AI Programming in Python course not long ago, and it was with a bit of gnashing of teeth towards the end. :[ The funny thing is, it wasn't (just) because it was technically challenging, but mostly learning-related anxiety and procrastination.
I'm curious about what others in the Tildes community are learning via massive open online courses (MOOCs), and what you think about them.
In a meta-sort of way, I'm building a platform called MindsMatch help other learners finish their online courses faster. We are looking for users to alpha-test if you are interested!
In 1977, Stephen King published a novel about a school shooting called Rage. It is somewhat infamous, as it has been connected to instances of real-life school shootings. King, in response, allowed the story to fall out of print and has never reissued it. The novel has a lot in common with other YA stories and tropes: a disaffected protagonist, meddling/out of touch adults, and newfound social connection with peers. While the main character is undoubtedly disturbed, the novel feels somewhat uncritical (or potentially even supportive) of his actions.
Certainly fiction is a space where authors are free to explore any point of view or theme they wish. The beauty of fiction is that it is limitless and consequence-free. No people are harmed in Rage because there are no people in it. Its characters are merely names and ideas--they are a fiction.
Nevertheless, Rage addresses a real-world phenomenon, and the beauty of fiction is that it doesn't live as a lie. As Ursula K. Le Guin writes,
"In reading a novel, any novel, we have to know perfectly well that the whole thing is nonsense, and then, while reading, believe every word of it. Finally, when we're done with it, we may find - if it's a good novel - that we're a bit different from what we were before we read it, that we have changed a little..."
We like fiction because it resonates with us, exposing us to themes that can affirm, shape, or challenge our mindsets.
With this dichotomy in mind, I'm torn between whether authors should be free to explore anything they wish from the safety of make-believe, or whether they have a social responsibility because their words carry messages and ideas that directly impact lives. I'm not sure what to think, and I can come up with great arguments for both sides. What's your take? What social responsibilities do fiction authors have (if any)?
Hi everyone, it's been 12 days since last programming challenge. So here's another one. The task is to make an algorithm that'll count how long would it take to fill system of lakes with water.
It's raining in the forest. The forest is full of lakes, which are close to each other. Every lake is below the previous one (so 1st lake is higher than 2nd lake, which is higher than 3rd lake). Lakes are empty at the beginning, and they're filling at rate of 1l/h. Once a lake is full, all water that'd normally fall into the lake will flow to the next lake.
For example, you have lakes A, B, and C. Lake A can hold 1 l of water, lake B can hold 3 l of water and lake C can hold 5 l of water. How long would it take to fill all the lakes?
After one hour, the lakes would be: A (1/1), B (1/3), C(1/5). After two hours, the lakes would be: A(1/1), B(3/3), C(2/5) (because this hour, B received 2l/h - 1l/h from the rain and 1l/h from lake A). After three hours, the lakes would be: A(1/1), B(3/3), C(5/5). So the answer is 3. Please note, that the answer can be any rational number. For example if lake C could hold only 4l instead of 5, the answer would be 2.66666....
Hour 0:
\ /
----(A)----
\ /
\ /
\ /
----(B)----
\ /
\ /
\ /
| |
| |
--(C)--
Hour 1:
\============/
----(A)----
\ /
\ /
\============/
----(B)----
\ /
\ /
\ /
| |
|=======|
--(C)--
Hour 2:
==============
\============/ |
----(A)---- |
\================/
\==============/
\============/
----(B)----
\ /
\ /
\ /
|=======|
|=======|
--(C)--
Hour 3:
==============
\============/ |
----(A)---- | ========
\================/ |
\==============/ |
\============/ |
----(B)---- |
\===========/
\=========/
\=======/
|=======|
|=======|
--(C)--
Good luck everyone! Tell me if you need clarification or a hint. I already have a solution, but it sometimes doesn't work, so I'm really interested in seeing yours :-)
I want to give an introduction on several physics topics at a level understandable to laypeople (high school level physics background). Making physics accessible to laypeople is a much discussed topic at universities. It can be very hard to translate the professional terms into a language understandable by people outside the field. So I will take this opportunity to challenge myself to (hopefully) create an understandable introduction to interesting topics in modern physics. To this end, I will take liberties in explaining things, and not always go for full scientific accuracy, while hopefully still getting the core concepts across. If a more in-depth explanation is wanted, please ask in the comments and I will do my best to answer.
Bookmarkable meta post with links to all previous topics
Today's topic is the dual nature of light and matter, the wave-particle duality. It is a central concept in quantum mechanics that - as is tradition - violates common sense. I will first discuss the duality for light and then, in the next post, for matter.
In what terms can we think of light so that its behaviour becomes understandable to us? As waves? Or as particles? There are arguments to be made for both. Let's look at what phenomena we can explain if we treat light as a wave.
Let's start with an analogy. Drop two stones in a pond, imagine what happens to the ripples in the pond when they meet each other. They will interact, when two troughs meet they amplify each other, forming a deeper trough. When two crests meet they do the same. When a crest and a trough meet they cancel out.
Now if we shine light through two small openings and observe the resulting pattern, we see it's just like ripples in a pond, forming an interference pattern. When looking at the pattern formed on a screen placed at some distance from the openings, we see a striped pattern Light can be described as an electromagnetic wave, with crests and troughs. It sure seems like light is wavey! The wave nature of light allows us to describe phenomena like refraction and diffraction.
When we shine light on some metals, they will start tossing out electrons. This is called the photoelectric effect. How can we understand this process? Well we know light is a wave, so we imagine that the wave crashes into the electron that is chilling out near the surface of the metal. Once the electron has absorbed enough of the light's energy it will be able to overcome the attractive forces between itself and the positively charged atom core (remember, an electron has negative charge and so is attracted to the atom cores). So a higher intensity of light should make the electron absorb the required amount of energy more quickly. Easy, done!
However, there's something very peculiar going on with the photoelectric effect. If we shine low frequency light on said metal, no matter how intense the light, not a single electron will emerge. Meanwhile if we shine very little high frequency light on the metal, no matter how low the intensity, the electron will emerge. But how can this be? A higher intensity of light should mean the electron is receiving more energy. Why does frequency enter into this?
It seems that the electron needs a single solid punch in order to escape the metal. In other words, it seems it needs to be hit by something like a microscopic billiard ball that will punch it out of the metal in one go. The way physicists understand this is by saying light is made up out of particles called photons, and that the energy a photon carries is linked to its frequency. So, now we can understand the photoelectric effect! When the frequency is high enough, the photons in the light beam all individually carry enough energy to convince an electron to leave the metal. When the frequency is too low, none of the photons individually can knock an electron out of the metal. So even if we fire a single photon, with high enough frequency, at the metal we will see one electron emerging. If we shine low frequency light with a super high intensity at the metal, not a single photon will emerge.
So there you have it! Light is made out of particles. Wait, what? You just told us it's made out of electromagnetic waves!
So, maybe light is just particles and the wave are some sort of emerging behaviour? This was a popular idea, one that Einstein held for some time. Remember the experiment where we shone light through two small openings and saw interference (commonly known as the double slit experiment)? Let's just take a single photon and shoot it at the openings! Because light is particles we'll see the photon just goes through either opening - like a particle would. Then all the non-believers will have to admit light is made out of particles! However, when we do the experiment we see the photon interfere with itself, like it was a wave. Remember this picture which we said was due to wave interference of light? When a single photon goes through the openings, it will land somewhere on the screen, but it can only ever land in an area where the light waves wouldn't cancel out. If we shoot a bunch of photons through the openings one at a time, we will see that the photons create the same pattern as the one we said is due to wave interference!
So it would seem light acts like a particle in some cases, but it acts like a wave in some others. Let's take a step back and question these results. Why are we trying to fit light into either description? Just because it's convenient for us to think about things like waves and particles - we understand them intuitively. But really, there is no reason nature needs to behave in ways we find easy to understand. Why can't a photon be a bit wavey and a bit particley at the same time? Is it really that weird, or is it just our intuition being confused by this world we have no intuitive experience with? I would love to hear your opinions in the comments!
To add one final helping of crazy to this story; if we measure the photon's location right after it emerges from the slit we find that it doesn't interfere with itself and that it just went through a single slit. This links back to my previous post where I described superpositions in quantum mechanics. By observing the photon at the slits, we collapsed its superposition and it will behave as if it's really located at one spot, instead of being somehow spread out like a wave and interacting with itself. The self interaction is a result of its wavefunction interacting with itself, a concept that I will explain in the next post.
We learned that light cannot be described fully by treating it simply as a wave or simply as a bunch of particles. It seems to be a bit of both - but neither - at the same time. This forces us to abandon our intuition and accept that the quantum world is just fundamentally different from our every day life.
Next time we will talk about the dual nature of matter and try to unify the wave and particle descriptions through a concept known as the wavefunction.
As usual, please let me know where I missed the mark. Also let me know if things are not clear to you, I will try to explain further in the comments!
The photoelectric effect is actually what gave Einstein his Nobel prize! Although he is famous for his work on relativity theory he was very influential in the development of quantum mechanics too.
I've posted a few lengthy topics here outside of programming challenges, and I've noticed that the ones that seem to have spurred the most interest and generated some discussion were ones that were directly related to code quality. To avoid falling for confirmation bias, though, I thought I would ask directly.
Is there generally a greater interest in code quality discussions? If so, then what kind of things are you interested in seeing in those discussions? What do you prefer not to see? If not, then what kinds of programming-related discussions would you prefer to see more of? What about non-programming discussions?
Also, is there any interest in an informal series of topics much like the programming challenges or the a layperson's introduction to... series (i.e. decentralized and available for anyone to participate whenever)? Personally, I'd be interested in seeing more on the subject from others!
Hi there. It seems that minimalist and zero waste movements have picked up some steam recently in many first world countries as a reaction to the consumerist, greed-based lifestyles promoted and upon realisation of our impact on the world. As an aspiring zero waste minimalist and general conversationalist, I am interested in your opinions, so I'll bombard you with some questions.
Do any of you lead a minimalist or zero waste life, or are you aspiring to or making the transition right now?
What is your opinion of the movements?
Are you opposed to the lifestyles?
Why are you/do you want to be minimalist or create zero waste?
What is minimalism to you?
Are you a minimalist in some or all parts of your life?
What challenges did you run into when making the changes, and how did you overcome them?
Is there anything you recommend to those who are still just aspiring?
Does minimalism imply frugality?
Do you have anything else to add?
Following on from the Tildes 0.5 year survey in which 72% of users stated they used an Android device, and 24% used an iOS device, I thought it'd be fun to ask people in a longform manner to talk about their current phone, and their dislikes & likes about it. What has your upgrade history been like?
I'm currently utilising an iPhone XS (no "Max") in 256GB. This is my first phone upgrade where I've felt like the changes are a step sideways rather than forwards from what I've previously experienced. The minimal bezels are very nice, and once you understand how the iOS experience fits into the overall vision for Apple's phone lineup, the notch becomes an immediately obvious choice—a design compromise for the time being until we can place the sensor array under the display.
Face ID is acceptable. It fails a bit more often than Touch ID ever did, but it fails in different situations, and also works better in others. For a first generation iteration it's acceptable; if it can get more diverse with time and work better in extreme sunlight and at wider angles, it'll become definitively better than a fingerprint scanner.
I talked a bit about the OLED display in the XS in this comment here, where I can distinguish the pentile crosshatching pattern, and again, I feel that the OLED is a case of better in some situations, worse in others. The inky blacks are fantastic, but the dark ghosting is a compromise I'm less happy with. Apple's IPS LCD panels are so good, they had a high bar to meet here.
The camera is again truly fantastic; not enough to ever make me consider selling my Sony mirrorless, but the computational photography aspects makes taking challenging photos more of a breeze than ever before.
Finally, after living with a plus-sized phone for the past 4 years, a step back to a smaller form factor with a similar sized screen is a breath of fresh air—I can finally tie my shoelaces up with my phone in my jean pockets again.
The watch & AirPods & continuity integrations will keep me happy in the Apple ecosystem for a while yet, but I'd need to see a very compelling new feature of aspect to a future phone to upgrade in the next 2 years at this point. Phones are lasting longer than ever before, as they should, and Apple knows this.
iPhone 7 Plus, Jet Black 256GB. The Jet Black finish coupled with the weightier frame & thicker body definitely resulted in this feeling like the most polished iPhone 6-style design to date. Runner up for my favourite phone. Further more the P3-gamut display significantly improved image quality. I wasn't happy enough with the iPhone X to consider an upgrade.
iPhone 6 Plus, Silver 128GB. Might be my least favourite phone of all time? Too thin, slippery, suffered from bendgate; and had display issues which gave it a bad rap. Touch ID was cool; however.
iPhone 4, Black. Might be my favourite phone of all time, purely from a design standpoint? Utilising the steel frame around the edge of the phone as an antenna was completely unheard of back then and truly a fantastic design innovation. The sandwiched glass profile was both a fingerprint magnet and truly gorgeous; and the Retina display was breathtaking. I'd love to see a return to this design profile.
iPhone 3G. My first phone. I distinctly remember jailbreaking this device to change the cellular provider name in the top left corner & enable some extremely low quality video recording; this was also the good old days of fantastic games like Tap Tap Revenge.
How about you?
I'm rather sleepy, generally very reserved when it comes to sharing my work, and not a native user of English, but I have a couple poems in English, and I though I'd share one here and see what the folks think of it. I love the challenge of writing stuff in languages other than my native tongue.
a bird with no wings
a song no one sings
a sorrow when time brings
nil.
ex nihilo nihil fit
et words have no wit
mouth knows only to spit
nil.
time is scarse and gods wobble
in vain hurry naive men hobble
ignoring they will only nobble
nil.
I want to give an introduction on several physics topics at a level understandable to laypeople (high school level physics background). Making physics accessible to laypeople is a much discussed topic at universities. It can be very hard to translate the professional terms into a language understandable by people outside the field. So I will take this opportunity to challenge myself to (hopefully) create an understandable introduction to interesting topics in modern physics. To this end, I will take liberties in explaining things, and not always go for full scientific accuracy, while hopefully still getting the core concepts across. If a more in-depth explanation is wanted, please ask in the comments and I will do my best to answer.
Bookmarkable meta post with links to all previous topics
Today's topic will be light emitting diodes, better known as LEDs. As the name suggests, we'll have to discuss light and diodes. We will find out why LEDs can only emit a single colour and why they don't get hot like other sources of light. Let's start by discussing diodes, in case you are already familiar with diodes note that I will limit the discussion to semiconductor (p-n with a direct bandgap) diodes as that's the type that's used in LEDs.
A diode is an electronic component that, ideally, only lets electric current through in one direction. In other words it's a good resistor when the current flows in one direction and a really good conductor when the current flows in the other direction. Let's look a bit closer at how diodes function.
Diodes are made out of two different semiconducting materials. In everyday life we tend to classify materials as either conducting (metals being the prime example) or non-conducting (wood, plastics, rubber). Conductance is the flow of electrons through a material, a conducting material has a lot of electrons that can move freely through a material while an insulator has none. Semiconducting materials fall in between these two categories. They do conduct but not a lot, so in other words they have a few electrons that can move freely.
We are able to change a semiconductor's conductivity by adding tiny amounts of other materials, this is called doping. As an example, we can take silicon (the stuff that the device you're reading this on is made out of) which is the most well-known semiconductor. Pure silicon will form a crystal structure where each silicon atom has 4 neighbours, and each atom will share 1 electron with each neighbour. Now we add a little bit of a material that can share 5 electrons with its neighbours (how generous!). What will happen? Four of its shareable electrons are busy being shared with neighbours and won't leave the vicinity of the atom, but the fifth can't be shared and is now free to move around the material! So this means we added more freely flowing electron and that the conductivity of the semiconductor increases. An illustration of this process is provided here, Si is chemistry-talk for silicon and P is chemistry-talk for phosphorus, a material with 5 shareable electrons. This kind of doping is called n-type doping because we added more electrons, which have a negative charge, that can freely move.
We can do the same thing by adding a material that's a bit stingy and is only willing to share 3 electrons, for example boron. Think for a moment what will happen in this case. One of the silicon atoms neighbouring a boron atom will want to share an electron, but the boron atom is already sharing all of its atoms. This attracts other electrons that are nearby, one of them will move in to allow the boron atom to share a fourth electron. However, this will create the same problem elsewhere in our material. Which will also get compensated, but this just creates the same problem once more in yet another location. So what we now have is a hole, a place where an electron should be but isn't, that is moving around the crystal. So in effect we created a freely moving positive charged hole. We call this type of doping p-type. Here's an illustration with B the boron atoms.
So what would happen if we took a n-type semiconductor and a p-type semiconductor and pushed them against one another? Suddenly the extra free-flowing electrons of the n-type semiconductor have a purpose; to fill the holes in the p-type. So these electrons rush over and fill the holes nearest to the junction between the two semiconductors. However, as they do this a charge imbalance is created. Suddenly the region of p-type semiconductor that is near the junction has an abundance of electrons relative to the positive charges of the atom cores. A net negative charge is created in the p-type semiconductor. Similarly, the swift exit of the electrons from the n-type semiconductor means the charge of the cores there isn't compensated, so the region of the n-type semiconductor near the junction is now positively charged. This creates a barrier, the remaining free electrons of the n-type cannot reach the far-away holes of the p-type because they have to get through the big net negative charge of the p-type near the junction. Illustration here. We have now created a diode!
Think for a moment what will happen if we send current* (which is just a bunch of electrons moving) from the p-type towards the n-type. The incoming electrons will face the negative charge barrier of the p-type and be unable to continue. This means there is no current. In other words the diode has a high resistance. Now let's flip things around and send electrons through the other way. Now they will come across the positive charge barrier of the n-type semiconductor and be attracted to the barrier instead. The electrons' negative charge compensates the net positive charge of the barrier on the n-type and it will vanish. This destroys the equilibrium situation of the barrier. The p-type holes are no longer repelled by the positive barrier of the n-type (as it no longer exists) and move closer to the junction, this means the entire barrier will fade and current can move through. We now have a conductor.
Now let's find out how we can create light using this method. When current is applied to a diode what happens is that one side of the diode is at a higher energy than the other side. This is what motivates the electrons to move, they want to go from high energy to low energy. If the p-type semiconductor is at a higher energy than the n-type the electron will, upon crossing the junction between the two types, go from a high energy level to a lower one. This difference in energy must be compensated because (as @ducks mentioned in his thermodynamics post) energy cannot be destroyed. So where does the energy go? It gets turned into light!
The energy difference between the p-type and n-type is fixed, meaning a fixed amount of energy is released each time an electron crosses the junction. This means the light is of a single colour (colour is how we perceive the wavelength of light, which is determined by the energy of the light wave). Furthermore, none of the energy is lost so there is no energy being turned into heat, in other words the LED does not get warm.
So now we know why the LED is so power-efficient; it does not turn any energy into heat, it all goes into light. We now also know why they only emit a single colour, because the energy released when an electron crosses the junction is fixed.
I think next time I will try to tackle the concept of wave functions in quantum mechanics.
As usual, please let me know where I missed the mark. Also let me know if things are not clear to you, I will try to explain further in the comments!
*) Yes, current flow is defined to be opposite to the flow of the electrons, but I don't want to confuse readers with annoying definitions.
The programming challenges have kind of come to a grinding halt recently. I think it's time to get another challenge started!
Given a grid of symbols, representing a simple binary state of "filled" or "unfilled", determine whether or not a square is present on the grid. Squares must be 2x2 in size or larger, must be completely solid (i.e. all symbols in the NxN space are "filled"), and must not be directly adjacent to any other filled spaces.
Example, where 0 is "empty" and 1 is "filled":
000000
011100
011100
011100
000010
// Returns true.
000000
011100
011100
011110
000000
// Returns false.
000000
011100
010100
011100
000000
// Returns false.
For those who want a greater challenge, try any of the following:
I want to give an introduction on several physics topics at a level understandable to laypeople (high school level physics background). Making physics accessible to laypeople is a much discussed topic at universities. It can be very hard to translate the professional terms into a language understandable by people outside the field. So I will take this opportunity to challenge myself to (hopefully) create an understandable introduction to interesting topics in modern physics. To this end, I will take liberties in explaining things, and not always go for full scientific accuracy, while hopefully still getting the core concepts across. If a more in-depth explanation is wanted, please ask in the comments and I will do my best to answer.
Spintronics
Quantum Oscillations
Quantisation and spin, part 1
Today's topic will be a continuation of the topics discussed in my last post. So if you haven't, please read part 1 first (see link above). We will be sending particles through two Stern-Gerlach apparatuses and then we'll put the particles through three of them. We will discuss our observations and draw some very interesting conclusions from it on the quantum nature of our universe. Not bad for a single experiment that can be performed easily!
We will start simple and rotate the set-up of the last post 90 degrees so that the magnets face left and right instead of up and down. Now let's think for a moment what we expect would happen if we sent silver atoms through this setup. Logically, there should not be in any difference in outcome if we rotate our experiment 90 degrees (neglecting gravity, whose strength is very low compared to the strength of the magnets). This is a core concept of physics, there are no "privileged" frames of reference in which the results would be more correct. So it is reasonable to assume that the atoms would split left and right in the same way they split up and down last time. This is indeed what happens when we perform the experiment. Great!
Let's continue our discussion by chaining two Stern-Gerlach apparatuses together. The first apparatus will be oriented up-down, the second one left-right. We will be sending silver atoms with unknown spin through the first apparatus. As we learned in the previous post, this will cause them to separate into spin-up and spin-down states. Now we take only the spin-up silver atoms and send them into the second apparatus, which is rotated 90 degrees compared to the first one. Let's think for a moment what we expect would happen. It would be reasonable to assume that spin-left and spin-right would both appear 50% of the time, even if the silver atoms all have spin-up too. We don't really have a reason to assume a particle cannot both have spin up and spin right, or spin up and spin left. And indeed, once again we find a 50% split between spin-left and spin-right at the end of our second apparatus. Illustration here.
So it would seem silver atoms have spin up or down as a property, and spin left or spin right as another property. Makes sense to me. To be sure, we take all the silver atoms that went up at the end of the first apparatus and right at the end of the second apparatus and send them through a third apparatus which is oriented up-down (so the same way as the first). Surely, all these atoms are spin-up so they will all come out up top again. We test this and find... a 50-50 split between up and down. Wait, what?
Remember that in the previous post I briefly mentioned that if you take two apparatuses who are both up-down oriented and send only the spin-up atoms through the second one they all come out up top again. So why now suddenly do they decide to split 50-50 again? We have to conclude that being forced to choose spin-left or spin-right causes the atoms to forget if they were spin-up or spin-down.
This result forces us to fundamentally reconsider how we describe the universe. We have to introduce the concepts of superposition and wave function collapse to be able to explain these results.
The way physicists make sense of the kind of behaviour described above is by saying the particles start out in a superposition; before the first experiment they are 50% in the up-state and 50% in the down-state at the same time. We can write this as 50%[spin up]+50%[spin down], and we call this a wave function. Once we send the particles through the first Stern-Gerlach apparatus each one will be forced to choose to exhibit spin-up or spin-down behaviour. At this point they are said to undergo (wave function) collapse; they are now in either the 100%[spin up] or 100%[spin down] state. This is the meaning of observing in quantum mechanics, once we interact with a property of an atom (or any particle, or even a cat) that is in a superposition this superposition is forced to collapse into a single definite state, in this case the property spin is in a superposition and upon observing is forced to collapse to spin up or spin down.
However, once we send our particles through the second apparatus, they are forced to collapse into 100%[spin left] or 100%[spin right]. As we saw above, this somehow also makes them go back into the 50%[spin up]+50%[spin down] state. The particles cannot collapse into both a definite [spin up] or [spin down] state and a definite [spin left] or [spin right] state. Knowing one precludes knowing the other. An illustration can be seen here.
This has far reaching consequences for how knowable our universe it. Even if we can perfectly describe the universe and everything in it, we still cannot know such simple things as whether a silver atom will go left or right in a magnetic field - if we know it would go up or down. It's not just that we aren't good enough at measuring, it's fundamentally unknowable. Our universe is inherently random.
In these two posts we have broken the laws of classical physics and were forced to create a whole new theory to describe how our universe works. We found out our universe is unknowable and inherently random. Even if we could know all the information of the state our universe is in right now, we still would not be able to track perfectly how our universe would evolve, due to the inherent chance that is baked into it.
Well that was quite mind-blowing. Next time I might discuss fermions vs bosons, two types of particles that classify all (normal) matter in the universe and that have wildly different properties. But first @ducks will take over this series for a few posts and talk about classical physics and engineering.
As always, please feel free to ask for clarification and give me feedback on which parts of the post could me made clearer. Feel free to discuss the implications for humanity to exist in a universe that is inherently random and unknowable.
Observant readers might argue that in this particular case we could just as well have described spin as a simple property that will align itself to the magnets. However, we find the same type of behaviour happens with angles other than 90 degrees. Say the second apparatus is at an angle phi to the first apparatus, then the chance of the particles deflecting one way is cos^2(phi/2)[up] and sin^2(phi/2)[down]. So even if there's only a 1 degree difference between the two apparatuses, there's still a chance that the spin will come out 89 degrees rotated rather than 1 degree rotated.
For those that don't know, NaNoWriMo (National Novel Writing Month) is an annual challenge to write a 50,000 word novel over the course of the month of November. That translates to roughly 1,600 words a day. More info on NaNoWriMo here.
I first tried it two years ago though I fizzled out at around 10,000 words and moved on to another WIP. Last year I didn't formally participate though I made an effort to write something every day. Not sure about my word count.
This year I'm doing a series of short stories in a shared setting since I've been doing more short form writing as of late and I've been mulling over the idea for a few weeks now. It's a nice way to experiment with different settings and themes within a "singular" work. I've made some notes on plot hooks, settings, characters, and ideas I wanted to explore, so it's only a matter of writing the stories now. Maybe I'll even share excerpts as I go along.
So has anyone else made plans to do it this year?
I want to give an introduction on several physics topics at a level understandable to laypeople (high school level physics background). Making physics accessible to laypeople is a much discussed topic at universities. It can be very hard to translate the professional terms into a language understandable by people outside the field. So I will take this opportunity to challenge myself to (hopefully) create an understandable introduction to interesting topics in modern physics. To this end, I will take liberties in explaining things, and not always go for full scientific accuracy, while hopefully still getting the core concepts across. If a more in-depth explanation is wanted, please ask in the comments and I will do my best to answer.
Spintronics
Quantum Oscillations
Today's topic will be quantisation, explained through the results of the Stern-Gerlach experiment which was first performed in 1922. This topic treats a much more fundamental concept of quantum physics than my previous topics.
In 1922 physicists Stern and Gerlach set up an experiment where they shot silver atoms through a magnetic field, the results of this experiment gave conclusive support for the concept of quantisation. I will now first explain the experiment and then, using the results, explain what quantisation is. If you would rather watch a video on the experiment, wikipedia provided one here, it can be watched without sound. Note that I will dive a bit deeper into the results than this video does.
The experiment consists of two magnets, put on top of each other with a gap in the middle. The top magnet has its north pole facing the gap, the bottom magnet has its south pole facing the gap. See this illustration. Now we can shoot things through the gap. What do we expect would happen? Let's first shoot through simple bar magnets. Depending on how its poles are oriented, it will either bend downwards, upwards or not at all. If the bar magnet's north pole is facing the top magnet, it will be pushed downwards (because then north is facing north). If the bar magnet's south pole is facing the top magnet, it will instead be pushed upwards. If the bar magnet's poles are at a 90 degree angle to the two magnets it will fly straight through, without bending. Lastly, if the bar magnet's poles are at any other angle, say 45 degrees, it will still bend but less so. If we send through a lot of magnets, all with a random orientation, and measure how much they got deflected at the other side of the set-up we expect to see a line, see 4 in the illustration.
Now we'll send through atoms, Stern and Gerlach chose silver atoms because they were easy to generate back in 1922 and because they have so-called spin, which we will get back to shortly. We send these silver atoms through in the same way we sent through the bar magnets; lots of them and all of them with a random orientation. Now what will happen? As it turns out all the atoms will either end up being deflected all the way up or all the way down, with nothing in between. 50% will be bent upwards, 50% downwards. So silver atoms seem to respond as if they were bar magnets that either bend maximally up or maximally down. In the illustration this is labeled 5.
If we were to take only the silver atoms that bent upwards and sent them through the experiment again, all of them would bend upwards again. They seem to remember if they previously went up or down rather than just deciding on the spot each time if they go up or down. What model can we think of that would explain this behaviour? The silver atoms must have some property that will make them decide to bend up or down. Let's call this property spin, and say that if the silver atoms chose to bend up they have spin up, if they chose to bend down they have spin down. It seems that these are the only two values spin can have, because we see them bend either maximally up or maximally down. So we can say the spin is quantised; it has two discrete values, up or down, and nothing in between.
We have found a property of atoms (and indeed other particles like electrons have spin too) that is quantised. This goes against classical physics where properties are continuous. This shows one of the ways in which physics at the smallest scales is fundamentally different from the physics of everyday life.
Next time we will investigate what happens when we rotate the angle of the magnets used in the experiment. This will lead us to discover other fundamental aspects of physics and nature, quantum superpositions and the inherent randomness of nature.
EDIT: part 2 is now up here.
As discussed in the last post, I am trying something different for this post. Talking about more fundamental quantum physics that was discovered 100 years ago rather than modern physics. Did you like it? Let me know in the comments!
Hello everyone! It has been a while since last programming challenge, it's time for another one!
This week's goal would be to build your own interpreter.
Interpreter is program that receives input and executes it. For example Python is interpreted language, meaning you are actually writing instructions for the interpreter, which does the magic.
Probably the easiest interpereter to write is Brainfuck interpreter. If someone here doesn't know, Brainfuck is programming language, which contains following instructions: ,.<>[]-+. Other characters are ignored. It has memory in form of array of integers. At the start, pointer that points to one specific memory cell points to cell 0. We can use < to move pointer to left (decrement) and > to move pointer to right (increment). . can be used to print value of cell the pointer is currently pointing to (ascii). , can be used to read one character from stdin and write it to memory. [ is beggining of loop and ] is end of loop. Loops can be nested. Loop is terminated when we reach ] character and current value in memory is equal to 0. - can be used to decrement value in memory by 1 and + can be used to increment value in memory by 1. Here's Hello World:
++++++++++[>+++++++>++++++++++>+++>+<<<<
-]>++.>+.+++++++..+++.>++.<<++++++++++++
+++.>.+++.------.--------.>+.>.
People with nothing to do today can attemp to make an interpreter for the Taxi programming language.
You can even make your own language! There are no limits for this challenge.
In an effort to get more content on Tildes, I want to try and give an introduction on several 'hot topics' in condensed matter physics at a level understandable to laypeople (high school level physics background). Making physics accessible to laypeople is a much discussed topic at universities. It can be very hard to translate the professional terms into a language understandable by people outside the field. So I will take this opportunity to challenge myself to (hopefully) create an understandable introduction to interesting topics in modern physics. To this end, I will take liberties in explaining things, and not always go for full scientific accuracy, while hopefully still getting the core concepts across. If a more in-depth explanation is wanted, please ask in the comments and I will do my best to answer.
I had a different topic planned as a second post, however it turned out I had to explain a lot more concepts that I anticipated so that it would no longer fit this format. Then I got busy. Now I finally found a topic I think I can do justice in this format.
Today's topic will be quantum oscillations.
Quantum oscillations are periodic fluctuations in some materials' properties when it is exposed to a strong magnet. As the name suggests, this effect arises from quantum physics. Nevertheless, I think it's relatively easy to give a feel on how it works. In the rest of this post I will focus on one kind of quantum oscillation, the oscillation of a material's resistance (with the very fancy name Shubnikov-de Haas oscillations), because electrical resistance is a concept most people are familiar with. However, there are many other material properties that fluctuate similarly.
Let's start from the basics, electrical resistance. Electrical resistance tells you how hard it is for an electrical current to flow through a material. Related to this is conductance, which instead tells you how easy it is for a current to flow through a material (so it is the inverse of the resistance). Now, something funny happens to some metals' conductance when you expose them to a strong magnet.
Let's think for a moment on what we expect would happen. Would the conductivity be affected by the magnet? Perhaps a stronger magnet would increase the conductivity, or reduce it. What we most certainly wouldn't expect to happen is for the conductivity to go up and down as we increase the strength of the magnet we aimed at the material. Yet, this is exactly what happens. In this picture we see the conductivity (expressed on the vertical axis) plotted against the magnetic field (expressed on the horizontal axis). The conductivity is going up and down like crazy!
One of quantum physics core principle is quantisation (who'd have thought). And as it turns out, this quantisation is at the core of this behaviour. For the purpose of this post, quantisation can be thought of as energies at which the electrons are allowed to have.
Normally, when electrons are in a metal, there are no real restrictions on what energy they are allowed to have. Some electrons will not have a lot of energy and won't move, other electrons will have a lot of energy and be able to move freely around the metal.
However, when metals are put in a strong magnetic field the energies of the low energy electrons are allowed to have changes drastically. The electrons are only allowed to be at certain energies, with a wide gaps in between these energies. Crucially, the exact values of these energies change with the strength of the magnet.
This means that at some magnet strengths, the allowed low-energy energies will nicely line up with the energies the free-flowing electrons have. This means some of those electrons will interfere with the free flowing electrons, making it harder for them to flow freely*. This interference in electron flow means less conductance! Then, when we change the magnetic field so that the energies are no longer aligned, the free flowing electrons no longer get caught and will be able to move freely, so that the conductivity goes up again. This pattern becomes more pronounced as the magnetic field strength increases.
These oscillations were first noticed in bismuth by Shubnikov and de Haas in the year 1930. It was direct evidence for the quantum mechanics underlying nature. These days quantum oscillations are a popular method to extract information on a metals, alloys and semimetals' properties. These techniques have been used to, for example, further our understanding of high temperature superconductivity.
D Shoenberg - Magnetic Oscillations in Metals (1984)
*more technically: the probability of scattering is proportional to the number of states into which the electron can be scattered, which is given by the number of available states near the energy surface of the material.
In most of my programming, I try and remain professional, and do things in a readable, maintainable way, that doesn't involve pushing the language to breaking point.
But, occasionally, I give myself free reign. What if you didn't care about the programmer who came after you? What if you didn't care about what a programmer should do in a certain circumstance?
For myself, over the years I've written and rewritten a C library, I like to call CNoEvil. Here's a little taste of what you could do:
#define EVIL_IO
#define EVIL_COROUTINE
#include "evil.h"
proc(example, int)
static int i = 0;
coroutine();
While 1 then
co_return(++i);
end
co_end();
return i;
end
Main then
displayln(example());
displayln(example());
end
(And yes, that compiles. Without warnings. Even with -Wpedantic.)
So... Here's the challenge:
Ignoring the rules, and best practices... How can you take your favourite programming language... And make it completely unrecogniseable?
(Might be best to choose a language with macros, like Nim, Rust, any of the Lisps. Though, you can still do some impressively awful things in Java or Python, thanks to overloading inbuilt classes.)
Challenge Ideas:
I don’t know how to really explain my fascination with programming, but I’ll try. To somebody who does it, it’s the most interesting thing in the world. It’s a game much more involved than chess, a game where you can make up your own rules and where the end result is whatever you can make of it. - Linus Torvalds
Here’s a problem I had to solve at work this week that I enjoyed solving. I think it’s a good programming challenge that will test if you really grok XML.
Your input is some XML such as this:
<DOC>
<TEXT PARTNO="000">
<TAG ID="3">This</TAG> is <TAG ID="0">some *JUNK* data</TAG> .
</TEXT>
<TEXT PARTNO="001">
*FOO* Sometimes <TAG ID="1">tags in <TAG ID="0">the data</TAG> are nested</TAG> .
</TEXT>
<TEXT PARTNO="002">
In addition to <TAG ID="1">nested tags</TAG> , sometimes there is also <TAG ID="2">junk</TAG> we need to ignore .
</TEXT>
<TEXT PARTNO="003">*BAR*-1
<TAG ID="2">Junk</TAG> is marked by uppercase characters between asterisks and can also optionally be followed by a dash and then one or more digits . *JUNK*-123
</TEXT>
<TEXT PARTNO="004">
Note that <TAG ID="4">*this*</TAG> is just emphasized . It's not <TAG ID="2">junk</TAG> !
</TEXT>
</DOC>
The above XML has so-called in-line textual annotations because the XML <TAG> elements are embedded within the document text itself.
Your goal is to convert the in-line XML annotations to so-called stand-off annotations where the text is separated from the annotations and the annotations refer to the text via slicing into the text as a character array with starting and ending character offsets. While in-line annotations are more human-readable, stand-off annotations are equally machine-readable, and stand-off annotations can be modified without changing the document content itself (the text is immutable).
The challenge, then, is to convert to a stand-off JSON format that includes the plain-text of the document and the XML tag annotations grouped by their tag element IDs. In order to preserve the annotation information from the original XML, you must keep track of each <TAG>’s starting and ending character offset within the plain-text of the document. The plain-text is defined as the character data in the XML document ignoring any junk. We’ll define junk as one or more uppercase ASCII characters [A-Z]+ between two *, and optionally a trailing dash - followed by any number of digits [0-9]+.
Here is the desired JSON output for the above example to test your solution:
{
"data": "\nThis is some data .\n\n\nSometimes tags in the data are nested .\n\n\nIn addition to nested tags , sometimes there is also junk we need to ignore .\n\nJunk is marked by uppercase characters between asterisks and can also optionally be followed by a dash and then one or more digits . \n\nNote that *this* is just emphasized . It's not junk !\n\n",
"entities": [
{
"id": 0,
"mentions": [
{
"start": 9,
"end": 18,
"id": 0,
"text": "some data"
},
{
"start": 41,
"end": 49,
"id": 0,
"text": "the data"
}
]
},
{
"id": 1,
"mentions": [
{
"start": 33,
"end": 60,
"id": 1,
"text": "tags in the data are nested"
},
{
"start": 80,
"end": 91,
"id": 1,
"text": "nested tags"
}
]
},
{
"id": 2,
"mentions": [
{
"start": 118,
"end": 122,
"id": 2,
"text": "junk"
},
{
"start": 144,
"end": 148,
"id": 2,
"text": "Junk"
},
{
"start": 326,
"end": 330,
"id": 2,
"text": "junk"
}
]
},
{
"id": 3,
"mentions": [
{
"start": 1,
"end": 5,
"id": 3,
"text": "This"
}
]
},
{
"id": 4,
"mentions": [
{
"start": 289,
"end": 295,
"id": 4,
"text": "*this*"
}
]
}
]
}
Python 3 solution here.
If you need a hint, see if you can find an event-based XML parser (or if you’re feeling really motivated, write your own).
I grew up playing DOOM, but if I were to boot up the original game I would find it frustrating to play by modern standards (e.g. mouse movement?!). Thankfully, there are a ton of source ports that modernize the engine and make the game more accessible to current gaming sensibilities (e.g. WASD-movement). They're basically community remasters of the game.
It got me wondering about what other games have strongly benefited from tools that exist outside of the game itself.
Examples of what I mean:
It's time for another programming challenge!
Given a list of coordinate pairs on a 2D plane that describe the vertices of a polygon, determine whether the polygon is concave or convex.
Since a polygon could potentially be any shape if we don't specify which vertices connect to which, we'll assume that the coordinates are given in strict order such that adjacent coordinates in the list are connected. Specifically, if we call the list V[1, n] and say that V[i] <-> V[j] means "vertex i and vertex j are connected", then for each arbitrary V[i] we have V[i-1] <-> V[i] <-> V[i+1]. Moreover, since V[1] and V[n] are at the ends of the list, V[1] <-> V[n] holds (i.e. the list "wraps around").
Finally, for simplicity we can assume that all coordinates are unique, that all polygon descriptions generate valid polygons with 3 or more non-overlapping sides, and that, yes, we're working with coordinates that exist in the set of real numbers only. Don't over-complicate it :)
For those who want an even greater challenge, extend this out to work with 3D space!