lapsu-blog
lapsu-blog
lapsu.tv
38 posts
Software stuff
Don't wanna be here? Send us removal request.
lapsu-blog · 6 years ago
Text
Berhalter already gave us most of his USMNT lineup for March (part 2)
Previously, I posted my expected lineup for the USMNT in March once the full player pool is available and offered explanations for each of the players on the left side of the lineup. Here’s the second half on the right side. Again, the full lineup should look something like:
 Pulisic   Altidore?   Johnson?
      Weah?       McKennie
     Bradley      Adams
  Brooks     Long     Miazga
I already wrote about Long, Brooks, Bradley, Weah and Pulisic. Let’s start again from the back.
Matt Miazga at RB
This could be Zimmerman or someone else, but Miazga has the best combo of 1:1 defending and passing for this spot. He’s a better passer than Long, so more likely to be on the right where Berhalter’s system expects passes to start the offense.
Adams at Right Back / DM / Nick Lima
Nick Lima was great at this position in January but it really seems like it was designed for Tyler Adams, who has the speed and awareness to play DM, move forward into the attack and still get back on defense. As much as the left side was designed for Pulisic, the right side seems designed to give Adams the freedom to roam forward on offense and still break up counter attacks on defense. Nick Lima should be the backup here.
Fabian Johnson at Right Wingback?
This is the most open position and will likely be a point of frustration for USMNT fans. As much as the left side is designed for Pulisic to stay forward, the right winger has defensive responsibility to cover the right back position if Tyler Adams is defending centrally or caught forward in the attack. It will be more of a wingback than a fully offensive winger. This is why I don’t think it will be Weah. Fabian Johnson seems like the favorite, but alternatives might be Paul Arriola or even Deandre Yedlin who’s likely a better fit here than at the RB/DM combo position of Tyler Adams and Nick Lima.
Weston McKennie as Right 10
McKennie fits well in Roldan’s spot as our best two-way central midfielder.
Jozy Altidore at Striker
Altidore is still the best strike for the US and I’m optimistic to see what he can do with the support of Berhalter’s system. This seems like the second most open position after right wing because his relationship with Zardes gave fewer hints about what he was looking for besides, “Someone who I coached for the past year and will know exactly what I want.” Zardes did score 19 goals in 2018 so if he’s there in March he has the productivity to justify it.
The Twist
There’s one last interesting twist about Berhalter’s asymmetrical system: it’s entirely reversible. Depending on who the opponent has attacking and defending on each side, it would be easy to flip the entire lineup left to right. The back 3 slide right one spot, then Tyler Adams and everyone else just switches over to the other side of the field.
Thanks for reading, I hope you enjoyed it and that you’ll be less surprised when you see John Brooks at left back or Deandre Yedlin at right wing in March.
0 notes
lapsu-blog · 6 years ago
Text
Berhalter already gave us most of his USMNT lineup for March (part 1)
Most of the speculation about the USMNT lineup for March has reverted to something more familiar to the Sarachan era than to what Berhalter did in January. The US played a 3-2-2-3 with possession and fell back to a 4-4-2 in defense. But we know that Berhalter wants to keep the ball in possession most of the time, so the 3-2-2-3 is the primary shape. As a reminder, against Panama that looked like:
  Left Wing    Zardes    Right Wing
         Left 10    Right 10
         Left DM    Nick Lema
      Lovitz    Long   Zimmerman
But who will play in those positions in March once the full player pool is available? Berhalter has given away most of this already, both by what he’s asked those players to do, and just as importantly, what he asked them not to do. In the full Barring injury, here’s what he’s given us so far:
  Pulisic   Altidore?   Right Wingback?
       Weah?       McKennie
      Bradley      Adams
   Brooks     Long     Miazga
