• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

Any Haskell tutorials that aren't so focused on doing everything through ghci? I guess the interpreter is good for leaning the basics but I want to learn how to actually put a program together.
 
Ah Ruby on Rails, the current rockstar of web application development (Djano/Python crew holla). Enjoy it while it lasts, PHP will be making it's come back!
 

survivor

Banned
Isn't Scala also rising/hottest new thing for web development? At least for the big companies. Tumblr, Twitter, Guardian, Linkedin all seem to be using it.
 
Wait what? I thought people wanted that dead... what niche does it fill that something else can't do better?

Oh cool they have the PHP on the internets now

EDIT: Hah, that reminded me, I did do some PHP work week or two ago. My face was whatthechrist.php.gif.exe the whole time.

I was joking sorry. I hate PHP like the republican party hates poor people.

I would love to see breakdown over the years of PHP usage. How IS python/django doing anyways? I know a few years ago everyone and their parents swore it was poised to pretty much take over the internet as the go to framework.
 
I was joking sorry. I hate PHP like the republican party hates poor people.

I would love to see breakdown over the years of PHP usage. How IS python/django doing anyways? I know a few years ago everyone and their parents swore it was poised to pretty much take over the internet as the go to framework.

I did understand the joke
because no-one in their right minds would hope for PHP comeback ^^

Actually, I'd like PHP6 just for the name. Pee-aitch-pee-sex
 
I did understand the joke
because no-one in their right minds would hope for PHP comeback ^^

Actually, I'd like PHP6 just for the name. Pee-aitch-pee-sex

I'm sure hardcore PHP fans are awaiting the day.

Rails will die once my team releases the framework we've been working on called "Migraine" that uses Objective C. You'll also need flash installed because

You guys will praise me as "innovative" I'll land on the cover of time magazine with an awesome quote about how I changed the internet forever.


Sounds about right
 

clip

Member
Does anyone work with Flask and Postgres?

I'm trying to package up my app using distribute, but I'm not sure how to handle the Postgres/psycopg2 dependencies that are outside of Python.
 

injurai

Banned
I've always been overwhelmed by web dev. How does one begin approaching it? Like C or Java is pretty straight forward. But web seems like well.. a web of a whole bunch of tools and languages coupled together in some lose interface.
 
I've always been overwhelmed by web dev. How does one begin approaching it? Like C or Java is pretty straight forward. But web seems like well.. a web of a whole bunch of tools and languages coupled together in some lose interface.

what's wrong with that, this sounds like you're racist against hipsters or something
 

injurai

Banned
what's wrong with that, this sounds like you're racist against hipsters or something

Lol what... I'm just lost in understanding web world.

I just have no clue how to approach that stuff. Like node.js is a server side engine to interpret JS code? And that is used to generate and serve up web pages? Which then the pages themselves are using JS and other libraries to render stuff client side? Is that how it works?
 
Doesn't look like it. :) Almost every Bay Area startup uses Bootstrap for their first website and product pitch, and it shows.

I use to hate bootstrap but nowadays I've come to terms with it and honestly have no problem with it anymore. I've noticed among the people I know that many people jump into front end development use Bootstrap as a start point then go off to learn different things. That and as you stated they have their use for cooking up MVPs.

I'm not a huge front end guy so that's just my take on it.
 
I just have no clue how to approach that stuff. Like node.js is a server side engine to interpret JS code? And that is used to generate and serve up web pages? Which then the pages themselves are using JS and other libraries to render stuff client side? Is that how it works?
Yeah, that's the basic gist of it, though I'd clear up that those other libraries are most likely in JavaScript. HTML for page structure, CSS for styling, JavaScript for logic that runs in the browser. There's overlap in some areas with HTML5 and CSS3 features, but that's the general idea.

Mozilla Developer Network has one of the best edited repositories for documentation on all things front end, and they've got some good intro pieces. All you need is a text editor.

The web dev thread will give you an idea of what's trendy these days and it's probably the preferred place for that line of questioning.

Though as far as JavaScript's concerned, and this is what I've heard through friends handling hiring, if you know how to use a timing event, you are way ahead of what most front end developers know. There's a bunch of markup languages, there JavaScript, there's whatever you have running on the server. It's bearable once you're used to the sprawl.
 

