Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Journaling

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

oRenj9 posted:

So, I just finished writing a "file system" as part of my Operating Systems class. This was actually the funnest project I've had in school. I enjoyed working with the bits and bytes so much that I completed it in two days, rather than the allotted two weeks.

You may find the following book useful:

Practical File System Design with the Be File System (is out of print and the author has put a copy online). http://www.nobius.org/~dbg/practical-file-system-design.pdf

oRenj9
Aug 3, 2004

Who loves oRenj soda?!?
College Slice

tef posted:

You may find the following book useful:

Practical File System Design with the Be File System (is out of print and the author has put a copy online). http://www.nobius.org/~dbg/practical-file-system-design.pdf

This is exactly what I was hoping to get, thank you so much.

Combat Pretzel
Jun 23, 2004

No, seriously... what kurds?!
Kids, make sure you properly clamp values before converting it from doubles down to shorts. I just spent 1.5 hours picking a bunch of math apart, wondering why it put out batshit insane waveforms, even tho this should have been impossible. Problem happened in a completely different piece of code. :suicide:

Shadaez
Dec 19, 2011
I'm a relatively new programmer, and I'm trying to do Perlin noise but I'm having a hard time finding a tutorial or guide on how it works and how to implement it. Every guide or thing I find is just HERES THE CODE AND WHAT YOU CALL TO GET SOME NOISE!
Do I even need to understand how it works, or should I just be basically copying the code?

Jewel
May 2, 2009

Shadaez posted:

I'm a relatively new programmer, and I'm trying to do Perlin noise but I'm having a hard time finding a tutorial or guide on how it works and how to implement it. Every guide or thing I find is just HERES THE CODE AND WHAT YOU CALL TO GET SOME NOISE!
Do I even need to understand how it works, or should I just be basically copying the code?

As with most things, you can either find complex algorithms with near-no explanations, or a basic explanation with no code/algorithms.

I tend to prefer the second since it gives me a bit of a logic puzzle in how to code it anyway.

Here's a good one to do with perlin noise, I didn't really use the code here at all, just the ideas behind it.

http://freespace.virgin.net/hugo.elias/models/m_perlin.htm

Shadaez
Dec 19, 2011

Jewel posted:

As with most things, you can either find complex algorithms with near-no explanations, or a basic explanation with no code/algorithms.

I tend to prefer the second since it gives me a bit of a logic puzzle in how to code it anyway.

Here's a good one to do with perlin noise, I didn't really use the code here at all, just the ideas behind it.

http://freespace.virgin.net/hugo.elias/models/m_perlin.htm

I found this, too, but some dude on Wikipedia claims it's not really perlin noise?
http://en.wikipedia.org/wiki/Value_noise

Jewel
May 2, 2009

Shadaez posted:

I found this, too, but some dude on Wikipedia claims it's not really perlin noise?
http://en.wikipedia.org/wiki/Value_noise

Whatevverrr, it looks fine and fits what you wanna do. It's less a case of "that's not perlin noise" and more a case of "what I wanted isn't perlin noise in the first place, it's whatever that is".

Scaevolus
Apr 16, 2007

Almost everything you'll find online about "Perlin Noise" is actually just "Value Noise".

Perlin noise has useful properties for procedural generation including consistent feature sizes and a continuous first derivative (handy for displacement maps).

Read this to understand the math:
http://webstaff.itn.liu.se/~stegu/TNM022-2005/perlinnoiselinks/perlin-noise-math-faq.html

Once you understand how a single point is derived, the example code should be readable.

http://www.mrl.nyu.edu/~perlin/doc/oscar.html#noise

Simplex Noise is pretty neat too. It's isotropic (there aren't noticeable horizontal/vertical biases) and is better for higher dimensions (O(N^2) vs O(2^N)). http://webstaff.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I'm fine with that, but I'm unsure of how to do the octaves trick (and thus making real fractal noise) with real Perlin noise.

etcetera08
Sep 11, 2008

I feel like this is a really dumb question, but how does one release their code for a project without including important credentials? For example, I wanna throw up a web project I working on onto github without my database login information. I'm not sure what the best way to do this is. I can think of a couple solutions but they're kind of ugly.

Jewel
May 2, 2009

