Simon blogs

Started by Simon, October 18, 2015, 06:05:44 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Simon

#270
Powershell 6.2 added cd -. Alternatively, there is bash for Windows, and Windows git comes with git bash.




youtube-dl got DMCA'd and is not on github.

youtube-dl is a free-and-open-source video-downloading command-line tool. Extremely useful to avoid Google's bloated web player. When I want to watch something, I download the entire video and watch it offline. Only once in a blue moon, when I want to comment on a video, I access a video's actual page.

Bleeping Computer nicely summarizes: The successful use of a DMCA infringement notice to shutdown software that is in itself not a copyright violation is a scary precedent and one that lays the groundwork for misuse in the future.

Attacking a project via DMCA does not require any legal backing. It's enough to be a holder of some intellectual monopolies that somehow feel related. github is not the defendant, but is merely by DMCA forced to comply with the attack. It's the defendant's (the project's) task to fight an unduly issued DMCA takedown. IANAL.

That's part of the reason why I want no third-party copyrights in Lix, to avoid such DMCA harassment that is hard to fight.

Anyway!
youtube-dl 2020-09-20 Python source
youtube-dl 2020-09-20 Linux binary
youtube-dl 2020-09-20 Windows binary

The problem is that Youtube often changes its protocols or file naming etc., and youtube-dl plays catch-up. Above version 2020-09-20 will probably only remain useful for a few weeks.

Who wants to help me buy a battleship and blockade the Americans with me? Free Pepsi Max Lemon will be served on my ship.

-- Simon

namida

Huh. For some reason, I still have Powershell 5.X; despite regularly running Windows updates. I'm guessing I need to update it manually.

To be fair, I rarely use any kind of command line in Windows for more than a single command, and even that's pretty rare.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Simon

#272
Tomorrow is the final day at work before 2 weeks of vacation. Because of pressure on the team to get stuff done, in 2020, I have never taken off more than a week continuously. Thus the 2 weeks are a luxury chance to get stuff done in several hobbies.

Plans for the holidays:

Sleep schedule. Maintain a super-early sleep schedule. Ideally, I'll be awake from 05:00 through 21:00 local time. No computer past 20:30 local time.

Undo. Finish the undo feature in the Lix editor. It's been in the works since May 2020. Magnificent feature, heavily relying on object-oriented programming that I like so much, I've owed it to myself for years to make undo.

Level contest. Build a level for Level Contest #22, enjoying the finished undo feature. After all, the serious work on undo began after my furious ragequit during level building for an earlier contest. I trashed 20 minutes of unsaved work by accidental tile deletion.

Jazz. Finish and assemble patch over Jazz Jackrabbit 1 v1.3 to submit to GOG that fixes the near-impassable Orbitus 2, fixes broken airboard ditches, and ideally adds v1.0, v1.2, unmodified v1.3. Even though there are several such patches for Orbitus 2 around the internet, the speciality here is that we want to push the patch into GOG's monopoly release of Jazz 1. The years of research across the different versions will be put to good use.

Also stream some speedruns of Jazz 1. Rarely had time for streams throughout the year. I should play through the entire fixed v1.3 anyway, to check that it all works.

Craft. Can't have anybody over for boardgaming yet. But I have a couple box/component improvements on the backburner that need peaceful evenings.



-- Simon

Simon

#273
Two Reasons

...for why it's hard to stop working in mathematics or software.

A Mind Is Born, Youtube video of the audio/video output of a Commodore 64 demo executable, 2 minutes, 2017, by lft.
  • The handwritten executable is 256 bytes long. Bytes! Not kilobytes.
  • The executable generates the song, that song in turn generates the visuals.
  • The song by itself is excellent already, highly mesmerizing in a loop.
The Art of Code, Youtube video of a programming culture talk, 61 minutes, 2020, by Dylan Beattie. Contents:
  • On Conway's Game of Life, the Mandelbrot set, emergent complexity.
  • On quines, including the Oroborous Quine that loops through 128 languages.
  • On esoteric programming languages, with his own esolang Rockstar: "Can you perform a Rockstar program and have people just think it's a bad heavy metal song from the 1980's?"


^ Plot of the Julia set at −0.5 + 0.1 i of the Burning Ship.

-- Simon

Simon

#274
Only squaring and absolute value