XenodudeX

Junior Member
So I'm ( yet again) having trouble with an Visual Basic assignment.

Basically I have to write a code that displays the users selected items plus the quantity that was selected in a list box.
Type in a number in the text box, and the program automatically adds the item plus the quantity and the overall price in the list box.

Capture1.png

When you hit " Complete my order!" it adds everything plus tax as the total


So... this one is similar to my last assignment, what's different is that I have to have at least 2 sub-procedures or functions in the coding. This assignment is much harder, at least with the last one I knew at least how to get started, but with this, I'm completely stumped.
 
So... this one is similar to my last assignment, what's different is that I have to have at least 2 sub-procedures or functions in the coding. This assignment is much harder, at least with the last one I knew at least how to get started, but with this, I'm completely stumped.

Make a function that calculate the tax and one that calculates the total?
 

NotBacon

Member
Some of the best engineers in the world are Windows-only. Of course some of the best engineers in the world are Unix-only too. If Windows and GUIs are a red flag for you, it sounds like you have a bias which is not substantiated with actual facts.

I'm a Unix guy at heart (and home), and used to hate Windows with a fiery passion. But after being forced to tackle several C#/C++ projects at work, I'll admit Visual Studio is a nice environment and Powershell is decent for CLI work. I still prefer my Unix tools, but Windows development definitely has it's place.

That said, I still hate Windows as an OS big time. It feels very clumsy to work in, even after trying to adopt a Windows-style workflow, and I dread doing OS tasks.

So... this one is similar to my last assignment, what's different is that I have to have at least 2 sub-procedures or functions in the coding. This assignment is much harder, at least with the last one I knew at least how to get started, but with this, I'm completely stumped.

One step at a time. Write down the functionality of this program on paper. Look up UML diagrams and see if you can create a simple one. Or just write some pseudocode like I mentioned a couple pages ago. Seriously try to break this down into simple steps, then break those steps into even smaller steps, etc.

It's difficult to code an entire program...
It's easy to code 'add some numbers together' or 'calculate tax for this number'...
 

XenodudeX

Junior Member
I'm a Unix guy at heart (and home), and used to hate Windows with a fiery passion. But after being forced to tackle several C#/C++ projects at work, I'll admit Visual Studio is a nice environment and Powershell is decent for CLI work. I still prefer my Unix tools, but Windows development definitely has it's place.

That said, I still hate Windows as an OS big time. It feels very clumsy to work in, even after trying to adopt a Windows-style workflow, and I dread doing OS tasks.



One step at a time. Write down the functionality of this program on paper. Look up UML diagrams and see if you can create a simple one. Or just write some pseudocode like I mentioned a couple pages ago. Seriously try to break this down into simple steps, then break those steps into even smaller steps, etc.

It's difficult to code an entire program...
It's easy to code 'add some numbers together' or 'calculate tax for this number'...

Yeah basically I got this going on:

Code:
 TotalandSubTotal()

Code:
 Sub TotalandSubtotal()
 varSubTotal = varSubTotal + totalquantity
        varTotal = varTotal + varSubTotal
end sub

..And
Code:
RunningTotalandSubtotal()

Code:
Sub RunningTotalandSubtotal()


        If varSubTotal <= 14.0 Then
            varSubTotal = varSubTotal

        End If
        If varTotal >= 14.0 Then
            varTotal = varTotal
        End If
    End Sub

The program seems to work, but I;m not really sure if I did it correctly.
 
The program seems to work, but I;m not really sure if I did it correctly.
Going from the "teach a man to fish instead of giving the fish" school of thought, I think you need to learn how to build confidence in your results. :)

Like, you should be able to print out variables and your results to the console. Very simple debugging routine. Unfortunately the method to call in Visual Basic is very... verbose. MSDN has a solution that I'll just pull from there and show in the simplest possible form:
Code:
My.Application.Log.WriteEntry("The variable varSubtotal has a value of " & varSubtotal)

Try and print some stuff out to the console, and see if it's what you expect. You should be checking things you do to make sure that they are what you expect.



