-
5 votes
-
How Sears was gutted by its own CEO
10 votes -
Breaking all the rules
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...
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:
- Make Python look like C
- Make Java look like Python
- Make anything look like BrainFuck
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
21 votes -
25 Mistakes that Peg You as an Amateur Writer
18 votes -
The pyramid scheme that collapsed a nation
6 votes -
Fireworks Drowned Siren Of Train That Ran Over 60 Celebrating Dussehra
12 votes -
Open offices have driven Panasonic to make horse blinders for humans
9 votes -
About time: why western philosophy can only teach us so much
6 votes -
Jack Stauber – Pumpkin Song (2018)
5 votes -
Looking for opinions on how to moderate a community
Hello. I moderate a reddit sub with about 450 thousand people and we have had trouble with transgender people facing abuse from idiots in two different threads. In one of them, a woman chimed in...
Hello.
I moderate a reddit sub with about 450 thousand people and we have had trouble with transgender people facing abuse from idiots in two different threads. In one of them, a woman chimed in and it got ugly (4 bans in the first 12 comments), in the other a trans woman took part and got shit for it (also featured a few users banned).Now, each of them had a very different approach. The first got defensive and stopped participating, while the second took the time to respond to the stupid but not offensive ones, trying to educate them.
So even if this is something that bothers me a lot and makes considerably angry, I realised that maybe I should take a more nuanced view on this, and I should actually ask for more opinions on how to handle thiS, instead of simply applying my own standards and maybe making things worse and/or missing a chance to make things better. And since Tildes has always provided me with intelligent, thoughtful and interesting points of view and opinions, I thought this would be the best place for this question.
And so here I am, asking anyone that would care to give an opinion: what would a good moderator do? How harsh or lenient should we be with ignorant but not offensive comments? Should we get involved at all if the discussion is not offensive? What would make our sub a nicer place to everyone? Any other thoughts?
Thank you very much to all.
20 votes -
Victory for 'Valve Turners' as Judge Allows 'Necessity Defense' for Climate Trial
9 votes -
Kino - Zarkoj za mnoj dver, ja uhozhu (Close the door, I am leaving) (1988)
6 votes -
Wentworth by-election: Independent candidate Kerryn Phelps claims victory, Government loses majority.
5 votes -
Will lurkers have access to the same privileges active commenters will have?
Or do you have to comment in order to count as an active user?
22 votes -
Coheed and Cambria - Island (Big Beige / 4th St. Demos)
5 votes -
Any resources exploring the gap between beginner and top 5% expert in various tech fields?
I am looking for any resource that could tell me how much knowledge and training is needed to go from a beginner to expert, in let's say application software development for example. Or in...
I am looking for any resource that could tell me how much knowledge and training is needed to go from a beginner to expert, in let's say application software development for example. Or in artificial intelligence.
If there isn't any one source, are there any general type of sources I can use to piece together one mega-source?
14 votes -
What editor do you use?
Hey y'all, first time actually posting something here! Just curious what editor people use, whether its for coding, writing, or just the occasional note, whatever. I've gone through most of the...
Hey y'all, first time actually posting something here! Just curious what editor people use, whether its for coding, writing, or just the occasional note, whatever. I've gone through most of the well-known ones (vim, emacs, atom, vs code for starters), but only ever really messed around with vim enough to like it, and I've also been trying out gedit for the last little while and really liking it, but I'm curious to see what other people use!
33 votes -
The Joy of Haxe
6 votes -
Mexican government officials visit Canada to learn about marijuana legalization
10 votes -
Could the display theme be account bound?
Edit: What I'm asking below is actually already an option, I guess I'm just bad at reading :-/ As of right now, when you choose a theme, a theme cookie is created which takes a simple string value...
Edit: What I'm asking below is actually already an option, I guess I'm just bad at reading :-/
As of right now, when you choose a theme, a
theme
cookie is created which takes a simple string value (white
,light
,dark
orblack
).It's straightforward and it works well, but for someone like me who set his browser to delete cookies at the end of his session, it's a little inconvenient to have to go into my settings to set a theme everytime I log on Tildes.
It's a low-priority request, obviously, but maybe you could consider it? I do understand that it makes sense to have it as a cookie since a user may prefer different themes on different devices.
In the meantime I think I'll just write a script to set my theme to black automatically.
8 votes -
Can Hasan Minhaj make topical comedy work on Netflix?
4 votes -
Raleigh Ritchie - Time in a Tree (2018)
4 votes -
United Nations cautions against unilateral recognition of Jerusalem as Israel's capital
13 votes -
Trust no one: How Le Carré's Little Drummer Girl predicted our dangerous world
5 votes -
How Telltale Games went broke in one week
12 votes -
The impact of gratitude on adolescent materialism and generosity
10 votes -
Not real news: The Associated Press reports on this week's most shared fake news
19 votes -
The suffocation of American democracy
8 votes -
XML Data Munging Problem
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:...
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).
4 votes -
Endless Depth - A Fractal Piece
7 votes -
Knuckle Puck - Double Helix (2017)
5 votes -
What I’ve learnt about parenting a queer teen
9 votes -
Funimation, Crunchyroll end content-sharing partnership
13 votes -
The LibriVox free audiobook collection
12 votes -
Jony Ive on the Apple Watch and Big Tech’s responsibilities
5 votes -
Extreme botany: The precarious science of endangered rare plants
7 votes -
Gorky Park - Bang (1989)
4 votes -
100 Websites That Shaped the Internet as We Know It
9 votes -
What are some current examples of "the emperor's new clothes?"
For those unfamiliar with the story, "The Emperor's New Clothes" is about an emperor who parades around naked, but nobody will point out the obvious for fear of being seen as ignorant....
For those unfamiliar with the story, "The Emperor's New Clothes" is about an emperor who parades around naked, but nobody will point out the obvious for fear of being seen as ignorant. Idiomatically, it refers to something seen as true or widely praised, simply because nobody is willing to speak out against it.
I saw a rant about "blockchains" being the new overhyped hotness for tech companies, and it made me wonder what other "new clothes" are out there right now. What's something you have a strong takedown for that everybody else seems to love/support?
38 votes -
VC folks talk about social media, community, and the failings - includes ex-product head of YouTube
3 votes -
Discord just added a forced-arbitration clause to their Terms of Service (Discord staff response in comments)
39 votes -
The bad behavior of the richest: what I learned from wealth managers
16 votes -
Bomb the Music Industry! - Struggler (2010)
6 votes -
Your Real Biological Clock is You’re Going to Die
9 votes -
Japan's Hometown Tax
10 votes -
Apple CEO Tim Cook is calling for Bloomberg to retract its Chinese spy chip story
13 votes -
US charges Russian with trying to influence 2018 Midterms
7 votes -
What will be left of the people who make our games?
20 votes -
Halfbakery (is back)
13 votes -
Steam developers speak: Maximum profits for Valve, minimum responsibilities
10 votes