The basics of complex dynamics are accessible with a mere few weeks of first-semester math. Or maybe you've seen complex numbers during high school. Complex numbers can be multiplied and have an absolute value. The only thing that's not intuitively clear is that "tends to infinity" for complex numbers means "grows unbounded in absolute value, regardless of any direction".

Let f: ℂ → ℂ be a function. The filled Julia set of f consists of the points z ∈ ℂ whose orbit under under f remains bounded, i.e., the sequence z, f(z), f(f(z)), f(f(f(z))), ..., does not grow to infinity. Show that the filled Julia set of zz² is the closed unit disc { |z| ≤ 1 }.

Show that the filled Julia set of zz² − 2 contains no real number x with |x| > 2, and that it contains every real number x with |x| ≤ 2.
Hint
What happens if an orbit contains a point y with y > 2? You can then write y = 2 + a for some a > 0.

Harder though, probably needs more theory: Show that the filled Julia set of zz² − 2 is precisely the real interval [−2, 2] ⊆ ℂ, i.e. there are no other numbers in it than we had already seen in the previous exercise.
Hint
Probably too hard to get right with only entry-level experience. I didn't get it proven properly on the fly. You'll have to consider arguments (angles) of the numbers as well as distance from 0, and if the argument under iteration becomes close to pure imaginary, you're fine, but it's not clear that this will always come close enough with enough distance from 0.

It's possible that this requires deeper theory about Julia sets, e.g., f(J) = J = inverse image of J under f.

The Mandelbrot set M ⊆ ℂ is the set of points c ∈ ℂ for which 0 is contained in the filled Julia set of zz² + c. We've already seen that 0 and −2 are in M. Show that the intersection M ∩ ℝ is the interval [−2, ¼].
Hint

The task has three parts. First, look at the case c < −2.

For the second case, −2 ≤ c ≤ 0, it may be helpful that |c²| < 2|c|. I'm still not getting this done on the fly, feel free to skip until I have reproven this.

For positive c, show that the orbit sequence 0, f(0), f(f(0)), ... is monotonically increasing, thus either converging to a limit point or growing unbounded. If a limit point x of the iteration under the continuous function f exists for real c, it must satisfy x = f(x) and must be a real number.

Show or refute that M is locally connected.
Hint
When you receive your Fields medal for this, I would be grateful if you mentioned me for inspiration!




This is really all there is to the definition of the Mandelbrot set, and it shows why you can already draw nice pictures of these things in only 10 to 50 lines of code.

After that, you can get arbitrarily elaborate with coloring, depending on how fast values diverge to infinity. You may have seen the lovely smooth fractal zoom videos that abound on Youtube; they come from really elaborate programs that take hours and days to render the many frames.

-- Simon

mobius

Quote from: Simon on October 31, 2020, 10:08:52 AM
Powershell 6.2 added cd -. Alternatively, there is bash for Windows, and Windows git comes with git bash.




youtube-dl got DMCA'd and is not on github.

youtube-dl is a free-and-open-source video-downloading command-line tool. Extremely useful to avoid Google's bloated web player. When I want to watch something, I download the entire video and watch it offline. Only once in a blue moon, when I want to comment on a video, I access a video's actual page.

Bleeping Computer nicely summarizes: The successful use of a DMCA infringement notice to shutdown software that is in itself not a copyright violation is a scary precedent and one that lays the groundwork for misuse in the future.

Attacking a project via DMCA does not require any legal backing. It's enough to be a holder of some intellectual monopolies that somehow feel related. github is not the defendant, but is merely by DMCA forced to comply with the attack. It's the defendant's (the project's) task to fight an unduly issued DMCA takedown. IANAL.

That's part of the reason why I want no third-party copyrights in Lix, to avoid such DMCA harassment that is hard to fight.

Anyway!
youtube-dl 2020-09-20 Python source
youtube-dl 2020-09-20 Linux binary
youtube-dl 2020-09-20 Windows binary

The problem is that Youtube often changes its protocols or file naming etc., and youtube-dl plays catch-up. Above version 2020-09-20 will probably only remain useful for a few weeks.

Who wants to help me buy a battleship and blockade the Americans with me? Free Pepsi Max Lemon will be served on my ship.

-- Simon

thanks, that's useful.

HAve you heard anything about the supposed lawsuit the US government is taking against Google? (for monopolistic practices). I've only read about this once and heard little else about it.
everything by me: https://www.lemmingsforums.net/index.php?topic=5982.msg96035#msg96035

"Not knowing how near the truth is, we seek it far away."
-Hakuin Ekaku

