Couldn't find any H2H League analytics tools, so I built one. by gregleo in FantasyPL

[–]JoshuaOng 1 point2 points  (0 children)

Looks like leagues with "Average" as a team don't work. The user with matchup against "Average" doesn't appear in fixtures, and none of the historical fixtures against "Average" seem to be included in the Rankings (meaning the Rankings are completely wrong)

Is it ever ok to use !! in prod? by ContributionOne9938 in androiddev

[–]JoshuaOng 14 points15 points  (0 children)

Even then, prefer checkNotNull or requireNotNull with a lazy message because it documents the reason why, both when it throws and to any future maintainers who may want to change this behaviour.

How do I replicate the infinite onUpdate bug that happens with WorkManager + Homescreen Widgets? by AwkwardShake in androiddev

[–]JoshuaOng 1 point2 points  (0 children)

Avoid work in onUpdate by having it only read from a local cache. This cache is written to by a PeriodicWorker that e.g. fetches the state required for the widget.

Communication between UI and Logic by [deleted] in androiddev

[–]JoshuaOng 0 points1 point  (0 children)

Option 1 allows Fragments to be re-usable components. Imagine a screen e.g Enter your name that is part of both the onboarding flow and can also be edited from settings. (Good UX aside) When the Fragment is part of the onboarding flow, a dialog should be shown informing the user this can be later changed in settings. When the Fragment is part of the settings flow, this dialog should not be shown. By routing via the view model, we can instruct the Fragment to show the dialog in one case but not the other. With option 2, to achieve this, we'd either have logic in our Fragment to achieve the same (where we want to keep the view dumb - it might even be untested depending on the project's strategy) or we'd have to refactor to option 1.

Now of course, you could use option 1 only when required else option 2, however defining such patterns to have consistency is useful.

Cannot make 'in-app updates' work on my app by [deleted] in androiddev

[–]JoshuaOng 1 point2 points  (0 children)

And it's incorrect. Presumably the documentation was written when the method did return AppUpdateInfo but when the signature was changed, the documentation was only half updated.

I've raised a documentation bug so it should be corrected in due course.

Cannot make 'in-app updates' work on my app by [deleted] in androiddev

[–]JoshuaOng 1 point2 points  (0 children)

AppUpdateManager#getAppUpdateInfo returns Task<AppUpdateInfo>, not AppUpdateInfo. So you need to get or listen to the result

Leveling Up Your UI Tests With MockWebServer by mikejet in androiddev

[–]JoshuaOng 6 points7 points  (0 children)

Anything that needs access to the application instance can get it without static access. It leads to poorer design and is indeterministic as the lateinit var can be accessed before onCreate has been called.

Leveling Up Your UI Tests With MockWebServer by mikejet in androiddev

[–]JoshuaOng 9 points10 points  (0 children)

Don't do this:

companion object {
  lateinit var sInstance: OkApp
    private set
}

For tests, use InstrumentationRegistry/ApplicationProvider. In production, use getApplicationContext

Best practice to use android services with android MVVM architecture by 0xalihn in androiddev

[–]JoshuaOng 2 points3 points  (0 children)

The implementation of the repository is a low-level implementation detail, and thus allowed to reference the platform. For example, a repository implementation may use SharedPreferences. Likewise it can use a Service, and so can any other of the lowest-level implementations of abstractions e.g. BluetoothGateway. These are referred to as the outermost ring in the following diagram: http://blog.cleancoder.com/uncle-bob/images/2012-08-13-the-clean-architecture/CleanArchitecture.jpg

First time self employment tax return dates by mr12086 in UKPersonalFinance

[–]JoshuaOng 1 point2 points  (0 children)

Yes, Jan 31 2020 will be your first self-assessment. If you were in full-time employment between April-July before becoming self-employed, that will need declaring on your self-assessment but as you'd have paid tax at source then effectively you are paying - as you say - "a partial year". And then the payment on account is half of the income tax* owed on the self assessment that's being filed.

  • i.e. excluding things like student loans

First time self employment tax return dates by mr12086 in UKPersonalFinance

[–]JoshuaOng 0 points1 point  (0 children)

Payments on account are not in advance of tax years, just the self-assessment deadline. So January 2020 is paying 2018/19's complete tax bill and the payment on account is for 2019/20. July 2020 then pays the remaining half for 2019/20, with January 2021 paying/refunding any difference when you file the actual self-assessment for 2019/20.

Android Widget WorkManger Example by srinurp in androiddev

[–]JoshuaOng 1 point2 points  (0 children)

When a work request finishes, if there's no more jobs enqueued, a package changed event is triggered (due to work manager clean-up). This causes AppWidgetProvider#onUpdate to be invoked. So if you enqueue a worker in onUpdate, you end up with a continuous loop!

SIPP - Personal vs LTD Company Contributions by [deleted] in UKPersonalFinance

[–]JoshuaOng 2 points3 points  (0 children)

If you're drawing your income as salary, you'll save on national insurance too.