Berhalter’s system is asymetrical left to right, so I’ll break up the explanations that way as well, starting with the left and saving the right side for a separate post.
John Brooks at Left Back
This puts Brooks at LB in the 4-4-2 which people might find surprising, but it’s really more of LCB in the 3-2-2-3. Berhalter was looking for Daniel Lovitz to play passes and start the attack which Brooks should excel at. By moving outside in the 4-4-2, it gives Brooks additional cover defensively, which he can definitely use.
Aaron Long at Center Back
Aaron Long will remain where he is. In January, Berhalter asked Long to be unbeatable defensively and make simple passes to the other backs and defensive midfielders. Long’s recovery speed and defensive skills make him the best fit for this role.
Michael Bradley as the 6
Michael Bradley will stay where he was in January. An alternative here would be Tyler Adams, but in January, Bradley and Trapp both stayed at home in front of the defensive 3. Tyler Adams could certainly do that, but his ability to cover ground and recover defensively would be wasted. The defensive nature of this role also tells us who will be playing in front of Bradley.
Christian Pulisic at Left Wing
This entire asymmetrical system is designed to take advantage of Christian Pulisic’s attacking ability on the left wing. Brooks is a CB playing as a LB who stays home and doesn’t push forward. Michael Bradley is a 6 who stays home and doesn’t push forward. Berhalter wants Pulisic to have the freedom to attack while limiting his defensive responsibility.
Tim Weah at Left 10?
This one is a little fuzzier as Berhalter has not given away as much here. I don’t think Weah is a lock for the starting lineup, but if he’s there, he’s more likely to be central than the right wing. You’ll read why in the next post. Weah has played centrally some for Celtic and the right wing puts him on the opposite side of the field as Pulisic. By putting him at the left 10, he can combine with Pulisic and rotate and overlap when the opportunities arise. Also in January Djordje Mihailovic played as the second forward in the 4-4-2, a reduced defensive responsibility which will suit Weah more than say, Weston McKennie.
Keep reading for part 2 of the Berhalter’s starting lineup in March.
0 notes
lapsu-blog · 9 years ago
Text
Nonlinear Error Handling with Leema
Like many other functional languages, Leema uses single assignment. Leema also has builtin language support for failure types. Putting these two properties together provides an interesting result.
Error handling no longer has to be inline with logic code.
Each label is only assigned once
Each label then also functions as a unique identifier for a single expression
As a unique identifier, statement order is no longer significant
Error checks can be moved out of order within the function without changing behavior
Primary control flow is left uncluttered by error handling
Here are two functions that do the same thing: hypothetically fetch Twitter data. In this case, the entire page should fail if the profile data cannot be fetched, but we should still render the page if there is a failure fetching tweets or favorites.
The first example is written with traditional exceptions and the second is written with Leema's non-linear error handling. Note how in the first example, the try/catch blocks disrupt the primary flow of code. It's signficantly harder to visually trace the execution for the cases inside the try/catch blocks.
In the second example with Leema, the primary flow is clearly laid out with no difference between the calls with error handling and the calls without. The error handling is still there, but it's just hidden below in the postscript block where it doesn't distract from the logic of the function.
Traditional
func twitter_profile(conn: Db, user_id: Int) {    let profile := query_profile(conn, user_id)
   try {        let tweets := query_tweets(conn, user_id)    } catch (DbException te) {        let tweets := []    }
   try {        let favs := query_favorites(conn, user_id)    } catch (DbException fe) {        let favs := []    }
   return format_profile(profile, tweets, favs) }