Mild rant.

In JavaScript that logging function would be
Code:
console.log("The variable varSubtotal has a value of " + varSubtotal);

In C, with a format specifier, this would be,
Code:
printf("The variable varSubtotal has a value of %d", varSubtotal);

Visual Basic is... I don't know what class you're taking, but it's not on my list of languages that a new programmer should learn. Now, the functions, control flow, debugging process and the fundamentals you'll learn from it are more or less similar enough to what other programming languages do. It won't cripple you, but it's hard to find good beginner resources to learn from compared to Python and JavaScript.

VB's legacy comes from the early 90s, when visual interface building tools like in ExperLisp, Delphi, and Steve Jobs' NeXTSTEP Objective-C programming tools were thought to be the future of software development. Visual Basic was unified with the C# runtime for .NET, and now VB's mostly supported as a means to move big enterprisey businesses that wrote old Visual Basic apps onto the far more expressive and Java-competitive managed language, C#. Visual Basic is not a hot ticket item anymore.

There's also "Visual Basic for Applications" (VBA) for Microsoft Office to do macro programming in documents, but that's a byproduct of another 90s programming trend that I don't think most new programmers are going to be interested in. I once dealt with a web server running Visual Basic on ASP.net because the developer had experience in VBA... not one of the more fun experiences of my career, let me tell you. Everybody in this thread who has had bad things to say about PHP, there are worse things, trust me.

Unless smarter spreadsheets really are something you want to do, it's a strange place to start. Though UTAU, the software that spawned Kasane Teto, was written in Visual Basic 6.0, so it's not impossible to do something fun with... it's just... an odd choice.

Python and JavaScript are among far more beginner friendly and fun programming languages to pick up, in my experience.
 

Slavik81

Member
I'm implementing binary image shrink from Digital Image Processing by William K. Pratt, and I ran into what appears to be a bug.

For this input:
[0, 0, 0, 1, 0;
1, 1, 1, 1, 0;
0, 0, 1, 1, 0;
0, 0, 1, 1, 0;
0, 0, 0, 1, 0]

I get this output:
[0, 0, 0, 0, 0;
0, 1, 1, 1, 0;
0, 0, 0, 0, 0;
0, 0, 0, 1, 0;
0, 0, 0, 1, 0]

That seems wrong to me. I expected connectivity to be preserved. What's even more surprising is that octave has the same output. I'm filing a bug for that, since the documentation directly states that the Euler number of the image will preserved, but bweuler(in) != bweuler(out).

So, it sounds like I'll need a third opinion. Would somebody mind running this through matlab?
Code:
in=[0, 0, 0, 1, 0;  1, 1, 1, 1, 0;  0, 0, 1, 1, 0;  0, 0, 1, 1, 0;  0, 0, 0, 1, 0]
out=bwmorph(in,'shrink')

EDIT: The book's 3rd edition lists L Cluster unconditional mark patterns as being "thin-only". That text is gone in the 4th edition. Apparently, the textbook was wrong. I'm still curious about matlab, though.
 
I started dabbling in c# and the beginner assignments mostly give you the various math formulas and such that you'll need. My question is, as a professional, does someone else typically supply you with the necessary equations, like a coworker or employer, or are you expected to come up with it on your own in addition to implementing it?
 
I started dabbling in c# and the beginner assignments mostly give you the various math formulas and such that you'll need. My question is, as a professional, does someone else typically supply you with the necessary equations, like a coworker or employer, or are you expected to come up with it on your own in addition to implementing it?
Not sure what exactly you mean by math formulas, you'll have to give examples and zero in on what you mean.

The majority of programming in terms of math is logic (structure, control flow) and fairly pedestrian algebra. In certain domains like 3D graphics, there's a limited subset of linear algebra that you end up using, but it's the same linear algebra that everybody else uses in 3D graphics programming, so it's not hard to find sources to walk through it. Same goes for field like audio with Fourier transforms and signal manipulation; the math is known and a many-times-over solved problem.

