|
Shy posted:Am I missing something or do JetBrains IDEs outside of DataGrip not offer SQL code formatting? It works for me in IDEA, at least inside .sql files with Postgres dialect chosen. The lesser IDEs might not have it.
|
# ? Feb 14, 2018 18:43 |
|
|
# ? May 31, 2024 02:35 |
At the very least I think all JetBrains IDEs support the exact same plugins, so you should be able to find an SQL plugin for any IDE that doesn't have native support. I know several of their IDEs are still very barebones in terms of extra features, since they're focusing on core. CLion, for instance, only just started feeling like something that doesn't belong in alpha, and Goland honestly feels like it needs a lot of core work.
|
|
# ? Feb 14, 2018 22:31 |
|
Not exactly programming but I am sure you can help me. You are programming a videofame and the protagonist says "I have 27 gold". The code in C (all I ever knew and now forgot) would say somethin like Print &Gold " I have &gold gold" or something along those lines. I really don't remember. So my question, how can I write the same thing in pseudocode sothat anyone, even the most computer illiterate person, can get what I mean? As in, they get that there's a pre-written part and a part that's fetched from somewhere in the program? How can I make it glaringly obvious? Thanks a lot! VVV much appreciated, but I should have explained, I am not trying to explain code, it has to go on a sort of art project. I am trying to mock procedurally generated things out there,like "Why" $profile.age "is tje best age to start a career in" $latest.search "!". That I keep seeing. I just want to find the most obvious way to put it, and it has to be in one instance, preferrably. Dawncloack fucked around with this message at 14:07 on Feb 15, 2018 |
# ? Feb 15, 2018 10:34 |
|
Might help to repeat examples with different inputs. Here's something that's really close to valid Python syntax that might get the point across.code:
|
# ? Feb 15, 2018 12:19 |
|
Dawncloack posted:Not exactly programming but I am sure you can help me. C# code:
|
# ? Feb 15, 2018 14:58 |
|
Dawncloack posted:Not exactly programming but I am sure you can help me. You might look for inspiration here. I agree that formatting is going to be at least as important as syntax for what you're doing though.
|
# ? Feb 15, 2018 15:05 |
|
Something like "I have [amount of] gold" or "Why [age] is the best age to start a career in [field]!" perhaps?
|
# ? Feb 15, 2018 15:45 |
|
http://www.ocr.org.uk/Images/202654-pseudocode-guide.pdf That's the pseudocode guidelines for the main Computing exam board here in the UK.
|
# ? Feb 15, 2018 16:05 |
|
Dawncloack posted:I am trying to mock procedurally generated things out there,like Portal did this by having GlaDOS say things like "You must be the pride of [INSERT SUBJECT HOME TOWN]! I bet everyone in [INSERT SUBJECT HOME TOWN] is proud of your accomplishments."
|
# ? Feb 15, 2018 20:26 |
|
City Name Sports Team
|
# ? Feb 15, 2018 21:26 |
|
Using a computery typeface will probably help too, so it has that sense of a robot voice butting in
|
# ? Feb 15, 2018 21:39 |
Sedro posted:It works for me in IDEA, at least inside .sql files with Postgres dialect chosen. The lesser IDEs might not have it. Joda posted:At the very least I think all JetBrains IDEs support the exact same plugins, so you should be able to find an SQL plugin for any IDE that doesn't have native support. I know several of their IDEs are still very barebones in terms of extra features, since they're focusing on core. CLion, for instance, only just started feeling like something that doesn't belong in alpha, and Goland honestly feels like it needs a lot of core work. Setting a project dialect made it work for project files, so apparently no plugins required but needs some customization unlike DataGrip.
|
|
# ? Feb 16, 2018 12:06 |
|
Okay, so there was a graph theory question in a recent Amazon technical screening that I failed on. I want to try it again without the pressure of an interview and get some advice on solving this motherfucker. Given any node in a particular tree, get its right sibling if it exists, or nothing (null) if it does not exist. The tree looks like this: code:
I understand the fact that each node has an optional parent, left child, and right child. Let's start with the base case: the root (1). 1 does not have a parent, so it cannot have any siblings. So that's our first rule: code:
code:
Our next case is 3. 3 does have a parent, but it is already its parent rightmost child, so it can't have a rightmost sibling. Our code now looks like this: code:
Now we get to deal with the black sheep of the family that is node 4. (Been there.) Node 4 is a funny one in that it has a parent with no right child, yet it has a right sibling in 5. So clearly, our "if parent has no right child then no right sibling" assumption is wrong, and there's a more complicated solution. 4 does have a right sibling. The reason for this is that 4's parent 2 does not have a right child, but 2's parent 1 has a right child 3 that has a left child 5. So it looks like if your node's parent does not have a right child, you need to: 1. Go up until you find a parent that does have a right child that isn't the same as the original node 2. From that right child, select each left child until you reach the same level of depth as the original node So it's something like... code:
|
# ? Feb 16, 2018 16:28 |
To get a right sibling, you need to walk upwards, eventually arrive from a left branch, then walk down the right branch.
|
|
# ? Feb 16, 2018 16:42 |
|
I'm probably wrong, but I think a breadth-first search would be the core algorithm?
|
# ? Feb 16, 2018 16:43 |
|
ynohtna posted:I'm probably wrong, but I think a breadth-first search would be the core algorithm? No, nielsm has the right of it. You know the trick for navigating mazes where you just keep your right hand on the wall? It's the same principle, you just need to be able to recognize when to walk up, when to walk down, and when you've reached the correct depth.
|
# ? Feb 16, 2018 16:50 |
|
Is there an easy way to convert an image from png to gif? With google images dropping "view image" I had a hacky idea: Take screenshot Run a script that converts most recent screenshot from png (usually huge for anything photographic) to a high quality jpg (like a 9 on the photoshop slider) is this possible in say, python?
|
# ? Feb 16, 2018 16:50 |
|
TooMuchAbstraction posted:Portal did this by having GlaDOS say things like "You must be the pride of [INSERT SUBJECT HOME TOWN]! I bet everyone in [INSERT SUBJECT HOME TOWN] is proud of your accomplishments." Yeah that was one of my favorite details of the entire game.
|
# ? Feb 16, 2018 16:59 |
There's many ways to convert between image formats, and lots of stand-alone programs that can do it. On Windows, IrfanView is a decent, light-weight image viewer that can also convert, and has batch functionality. Pure GUI program. Cross-platform, there is the suite of command-line tools ImageMagick, the main component is a program called "convert". So you can run a command like "convert inputfile.png outputfile.gif", and it does just that. And you can find bindings for tons of different image processing libraries for pretty much any programming language. Python for example has a binding for ImageMagick, or Pillow which is forked from the classic PIL (Python Imaging Library).
|
|
# ? Feb 16, 2018 16:59 |
|
Caganer posted:Is there an easy way to convert an image from png to gif? download imagemagick, just do code:
|
# ? Feb 16, 2018 17:07 |
|
TooMuchAbstraction posted:No, nielsm has the right of it. You know the trick for navigating mazes where you just keep your right hand on the wall? It's the same principle, you just need to be able to recognize when to walk up, when to walk down, and when you've reached the correct depth. Yeah, but that's exactly what it means to do a breadth first search, to go back up and down to capture nodes at the same depth when walking the tree, before going down to another level. At any point what Pollyanna wants is the next node [at the same level] that would be checked in a breadth first search.
|
# ? Feb 16, 2018 19:10 |
|
Caganer posted:With google images dropping "view image" Right click on the image in the expanded preview and copy image address.
|
# ? Feb 16, 2018 20:23 |
|
Bruegels Fuckbooks posted:download imagemagick, just do but will that optimize use of the jpg algo? I've found that adjusting from max rs to say 9/12 really knocks the filesize down.
|
# ? Feb 16, 2018 20:26 |
|
Caganer posted:but will that optimize use of the jpg algo? I've found that adjusting from max rs to say 9/12 really knocks the filesize down. probably
|
# ? Feb 16, 2018 20:31 |
|
ImageMagick is a huge, thoroughly-established library. If your problem involves images, it can do it, though you might have to pull in ffmpeg if you're working with video streams.
|
# ? Feb 16, 2018 20:39 |
|
How exactly are you defining "right sibling"? I think that if you have the definition nailed down precisely, then it's much easier to write the code.
|
# ? Feb 17, 2018 01:18 |
|
What is the proper way of working with go templates and yaml in general. I'm doing some changes to kubernetes helm charts and trying to keep track of what the gently caress I'm doing in vanilla vim is impossible and obviously stupid way of doing it. I don't even know how to test the changes I've made yet
|
# ? Feb 17, 2018 03:58 |
|
TooMuchAbstraction posted:ImageMagick is a huge, thoroughly-established library. If your problem involves images, it can do it, though you might have to pull in ffmpeg if you're working with video streams. Cool I’ve been trying to find a small programming project this looks like a good fit
|
# ? Feb 17, 2018 06:40 |
|
So I think I got what signed and unsigned mean for things like int, floats, etc. which is But why is it called signed and unsigned? It seems like to me a poor choice of name to describe that kind of behavior. And is it just a coincidence that we use signed and unsigned to describe valid applications as well? Nude fucked around with this message at 16:32 on Feb 17, 2018 |
# ? Feb 17, 2018 16:15 |
|
Nude posted:But why is it called signed and unsigned? Not gospel, but I assume because you are taking the high bit away from the numeric representation and using it as the sign bit. A number with a sign bit is signed, a number without a sign but is unsigned.
|
# ? Feb 17, 2018 16:19 |
|
ulmont posted:Not gospel, but I assume because you are taking the high bit away from the numeric representation and using it as the sign bit. A number with a sign bit is signed, a number without a sign but is unsigned. Oh okay it seems in my example I confused the two, this makes sense and also makes it easy to remember which is which thanks.
|
# ? Feb 17, 2018 16:30 |
Nude posted:So I think I got what signed and unsigned mean for things like int, floats, etc. which is signed can go from 0-byte max. While unsigned halves the byte max number to include both positive and negative. You got it flipped. Unsigned is from 0 to a maximum, signed is from negative to positive with 0 in the middle. The term comes from plus sign and minus sign: A value which can have a plus sign or minus sign is just called signed. And contrarily, an unsigned number does not have a sign and is generally assumed to always be positive. An 8 bit unsigned number can have values from 0 to 28-1 (i.e. 255), while an 8 bit signed number in two's complement representation can have values from -(27) to 27-1 (i.e. -128 to +127). There's 256 different values possible regardless of whether it's signed or unsigned, it just affects how the binary representation is interpreted.
|
|
# ? Feb 17, 2018 16:31 |
|
Nude posted:So I think I got what signed and unsigned mean for things like int, floats, etc. which is signed can go from 0-byte max. While unsigned halves the byte max number to include both positive and negative.
|
# ? Feb 17, 2018 16:31 |
|
Thanks guys! Yeah I don't know why I couldn't see that connection, but I appreciate your answers. Clears it right up.
|
# ? Feb 17, 2018 16:41 |
|
Nude posted:So I think I got what signed and unsigned mean for things like int, floats, etc. which is There is no unsigned float. By definition, they have a bit reserved for their sign.
|
# ? Feb 17, 2018 23:17 |
|
Is there a way to return some version of `ls -s` where the values are relative to 100% rather than MB/GB/B? Eg:code:
|
# ? Feb 18, 2018 16:21 |
|
ufarn posted:Is there a way to return some version of `ls -s` where the values are relative to 100% rather than MB/GB/B? "Relative to 100%" doesn't mean anything...do you mean size as a percentage of the size of the largest entry in the listing? So if I have three files 10MB 5MB and 1MB I'd receive a listing like 100% 50% 10% ? `ls` can't do that but it seems like it wouldn't be too hard to write a script which can accept a listing and output what you want.
|
# ? Feb 18, 2018 19:07 |
|
code:
|
# ? Feb 18, 2018 19:30 |
|
Comedy option:code:
By the way, ufarn, are you sure you don't just want something that computes total folder sizes recursively like baobob or ncdu rather than just converting the sizes to percentages? mystes fucked around with this message at 19:44 on Feb 18, 2018 |
# ? Feb 18, 2018 19:40 |
|
|
# ? May 31, 2024 02:35 |
|
mystes posted:Comedy option:
|
# ? Feb 18, 2018 20:39 |