etcetera08 posted:

I feel like this is a really dumb question, but how does one release their code for a project without including important credentials? For example, I wanna throw up a web project I working on onto github without my database login information. I'm not sure what the best way to do this is. I can think of a couple solutions but they're kind of ugly.

Have a CFG file dictate the login info? Don't upload your one but give a template one and point out they need to add their own info?

Edit: vvv Oh! Rad! I like to try and answer questions like this in ways that seem logical to me, not ways I've read about (in this case I'd never thought about this problem before). It helps get me a good mindset of how things work without following the mentality of "I was told to do this, this is what I should do". If I'm wrong then other people usually correct me and I learn something still! Always a good way to go about it imo. Answering peoples' questions is one of the best ways to learn aside from actually doing it yourself.

Jewel fucked around with this message at 15:23 on Nov 12, 2012

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

etcetera08 posted:

I feel like this is a really dumb question, but how does one release their code for a project without including important credentials? For example, I wanna throw up a web project I working on onto github without my database login information. I'm not sure what the best way to do this is. I can think of a couple solutions but they're kind of ugly.

If you're looking at this from a version control angle, a common way to do it is to have an regular config file that is full of default or example values checked into source control and a second 'site' config file that is not checked in which contains any sensitive bits. Your software then looks at both and has the 'site' config file override the real one in the case of differences.

Opinion Haver
Apr 9, 2007

How does memory virtualization work with Intel VMX? My understanding is that with EPT the guest can do whatever it wants with CR3, and then the EPT steps in and translates the guest-physical address to a host physical, but what do you do if you don't have EPT available?

Turds in magma
Sep 17, 2007
can i get a transform out of here?
Is there a thread with some discussion of CUDA in it, and/or does anyone have any informed opinions about it.

I have a problem i'm working on where my time-limiting step is inverting a very large non-sparse matrix (not directly, but it's a generalized eigenvalue problem, so i'm effectively doing that, and I need all the eigenvalues).

I'm currently using the Intel compiler, and their implementation of the LAPACK routines for this, and it's reasonably fast, but if I want it to execute in real-time while I take data then I need about an order of magnitude speed increase. Will CUDA on a reasonable videocard help this?

JawnV6
Jul 4, 2004

So hot ...

yaoi prophet posted:

How does memory virtualization work with Intel VMX? My understanding is that with EPT the guest can do whatever it wants with CR3, and then the EPT steps in and translates the guest-physical address to a host physical, but what do you do if you don't have EPT available?

Trap it and do it in software. There's a VMware whitepaper that compares shadow page tables to EPT.

Scaevolus
Apr 16, 2007

Otto Skorzeny posted:

If you're looking at this from a version control angle, a common way to do it is to have an regular config file that is full of default or example values checked into source control and a second 'site' config file that is not checked in which contains any sensitive bits. Your software then looks at both and has the 'site' config file override the real one in the case of differences.

Make sure you add the sensitive config file to .{git,svn,hg}ignore as well.

Opinion Haver
Apr 9, 2007

JawnV6 posted:

Trap it and do it in software. There's a VMware whitepaper that compares shadow page tables to EPT.

So basically you trap any access to CR3, page directories, and page tables, and tell the guest what it 'thinks' it should get for each of those, then set up your real page table the right way? In that case, when the guest goes to read the physical page corresponding to 0x1234, it'll use whatever's actually stored in CR3 (which the host sets up). Which means that each guest and the host have to have different page tables because 0x1234 in the guest isn't going to be the same machine page as 0x1234 in the host, correct?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Essentially yeah, the host maintains its own page tables separate from the guest OS. When the guest OS updates its page tables in any way, the host makes a corresponding change to the "real" page tables so they keep matching.

When the guest OS maps virtual address A to point to physical address B. That gets trapped by the virtualization layer, which then updates the "real" page tables to point that virtual address A to the actual memory behind what the guest thinks of as physical address B.

etcetera08
Sep 11, 2008

Otto Skorzeny posted:

If you're looking at this from a version control angle, a common way to do it is to have an regular config file that is full of default or example values checked into source control and a second 'site' config file that is not checked in which contains any sensitive bits. Your software then looks at both and has the 'site' config file override the real one in the case of differences.