I've never had an employer give me "formulas", as you say, but Valve allegedly used to give new hires copies of Real-Time Rendering: Second Edition. Nobody's barred me from bringing books and reference materials to work with me, though I've had trouble getting a $350 case that I bought from Newegg.com out of a Fortune 500 company's office. YMMV.
 
I mean, say the army tasked you with making a program that predicted where a missile would hit based on angle and speed. Would you have to come up with the math procedure in addition to physically programming it, or does someone else say "here's the steps to calculate that, now make it into a program."

Obviously that's a rather simple example.
 
On the subject of debug tools, if you're looking for performance optimization on Linux, Brendan Gregg (formerly of Sun, Joyent, and the primary author of the DTrace book) has has a rather good blog showing the state of performance tracing tools on the platform.

Linux Performance Tools 2014 gives a good state of affairs, and he has a devoted page to Linux Performance showing off all of his works explaining the various tools and how they work. And of course he wrote the best-selling book on the subject.

This is more sysops level stuff, but performance profiling to see where your app is spending the most time can really come in handy.

OS X has Instruments and a port of DTrace that hasn't been updated in some time, but which does form the basis for custom instruments on OS X. There are a few excellent tutorials out there for OS X. FreeBSD has its own DTrace with some perfectly good documentation of its own.
This is a little misleading, since most apps don't really need hardcore instrumentation to understand performance. If you're on linux, you have the magic tool to tell you where most of your CPU/RAM is spent already, and no instrumentation is needed.

For CPU cycles,
valgrind --tool=callgrind [cmd args]
+
kcachegrind

For heap usage,
valgrind --tool=massif [cmd args]
+
massif-visualizer
 
I mean, say the army tasked you with making a program that predicted where a missile would hit based on angle and speed. Would you have to come up with the math procedure in addition to physically programming it, or does someone else say "here's the steps to calculate that, now make it into a program."

Obviously that's a rather simple example.
It works. :)

There might be a setting where teams work in a manner where somebody else comes up with mathematical proofs to validate their mathematical equation modeling a given phenomenon and the programmer has to implement it. But that's not what I see in the ACM and most forms of business and industrial research. Even there, the researcher would be expected to write a program to illustrate their mathematical model, and implement it. The code may be gross and awful, but somewhere it should exist as a means to test it.

Oftentimes the programmer has to research and figure out the math themselves and organize it into the form of a computer program. But even with what you describe, physics with some trigonometry would be necessary, and that's something that doesn't necessarily require an expert to do. Though I'd certainly have some reference books handy to take that on and figure out as many details that I could. Most of which will be bought out of pocket, but some settings may allow you to file that as a work expense.

That said, a surprising number of industry programmers actively dislike math. You can spend quite a bit of time in this field and barely touch subjects like trig, because just trying to organize programs well enough that it's maintainable and functional is difficult enough, in of itself.
 
This is a little misleading, since most apps don't really need hardcore instrumentation to understand performance. If you're on linux, you have the magic tool to tell you where most of your CPU/RAM is spent already, and no instrumentation is needed.

For CPU cycles,
valgrind --tool=callgrind [cmd args]
+
kcachegrind

For heap usage,
valgrind --tool=massif [cmd args]
+
massif-visualizer
Yes, Valgrind came from the Linux kernel project as a means of catching various performance bugs, especially of the heap corruption and memory leak kind. It is directly referenced by Zed's Learn C The Hard Way, and it is a very good tool that should be used. Thanks for bringing that one up, I got carried away with showing too much of the bigger picture of Linux runtime tooling. (it's cool tho)

Though I take some exception, sir or ma'am, with how you define Valgrind tooling as "no instrumentation". Callgrind and Kcachegrind are definitely a form of runtime instrumentation, and massif builds on Valgrind's memory analysis tooling. Which amount to overridden malloc/free calls that come interspersed with instrumentation to provide smarter, semantic information. It's why Valgrind's authors call the Valgrind project an instrumentation framework on the front page description.

Instruments on OS X and iOS are also pretty similar and painless, for the most part. Most programming in C/C++ should require frequent memory profiling and nice stack traces, just to avoid really nasty memory corruption problems that are very hard to track down later.

EDIT: Xcode's "Guard malloc" build setting is also really good for catching heap corruption. It builds on OS X's libgmalloc and is as easy to enable as checking a box.
 
