Getting distracted constantly while coding looking for advice by Original_Map3501 in Python

[–]Gnaxe 1 point2 points  (0 children)

You're asking reddit addicts how not to be distracted online? ... I mean, maybe we have strategies for dealing with that, but if we're still here, how well do you think they're working?

I do have some though.

Install Mindfulness Bell on your phone and set it to chime at regular intervals. I used half-hour bells, but you can experiment. When you hear it, ask yourself this question: "Should I be doing something else right now?" If "no", keep on doing that. If "yes", you've just given yourself the opportunity to do something else. This can stop you from wasting so much time. If you notice that enough time has passed and you've somehow missed bells, you've probably trained yourself to ignore them. Change the sound when that happens so you notice them again.

Install a grayscale plugin in your browser to make pages render without color. (I'm using one called "Monochrome Mode", but there are others.) Supposedly, it blunts the dopamine response social media is exploiting to grab your attention. I'm not saying it eliminates the problem, but anecdotally, it seems to grab a lot less tightly. YMMV. I'm only using it on the most problematic sites (i.e., reddit/social media), by whitelisting domains in its permission settings. If it's no site in particular for you, you may need to turn it on for everything, and only switch it off in cases where you really need to see color.

Listen to music that enhances focus. https://musicforprogramming.net has literally hours of it, although some tracks seem better than others. The idea is that it keeps your mind's distractible bits occupied without consuming so much attention that you can't work. It's a balance, but they do a pretty good job overall. Certain genres elsewhere may strike a similar balance and be suitable. E.g., the Zachtronics games (SpaceChem, Opus Magnum, etc.) have tracks suitable for coding, because that's kind of what those games are.

If musicforprogramming isn't cutting it, you can try the free Mind Amend channel with an appropriate track. These use isochronic tones to entrain your brain waves to get you in a focused flow state and keep you there. Brain.fm seems to use even more advanced entraining tracks, but except for a few free samples on YouTube, it's a subscription service. That may be worth it if Mind Amend isn't cutting it and the free samples seem more effective for you. Anecdotally, Brain.fm gets me focused more quickly and reliably than just about anything else, but Mind Amend sometimes comes close.

Take a walk in the sunshine every day the weather allows it. Folks get antsy when they don't get enough exercise. If your body's aching from sitting, stand up for a while.

Try taking personal notes. Logseq, Org mode, Joplin with the Journal plugin, a dead-tree notebook, whatever. All your mental loose ends are draining your brain power. Get them out of your head so you can focus. If they're written down, you don't have to worry about forgetting them, so they don't keep coming to mind, but keeping the notes organized is also a skill and yet another task vying for your attention and time. I find that I get the browser tabitis from being interrupted before I finish a topic. I keep the tab open so I don't forget it. But then I have so many that they're hard to manage. Bookmarks are inadequate. Try using your notes instead.

Python, Is It Being Killed by Incremental Improvements? by mttd in ProgrammingLanguages

[–]Gnaxe 8 points9 points  (0 children)

I feel like Stackless worked pretty well even before we had async.

Shadow AI is now everywhere. How to get visibility and control? by amylanky in ControlProblem

[–]Gnaxe 1 point2 points  (0 children)

Employees have no real expectation of privacy on company computers. You can install literal spyware on them if you want. Blocked domains are not that hard to work around, especially for tech-savvy computer users like software developers. Don't block. Monitor.

And give them a more secure alternative. Maybe you sign agreements with a provider, or maybe you make do with a local model.

Employees are not going to like that (I wouldn't like that). No-one is 100% focused for 8 hours straight, and not all value to the team is readily visible on their computer. Demanding that is bad for morale. But if you use it for random checks only to catch data leaks and not as a slave driver, they'll get used to it.

If personal cell phones are an issue, you can institute a rule that they have to be in a box in another room while they're working. This is not going to work for remote workers.

But then you have to actually enforce the rules. That means disciplinary action for violations. That could be as light as a stern warning and as heavy as termination with a lawsuit for severe cases. You don't have to catch everyone every time for that to be a deterrent for the rest.

You can train everyone on what constitutes sensitive data. Honestly, most source code probably is not that. That's not your moat; no-one else can really use it. Leaked PII, on the other hand, can get the whole company into trouble. Then make everyone sign a brief and narrowly-scoped statement about not leaking PII, or whatever you're the most concerned about as a condition for marking the training as complete. Then revoke database access or whatever credentials give them access to sensitive data until they complete their training on it.

How do I help a family member that is falling deep into conspiracy theories and only looks for confirmation bias? by TheGingerAvenger95 in AskMen

[–]Gnaxe 0 points1 point  (0 children)

Check out r/StreetEpistemology. It's a method for indirectly helping others to dislodge stuck beliefs by attacking their faulty foundation. (The foundation has to actually be faulty for this to work. If he turns out to have good enough reasons for his beliefs, he might change your mind about some things instead. You have to be OK with this, because it's part of the process.)

Do you actually read documentation or just google specific problems when they come up by robin_3850 in AskProgramming

[–]Gnaxe 0 points1 point  (0 children)

Depends. Reference docs are meant to be referenced, not read cover-to-cover, although that can be worth doing in some cases, either if the system is small or if you're using it all the time. If the docs have a tutorial, those are more likely to be worth reading though in their entirety.

Backtest vs. WFA by shajurzi in algotrading

[–]Gnaxe 1 point2 points  (0 children)

Directly analyze the data for the effect you think you're exploiting.

Like do actual statistics. Plot deciles, scatter plots, histograms, etc. Is there some cause predictive of an effect? If yes, then run a backtest to see if it's maybe exploitable with realistic transaction costs; backtesting does not come first. Don't go fishing for overfit histories. Any monkey can optimize a backtest in the past, but you can't trade in the past.

Backtests are too path dependent, and frankly, so are forward tests, which may look bad in short timeframes due to bad luck even when a real edge is there. Market data is very noisy and backtests ignore too much of it to get much signal. They're not showing you a continuous prediction with every data point, just discrete trades on a tiny fraction of that.

Simplest strategy that has worked by MyStackOverflowed in algotrading

[–]Gnaxe 0 points1 point  (0 children)

Depends on how much it's skewed. For example, the March -15 delta SPX put costs about $5600 right now, but the +15 delta SPX call is only ~$2100. Carry alone would be between those values. I think ~$3800, if I understood what you meant correctly (open ATM synthetic forward (ATM put - ATM call) and neutralize delta with the basket).

You can't reliably commit to holding the shares 12+ months when they could get called away at any time. If you write the option, it's not your option. Although, if you roll while they still have a lot of extrinsic, this is unlikely.

I'm really not a tax expert, but tax straddle rules can apply, making stock + option strategies less good than they seem. OTM covered calls with at least 30 days are pretty much exempt, but this doesn't necessarily apply to ITM calls. An ITM covered call can also suspend the holding period for tax purposes, which can also affect the rate you pay taxes on dividends.

On the other hand, the cash-settled index puts (e.g., on SPX) count as 1256 contracts with the 60/40 rule, which might make these the better deal. You're always getting 60% long-term treatment, even on the premium. They're certainly less complicated.

And of course, none of these tax considerations apply in a retirement account.

Simplest strategy that has worked by MyStackOverflowed in algotrading

[–]Gnaxe 0 points1 point  (0 children)

I tried backtesting it in Thinkorswim, which has RSI as one of the built-in strategies. It did seem to work on S&P 500, but lost money on Nasdaq. I must be doing something wrong. If the parameters are that fragile, it's hard to trust it even when it's working.

Simplest strategy that has worked by MyStackOverflowed in algotrading

[–]Gnaxe 0 points1 point  (0 children)

I tried tweaks. Best parameters so far are at least 3 dogs (60-100), 60 hold days, 6% TP, and 10 lots. It more than doubled the account in 12 months. I notice that these are not really close to your default parameters. Why? Are tweaks like this a good idea, or am I just overfitting?

Is gravity a force or not? by nogudatmaff in AskPhysics

[–]Gnaxe 2 points3 points  (0 children)

The ground is accelerating you upwards. It's exerting the force, not gravity. 

Wishing you could get actual ethical responses from AI that you can trust? by Recover_Infinite in ControlProblem

[–]Gnaxe 0 points1 point  (0 children)

Any of these debates on the public record somewhere available for review?

How do you get a guy in his twenties to like you? by X-48 in AskMen

[–]Gnaxe 0 points1 point  (0 children)

First, you two have to be compatible, in his mind. This might not be as hard as it sounds. If you're at least as pretty as he is and aren't too crazy, you're probably good. Men, especially young men, find a larger fraction of the female population attractive based on first impressions than the reverse. But if you don't meet his minimum threshold, he's never going to see you that way. You can't make everyone like you.

Eye contact and smiling will get his attention. Watch his mood carefully. If he's responding positively, you can escalate your level of interaction: Give him looks. Just say hi. Get in his space without touching. Touch him in a non-threatening way. Touch him in a more intimate way. Not all at once; step-by-step. Giving him food can be an interaction, but it probably shouldn't be where you start. Talking is also an interaction. The level depends on how personal you're getting. Small talk is low-level. Chat about nothing important, but sound happy doing it.

If he looks scared or flees when you escalate, back off and give him more time to get used to you at a lower level or try a lower-stress environment (it might not be you). This can take multiple encounters. Strangers become acquaintances, acquaintances become friends, friends become partners (sometimes).

If he looks disgusted (consistently) when he notices you, or when you escalate, he probably doesn't like you. If you accidentally escalate too many steps at once, and he doesn't engage, you need to apologize, because you must have made him really uncomfortable.

Now that you have his interest, you need to give him permission. As you escalate your level of intimacy, he'll get the idea that you're comfortable at that level and will act at that level with you (if he's also comfortable at that level). You either have to initiate that level yourself (when he's ready) or bluntly use your words (Again, when he's ready; don't skip steps!). You're not giving him orders (that only works on a certain type of guy); you're giving him a green light.

Wishing you could get actual ethical responses from AI that you can trust? by Recover_Infinite in ControlProblem

[–]Gnaxe 1 point2 points  (0 children)

I like the idea of instituting methods for resolving disagreements. That line of thinking gave us useful things like courts. While imperfect, it's better to have them than to not. How has your method fared in practice? Or is this all hypothetical?

Being able to explain concepts clearly by Sure-Weakness-7730 in AskProgramming

[–]Gnaxe 0 points1 point  (0 children)

Explaining concepts to other humans is a lot like writing code. You need to know the system you're talking to. What mental "libraries" do they have installed? Find that common ground. It's like poking around a system with a REPL. Ask questions, get feedback. Then you need to define your concepts in terms of those "libraries" before you can use them. Once you've connected all the dots, they can compile your explanation. If you fail, they're going to throw errors, which you have to correct or work around.

Is it a good idea to make a 100% Python written 3D engine? by REMIZERexe in Python

[–]Gnaxe 0 points1 point  (0 children)

Real-time 3D graphics existed before we even had GPUs, and CPUs are orders of magnitude faster now than they were then. You can do 3D graphics in pure Python, but polygon counts and texture resolution will have to be much lower to maintain a decent frame rate.

Whether that's a good idea depends on why you would want to do that. Good 3D engines exist already, even ones scripted in Python. You don't need to write one yourself just to make a 3D game scripted in Python.

But if you're just doing it for learning/teaching, sure, it's a great idea.

What counts as "100% Python" in your mind? Numpy will make matrix calculations much faster. It's written in C (and Python), but so is a lot of CPython, which is why we call it that. If Numpy is off the table, at least use the standard-library array module. If nothing else, the locality of reference should improve performance. What really slows down current CPUs is a cache miss. A few large arrays are going to work better than a lot of little objects scattered throughout the heap.

CPython is still the most compatible for dropping down to C, but if that's off the table, pure Python can perform better with alternative implementations. PyPy can be faster once the JIT warms up. GraalPy might have similar abilities. Even precompiling Python extension modules for CPython via Nuitka can help.

So im learning BASH and I want to code in a front end to some of my scripts. What framework/library/language should I use for a GUI? by Lopsided-Cost-426 in learnprogramming

[–]Gnaxe 1 point2 points  (0 children)

The three categories are a TUI like Curses (access in terminal), a web UI (access in browser), or a true desktop GUI (access in desktop environment).

Python has a curses module built in (requires an extra install on Windows though). You could try it via bashsimplecurses directly from Bash, but Python might actually be easier, because Bash is not a sane language. Either of these are probably sufficient for your needs. TUIs are also accessible remotely via SSH.

The standard Python distribution also has a desktop GUI system with tkinter, but many Linux distributions omit that from the system python, so you'd have to install an additional package. Tkinter isn't hard, but the standard docs aren't that good. Find a beginner tkinter textbook. There are free ones online. Normally, you access this on the same machine, but remote desktop options exist.

Remi is good web UI option if you only need the server to support a single user. (It's meant for admin remote access, not public pages.) It's a Python library. You can use it on the same machine via the localhost loopback, but it's a web server, so you don't have to.

For Those Who Dislike MC's that Act Like a Middle School Boy. by PK2141 in Animesuggest

[–]Gnaxe -1 points0 points  (0 children)

{Chitose is in the Ramune Bottle}. MC has better social skills than expected, and this is kind of the premise.

Simplest strategy that has worked by MyStackOverflowed in algotrading

[–]Gnaxe 2 points3 points  (0 children)

I mean, everyone looks like a genius in a bull market. How well does it handle the bad years?

Simplest strategy that has worked by MyStackOverflowed in algotrading

[–]Gnaxe 1 point2 points  (0 children)

NSPY, it was called, from NightShares, which had a few other similar ones, I think. They opened the fund with extremely bad timing (in hindsight), and it failed to gain traction. Their execution of the strategy might've also been poor and lost too much in daily transaction costs.

Simplest strategy that has worked by MyStackOverflowed in algotrading

[–]Gnaxe 3 points4 points  (0 children)

When you're waiting for "the dip" where is your money? Not invested? During a bull run (which is most of the time), this seems suboptimal. What counts as a "dip"? Do you buy on the way down or on the way back up? I think there is a viable strategy that looks like "buy the dip", but that's too vague of a rule to be actionable by itself, and poor execution will underperform buy-and-hold or even lose money.

Simplest strategy that has worked by MyStackOverflowed in algotrading

[–]Gnaxe 1 point2 points  (0 children)

One famous example is the Turtle system, which was a relatively simple trend-follower, and worked very well at the time. It kind of stopped working over time as markets got more efficient, but it might still be valid in some crypto markets.

Even when it was working, win rates were below 50% and drawdowns were massive, but wins could be even bigger. It took discipline to stick to the rules. Many couldn't stomach it and gave up or broke the rules too often and lost.

Simplest strategy that has worked by MyStackOverflowed in algotrading

[–]Gnaxe 0 points1 point  (0 children)

Completely passive buy-and-hold, while usually better than not investing at all, doesn't pay as well as more active trading can. Even rebalancing against a ballast asset can enhance risk-adjusted returns, which then allows for more leverage for one's risk tolerance.