"I have seen a heap of trouble in my life, and most of it has never come to pass" - Mark Twain


Simon

Quote from: mobius on December 30, 2020, 12:16:50 AM
lawsuit the US government is taking against Google? (for monopolistic practices).

No, had to websearch for it.

Google is special in that few other corporations (Facebook?) have such extensive collections of user privacies. The resulting lawsuits feel like precedence cases much more than like consequent applications of existing laws. Thus, hard to speculate what will happen.

I still don't have a smartphone, and I search with Google 2 or 3 times per year, in the rare occasions when alternative search engines fail to find what I want.




The youtube-dl repo is back on github and their homepage has always offered their downloads; my reosting wasn't necessary in the end. Happy to see github going to offer more help for attacked developers.

-- Simon

Simon

#277
Sniping

To bid on Ebay, you enter the maximum that you are willing to pay. Ebay will then bid for you up to that amount. If you enter $50 for an item, but the highest anybody else is willing to pay is only $40, you win the item at $41.

This auction ruleset (winner pays the price of the 2nd-highest bid) is called a Vickrey auction (this would require Ebay to keep all bids sealed; see next post for correction). The Vickrey auction has a weakly dominant strategy at bidding personal valuation of the item: No matter what other people bid, you'll do best if you bid your own personal valuation. You cannot strategically bid better than your personal valuation to save money.

Thus, type your personal valuation once, and don't look at the auction again, assuming that your personal valuation doesn't change during the 7 days of the auction.

Do people do that? No. Many people will snipe, i.e., enter their maximum during the final 10 seconds, sometimes the final 2 or 3 seconds.

Sniping is good when the winner must pay his full winning amount, as opposed to Ebay's rule of paying the second-highest bid + $1. When you must pay your full entered amount, you want to keep the price artificially low during the auction, and then win with a strategic snipe bid that is less than your personal valuation. Other snipers make this really hard; if you fear that the item is super rare, you snipe close to your personal valuation just to make sure. But usually, sniping is sound because everybody will bid below their personal valuation.

Why do people still snipe Ebay auctions (pay second-highest bid + $1) when game theory tells us that it's unnecessary?
  • Habit. If you have free time around end-of-auction, it's fun to watch the end and participate.
  • Not understanding that entering the personal valuation is weakly dominant irrespective of when it's entered. After all, sniping is not worse than bidding early, assuming it doesn't cause you stress.
  • Enticing other bidders to misjudge the item. If you're successful, you'll save money even if you finally enter your own personal valuation: Since Ebay displays the number of bids and the current price, you make the item look unwanted. Other bidders might underestimate their personal valuation, thus the second-highest bid will be lower. You avoid nudging other bidders to reconsider. I'll call this the Kindergarden effect (probably not a widespread name): The same item is woth more to A if B wants it, regardless of whether A and B will ever interact. Kindergarden effect is real, e.g., in investment bubbles, so it can be a reason to snipe.
  • Abusing a human cognitive bias that favors safety. You can speculate that the other person will enter a small amount first, and that he plans to rebid on first resistance. This way, he can always rest assured that his final price is close to his current entered maximum. Maybe he expects, with good reason even, to win the auction at a small price, and he hates to be surprised by having to pay close to his high correct personal valuation. By obscuring your maximum until the last second, you force him to enter his personal valuation while there is no resistance, and thus force him to suffer mathematically irrelevant surprise.
All this makes me very happy, and I should work on my own biases.

-- Simon

Simon

#278
Sniping, part 2

Pitfalls of Early Bidding, an essay that deems sniping on Ebay the only proper way to bid, even though the winner will only have to pay the second-highest bid. He defines early bid to be anything that other bidders can react to. With good internet, even 5 seconds can be too early.

He has several strong points, and 80 % of it aligns with my 3rd assumption: Early bidding drives the price due to nudging other bidders to reconsider their personal valuation. My assumptions about habit/nonunderstanding weren't even remotely considered.

He makes a particular point of how (early bids and Ebay messaging) will induce auction fever in other buyers, i.e., irrational personal overvaluation of the item. This makes sense for Ebay because Ebay will earn more fees if the item sells for a higher price. But it's detrimental for the bidders; bidders don't want other people to overvaluate, since other people's personal valuation becomes the buyer's price.




Correction to part 1: A Vickrey auction requires sealed bids, i.e., bidders can't see the bids or names of other bidders. Ebay auctions are like Vickrey auctions only if everybody snipes. Early bids violate the requirement that bids be sealed; Ebay prominently displays the number of bids and the current price (~second-highest bid).