Yeah, I'm talking about manual code instrumentation and/or required recompilation when I say "no instrumentation". Both of those are painful steps to go through for the common case, and the point is to minimize pain. ;p

valgrind doesn't even require you to have debugging symbols!
 

Celcius

°Temp. member
So enums are about as awesome and useful as I think they are right?

If you're talking about Java then yes indeed. If you have a known number of choices for the possible values then using enums will make some things like input validation easier than using Strings. (plus later you can convert to a String or whatever if needed)
Plus it's easy to iterate over all the possible values of your enum class, etc...
 

Mabef

Banned
I guess this is a theoretical question more than anything: Are 2D switches a thing in programming? Disclaimer: idk what im doing.

- When I want to do a series of actions based on a variable's value, I use a switch statement.
- When I want to do a series of actions based on two variables' value, I use a... 2D switch?

My current method is using a switch on a temporarily created array, but it feels weird. Using a lot of if statements feels weirder. I guess it all works, I'm just wondering if there's a common approach.
Code:
     0   1   2 
   -------------
 0 | a | b | c |
 1 | d | e | f |
 2 | g | h | i |
 
I guess this is a theoretical question more than anything: Are 2D switches a thing in programming? Disclaimer: idk what im doing.

- When I want to do a series of actions based on a variable's value, I use a switch statement.
- When I want to do a series of actions based on two variables' value, I use a... 2D switch?

My current method is using a switch on a temporarily created array, but it feels weird. Using a lot of if statements feels weirder. I guess it all works, I'm just wondering if there's a common approach.
Code:
     0   1   2 
   -------------
 0 | a | b | c |
 1 | d | e | f |
 2 | g | h | i |

It's not a thing in c/c++, but it is in some other languages. Usually functional programming languages. Really depends how complicated the operations are, but one option if they're pretty complicated is to have a matrix of function or base class pointers with a common signature, then index into the matrix and call the function.

Maybe post some more specifics about what you're doing, might help come up with the best solution.
 
Can someone explain to me in a fairly simple manner why many developers believe that development is done better on UNIX systems?

My school teaches all of its classes using Windows and my current internship has me working on Windows (using Visual Studio). This has me thinking that I won't have much UNIX experience by the time I finish school.

Are the tools better there? Do you get any benefits if you are still just working in an IDE? Is it all preference?

I've searched around before but never really found a good answer, so I'd appreciate any info!
 
Can someone explain to me in a fairly simple manner why many developers believe that development is done better on UNIX systems?

My school teaches all of its classes using Windows and my current internship has me working on Windows (using Visual Studio). This has me thinking that I won't have much UNIX experience by the time I finish school.

Are the tools better there? Do you get any benefits if you are still just working in an IDE? Is it all preference?

I've searched around before but never really found a good answer, so I'd appreciate any info!
Yes, with the exception of graphics stuff. (Visual Studio + DirectX is still a potent combo)

But more importantly, Windows systems are very finicky. BSD (Mac) and Linux are much more stable and reliable OSs -- I would actually say they are much more modern OSs -- and developers usually don't want to be fighting both their computer and their code. With Windows you usually are.

The other thing is that Linux is much more viable for developer types who already understand OSs than it is for the general populace. So you'll see a higher % of usage just from the demographic alone.
 
Can someone explain to me in a fairly simple manner why many developers believe that development is done better on UNIX systems?

My school teaches all of its classes using Windows and my current internship has me working on Windows (using Visual Studio). This has me thinking that I won't have much UNIX experience by the time I finish school.

Are the tools better there? Do you get any benefits if you are still just working in an IDE? Is it all preference?

I've searched around before but never really found a good answer, so I'd appreciate any info!

I would say there are 5 big reasons.

1) the shell is more powerful and so many people feel more productive with this extra power.

2) with vi and emacs, people feel like having a programming language built into their editor makes them more productive.

3) portability. Most unix systems support posix, and they all kind of share the same api. Makes portability easier.

4) open source. Unix based systems have a much larger base of open source software, so it can be easier to get started with a wide set of useful libraries for free.

