art with code


WebGL 2.0

Started doing some vanilla WebGL 2.0 development this month. I like it. I haven't really ventured further into the new API features than doing 3D textures and GLES 3.00 shaders (which are very nice).

The new parts of the API feel a bit like this: you've got buffers and a shader program. What you do is plug the buffers into the inputs and outputs of the shader and run it. Uniforms? You can use a buffer for that. Textures? You can texImage from a buffer. After you've run your program over your vertex buffers, you can readPixels into a buffer. And there are functions for copying buffer data between buffers (and texture data from one texture to another). You can even write the vertex shader output to a buffer with transform feedback.

The fun tricks this opens up are myriad. Use a vertex shader to create a texture? Sure. Update your shader uniforms with a fragment shader? Uh ok. Generate a mesh in a fragment shader and drop it into a vertex array? Yeaaah maybe. All of this without having to read the data back into JavaScript. I wonder how far you could take that. Run an app in shaders with some interrupt mechanism to tell JavaScript to fetch the results and do something in the browserland.

There is still a dichotomy between buffers and textures, so there are some hoops to jump through if you're so inclined.


Users for sale

Think of this business model for a bit. A company pays you to use their product. To subsidise manufacturing the product, the company sells you to the highest bidder.

This will completely screw up the market for the product.

If you want to compete in the market, you can't compete on price. You have to offer a higher-quality product for free or even pay more than the competition to the users to attract them to your product. At the same time, you can't make as much money as the incumbent because you don't have as many slaves to sell, and you can't get as much money per slave because you need to compete on price (and likely the quality of your slaves and your knowledge of their best use is lacking due to you being new to this).

But, I hear you say, surely this isn't slavery. And yes, it's a very chilled out form of slavery. The company pays you with digital tobacco. All you have to do is gaze into your phone and endlessly scroll through content. It's not a very demanding job. But you have to do it several hours a day to earn money for the company. Very minimal money, mind. You're getting paid nothing, of course. Otherwise it wouldn't be slavery. The company makes a fraction of a cent per hour of your scrolling work. It's a very low productivity job.

Unless you're one of the superslaves, that is. Superslaves create the content for the endless scroll. They work very hard to bring more slaves to the product, in exchange for control over the slaves they attract, which they can then sell to the highest bidder. Superslaves are still slaves. The company doesn't pay them. (But if your business is selling ad space in popular spaces, you pay the space owner space rent to show ads in space. In which case the superslaves are space landlords instead. The space land might be owned by the company though, provided to the space landlords as a freebie to entice them to create a popular space where they can sell ad space back to the company in which case the space landlords are superspaceslaves instead. Internet business models: rocket science.)

The fun part is this: the users are paid for their endless scrollwork in digital tobacco. The digital tobacco has monetary value. The users should technically declare it in their taxable income. The employer who provides the endless scrollwork to the users should list the users as their employees.

Note that this is only a problem if the employer pays the users in free services. If the company only purchases ad space and resells it to advertisers, the users are not paid by the company and there's no problem. If the users have to pay for the service provided by the company and another company can offer the service for less (but no company can offer it for free), and the users are not sold to the highest bidder, there's no problem.

If the company provides the users a free service funded by ad space on the free service, the users are employees of the company, working for the company to look at ads in the hopes that the ads persuade the users to change their behavior in a way that the advertisers pay for.


iPhone X launch

The iPhone 8 & X launch feels a bit badly timed (like the iMac Pro, Mac Pro 2 announcements / rumors.) It might be fine though.

What me worry? The iPhone X is the future of the iPhone. It changes the screen form factor a bit, removes the home button, requires minor app redesigns due to the hump and the lack of home button, replaces Touch ID with Face ID and is full on AR twin cameras thing. It's very expensive. And you can't buy it.

The iPhone 8 then. Why would you buy an iPhone 8? Or an SE, or a 6 or a 7. The writing is on the wall. Those iPhones are finished. They don't have Face ID and they have the home button that's about to be deprecated. They look dated and they're cheap.

You can't buy the Apple flagship iPhone at the moment. You can buy the already obsolete iPhone 8, or wait for the X. And the X is suffering from supply problems on its OLED displays that are trickling in from Samsung, who gets the first dibs on the screens for its Galaxy lineup. 