Makes sense, thanks!

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

etcetera08 posted:

I feel like this is a really dumb question, but how does one release their code for a project without including important credentials? For example, I wanna throw up a web project I working on onto github without my database login information. I'm not sure what the best way to do this is. I can think of a couple solutions but they're kind of ugly.
Put the credentials in an environment variable, have that environment set by something not version-controlled or at least separately version controlled. For example, I use rbenv-vars locally, and Heroku config when deploying.

Goat Bastard
Oct 20, 2004

I'm working on a green fields project with developers I respect, who think that the following is a good way to represent reference data in an RDBMS

code:
ID      CODE TITLE    IS_THING_A IS_THING_B IS_THING_C IS_THING_D IS_THING_E
------  ---- -------  ---------- ---------- ---------- ---------- ----------
403934  THA  Thing A  1          0          0          0          0
392933  THB  Thing B  0          1          0          0          0
229304  THC  Thing C  0          0          1          0          0
229390  THD  Thing D  0          0          0          1          0
553323  THE  Thing E  0          0          0          0          1
The benefit as they see it is that we get to use autocomplete when writing SQL queries to find a given type of reference data, and when they need to add more reference data then all they need to do is add another field to the entity in question. Plus it's great when they need to look up a specific one, because all they need to do is generate a query that gos WHERE IS_THING_X = 1.

There are tens of reference data entities, each containing up to hundreds of rows (never into the thousands). They don't feel they can trust the code column to be immutable since it has to match a column that's controlled by another system (even though they're comfortable basing SQL joins on that same column, and it's always unique in the master system) and they're not comfortable collapsing all those IS_THING_* columns into a single field that references an enum or table of known codes or anything else I could think of to suggest, even though we have absolute control all of those columns and no other system cares about them (or knows they exist) at all.

I'm pretty sure this is the second worst idea I've seen in real life, but I can't convince my colleagues. They're not bad developers and they're way better than this, and I'm really not sure why I can't explain to them why this is a really bad design.

So I guess my question is: Am I wrong? And if not then what else should I do to convince these people? Because at the moment I'm pretty sure I'd rather look for another job than have my name attached to this mess.

Hughlander
May 11, 2005

Goat Bastard posted:

I'm working on a green fields project with developers I respect, who think that the following is a good way to represent reference data in an RDBMS

code:
ID      CODE TITLE    IS_THING_A IS_THING_B IS_THING_C IS_THING_D IS_THING_E
------  ---- -------  ---------- ---------- ---------- ---------- ----------
403934  THA  Thing A  1          0          0          0          0
392933  THB  Thing B  0          1          0          0          0
229304  THC  Thing C  0          0          1          0          0
229390  THD  Thing D  0          0          0          1          0
553323  THE  Thing E  0          0          0          0          1
The benefit as they see it is that we get to use autocomplete when writing SQL queries to find a given type of reference data, and when they need to add more reference data then all they need to do is add another field to the entity in question. Plus it's great when they need to look up a specific one, because all they need to do is generate a query that gos WHERE IS_THING_X = 1.

There are tens of reference data entities, each containing up to hundreds of rows (never into the thousands). They don't feel they can trust the code column to be immutable since it has to match a column that's controlled by another system (even though they're comfortable basing SQL joins on that same column, and it's always unique in the master system) and they're not comfortable collapsing all those IS_THING_* columns into a single field that references an enum or table of known codes or anything else I could think of to suggest, even though we have absolute control all of those columns and no other system cares about them (or knows they exist) at all.

I'm pretty sure this is the second worst idea I've seen in real life, but I can't convince my colleagues. They're not bad developers and they're way better than this, and I'm really not sure why I can't explain to them why this is a really bad design.

So I guess my question is: Am I wrong? And if not then what else should I do to convince these people? Because at the moment I'm pretty sure I'd rather look for another job than have my name attached to this mess.

What do I think? I think that the coding horror thread is over here because that's what you have.

Spatulater bro!
Aug 19, 2003

Punch! Punch! Punch!