5) irrational bias. Many unix people have a sense of intellectual superiority over windows programmers because they feel like GUIs are for babies.
 

Mr.Mike

Member
It probably helps that most (I'm guessing) developers would have started out on UNIX at school.

I've come to really like the command line, vi and UNIX in general. I'll probably install in on my desktop after this semester's over since I don't really play PC games much anymore outside of Paradox games, which are also on linux. (I need Visual Studio for MASM for an Assembly course this semester).

I do find it weird how strongly people feel about UNIX though. My Systems Programming prof seems to have something against Windows.
 
If someone were to ask me why I develop on OSX/Linux, I'd point out the ridiculous number of times Windows decided to shit itself as my reasoning.

Anecdotal.
 

injurai

Banned
Can someone explain to me in a fairly simple manner why many developers believe that development is done better on UNIX systems?

My school teaches all of its classes using Windows and my current internship has me working on Windows (using Visual Studio). This has me thinking that I won't have much UNIX experience by the time I finish school.

Are the tools better there? Do you get any benefits if you are still just working in an IDE? Is it all preference?

I've searched around before but never really found a good answer, so I'd appreciate any info!

It has to do with the history of computer science. Unix and then later linux became the defacto OS paradigm. It was developed by computer scientists for computer scientists. The end goal is not to deliver a product to end users. As a result there are many aspects about linux world that are beloved and greatly appreciated. There is something to be said about the massive amounts of money and support behind Windows. Just look at Direct X. It's certainly the king of graphics apis, putting other stacks to shame. Windows and OSX are far ahead in terms of gui technology and it's integration into the OS.

Linux has never really concerned itself with protecting the end user. Your given root access, solutions to problems are handled via command line. Even recent consumer friendly Ubuntu is a far cry. You can get into the system and customize everything. This includes your development environment.

Additionally C was pretty much created with the intention of writing unix. Unix and C go hand in hand. Unix as an OS became the intermediary into the driving system processes and doing systems programming. There is just so much to be learned in this world. It really paints of a picture of what computers are and how we should think about computation. Even the windows machines and servers are widely used in the business world, namely for their support. It's hard to not think that Unix is the better platform to learn on.
 
Thanks for the answers. I've used Windows all my life and have only had very little experience with OSX/Linux systems in general. I've never tried anything but Windows for programming so far.
 
Yes, with the exception of graphics stuff. (Visual Studio + DirectX is still a potent combo)

But more importantly, Windows systems are very finicky. BSD (Mac) and Linux are much more stable and reliable OSs -- I would actually say they are much more modern OSs -- and developers usually don't want to be fighting both their computer and their code. With Windows you usually are.

The other thing is that Linux is much more viable for developer types who already understand OSs than it is for the general populace. So you'll see a higher % of usage just from the demographic alone.

Dunno if you have experience with Windows Server in a modern context but they are really not anymore stable than Windows anymore. They are all pretty much the same at this point in time in terms of stability. I would say that Windows Server even has better built in tools at this point than any other platform as well, particularly from a GUI point of view. Command line with powershell is about the same. I think it's a toss up between them at this point.

This is basically how I feel about programming environments at this point too. We are a windows shop at work and I find it easily usable and it has its own benefits. At home I use ubuntu for personal and hobby projects. There is virtually no difference in usability or one that I'd put better than the other in general, they are just different, and anyone who says there is a best one can only point to specific circumstances or their own personal preference and not many solid objective facts.
 

NotBacon

Member
If someone were to ask me why I develop on OSX/Linux, I'd point out the ridiculous number of times Windows decided to shit itself as my reasoning.

Anecdotal.

Pretty much how I feel. It's just not as reliable in my experience as an OS, but MS definitely knows how to make an IDE.
I'd put it up there with IntelliJ.

Thanks for the answers. I've used Windows all my life and have only had very little experience with OSX/Linux systems in general. I've never tried anything but Windows for programming so far.

You can burn a live USB in little time and boot into a no-consequences live session easily. If that turns out not to be so easy (secure boot or some other garbage), or your machine has a ton of RAM, a virtual machine is even easier.

Get your feet wet :)
 
Top Bottom