Imagine the scenario. The iPhone X is nowhere to be seen. The few phones that arrive are sold out instantly. You go to the Apple store to play with the X but you can't buy one. You look at the 8 and it looks bad in comparison. So you walk out. And perhaps end up buying something that looks like the X - say a Samsung Galaxy S8. Sure, it's not an iPhone but at least it's not obsolete like the iPhone 8.

I like the X, but I don't like it $999 much. At the same time, I don't want to buy the 8 or lesser iPhones because the X is the future. At $799 the iPhone 8+ looks like especially bad value. It doesn't have the features of the X (even though the specs are similar), doesn't look like the X, it's expensive and it's obsolete.

Launching just the X or just the 8 would've been fine. But launching them both with a delay on the X feels like a bad move. Delay on the 8 would've been fine as it wouldn't eat into the sales of the X. But announcing X depresses sales of 8. A delay on X gives you no replacement sales. Equal specs between 8+ and X make the X seem like a cosmetic thing -> you start thinking "who cares about the phone, just buy the looks" -> buy something that looks like the X.

Na well, I'm probably wrong. 


Negotiating a Brexit

The Brits are negotiating with the haggling approach, the EU with the "let's do modifications to a reasonable compromise" approach. That's why the Brits seem to be out of their minds like the wino at the liquor store trying to haggle down the price of a 20 quid bottle of whiskey by starting with a 5 pound offer. And to the Brits, the EU seems to be very inflexible like the shopkeeper who says that prices are fixed (but there's a bit of leeway depending on what else you buy and how you behave).

This is pretty hard to fix after the fact. If the Brits go with "okay, let's do it your way", it'll look like they're suddenly giving a lot of ground. If the EU starts doing a haggling approach with an unreasonable first offer, it'll look like they've gone bonkers and are negotiating in the wrong direction.

For the Brits, the best approach is to keep haggling to extract concessions. They're already unreasonable so there's very little to lose by slowly moving towards the reasonable compromise. You can even do yanks in the other direction to see if you can nudge loose any extras.

For the EU, the best approach is to stop negotiating until the Brits are at the reasonable compromise. Then you can start figuring out the modifications and get the deal done. There's no point in negotiating while the Brits are approaching the middle ground, so it's best to just end negotiation rounds once you find out that they're not there yet.

The problem with these approaches is that while they're good optics at home, they antagonize the British audience towards the EU and the EU audience towards the Brits. The Brits seem like welfare queens, wanting to have everything without doing anything, whereas the EU looks like a bunch of rigid bureaucrats, unable to do a deal.

To counter this, the two sides appeal to the public on the other side. The EU ends up courting the British public by promises that they'll retain their citizenship and that the negotiations are mostly about boring bureaucratic stuff with the out-of-touch British government. The Brits end up telling that other Europeans should bugger off from the blighted isles before the pox descends upon them.. um, wait what? There's no British PR outreach, just Home Office hardliners ranting about their clients. Perhaps this should change?

To bridge the gap between the negotiation strategies, the EU could gradually shift more towards a haggling approach by moving the goalposts. Apply time pressure, give concessions on minor things, but start going for a worse deal for the Brits on things that matter. Then you can start doing haggling, give concessions and move towards a reasonable compromise once again. The other way to get to the unreasonable offer necessary to start haggling is to have some big shift - say you change the negotiator or that some unnamed governments have insisted to change the position in a big way because October is approaching or that the skies are cloudy therefore we need to insist on triple payments, all the stolen EU tax money in the tax havens, and the reunification of Gibraltar and Ireland.

The Brits could bridge the gap by misstating the EU position as something unreasonable that they've never said, then haggle against this strawman position until the EU position as stated by the Brits agrees with the actual EU position, and the Brit position is also at the reasonable compromise. The other way would be a big shift of their own, something like "Oh! Right! We misread your proposal. Yes, this seems much more agreeable, let's work from here then."

Thing with haggling: both sides get big wins in the process when going from unreasonable to reasonable. That's the psychology. If you don't get big wins, you'll get frustrated. The "modifying a reasonable compromise" process on the other hand nets you a few small wins, a few small losses. It's not as exciting and can be done a lot faster.


Post-Brexit Britain

How will Britain look like after the Brexit process has been completed and Britain is no longer a member of the European Union? The first step of the post-war government is to negotiate a trade deal with the EU to trade with the other European countries with minimal hassle. This trade deal will be an easy one, as EU standards already follow the British standards.

All that is needed is an agreement on the future evolution of those standards and a place to settle disputes, and the budget for running that place. Most likely, the standards will be driven by the EU, with the UK getting a minor voice in building them, UK could potentially get an equal vote with the other member states.

As for the place to settle trade disputes: as WTO is not really up to dealing with issues with British sensibilities, it's likely that the place would be closer to London. Perhaps in Luxembourg, a relatively neutral country between Brussels and London.

Making standards isn't cheap, there needs to be some budget for all the work required for that. This budget would be split between the EU and the UK in a proportional fashion. There will need to be some further integration of the UK and EU markets so that free trade Britain can flex its wings and fly on unhindered trade flows.

Domestically, there will be need for some extra revenue for the state to pay for the incurred one-time costs from the Brexit process. The UK is sitting on a sizable treasure chest in the form of untaxed corporate revenue squirreled away in its off-shore tax havens. A reasonable course of action would be to impose a one-time 30% levy on all money held in UK tax havens, followed by a modest increase in the income and corporate taxes in the tax havens, perhaps to 20% or so.

In order to maintain public order and defend against foreign propaganda, the UK government would require that media organizations operating in the UK need to have 60% British ownership and the controlling owners need to be British nationals who are resident in the UK 183 days per year or more. Any broadcast or internet media organisations falling afoul of the ownership laws would be banned from operating in the UK to prevent UK's independence being eroded by targeted hostile falsehoods. UK can use their trade deal with China to acquire the technology needed to run an firewall around the islands. You could call it Hadrian's Firewall.

The firewall would open the British marketplace to British service providers, British internet utilities and British media companies. No longer would Britain have to pay billions of dollars of tribute to overseas companies for providing simple utilities like internet search, messaging boards and advertising services. Silicon Roundabout would grow into Silicon Britain, with British companies exporting world-class high-value-add services to billions of people around the world.

To meet the needs of an aging population, the NHS needs to be beefed up as the retirees can no longer be shuffled off to Spain. To pay for the NHS boost, there will have to be some mild tax increases on capital gains, foreign entities, corporations and high income earners. The government would be well advised to set the highest income tax bracket at 55%, with corporate revenues after salaries also subjected to progressive taxation ranging from 15% to 55% for the largest multinationals.
Given the increased tax income, Britain could well afford to build new cities and developments to sell affordable housing to all segments of the population, multiplying the size of the British property market. With millions of newly-minted homeowners, the proportion of income spent on non-productive rental redistributions would fall and release a tsunami of private investment and increased productivity as motivated entrepreneurial homeowners take their stand and build billions of pounds worth of companies and create millions of new jobs.

To further prevent Brexit from causing great harm to the people of Britain, the British government needs to support its citizens. The one best way to improve the lot of the ordinary Briton is to reduce taxes on necessities. By getting rid of the VAT, the people of Britain will have 20% more money to spend on rebuilding Britain. For a family living on 20,000 pounds a year, this would free an extra 4,000 pounds to invest into their future and the future of Britain.


Brexit - What's going to happen

Brexit is well underway and the shape of the future relationship between the UK and the EU is becoming clearer. There are negotiations, yes, but the positions are very clear and the solutions to achieve those positions are also very clear.

1) EU citizens resident in the UK will get UK citizenship if they want. UK citizens resident in the EU will get a EU citizenship if they want.

2) Northern Ireland will become an independent country with a free movement & customs union with the Republic of Ireland. Ditto for Gibraltar. NI and Gibraltar will retain their UK military bases, perhaps they'll end up called NATO bases as a fig leaf.

3) UK will not be a part of the customs union and will not be part of a free movement arrangement.

4) UK will continue to do 60% of its trade with the neighbouring EU states, because they're next to it. EU will continue to do 15% of its trade with the UK, because it's next to it.

5) After the Brexit is over, UK will rejoin the European research cooperation institutions / Euratom / Europol / whatever.

6) Nigel Farage will be the next PM.


1) UK doesn't keep track of people after they enter the country. (In Germany and France, you need to register with the local authorities when you move in.) Therefore the UK can't easily send all EU citizens in the UK a polite letter asking them to end their lives in the UK. The easiest and cheapest (hey, austerity government) solution is to give them UK citizenship and require UK citizenship or work visa to take up employment. EU's position has been all along that UK citizens are EU citizens and they can stay if they want (proviso three-month rules etc. free movement limitations.)

2) NI doesn't want to join the Republic. No one wants a hard border in Ireland. There's no realistic soft border solution that doesn't turn NI into the preferred smuggling route to and from the UK. So, soft border in Ireland, hard border between NI and the UK. Ditto for Gibraltar. Legit concerns in NI and Gibraltar about how real their independence is without way to push off RoI / Spain -> UK military bases as guarantee.

3) Non-hard Brexit would bring Nigel Farage back into politics and everyone in the Tory party agrees that even a nuclear winter is preferable to that. So hard Brexit it is.

4) Trade is GDP per distance. Look at Finland for example. Its largest trading partners are Germany, Sweden, the Netherlands and Russia. Germany is near and has a large economy. Sweden is even closer. There are sanctions against Russia and yet Finland does more trade with Russia than with the UK / China / US. Distance matters in trade.

5) After the Brexit is over and the Farage threat has been neutralized, the lobbyists in Westminster are free to push the government to minimize the damage.

6) Farage can't be neutralized, only temporarily appeased.


Finnish rail privatization

TL;DR: Rent out train cars to commercial operators and give customers choice on which company's car they want to sit, but keep the core rail network and rolling stock as a state-run company funded by taxes.

The Finnish govt has decided to privatize the state railroad company. This is ... well, railroads are really terrible infrastructure to privatize. They need massive investment, make quite little money directly out of the investment and require central planning and co-operation to keep the network used at max capacity.

Building new rail is expensive, even in Finland where there are no people. No privatized railroad company has ever built any new rail. It's just not doable for a private company. Privatized companies are forced to operate on the existing network and wait for the government to foot the bill for new rail links. Sure, the companies might want to have new rail links or even just improve existing ones, but they don't have the money to do that. And they never will, because rail doesn't attract investors because rail doesn't generate enough profit. "Hey investor Bob, will you give us 5 billion euros to build a new rail link between these two towns? We reckon it'll pay itself off in increased tax payments to the govt in 20 years and it'll pay itself off  to us, the rail company, in 180 years or so. While it might not affect our share price much, you'll recoup your investment in dividends in maybe as little as 700 years."

Running rail as a profit-focused company is directly in conflict with running rail as a service. A profit-focused approach to rail is: never replace running stock, automated ticket gates on train cars (unless the govt subsidizes ticket control on stations), no conductors, no station maintenance, vending machines in all cars, trains wait on stations until they have enough passengers, run trains as slowly as possible to minimize power costs, oversell seats as much as possible, no customer service, no train drivers, no rail network maintenance, only run segments of the track that generate profit, stop trains at company-owned service stations with an over-priced shopping mall and no other transport connections for an hour at a time, charge extra for "fast" trains, focus service on segments with no other public transport & charge through the nose, buy the stations and charge extra from last-mile connection providers & parking, make stations very difficult to navigate and fill them with shops, sell concession store space on trains, block mobile network on cars, sell expensive wifi, use sturdy cheap-to-wash and cheap-to-replace interior in cars (read: unpainted metal seats, standing-only trains, video ad displays mounted behind plexiglass). Train cars made out of repurposed shipping containers with no windows (they take money to wash). Wash cars using ceiling-mounted sprinklers. No heating or AC because costly. Record everything customers do in the train and sell the tapes to advertisers.

Private rail operators, I'm available for consulting at $3000 per day. A steal at that price!

