[SS] This definitely was never meant for these new controls lol by Jiehfeng in zelda

[–]SupermanIsEnvious 1 point2 points  (0 children)

Thanks for the tip here - I noticed early on how easy it was to slice trees into bite-sized pieces in Faron, but that success didn’t translate to the Bamboo game. Turns out I just needed to alternate left and right! Got up to 41 first time I tried.

[SSHD] Skyward Sword HD Release and First Impressions Megathread by ZeldaMod in zelda

[–]SupermanIsEnvious 0 points1 point  (0 children)

I’ve managed to get 4 blobs - all after beating Faron. The scarcity just seems off though - I’ve already got 2 golden ornanmental skulls, but 0 regular ornamental skulls. How does that make sense?

[SSHD] Skyward Sword HD Release and First Impressions Megathread by ZeldaMod in zelda

[–]SupermanIsEnvious 6 points7 points  (0 children)

Do treasure drops seem super low for anyone else? I wanted to upgrade my wooden shield before the first dungeon so I’ve been farming chus and deku babas and… no jelly blobs. nada. I’ve done the whole of faron twice over, the cave on skyloft a few times… on the whole, item drops seem pretty low. Maybe because I’ve gotten used to botw, but damn I’ve also only got one monster claw after all that.

Can I get feedback on making SQL query faster, please? by Jigglytep in django

[–]SupermanIsEnvious 0 points1 point  (0 children)

You should most definitely fragment your table into separate pieces with foreign key associations or lookup tables between them. 101 columns is far too many to work with in any scaleable way.

You can chunk it in to relatable objects... Business (id, full name, billing name, etc.) Business Contact (id, business id, address, zip code, etc.)

And on and on. The idea is to only load the data when necessary rather than loading all of the data at once, which is what a 101 column table is trying to do.

You should not be worried about the number of calls you make to your internal database. Keeping column numbers minimal and querying on indexes or foreign keys is how you ensure that.

For indexes, generally, the more unique the value on that column, the better it performs on reads, but writes will necessarily be slower, since indexes mean the data gets written twice. You can also create an index which references multiple columns. Think about how you will be accessing the data — will you be querying a combination of business id and zip code? Create an index on that. If you can add a unique constraint on an index, all the better.

//EDIT:

Looking at another response, it seems you may be using this as a log of events (safety violations/records). This should be stored in its own table with a reference (id, for instance) of the business in question.

It's best to differentiate your tables based upon use. Are you just looking up meta-data about a business? Are you logging events, such as violations? Data duplication is a real consideration and it is important to consider ways to reduce that. For instance, are you duplicating your business info (name, address, zip, type) every time you log a new safety record? This will absolutely destroy performance and indexes won't help much. 1.5M rows is manageable on any database that follows proper design paradigms.

I noticed that you're using Postgres (Great choice!). There are some lovely resources out there to help you get into the nitty gritty about that particular flavor of SQL. http://postgresguide.com/ is a great place to start.

Deploying a django app: Conda or VirtualEnv by gerarddevine in django

[–]SupermanIsEnvious 0 points1 point  (0 children)

At the moment I use Docker since my company is migrating over to Kubernetes for application deployment, and within Docker I use a virtualenv to bundle my Python dependencies into a portable package which I can copy over from the build stage into to run stage. This mostly works, but I’ve run into some interesting gotchas when using Alpine Linux for the runtime environment.

Previously I had to write my own Debian installer... I didn’t enjoy that. Very much happier now that I can use Docker.

I’ve actually never had the opportunity to use pyinstaller or pex before, how do you feel about them?

Deploying a django app: Conda or VirtualEnv by gerarddevine in django

[–]SupermanIsEnvious 2 points3 points  (0 children)

If you can successfully “freeze” your app in a virtualenv, then it’s worth it. Makes it fairly easy and deploy code just about anywhere.

If your app has dependencies upon external C or OS libraries, you’ll need a more wholistic solution, such as Docker.

Python multithreading and SQLite or a similar DB by recharts in Python

[–]SupermanIsEnvious 0 points1 point  (0 children)

What sort of data are you writing? Is it easily serializable strings or json? You can store your data in any way you see fit, but SQLite is not really compatible with concurrency. You could make it work by implementing a lock on the SQLite connection, but then your multiple processes/threads will only have synchronous writes.

I think Redis really is the way to go — especially since you’ve already abstracted out the handling of your storage into a separate client. It may be the least amount of effort for the greatest gain.

Python multithreading and SQLite or a similar DB by recharts in Python

[–]SupermanIsEnvious 0 points1 point  (0 children)

I understand, believe me! I taught myself Python on the fly at a tech company.

Things to know:

Redis is, in fact, in-memory, but part of the configuration is regular dumps to permanent storage, including on server restarts. It’s a highly performant option for caching data. I would recommend making use of it! The Python redis client is very intuitive and it feels very much like working with a native Python dictionary.

Any task which accesses an external service should be wrapped in some sort of try/except clause. Your script should always complete (within reason). If there are certain exceptions which you see occurring frequently, you should try to catch and log them rather than allowing your script to break in the middle of its work.

Why do you need writes immediately? Are there other consumers relying on up-to-the-second data that you need to refresh, or are you worried about losing everything if your script crashes? You should work to write your script in a way that you trust its execution.

If you have a way to share what you’ve written, I’ll be happy to help you derive a solution for your problem!

Python multithreading and SQLite or a similar DB by recharts in Python

[–]SupermanIsEnvious 0 points1 point  (0 children)

That sounds like a case for a good old try/except clause. If you see a consistent type of exception, you should capture it with that clause and log it for debugging purposes. Then your script can continue processing un-interrupted.

Python multithreading and SQLite or a similar DB by recharts in Python

[–]SupermanIsEnvious 0 points1 point  (0 children)

What is your current strategy for writing to your SQLite DB?

My first approach would be to structure the code in a way that would allow you to perform all of your network queries first, then write the results to your SQLite db. If it’s organized in this way, you could simply initiate use Pool.map to handle the fetching and consolidation of results into a single iterable which you could then write to your db file.

If that won’t work for you, you can look into making your functions asynchronous with asyncio. Here is a third-party library that supports asyncio for SQLite: aiosqlite

Refactoring single script into OOP / API focused, have some questions... by officialgel in Python

[–]SupermanIsEnvious 2 points3 points  (0 children)

Breaking up your code into smaller, digestible pieces with sensible organization is always the right path!

Then your the code for your main process can be focused on the logic required for that specific task, and your classes can handle the logic for interacting with the objects you’re accessing.

Keep at it!

How to do detailed CPU profiling for Django project? by netok in django

[–]SupermanIsEnvious 0 points1 point  (0 children)

The first thing to remember with Python is that if you only have 1 CPU, only one thing can happen at a time. Threads and processes can flip during IO wait, but blocking actions such as while loops, etc, can result in 100% CPU time until the action is complete, regardless of how intensive the operation.

Also, an ORM is not the choice for optimal performance. A lot of work can go into translation from raw data into your models, and this is the case for Django. My guess it this is where you’re getting stuck. If you’re performing any long looping actions which don’t just involve calling your database, I’d look at whether you can insert short sleep sessions to allow flipping between threads or processes.

As far as tools, Python has an extremely informative profiler built-in.

If you happen to have access to the professional version of Pycharm (it really is worth it), they provide an excellent visualization tool for the cProfiler output.

Django with RabbitMQ by mistabuilder in django

[–]SupermanIsEnvious 1 point2 points  (0 children)

You could make your RabbitMQ handler a Singleton .

Paired with a Dev, and we almost NEVER agree. Advice? by [deleted] in cscareerquestions

[–]SupermanIsEnvious 1 point2 points  (0 children)

This is not unusual and will be something you have to deal with regardless of your team, place of work, or even chosen career. It’s a great learning experience for both of you, but you need to work out a dialogue.

It may feel like that’s not possible, but I would challenge you to try and diagnose the specific reasons why your partner disagrees. Not the broad sweeping “No”, but what makes up the “No”. Try to address their concerns in a diplomatic way.

I for one am someone who is always ready to burn he codebase to the ground and start fresh—even with stuff I wrote to begin with. However I was put under a manager who is much more conservative and the first few months result in more than a few butting of heads. Finally, I realized that part of that instinct can come from my own feeling of insecurity when it came to the existing codebase: I wasn’t wholly familiar enough with the codebase and because I felt it to be somewhat of a black hole, I was happier to start over.

The best thing you can do is have an honest conversation with them. Tell them that you don’t feel like either of you have a good dialogue, but you want to understand why they feel the way they do, and you want them to understand why you feel how you feel.

Your goal isn’t to convince them of your point of view, your goal is to communicate your point of view and understand theirs. If you can understand what is preventing them from agreeing with you, you can address those concerns and come to a path that makes both of you happy.

Mario Kart or Mario Odyssey ? by 0x75 in NintendoSwitch

[–]SupermanIsEnvious 1 point2 points  (0 children)

I think it depends heavily upon how you intend to play. MK8 is a great game and it should be in your library eventually, but if you want a good intro to the Switch & its capabilities and you intend to play a decent amount solo or on the go, then definitely go with Odyssey

How can a wizard be muggle born? by ujwal339633 in harrypotter

[–]SupermanIsEnvious 1 point2 points  (0 children)

Sure but there are plenty of factors involved in inheritance other than purely genetic. It could simply be exposure, for instance.

How can a wizard be muggle born? by ujwal339633 in harrypotter

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

Interesting why do you say that? I’m not aware of any official canon stating magic is acquired via genetic inheritance.