-- Simon

mobius

I use ebay a lot, and ironically I rarely use the auctions. I'd say 95% of the time I buy things with the "buy it now" option. For those unaware; this is actually very common. I've bought countless things, hundred probably over the past 5-10 years with the buy it now option; no auction, no bidding, no waiting, no games.

And the points you mention are precisely why. If I want something; I don't want to play games with strangers over how much it's worth. And I'm not re-arranging my schedule to secure a bid on ebay.  Sometimes I bid on an item early I know I won't get just to drive the price up then laugh maniacally to myself.

I wanted to make the point about buy it now; because apparently a lot of people don't know about this; and shy away from ebay because they think it's all auctions. Also of course there is the gamble of buying from random people but in my experience I've had about exactly the same rate of quality/poor quality and good/bad experiences with ebay then with any other major retailer. Plus I really like the idea of giving money directly to fellow citizens instead of to a big corporation. Only once in fact, in the 10 years I've been using ebay have I ever had a bad experience. I bought and item which never came and got no word from the seller; I informed ebay and they refunded me the amount in full. So I honestly have no complaints what-so-ever.

Very rarely I have won a bid by bidding early. Its happened I think most likely with cases where there were plenty of other options listed at the time and/or it was a low demand item. Usually I was the only person to bid at all. I won my current video graphics card that way (GTX something(?) ~100$ used.) It was an older (arguably outdated) model.
everything by me: https://www.lemmingsforums.net/index.php?topic=5982.msg96035#msg96035

"Not knowing how near the truth is, we seek it far away."
-Hakuin Ekaku

"I have seen a heap of trouble in my life, and most of it has never come to pass" - Mark Twain


WillLem

Quote from: Simon on January 25, 2021, 04:42:12 PM
A Vickrey auction requires sealed bids, i.e., bidders can't see the bids or names of other bidders. Ebay auctions are like Vickrey auctions only if everybody snipes. Early bids violate the requirement that bids be sealed; Ebay prominently displays the number of bids and the current price (~second-highest bid).

eBay's auction system is very unlike a traditional outcry auction, or even a sealed-bid type auction. The incentive of an eBay auction is to bid, in the first instance, the highest you'd be prepared to pay. This contrasts massively with other auction types, which tend to allow bidders to start very low and increase their bids in increments until somewhere close to the item's true value is reached.

Like mobius, eBay's bidding system totally puts me off getting involved with auctions, because far from presenting the opportunity to get an item at a fair price, or even a greatly reduced price, it's far more likely to drive the price higher than is fair, and encourages such practices as "bid sniping". I've won items by sniping, and there is definitely an accompanying rush of adrenaline, and the feeling that you've "beaten everybody", but it's an empty feeling, especially when you've been on the receiving end of a snipe and you know how frustrating and annoying it is.

This said, if an item isn't very popular and nobody else is bidding, it can be possible to get items extremely cheaply, and this can sometimes feel like cheating the seller. However, if the seller chooses to start the bidding so low, then they accept the possibility that the item will sell for that price.

Ultimately, I find that "Buy It Now" or "Best Offer" are the best ways to conduct a transaction on eBay, and I'll always favour these over an auction, even if an auction is somewhat presenting the opportunity to get the item at a lower price. You can never be sure that the opportunity is actually there until the auction has ended, and by then you could already be enjoying your item having bought it from someone who simply slapped a reasonable price tag on it.

Quote from: mobius on January 25, 2021, 10:16:45 PM
Sometimes I bid on an item early I know I won't get just to drive the price up then laugh maniacally to myself.

:crylaugh: :crylaugh: :crylaugh:

Brilliant.

Dullstar

Even ignoring eBay's specific implementation details, I definitely feel like an auction is the most stressful way to buy an item. I'd have to be pretty desperate for a deal to risk the auction over potentially paying a premium for the relatively stress-free buy-it-now option to get the item at a known, fixed price (sure, you could end up paying less with the auction... but you could also end up paying more, or not getting the item at all).

mobius

Guess what? Another point for Ebay.

I recently tried buying a mechanical keybord from a web store called "monprice.com". Package never came, though they said it should've been "delivered" on XXX. Before even asking for a refund I ordered the same exact product on ebay and got it in four days [this was without urgent shipping or anything btw].