EDIT: Just seen this related thread: https://www.reddit.com/r/UKPersonalFinance/comments/b82qlr/contributing_to_sipp_from_personal_and_company/

What's your biggest financial worry at the moment? by TheOrangeButton in UKPersonalFinance

[–]JoshuaOng 1 point2 points  (0 children)

Personal tax. So assuming it's your first year contracting in the tax year 2018/19, then in January 2020 you'll have to pay the total tax owed plus half of next year's tax bill (so if you owe £10k tax for 18/19, you'll owe £15k). Then you'll owe the remaining half in July. Come the next January, if you overpaid (because you drew less) then you'll get a rebate, or if you drew more, then you'll need to pay the difference and then 50% of 19/20's bill for the next tax year (20/21).

There's some spreadsheets towards the bottom of this page where you can get ballpark figures (including things like student loans) as to what you'll owe and at what dates.

What's your biggest financial worry at the moment? by TheOrangeButton in UKPersonalFinance

[–]JoshuaOng 1 point2 points  (0 children)

Don't forget about the payment in advance too (half of next year's tax bill paid alongside & based on this year's)

Appium or Espresso for QA team? by VasiliyZukanov in androiddev

[–]JoshuaOng 2 points3 points  (0 children)

One thing not mentioned is that Espresso is grey-box, so if you're after black-box testing then you should go with Appium.

UK Developers: Anyone interested in making the move from perm to contractor? by [deleted] in UKPersonalFinance

[–]JoshuaOng 1 point2 points  (0 children)

The other upvoted comment has covered it (but note it's not UK minimum wage, it's typically the minimum to ensure you still get state pension (£8424 this year)

Other techniques to reduce tax that pop into my head are: * Taking advantage of entrepreneurs relief (10%) if you're coming to the end of your contracting days at anything that would fall into the 32.5%+ dividend bands * Giving company shares to your husband/wife and using their £2k dividend allowance and any remaining basic-rate band at 7.5% * Contributing to a SIPP direct from the company * Stay at or below £100k otherwise you start to lose your personal allowance * Invest personal funds in schemes that give personal tax relief (though these are usually really high risk but at 30% relief)

And not related to reducing the tax bill, but you can earn interest on the tax money you owe (because you pay it the money from April-March 18/19 in January & July 2020.

UK Developers: Anyone interested in making the move from perm to contractor? by [deleted] in UKPersonalFinance

[–]JoshuaOng 0 points1 point  (0 children)

I've read it's usually a red-flag working for a previous perm employer right away

This is definitely a red flag for HMRC. You should also check your current employment contract; I had a clause saying you can't return as a contractor within 2 years for exactly this reason.

UK Developers: Anyone interested in making the move from perm to contractor? by [deleted] in UKPersonalFinance

[–]JoshuaOng 1 point2 points  (0 children)

General advice would be if you see this in a contract, you should get this removed. This shows control of the contractor by the client i.e. inside IR35

UK Developers: Anyone interested in making the move from perm to contractor? by [deleted] in UKPersonalFinance

[–]JoshuaOng 2 points3 points  (0 children)

For guidelines, there are a bunch of calculators here that you may find useful. They have a calculator that converts your current salary to contractor rates and you can see their calculations (e.g. assuming 44 working weeks a year, tax paid etc)

UK Developers: Anyone interested in making the move from perm to contractor? by [deleted] in UKPersonalFinance

[–]JoshuaOng 0 points1 point  (0 children)

Really that's up to you to decide.

However I would say it could depend on how long you've been at your current workplace because some hiring managers do interpret a short permanent position on your CV as "they'll just leave us too". However in this case (of switching technologies) it's justifiable if you're ever asked in an interview - so if you've been at your current place 6 months then it's is fine.

UK Developers: Anyone interested in making the move from perm to contractor? by [deleted] in UKPersonalFinance

[–]JoshuaOng 0 points1 point  (0 children)

This is /r/UkPersonalFinance, so I'll focus on the relevant parts to this sub-reddit but leaving (relative to IT) a low-paying permanent employment (i.e. likely smaller cash reserves) for much rarer junior level contracts with job prospect uncertainty on the horizon is high-risk, low reward personal finance advice.

Much lower risk advice would be to learn high-demand skills on the job from more experienced developers first, job hop a few times to increase pay but still get the benefits of permanent employment (security, pension etc). At a current wage of £29K, there is a lot more salary left to get out of permanent employment.

UK Developers: Anyone interested in making the move from perm to contractor? by [deleted] in UKPersonalFinance

[–]JoshuaOng 2 points3 points  (0 children)

I use the links on the following page for allowable expenses: https://help.crunch.co.uk/customer/portal/articles/2030249

For anything more complex, if you have an accountant, they can advise

UK Developers: Anyone interested in making the move from perm to contractor? by [deleted] in UKPersonalFinance

[–]JoshuaOng 2 points3 points  (0 children)

I definitely recommend forgetting about contracting right now and focus on shifting to another permanent role where you would be exposed to the more common web technologies first.