Nowhere in the "rail as profit" manifesto does it say: affordable, fast trains for comfortable travel. Transport networks are run to maximize long-term tax income through indirect boosts to the economy. Rail as profit is run to maximize short-term income to owners of the rail companies (in the transport infra long-term, the owners will be dead).

The new private rail operators can't run more trains on the network, the current network is already saturated. And because they lack coordination with each other, they can't run the network at as high capacity as a single operator. The end result is fewer trains per day. Which means higher ticket prices and maximizing on-journey profit (read: selling stuff on train) to recoup the losses from fewer trains. Add to that the other cost-cutting and you get the classic death spiral (less revenue -> cut costs, increase prices -> fire employees, do less maintenance, provide less service, run trains slower, shut down unprofitable parts of the network -> less revenue due to worse value proposition -> cut costs, increase prices ... repeat until you reach a steady-state or go bust.)

How should you run a rail privatization then?

Keep the rail network and the rolling stock as state-run services. You can think of a rail network as a network of neighborhoods enabled by the network. Would you sell all those neighborhoods to a private company who could then wreck 'em and probably screw your tax revenues alongside causing suffering to your people living in them? Nope. So you keep the network and rolling stock as something you run.

For the country, the best rail network is one that has good coverage and that links together the maximum number of people for a given travel time and that transports the maximum amount of goods around the country. These are competing needs, so on good rail networks you end up with multiple levels of rail service: fast intercity trains that link cities into larger economic units, commuter trains that tie the surroundings of a city together, and cargo trains that run long slow trains between industrial centers, cities and ports.

For the country and  the people, time spent in trains and waiting for trains (or cars for that matter) is time wasted. For that reason, the best commuter rail service is the one that runs fast trains frequently. Fast trains need a fast rail network. Frequent trains need a high-tech rail network. Frequent fast trains need a fast high-tech rail network. Which is kinda expensive.

At a governmental level, trains are profitable, much like road networks. They may be a big cost on a year-by-year spreadsheet, but the profit is captured in taxation of the increased economic activity. As such, rail and road networks are pretty much guaranteed to run at a loss, and that's by design. At country level, the best rail and road network is one that's operating at full capacity. And you don't get to full capacity if you're charging the users of the network enough to recoup the costs. You get to full capacity if using the network is very cheap, but the network is paid for by the economic benefits it creates.

Privatizing the rail service is a terrible idea. You'd be creating a tax-payer subsidized company that isn't accountable to tax payers and .. well, for the owner of the private rail company, the most profitable setup is one where they don't have to run a service and get all the subsidy money. Running a rail service is not profitable. Rail services are all subsidized. Subsidized services need massive regulation to function (rather than just sucking in the subsidies). Massive regulation creates monopolies. Monopolies are best run as state services.

What you can (and probably should) privatize are the external services. "Hey companies A, B and C! We'll rent you some space and carts in our train! You'll have this many passengers in the train every day, and you can sell them improved service in your space." Ditto for stations (or perhaps, specifically for stations.)

Having company revenues depend on number of passengers on a train makes the companies want to increase rail network coverage and number of passengers on the network. By also having shops at the stations, companies would want the trips to be fast so that people can spend more time shopping.

Leasing cars to competing companies while fixing ticket prices for the majority of the seats and allowing customers to pick which car they want: companies would have incentive to create great travel experience to attract more customers for their on-journey sales. You'd still have guaranteed network capacity & maintenance, all the country-level benefits of a transport network, but you'd privatize the parts that aren't part of the core service.

For an example: the British rail privatization. The best part of British rail are the mall-like stations and state-run inner city public transport (e.g. Transport for London). The actual privatized rail service is like if someone was paid to provide a rail service by the government and wanted to spend as little money on it as possible while extracting the maximum ticket price the traveler is willing to pay. To fix British rail, you'd have to turn it back into a state-run core network with privatized add-value services.

About Me

My photo

Built art installations, web sites, graphics libraries, web browsers, mobile apps, desktop apps, media player themes, many nutty prototypes, much bad code, much bad art.

Have freelanced for Verizon, Google, Mozilla, Warner Bros, Sony Pictures, Yahoo!, Microsoft, Valve Software, TDK Electronics.

Ex-Chrome Developer Relations.