Leema
func foo(conn: Db, user_id: Int) ->    ## all error handling is down here and out of the way    let profile := query_profile(conn, user_id)    let tweets := query_tweets(conn, user_id)    let favs := query_favorites(conn, user_id)    format_profile(profile, tweets, favs) -- ps ->    ## all error handling is down here and out of the way    failed tweets    |#dbexception -> []    --    failed favs    |#dbexception -> []    -- }
0 notes
lapsu-blog · 9 years ago
Text
Parsing Problems
Leema has a problem that I’ve kind of been ignoring. And honestly, I might keep ignoring it for a while longer, but I wanted to write it up anyway. The problem comes from trying to avoid semicolons as line endings (and is probably similar the issues that can happen when not using semicolons in Javascript). We already have line endings to tell us where one statement ends and another begins so we can just make newlines syntactically relevant. But we also use line endings to break up long lines so those newlines are not syntactically relevant.
The hard question then, is how to make newlines relevant when we want them to be, but not when we don’t want them to be. Here is an example for parentheses:
func foo(x, y) ->     let z := x + y     (x, y, z) --
How can we determine if that’s 2 lines or 1. This is how Leema currently parses that code: 
func foo(x, y) ->     let z := x + y(x, y, z) --
Where y is a function that takes 3 parameters x, y and z. As humans, we know that’s improbable. Functions rarely take themselves as parameters and we can’t pass z as a parameter before we’ve defined it. It would be possible to code this logic, but it would require making the parser aware of variable definitions at parse time. This would be complicated, ugly code.
The same problem exists for the minus sign.
func foo(x) ->     let z := 4 + x     -z --
How can we know this isn’t z := 4 + x - z? The minus case is a bit easier just because () are used in more ways. For example, maybe use - for minus and ~ for unary negation, but as long as the () case is still broken, it doesn’t help to just fix minus. And I keep hoping some way will arise to fix both of cases, but nothing has come to me so far. Maybe you have an idea to fix it?
0 notes
lapsu-blog · 9 years ago
Text
Back in 6 weeks with a new programming language
I'm taking some time off from my regular job, spending it in Europe working on my programming language: Leema. Previously, my time on Leema has been restricted to 10-15 minutes on the bus or subway, late at night after my daughter has gone to bed, or a rare afternoon home alone. This isn't great programming time.
My hope is that I can make much better progress if I can actually treat it like a professional project and spend regular contiguous hours on it. That's the hope anyway.
I've laid out a rough schedule for the next six weeks and honestly, it doesn't get me as far as I'd like. Hopefully having true focus on the problem will let me move faster than I'd expect. I'll let you know how it went in six weeks.
0 notes
lapsu-blog · 10 years ago
Text
NFL Rivalry Games
Isn’t it annoying that neighboring NFL teams are often split across conferences? Giants and 49ers in the NFC, Jets and Raiders in the AFC. They only play each other when the inter-division games randomly line up, which is rarely. Wouldn’t it be great if the NFL maintained one game each year for teams to play their geographic rival? They could play all the rivalry games on the same week and fans could drive for the road games. I would love to see each of these games every year:
Oakland & San Francisco - Bay Area match up obviously, still work even if the Raiders move to LA
Seattle & Denver - resurrect an old AFC West rivalry
San Diego & Arizona - the southwestest teams
Dallas & Houston - the two Texas teams
Kansas City & St. Louis - the cross Missouri rivalry, at least until the Rams move to LA
Giants & Jets - obviously this game should be played every year
Pittsburgh & Philadelphia - they could play this game sometimes at 100k seat Beaver Stadium halfway between the two cities
Washington & Baltimore - this would be a great game
Indianapolis & Cincinnati - 2 hour drive, this game should be every year
Miami & Tampa Bay - the panhandle rivalry
Those are the obvious games. The NFC North, NFC South and AFC North are more geographically aligned, so rivalries like Minnesota - Green Bay and Carolina - Atlanta are already division games. It also means that the remaining rivalry games have to be a bit further away.
Green Bay & Buffalo - The coldest weather teams
Minnesota & New Orleans - Both ends of the Mississippi River
Detroit & Cleveland - Western Lake Erie Rivalry
Chicago & Tennessee - Music City vs. Chicago Jazz
Atlanta & Jacksonville - Only a short 5 hour drive through rural Georgia between these 2 cities
New England & Carolina - Not an obvious rivalry but New England is up in the corner, so they have a long way to go. It’s too far to drive but only a 3 hour flight. And right now at least, Cam Newton against Tom Brady would be pretty appealing.
Each of these games is cross-conference except Indianapolis-Cincinnati and Minnesota-New Orleans. I imagine that might be a problem for some, but I’m fine with it.
So come one Roger Goodell, make this happen!
1 note · View note
lapsu-blog · 10 years ago
Text
Leema Function Types
I’m working on a new programming language called Leema and trying to incorporate ideas I like from other languages. One idea is Haskell’s model of separating pure functions from IO functions. That’s good, but makes no distinction about the kind of IO. It also does not allow for things like logging from pure functions, which is sometimes helpful for debugging.
As an improvement, I plan to split functions into the following types, to incorporate the ideas of command query separation into Haskell’s IO declaration.
proc - similar to an IO function in Haskell, or a regular function in most any other language. It can do anything.
func - pure functions that can do no input or output
command - an IO function meant for writing data; cannot call a query function
query - like a command, but for reading data; cannot call a command function
sysio - system level IO functions; simple wrappers around file and network reads and writes, can only be called by commands and queries
trace - observational functions for things like logging and metrics collection; can be called from any other function, even including pure functions
This is still very much in the idea phase, so plenty of time remains for it to not work out or just prove to be a bad idea.
0 notes
lapsu-blog · 10 years ago
Text
Partial Relegation for MLS
While it is true that MLS will never have relegation in the European sense, it doesn’t mean that MLS couldn’t develop its own unique form of promotion and relegation. In fact, it would even help as the league expands.
The aspects of European style relegation that make it a non-starters in MLS include:
Losing out on full share of TV money
Not competing against the top league teams
Not having a chance at the league championiship, MLS Cup
If MLS could devise a structure that works around these three issues, I believe MLS owners would accept it. #1 is easiest as it just means continuing to spread TV and other league revenue evenly for all teams. #2 and #3 are harder, but are essentially just league alignment and scheduling problems. Here’s an example of one such structure.
The central idea is to keep MLS’s divisional structure and expand it by breaking geographical East and West conferences into upper and lower divisions. Now there is an East 1 and an East 2, and a West 1 and a West 2. Seeding next year’s divisions with this year’s results would look like:
Tumblr media
Solving #2 from above is now just a scheduling problem. While upper division teams play more games against other upper division teams, the lower division teams will still get some games against upper division teams, especially their local rivals.
Solving #3 just means that the lower division teams still make the MLS Cup Playoffs. For example, the top 4 from each upper division and top 2 from each lower division would keep the current playoff format of 6 teams from each conference.
Now we can safely relegate the last place team from each upper division down to the lower division in the same conference and promote the top finisher from the lower division. Because upper and lower division teams play each other, we could even use league results to decide whether to swap the upper 4th place finisher with the lower 2nd place finisher.
In this model, MLS can get limited relegation to keep the top teams playing against each other more often, while not putting owners’ investments at severe risk. And by adding a 3rd or even 4th conference, this model could easily expand to accommodate 30 or 40 teams.
0 notes
lapsu-blog · 10 years ago
Photo
Tumblr media
Map of current teams and likely expansion cities in MLS showing how the league divides 3 ways much better than 2.
0 notes
lapsu-blog · 10 years ago
Text
Relegation in MLS
Lamenting the lack of promotion and relegation in MLS is a common pastime for American soccer fans. But it’s only half right. Several of the recent MLS expansion teams have come from NASL or USL. Although they’re not chosen by on-field success, if you squint, it’s kind of like promotion.
Relegation on the other hand is a pipe dream. Even when Chivas USA outright folded, the league simply put the team into stasis so that it could be brought back as LAFC.
MLS will never have relegation for one reason: team owners have paid for a team that won’t be relegated. Orlando City and NYCFC paid $70 million and $100 million franchise fees respectively. A permanent spot in the top league is part of the deal. MLS can’t just turn around and say, “We know you paid for a top league team, but now you have a second league team.” Orlando City is spending $84 million on a new soccer specific stadium. They can make that kind of investment because they don’t face the risk of relegation and loss of revenue.
Sure, there are teams in other American sports that have abused this system, like the Florida Marlins. They won the World Series in 1997 and then unloaded all their best players and finished dead last 1998, knowing their place in the Major Leagues was not in danger. They rebuilt and won the World Series again just 5 years later in 2003.
Yes, maybe relegation does raise the stakes for the bad teams, and keeps the bottom of the league more competitive. But removing the threat of relegation allows mid-level teams to invest more, take bigger risks and be more competitive with the big money teams. Just look at who won the World Series this year.
0 notes
lapsu-blog · 10 years ago
Text
First to Four Points
In an excellent interview with Planet Futbol, Jesse Marsch suggested that 3 game series or a first to 5 points would give better teams more of a home field advantage in the playoffs. First to 4 might be even better.
Play the first game at the higher seed’s stadium and the second game at the lower seed with standard 3 points for a win and 1 point each for a tie. If either team has 4 points after 2 games, they win the series. If not, they play a third game to decide it back at the higher seed’s home, going to penalties if necessary. This would have many benefits over the standard home and away series.
Higher seeded teams get a real home field advantage by playing first and having more games at home
Decide games on wins, not goal differentials (away goals is a pretty weak decider)
Less likely to decide a series with penalty kicks
The downside is that it’s more games, but it could still fit into the 2 weeks allocated for this year’s playoff series. First game on Sunday, second game the following Saturday and the final game on Wednesday if necessary. This has the happy side-effect of putting a team at a disadvantage for the next series if they can’t finish off their opponent in 2 games.
So come on MLS, let’s play First to Four Points in next year’s playoffs!
0 notes
lapsu-blog · 10 years ago
Text
CQRS in Function Definitions
Haskell has a useful separation for functions that use IO and functions that do not. That’s cool, but it doesn’t say anything about the kind of IO, it doesn’t differentiate between I and O. So what if that same idea were applied to CQRS?
Command Functions - write data to output
Query Functions - read data into memory
Pure Functions - no IO at all
Command functions can call any type of function. Query functions can only call Query or Pure functions. A Pure functions can only call other Pure functions.
This is good, but even when making a SQL query, you still need to send the query to the database before it can send the result. So this is more about logical, application level separation not low level IO. For that, another function type is needed.
IO functions do system level IO and can be called from either Commands or Queries but not Pure functions Overall, the syntax changes might look like this.
query read_x() {     db_query(”select * from x;”); // IO function } command write_x(x) {     db_query(”update x set data=$x”); } command main() {     x = read_x();     x = x + 1;     write_x(x); }
0 notes
lapsu-blog · 10 years ago
Text
Jurgen Klinsmann’s Replacement
It’s pretty obvious now that Jurgen Klinsmann won’t last much longer, so I won’t waste much time arguing that case beyond saying that the pickup game at your local park shows more organization that the USMNT lately. Let’s skip ahead to who will replace him.
Bruce Arena
He would be great, but let’s be honest, Bruce is absolutely dominating MLS right now. Why would he go back to the USMNT just so he can be fired for not winning the World Cup again?
Miguel Herrera
You know this would look great on the US sideline:
Tumblr media
He’s available, and made big improvements for the Mexican team, but the US fans probably couldn’t take a coach from our biggest rival. Maybe he wouldn’t want to coach for his greatest rival against his home country either, but It would be great drama if he could take revenge against El Tri for firing him.
Mike Petke
Petke might be as opposite of Klinsmann as possible. He played defense, represented the USMNT and is an MLS lifer. He would certainly end Klinsmann’s policy of biasing against MLS players. And he’s available after being fired indiscriminately from the Red Bulls despite leading them to 2 of the best seasons in their history.
Peter Vermes
He’s had good success in MLS for Sporting KC which is a traditional route to the USMNT head coach. But he hasn’t had coaching experience with the US team. He did play for the USMNT though, so maybe that makes up for it.
Tab Ramos
While Vermes has the MLS coaching experience, Tab Ramos has the US team coaching experience, having been the U-23 coach in 2014 and now a US assistant coach. Given how bad the team has been though, Ramos might be too tainted to come in as the next coach.
One possible outcome is Tab Ramos takes over as head coach if Jurgen were to agree to remain on as technical director only. Or he could be an interim manager for any games prior to hiring the new permanent manager.
Jill Ellis
Although possibly even more unconventional than Miguel Herrera, Jill Ellis has won a World Cup, which no other candidate can say. She started out the 2015 World Cup with sentimental lineups that included stationary Abby Wambach and still-injured Alex Morgan. But she got things worked out and her high pressure let the US dominate late in the tournament.
The biggest hangup for Jill Ellis is that she’s currently the #USWNT coach. As big a breakthrough as It would be for a woman to be the head coach for a major men’s national team, it probably be frowned upon to poach the World Cup winning women’s team coach in favor of the mediocre men’s team.
José Mourinho
This is a fun one. Mourinho’s job was already looking a little shaky after Chelsea’s poor start this year, and then they lost 3-1 to Everton. There’s a solid chance that he’ll be looking for work by the time the USMNT plays its first qualifier match against St Vincent and the Grenadines on November 13.
Who then?
Jurgen can’t be gone soon enough, and I’m looking forward to all the speculation about who will replace him. Who do you think? Who did I forget?
1 note · View note
lapsu-blog · 10 years ago
Link
Over the past couple of years I have spent a lot of time debugging other engineers’ test code. This was interesting work, occasionally frustrating but always informative. One might not immediately think that test code would have bugs, but of course all code has bugs and tests are no exception.
202 notes · View notes
lapsu-blog · 10 years ago
Text
Me, after the season finale of Game of Thrones
Tumblr media
1K notes · View notes
lapsu-blog · 10 years ago
Video
tumblr
Stannis is so done with your shit grammar.
221 notes · View notes
lapsu-blog · 11 years ago
Link
Introduction
Back in 1979, AT&T released a lightweight database engine written by Ken Thompson, called DBM (http://en.wikipedia.org/wiki/Dbm). In 1987 Ozan Yigit created a work-alike version, SDBM, that he released to the public domain.
The DBM family of databases has been quietly...
44 notes · View notes