This sort of thing has happened a number of times with Amazon and other places.
everything by me: https://www.lemmingsforums.net/index.php?topic=5982.msg96035#msg96035

"Not knowing how near the truth is, we seek it far away."
-Hakuin Ekaku

"I have seen a heap of trouble in my life, and most of it has never come to pass" - Mark Twain


Simon

#283
Yeah, I tend to buy stuff at auctions only if it's near-impossible to get the stuff otherwise. E.g., out-of-print board games from decades ago.




Potential topics for future blog posts:

Nifflas's games from a game designer's perspective. In the past 2 weeks, I re-played Within a Deep Forest and Knytt. Download Nifflas's freeware games, they run on Windows and in Wine, they have lovely tracker music.

Card solitaires. My custom card set for PySol is 4-color, and I should make a dark mode for it. Post full rules of a solitaire game I invented in 2011. Good existing games:
  • Pile On (a.k.a. Pileon, Pile Up, Beeswax),
  • House on the Hill without undo,
  • 4-suit Spider with undo.
General software engineering. I haven't written much about it in a while. Should get back to it. E.g., look into C++20 more. Or write more posts for Object-Oriented Design with Simon, the perennial favorite topic of Simon.

Cute C++ trickery. It's possible to use a function pointer as template argument. And there is a rule that templates with the same arguments produce only a single instantiation. That leads to this
shady pearl.

template <void (*f)()>
void call_at_most_once_per_minute()
{
    static
Timer timer;
    if (
it has been less than a minute according to the timer) {
        return;
    }
    f();
   
timer = now;
}


Then, whenever you want to call f(), you can instead call call_at_most_once_per_minute<f>() and get the desired behavior. There will be exactly one instance of the template per different function pointer, i.e., if you call the same f from two places (at least from the same translation unit), they use the same timer variable. I'm not 100 % sure what happens if you call the same f from two different translation units, whether the two template instantiations will be unified at link time to use the same static timer variable. I should check that.

Not very OO, but a nice hack for crusty old codebases at work. Colleague liked it a lot. I'm not sure if I can fully recommend it, it's not necessarily so clear to everybody. :lix-evil:

If the codebase is not crusty, instead of such trickery, consider to refactor to a service structure. You write lots of little classes that implement some invocation interface, and then hang them in some central service routine that times the invocations for you.




As usual, many hobbies compete for my free time, so prod me for the stuff that you find interesting. You should do that with Lix bugs too, prod me for what annoys you most, so that I can prioritize.

-- Simon

Simon

#284
Social Golfer Problem

You are organizing a Bridge/Skat/Doppelkopf/Mahjong/... tournament. Each table must have exactly s players (s = size of a table); e.g., for Bridge, s = 4. Based on the pre-registration, you're happy that the total number of players is a clean multiple of s, so for each session, you can distribute the players evenly to g tables (g = number of groups).

During a session, the players will remain seated at their table. Between sessions, you can re-seat all players between all tables as you like. Our task is to schedule the seating for the sessions. We want to allow as many players to play with each other as possible. We'll ignore time constraints. Thus:
  • Given s and g, find the biggest possible number of sessions, w, and a seating schedule for the w sessions such that no pair of players ever meets twice. It's OK if a pair never meets. If every pair meets, then we call the schedule a perfect solution.
  • Given s, g, if above's solution wasn't perfect, find a seating schedule that allows each pair of players to meet, and that, secondarily, minimizes the excess. By excess, I mean that it's really bad if players play 3 or even more games together, and that we also want to minimize the number of pairs that play 2 games together.
Perfect solutions exist, e.g., for:
  • 16 players, s = 4 players per table, g = 4 tables, w = 5 sessions.
  • 15 players, s = 3 players per table, g = 5 tables, w = 7 sessions.
  • 9 players, s = 3 players per table, g = 3 tables, w = 4 sessions.
Image

The 16-player-4-per-table case is particularly interesting because it has this lovely graphical method to recreate the schedule: The image has 1 center point, 15 points around it in 3 concentric pentagons, and a system of lines. Consider only the lines in red, ignore all other colors. To create the pairings, rotate the red lines around the central point, and every time the lines match with the points (happens 5 times during a full turn; this produces the lines in the other colors), seat connected points at a table.

I apologize to the Bridge players if they register in partnerships instead of in singles. Matching partnerships is like matching chess players; it's the specialization of the Social Golfer Problem for s = 2.

Links:
-- Simon