This is a strange question. It has to do less with programming and more with your mental state as a result of programming. I'm fairly new to this and lately I've been doing a lot of JavaScript and PHP coding at home in my spare time. When I code, I find myself absolutely immersed in it. We're talking trance-like, full mental attention. I'm sure that's normal. But I also find myself frustrated if I'm struggling with a particular problem and I'm unable to solve it before the day is over or I have to quit for whatever reason. I mean, VERY frustrated, like I can barely get on my with my day/evening, and I can't get my mind off of it to save my life. I'm uncommunicative and pissy with people for at least a couple hours. I just can't shake that relentless nagging feeling that I just HAVE to figure it out, and until I do nothing else matters.

My question: First, do you all experience this? And if so, how do you deal with it? Is this just a symptom of being a coding newbie? Am I just too wrapped up in it? Is smoking pot the solution?

movax
Aug 30, 2008

caiman posted:

This is a strange question. It has to do less with programming and more with your mental state as a result of programming. I'm fairly new to this and lately I've been doing a lot of JavaScript and PHP coding at home in my spare time. When I code, I find myself absolutely immersed in it. We're talking trance-like, full mental attention. I'm sure that's normal. But I also find myself frustrated if I'm struggling with a particular problem and I'm unable to solve it before the day is over or I have to quit for whatever reason. I mean, VERY frustrated, like I can barely get on my with my day/evening, and I can't get my mind off of it to save my life. I'm uncommunicative and pissy with people for at least a couple hours. I just can't shake that relentless nagging feeling that I just HAVE to figure it out, and until I do nothing else matters.

My question: First, do you all experience this? And if so, how do you deal with it? Is this just a symptom of being a coding newbie? Am I just too wrapped up in it? Is smoking pot the solution?

I don't get pissy at people, but unsolved problems will just kinda bounce around in my head for the rest of the day and while I sleep. More than once I've turned the car around leaving from work because the solution (or an idea) finally hits me on the drive home and I want to give it a try before it leaves my head.

Sounds like you just need to move to WA or CO and smoke a bowl after hitting a roadblock, and let the solution come to you :420:

biochemist
Jun 2, 2005

Who says we don't have backbone?

movax posted:

I don't get pissy at people, but unsolved problems will just kinda bounce around in my head for the rest of the day and while I sleep. More than once I've turned the car around leaving from work because the solution (or an idea) finally hits me on the drive home and I want to give it a try before it leaves my head.

Sounds like you just need to move to WA or CO and smoke a bowl after hitting a roadblock, and let the solution come to you :420:

I've woken up in the middle of the night and whiteboarded a solution to something that I couldn't figure out before. It's weird, I'm really obsessive about some things and I'm glad that it turned into a kinda-plus for this line of work.

Sab669
Sep 24, 2009

This isn't programming necessarily, but would it be 'kosher' if I were to use my work laptop for free lance development? There's some pretty handy, pretty expensive tools we use for publishing updates and some packages of more fancy windows forms controls and stuff that I'd love to be able to use. I suppose it depends on my boss and the actual license of the software, but has anyone done it?

epswing
Nov 4, 2003

Soiled Meat

Our issue tracker has three classes of issues: Bugs, Features, Tasks. Bugs are bugs, Features are things which provide tangible benefit to end users, and Tasks are everything else.

Bugs are annoying, frustrating, something you or someone else has written which is not behaving as expected, and you need to figure out why. Features are fun (generally), you get to build something new, satisfy a want. Tasks could go either way, but are generally neutral: refactoring, maintenance, house keeping, generally intangible to the end user.

To combat what you're describing, I usually have one of each on my plate, and throughout my day I switch between them. Keeps me sane, and sometimes you just need a break from a problem to see it with fresh eyes an hour later.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Sab669 posted:

This isn't programming necessarily, but would it be 'kosher' if I were to use my work laptop for free lance development? There's some pretty handy, pretty expensive tools we use for publishing updates and some packages of more fancy windows forms controls and stuff that I'd love to be able to use. I suppose it depends on my boss and the actual license of the software, but has anyone done it?

It depends. I've seen contracts that say that things created on a work-provided machine are owned by your employer, so check that out. Also it's probably a good idea to talk it over with your boss and get it in writing beforehand to avoid any ugliness, especially if the thing you want to create can be related to what you work with in any way.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Sab669 posted:

This isn't programming necessarily, but would it be 'kosher' if I were to use my work laptop for free lance development? There's some pretty handy, pretty expensive tools we use for publishing updates and some packages of more fancy windows forms controls and stuff that I'd love to be able to use. I suppose it depends on my boss and the actual license of the software, but has anyone done it?

The agreements you signed when you started your job very likely say that you can't do this, and that they're within their rights to fire you if you do.

Sab669
Sep 24, 2009

I guess I should probably mention I work at a tiny software shop (6 other people) and there was no legal mumbo-jumbo for me to sign when I was brought on. I'd of course run it by my boss if anything were to come to fruition from this idea.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Talk to your boss before you even begin, and get it in writing. It may sound excessive if you're all friends and a small shop, but there's no reason not to.

Macichne Leainig
Jul 26, 2012

by VG
So I'm absolutely confused on this homework problem I have with binary trees, and my professor is reluctant to help me because the only way to really help me is to give me the answer.

The question is something like this:

Draw a binary search tree whose right subtree has 3/4 of the elements as the left subtree, and has exactly 4 internal nodes and 4 leaf nodes.

The problem I'm having is that I'm physically unable to satisfy the ratio requirement while having the correct number of internal and leaf nodes. So without asking for straight-up answers, as that wouldn't teach me anything, I do have a few questions:

When he specifies left subtree and right subtree, does the node count on that include the BST's root node? I've tried it both ways and I'm physically unable to keep the ratio and numbers to his specifications.

Based on the definition of an internal node, would you think the root node counts? I don't think so myself, but maybe someone with more data structure knowledge can correct me.

Of course, here's the closest I can get:



I have, to my knowledge, 4 leaf nodes, 3 internal nodes, and the correct ratio in this tree. Unless anyone can shed some knowledge on it. I know how to insert numbers in the BST so I don't need help with that, but I don't want to start plopping numbers into it until I have the correct structure.

nielsm
Jun 1, 2009



I don't see why the root node shouldn't count as an internal node. It's not a leaf, ergo it must be internal.

Macichne Leainig
Jul 26, 2012

by VG

nielsm posted:

I don't see why the root node shouldn't count as an internal node. It's not a leaf, ergo it must be internal.

That's what I thought, it meets the definition of an internal node perfectly fine. Some references disagree with that but I think if the root counts as internal, my tree diagram is a correct answer to the problem.

E: Yeah, looking at previous lecture notes, my professor counts the root as internal. I'm not sure if it's correct, but it satisfies the question just fine. Thanks!

Macichne Leainig fucked around with this message at 18:42 on Nov 14, 2012

Goat Bastard
Oct 20, 2004

Hughlander posted:

What do I think? I think that the coding horror thread is over here because that's what you have.

Yea, that's what I figured. First time I've seen one happen in front of me and been powerless to stop it. Oh well, I guess I keep trying while I look for new work.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
So, here's a question. Is there any kind of implementation of XDebug that doesn't suck?

I spent hours trying to get it to work with Netbeans and still couldn't get it. I've got it working with PhpStorm but the actual IDE is kind of awful. All I want is to be able to set breakpoints and stop execution so I can check variable status. Shouldn't be too hard, right?

spiritual bypass
Feb 19, 2008

Grimey Drawer
Have you configured Apache and PHP to work with Xdebug yet? Does it work at all? Netbeans itself probably isn't the issue.

tarepanda
Mar 26, 2011

Living the Dream
Somewhat related to that last question about the database...

What's a good book I can read about database/table design? And something on Postgres would be great, too.

We have three or four programmers and occasionally we make programs that call for databases but none of us really know anything about good database design, so I KNOW that our poo poo is ugly and inefficient.

I'd like to make this an opportunity to learn. Where should I start?

I prefer books because it's easier for me to go off in a side office and read than it is to sit online and not get distracted by other sites/projects/e-mails/requests.

Adbot
ADBOT LOVES YOU

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

rt4 posted:

Have you configured Apache and PHP to work with Xdebug yet? Does it work at all? Netbeans itself probably isn't the issue.

Yes, I have. Like I said, I've been able to get it to work with PhpStorm, just not NetBeans. Either way, the larger question still stands. Is there anything better out there than Xdebug?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply