mrthesis

u/mrthesis


r/PHPhelp•

For stuff like Logger and DB, I only ever want one instance and im trying to lock down alternatives to singletons when needing a dependency deep down a call chain.

At the moment dependency injection containers seems like the way to orchestrate the whole deal. Are there any alternatives to either a container (which itself likely would be a singleton) or singletons?

28

I have a colleague, which is very prone to making poor Pull Requests. He have 10+ years of experience in the industry. More often than not, I cannot run his code without either requesting changes after only a few minutes of reviewing or it will fail to solve the task at all. I have underlined the cost of me sending back a Pull Request immediately, both to my and his own time. But they still occur weekly. Management have had multiple conversations with him about this as well.

Examples can range from deleting system critical existing code (He could not figure out what it did so he removed it), code which cannot parse, referencing nonexisting variables/files because of spelling errors. All the

3123

r/composting•

See the following two images: https://imgur.com/a/oibKyvK

I have a rather large pile of small twigs (smaller than 0.5cm or chipped), leaves and grass turfs (Image 1). I also have a worm compost with mostly greens, but also a bit of browns (lefthand side of image 2).

Would everything compost faster if I merge them into one big pile? Would covering the big pile with a tarp after watering it, help the process? It's been nearly 6 months of almost no visible progress. I turn it every 2-3 weeks.

31

r/composting•

I have the top cuttings of a cherry tree that was on my lawn.

The first image below is my bin, which is empty (the previous owner used it as a compost/trashcan, so I emptied it completely). It's been raining heavily the last few days so no chance anything will turn brown in the next few days. My current plan is to make a pile of small branches and leaves, run it over with the lawn mower and throw that into the bin until 3/4 full. Should I do something other than this or is that a fine start?

https://imgur.com/a/8Bl8ZnI

56

r/composting•

I have a compost container like the one linked below in my yard. It's full of VERY dry material. The bottom part behind the cover is loose material, probably dry "finished" compost? In it is living an ants nest. Above it, the top third of the container seems to be layers upon layers of compacted dried leaves that I cant seem to turn, even with my rake.

Can I somehow salvage this, or should I empty the contents at the landfill and start over?

http://humus.dk/images/humuskomposter.jpg

83

r/AskProgramming•

Whenever I have to name a class something, I try to fall back on designpatterns. But when those fall short, I'm often blank on how to name my classes. In particular, I often have a class that want to convert or calculate something.

I don't quite think a repository name is usable for a convert class (that takes a model and creates another model based on some calculation). Similarly I don't think the strategy pattern is applicable to every "calculation" class.

What do you fall back on whenever you don't have a design pattern to lean against naming wise?

74

The actual question is at the bottom :-)

Current job

At my current job I have a ton of different responsibilities, there's some rather exciting project (and some annoying legacy ones but that's every job). But management is ruining it at the moment, in that there is no actual project management, and when there is it's quite often ignoring the software-developers input (like, should we even board this project, we likely can't make it within the scoped time). We're crazy busy, with the end result of every assignment feeling rushed because "we gotta move on". We're a man short, have been for 6 months, and they are still looking but nothing concrete. (One issue being they wont pay wha

11

r/Angular2•

I have a series of div's with a switch case, hiding them (I assume angular destroys them at this point). My custom components OnDestroy is fired when being hidden. Can I somehow prevent this? In the below example, when going from lineup to statistics, <app-widget type="lineup"> is destroyed.

<div *ngIf="segmentModel" [ngSwitch]="segmentModel">
  <!-- lineup case-->
  <div *ngSwitchCase="'lineup'">
    <app-widget type="lineup"></app-widget>
  </div>

  <!-- statistics case-->
  <div *ngSwitchCase="'statistics'">
    <app-widget type="statistics"></app-widget>
  </div>
</div
95

r/PHPhelp•

I have a many-to-many relationship, currently with about 2.5k rows in one and 100 rows in the other (think Posts/Tags). Each Post has about 3 tags. This leads to my pivot table having 7.5k rows.

When trying to do $posts = Post::with('tags')->get();debug bar tells me it hydrated 10000 models (2500 + 7500). Can I somehow change this to only hydrate 2600 (2500 + 100)? Each tag only needs to be loaded once.

I'm guessing its because of the loading of the pivot/bridging table data, but I'm in a purely display scenario, so there is no need to do syncand such.

Otherwise, I guess it's time to look into pagination on server side, was hoping to keep that on client side for now (via Datatables

33

r/legogaming•

My kids love playing LEGO Marvel Super Heroes and I'm considering which LEGO game to buy next. Their main interest is traveling around in the open world part, either by vehicle, aircraft or ironmanflying.

Any recommendation for the best open-world game of the lot? I'm currently considering DC Super Villains.

Thanks :)

816

r/PHPhelp•

I have two parent tables, A and B and a child table C which has a relationship with either A or B. How do I best express this?

The tables is something like this:

 A: id, text
 B: id, text
 C: id, sub_text

Adding two columns, a_id, b_id being nullable on C seems like a waste as only one of them will be set. I could add two columns parent_id and parent_table_name, but I would like some sort of foreign key relationship where the child data is deleted, and then this wont work (I think).

13

r/techsupport•

I'm having issues with my start menu and settings app, which I can't seem to fix, nor google myself to a fix.

Start: If I open start and enter something, like "cmd", I can't right click it to open in administrative mode, the right click menu closes immediately after right clicking. Whenever I click something in start, it does not always start, sometimes it starts but doesn't close the start menu.

Settings: Win+I doesn't work. Sometimes I can't scoll down in menus. Any start menu entry going to settings wont work, I have to open the settings app manually and find the entry.

I've run "Reset This PC" (but kept user files), updated to newest windows update, scanned with malwarebytes, windo

11

r/PHPhelp•

Say I have a book model, but now I need some method that does a complex aggregate of a subset of the books. Where should this live? If I put it in my model, I get this wierd coupling that I need a specific book object to get back a collection of books. I could inline it where I need it, but then reuse is limited.

17

r/AvPD•

I've noticed a pattern of me hating to share anything with family or people close to me. When they give compliments on my progress I get all angry inside, and frustrated when they give me feedback. The ones close to me is the ones I want the least from. On the other hand, telling internet friends that I started a job, getting a compliment is valuable and meaningful. It's so weird having this all flipped compared to what is normal. The only connection I can make is that as a kid I got very little help with bullying issues, got a of stupid praise (oh be a millionaire one day) but no help getting forward. On the flip side, being "in" with my friends was all I craved, I didn't want to be left ou

339