[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 357 KB, 1168x840, cpls.jpg [View same] [iqdb] [saucenao] [google]
5016457 No.5016457 [Reply] [Original]

Programmers thread

>> No.5016472

What do you want to know ? I did a lot of php and javascript. C++ looks fun but I still have to learn it.

>> No.5016481

Starting as a programmer in a lab next week, primarily doing data analysis and biometric input. It will be my first programming job and im fairly nervous despite having been going over what I know again and again.

>> No.5016488

Taking Coursera's machine learning course, just starting to learn how to use Octave. Pretty cool language if I do say so myself.

>> No.5016489

I am trying to learn the BASIC programming language , can you learn it to me ?

>> No.5016498

I read Thinking Forth about a month ago. I am now convinced that Forth is the best language out there, even better than Common Lisp.

>> No.5016503
File: 15 KB, 319x475, candy cane.jpg [View same] [iqdb] [saucenao] [google]
5016503

>>5016498
> Thinks there's such thing as a general 'best language'

>> No.5016519

>>5016503
You gotta check out that book, it'll BLOW.YOUR.MIND!

>> No.5016523

Using scheme in my CS master, its kinda cool

>> No.5016531

I started taking that online coursera course on algorithms and it got me wondering why it is that vectorized code with linear algebra libraries perform so much better than loops. I mean, if you can calculate the minimum number of computations in terms of N, then linear algebra should perform pretty much the same as loops right?

I'm a mathfag but it's been about 6 years since I did any linear algebra. I remember there are a ton of math shortcuts one can do to avoid long computations. If these are the reason for the increased performance, then why aren't the concepts applied directly to the algorithm?

>> No.5016532
File: 377 KB, 794x697, C++.png [View same] [iqdb] [saucenao] [google]
5016532

Alright so I want to start learning programming and what I want to do is programming of software/programs.
What language should I use, C, C++, Python? What's the difference and where should I start self studying?

>> No.5016536

What languages does everyone see in school?

Kinda interested

I've seen: Java/C#/scheme/php/actionscript

I'm sure there's some others but cant remember

>> No.5016538

>>5016532
Start with java.

>> No.5016541

I have to learn R for a class this semester, but I have very very limited programming experience, can any post an extremely basic tutorial?

>> No.5016551

>>5016532

It depends on what you know already, what your area of study is, and what you want to use it for.

I suggest getting a good handle on structured programming and then afterwards moving onto object oriented programming.

Many languages do both, but some do OOP only. Java for example is OOP only. Also, it does it's own garbage collection, doesn't pass by reference, and does a lot of data-type typecasting stuff that will make it really easy to make mistakes for non-obvious shit.

Personally, I'd suggest you start with php. Contrary to what a lot of people will tell you, it's not just a web language, it can be used as a local scripting language like Bash. That's not the reason I'm recommending it though, the reason is because in it you can write really straightforward code, not have to worry about data types, and write either structured code or object oriented code. Once you know both those paradigms, switching to most other languages is a cinch.

>> No.5016563

>>5016536

Most of the languages I've learned have been out of school. I'm a mathfag and really the only stuff I've had to use has been either latex or matlab stuff.

languages I've learned over the years.

Basic --> Visual Basic --> C++ --> whole mess of web languages (including all kinds of database shit) --> common lisp --> forth

Also octave, bash, mirc, and a bunch of other scripting languages. I know how to use mathematica but I've never tried to program anything in it.

>> No.5016576

I think any languages besides C are bad starting points. People starting with Java or scripting languages may think that they have can program and then fuck up every pointer when trying something in languages with pointers. Especially Javabeginners often think in OOP, which is great in big programs, but is pantsonhead retarded on 90% of all project. Start with C, get used to it, move to C++ , learn OOP and you will never have problems with any language

>> No.5016686

>>5016532
I started with C++ and in no more than six months i was on the national olympiad. You got to hard-work if you want to be good at this.

>>5016536

In my school, teachers teach C++ and Pascal, also SQL and PHP on higher grades.

>> No.5016707

>>5016536

At my school I was taught Java, C++, MIPS, Haskell, and Prolog in classes.

>> No.5016731

>>5016531

Naive matrix multiplication is O(n^3). The best algorithm is about O(n^2.37). If you write a program that does matrix multiplication using your own loops, then there is no easy way for the compiler to apply the fast matrix multiplication algorithm, so your program will end up being significantly slower. I guess you could write an optimizer that tries to detect a matrix multiplication pattern, but that quickly runs into decidability issues (what if my program does matrix multiplication, but only when it has some specific user input?)

For n = 10^6, the fast algorithm is about 6000 times faster. So, yah.

>> No.5016749

>>5016731

Awesome, this explains so much. Thank you!

>> No.5016806

>>5016551
>Personally, I'd suggest you start with php. Contrary to what a lot of people will tell you, it's not just a web language, it can be used as a local scripting language like Bash. That's not the reason I'm recommending it though, the reason is because in it you can write really straightforward code, not have to worry about data types, and write either structured code or object oriented code. Once you know both those paradigms, switching to most other languages is a cinch.

Python would be a better language to start with in that case.

>> No.5016877

I just started taking a programming class for the first time (C++) any tips?
Also, studying to be comp eng

>> No.5016959

I have been trying to learn C++, anyone know a good place to go for good tutorials, I surprisingly did not find many for Microsoft Visual Studios 2010

>> No.5017017

I learned C++ originally in the bloodshed devc++ compiler with a game programming class. Though it's really really outdated now and I don't know what would be a good modern source for C++.

I know a lot of stuff that was considered good practices back in the day no longer is.

Sorry I can't be of any help.

>> No.5017080
File: 28 KB, 455x345, 2MGHdTP-8bpY79HlIyvfrjl72eJkfbmt4t8yenImKBVaiQDB_Rd1H6kmuBWtceBJ.jpg [View same] [iqdb] [saucenao] [google]
5017080

>>5016541
The best thing you can do to start is use the help manuals in the R package.

You might also compare R vs matlab/octave just for basic reference
http://mathesaurus.sourceforge.net/octave-r.html

Once you get past the basics, read R Inferno (free online book). It's sort of like the dogma of R and the inevitable weirdness that it has

>> No.5017106

I'll have to agree on the Python thingy. Or any real programming language for that matter. Stay away, and I mean far away from PHP as long as possible. It fucks your mind and doesn't teach you anything except writing messy code and how to not be consistent in anything you do. You'll be fooled into thinking you're able to program shit, and that's exactly what you will do, write shit.

>> No.5017322

Java master race reporting in.

>> No.5017433

>>5016523
Yay Scheme! I have a place in my heart set aside for lambda calculus which has somehow been entirely linked in my mind with Scheme...

That said I mostly use Matlab for my computational modeling and Perl for corpus analysis. Would do both in [R] but I'm too lazy to get around to it and I'm not convinced anyone's implemented an efficient sampler for a heirarchical Dirichlet process hidden Markov model... if they have you should let me know :)

>> No.5017456

I studied some C++ from a introductory book but then I gave up because I felt that I was getting lost and no longer understanding concepts.

Then I read that python is a good first language because the syntax isn't too hard so learning concepts flow easier.

>> No.5017703

In for loops, instead of using i as a counter, one should improve readability by using 'count'.

All Java and VB programmers do this already, why haven't you guys joined in?

>> No.5017708

>>5017703

You should just replace your for loops with matrix math.

All Octave and Matlab programmers do this already, why haven't you guys joined in?

>> No.5017721

Anyone here use D? I've found it's basically everything I like about Java and C++ put into a single language. Fully compiled (no silly "portable" byte code), has a garbage collector, there's no #includes or macros and uses standard imports (which I really like because I fall to C++ #include bugs), and even has support for functional programming (closures, anonymous functions, etc). You can find out more here:

http://en.wikipedia.org/wiki/D_%28programming_language%29

The biggest drawback is there's no large standard library but this could go away if there was more interest.

>> No.5017732

>>5017721
bulletML is written in D. It's for shmups.

>> No.5017921

>>5016877
If you want to be good at this, the best thing you can do is to practice a lot at home and ask your teacher whenever you don't understand something, even if it is the easiest thing ever and your classmates will laugh at you. Also, if you seem interested in that, your teacher will probably select you for the informatics olympiad in your city and you'll probably have more chances to get into that.

>> No.5017981
File: 1.59 MB, 252x252, c.gif [View same] [iqdb] [saucenao] [google]
5017981

Programming gentlemen, does computers have to work binary? What I'm asking is if there's any way of building a computer/writing code that transmits information as a continual stream?

I'm really curious

>> No.5017987

>>5017981
quantum computers.

>> No.5018020

>>5017981

So, that is actually a very natural idea. Instead of having the voltages transmit information by having a 0/1 state, have the voltages transmit information by having a real valued state. This would allow each voltage to carry much more information. For example, I could store the value Pi with one voltage where V = 3.14.... or I could store the value as 32 voltages where each voltage is on or off.

The advantage to the binary system is that it is much less prone to error, work with semiconductors (which build up to logic gates), and allow greater control than an analogue system.

To the last guy who replied, quantum computers aren't the same as an analogue system. I don't understand quantum computing at all.

>> No.5018026

>>5018020
Wouldn't this just be like circuitry?

quantum computers just use two dimensional numbers (complex numbers) for their boolean gates. Also, they use different gates because they can cover the whole space with them and shit. It's kinda cool, I guess.

>> No.5018073
File: 6 KB, 251x197, 1334489097022s.jpg [View same] [iqdb] [saucenao] [google]
5018073

>>5018020
Thank you for responding good sir. I do not understand how a stream like this would work practically, (or if it does) but it just seems like a more natural approach for numerical computations.. Like all representations and calculations that is related to graphics for example. Then shapes would actually be represented with continuity instead of a vast process of iterations. Mathematical functions supports this but I still do not understand how what is intuitive and simple in real life, such as physics and calculus can be presented efficiently using bits.

For big numerical computations, is there nothing more to it than more processing power- or is there a qualitative difference in method to get more (or complete) decimal accuracy? The only reference I have is when dealing with graphs in Mathematica- even though there's a supposedly different kernel machine error eventually shows up at some level of 'zoom' when graphing functions.

>> No.5018102

>>5017921
I'll take your advice anon, thanks for the info

>> No.5018124

So how does C# compare to these other languages.
I hardly ever see it discussed around these parts.
Uses?Employment opportunitys?

>> No.5018140

>>5018124
C# is an object-based language, in order you can do many things (such as games, for example) easier than in C or any other non-object-based language. Also, you have employment oportunities with this programming language.

>> No.5018190

I have an excel document

I have a column of relevant data

I want something to start at top of column, check cell for contents.

If cell has contents I want it read and add it to a string.

Content added to string, add "; ", goto next cell

Repeat until cell is empty

Print string.

End


How do I do this?

What is the most suitable language?

>> No.5018192

>>5018140
I need string in a form ready for copy and pasting.

>> No.5018213

>>5018190

just guessing, but I'd bet C# probably has libraries for working with excel. look in to that.

>> No.5018223

>>5018190
can't you do this with macros or something?

>> No.5018225

>>5018190
http://opendocumentformat.org/features/

>> No.5018244

>>5018190

Here is a macro that will do it:


Sub Macro1()

Dim mydata As String

Do
If ActiveCell.Value = "" Then
Exit Do
Else
mydata = mydata & Str(ActiveCell.Value) & ";"
ActiveCell.Offset(1, 0).Select
End If
Loop

ActiveCell.Offset(1, 0).Select
ActiveCell.Value = mydata
End Sub

Just select the top most data cell and run it. When it hits an empty cell, it will write your thing at the bottom.

>> No.5018249
File: 153 KB, 1239x707, macro.png [View same] [iqdb] [saucenao] [google]
5018249

>>5018244

And here's a pic of it in action.

>> No.5018262

>>5018249
>>5018244

Cool, it looks perfect. Thanks!

I don't know how to use visual basic though.

>> No.5018263

>>5018262

Its built into excel. Just record a macro, name it Macro1 (should be default) then immediately stop recording. Then view the spreadsheet's macros and edit Macro1 and the VB editor will pop up so you can just paste in the code. Finally you can close the VB editor and just run the macro from the macro list.

If you save the spreadsheet as a spreadsheet with macros, the macro will save and always be there.

>> No.5018276

>>5018263

It works!

Mostly. My cells contain letters and numbers in the format ABCD-0000

>> No.5018280

>>5018276

Sorry, I thought it was all numbers. Replace the respective line with this (exactly):

mydata = mydata & ActiveCell.Value & "; "

>> No.5018286
File: 48 KB, 350x339, 782.1324265219285.png [View same] [iqdb] [saucenao] [google]
5018286

>>5018280

It does exactly what I need it to.

Thanks again. i <3 u

>> No.5018288

>>5018286

No problem. Thank you for the puzzle!

>> No.5018444
File: 5 KB, 358x395, analog digital.gif [View same] [iqdb] [saucenao] [google]
5018444

>>5017981 What I'm asking is if there's any way of building a computer/writing code that transmits information as a continual stream?

Analogue vs Digital Signal
Analogue is the continual stream you are thinking of.


Transistors and Logic gates
Requires a binary description

Can an analogue signal hold information and work as memory? It would require a waveform to be streamed in a loop until something listens in, uses information and then change the waveform to represent new information. Very volatile way of storing information. Power failure means you lose your signal and all information if you are intent on not having a hardcopy.

>> No.5018770

>>5016519
>Thinking Forth
Yeah! The best part is that all the advice and techniques can still be applied within other languages (albeit somewhat less efficiently). A lot of that wisdom was rediscovered decades later in the agile programming movement.

That and Starting Forth are now available as free PDFs, updated for the modern Forth standard.

>> No.5019363

Is it recommended to try to learn 2 programming languages simultaneously, as a beginner programmer?

I've had some C++ lessons in high school and I want to continue learning that, and I've just gotten started with an online tutorial, but yesterday I've heard of Code Academy and got hooked with their Javascript lessons. (Seriously, very good site.) I've also heard Python is very good for beginners...

What's the best choice for each of the following priorities?
• improving my chances on the job market
• achieving a high skill level in a short time

>> No.5019421

>>5019363
Focus on C++. Multitasking impairs your learning.

>> No.5019788

I just started learning Java at the university. They recommended that we use either Emacs or Vim.
Which is the better editor Emacs or Vim?
Is there any good reason not to use other editors like Notepad++ or TextPad?

>> No.5019798

I hate C++

I use it because in my area everything is done in C++, but I hate the complexity of the language. I hope in the not too distant future C++ will be replaced by something cleaner like Haskell.

>> No.5019822

>>5016551

PHP is an absolutely horrible language. I'm not going to type a whole rant about it, but read this: http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/