Return to Level1Techs.com

Devember 2018

devember2k18

#181

I actually have 24" 1920x1200 main display plus old 22" BenQ 1680x1050 as secondary. I generally don’t like to have anything important open on my secondary screen, only stuff that I need to quickly reference. That’s why I currently have both the text editor and web browser side by side on my main monitor.

My plan is to get 1440 display, retire the old BenQ and put my current 24" vertically next to the new 1440 display. Though lately I’ve been thinking if I should get 30" 4K display, that would have enough space to put everything on one screen. Even with 4k display I still wouldn’t give up secondary screen :grin:.

One option would be to buy ultra wide display, but I don’t like those since while gaming I like to have discord and what not open on to the secondary monitor.


#182

4K is good, i got one of the korean 39inch 4k machines. Not the best monitor you will ever see but does the job! I wanted to try and get two 1080 screens either side, but am unwilling to pay for a good monitor mount. I bought a cheap one and 3d printed some extended arm bits, but that didn’t work well. They couldn’t hold the weight up.
30inch is a bit small to be running 4k, unless you have super good eyes. You can do the font scaling perhaps.


#183

Yeah, that’s why I feel 1440p is the sweet ass pot. Not too big, but just big enough to fit in most Vesa mounts.


#184

That’s what I’ve been thinking too. I would like to see 30-32inch 4k monitor in action to be able to determine if that would be okay for me or not. I’d rather not use scaling, since imo it kind of defeats the purpose of having 4k display if you will then scale all down to 1440ish size. Everything will of course look sharper because of the added pixels but, meh, naah :smiley:

Plus I don’t know how well linux DEs handle scaling.

I hear ya, so many have told me this that maybe I’ll eventually go and buy 1440 monitor.


#185

He didn’t mean to scale the stuff down, he meant scale the font up (so its not too tiny).


#186

Ah yea sorry, I misunderstood that. :man_facepalming:

And I also wrote wrong, meant to say scale up and not down. I should sleep more. :smiley:


#187

Would anyone have an suggestions for reducing the complexity of this code snippet? My complexity plugin says that it’s too high, but I feel like it is succinct enough.

const getCategory = async (req, res, next) => {
  try {
    // check to make sure they didn't send an empty parameter
    if (req.params.length !== 0) {
      // get current list of categories
      const categories = await conn.query('SELECT * FROM Categories')

      // compare parameter to list of categories. If we found a match, return
      // the found category. If there was no match return a 404 to the requester.
      if (Object.keys(categories).filter(key => categories[key].category_name === req.params.category)) {
        res.send(await conn.query('SELECT * FROM Categories WHERE Categories.category_name=?', req.params.category))
      } else {
        res.sendStatus(404).send('No matching categories found.')
      }
    } else {
      // they sent a bad request, the category param should not be empty
      res.sendStatus(400).send('Bad Request: Parameter should not be empty')
    }
  } catch (err) {
    res.sendStatus(500).send(err)
  }
}

#188

Yeah font scaling in windows, or the “make look big” option. It usually scales all the UI elements too, for most things. I still run some font scaling, If I don’t I tend to stick my face right in the screen before I know it… Wendell mentions that the magic number is 40 inch at 4k where you do not need to scale anything, and I think that is on the money.
Otherwise you are just creating a retina display, like an iPhone or something.


#189

@ArgGrr I see we posted at the same time, wanna take a stab at it?


#190

Hmm how is it measuring comp0lexity? By the nesting?
At the end of the day, nesting is fine unless you are doing recursion, then you’ll blow out the stack.
Best practice is a guideline, not a regulation. If it is working great, and you understand it, leave it alone :slight_smile:

But the only suggestion I have is check if things are valid, and bail out if they are not. That will reduce the amount of stuff in curly braces as you go down, including other curly braces.

const getCategory = async (req, res, next) => {
  try {
    // check to make sure they didn't send an empty parameter
    if (req.params.length == 0) {
      // they sent a bad request, the category param should not be empty
      res.sendStatus(400).send('Bad Request: Parameter should not be empty')
	  return;
	}
	  // get current list of categories
	  const categories = await conn.query('SELECT * FROM Categories')

	  // compare parameter to list of categories. If we found a match, return
	  // the found category. If there was no match return a 404 to the requester.
	  if (Object.keys(categories).filter(key => categories[key].category_name === req.params.category)) {
		res.send(await conn.query('SELECT * FROM Categories WHERE Categories.category_name=?', req.params.category))
	  } else {
		res.sendStatus(404).send('No matching categories found.')
	  }

  } catch (err) {
    res.sendStatus(500).send(err)
  }
}

#191

OK, how do you guys post code? And it looks like code… How U all do that?


#192
```
your code here
```

becomes

your code here

#193

Here, I’ve made this post a wiki. You can check it out:

three backticks surrounding your code:

void main() {
     std::cout << "Hello world" << std::endl;
}

four spaces makes a code block as well.

void main() {
    std::cout << "Hello world" << std::endl;
}

#194

Yeah the pre-formatted text button </> in the post edit window is what I use.


#195

Now I have to go back and edit all my posts!

Edit: I tried but it’s more work than I expected. I’m just going to change how I do future posts. That way it shows my learning on how to use the forum as well as code.


#196

void

Triggered.


#197

Time to step up your dev game :wink:


#198

How do movies not use this?!


#199

Just spent a few hours today going through my code trying to figure out what I was doing wrong that prevented my textured polygon from rendering when matrix transformations were applied to it.

Finally realized that I wasn’t doing something wrong (well technically it was wrong), but the neweste version of GLM I am using changed how matrices are initialized when using glm::mat4 yourMatrixHere;. Back in GLM 0.9.8 it initialized as the identity matrix, now in 0.9.9 it initilizes as the [0] (empty) matrix… GAH!


#200

The thing is really slowing down, isn’t it? Since my last post 9 hours ago there is no other devember entry update…