[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 385
Thread images: 31

File: yuki.jpg (104KB, 984x927px) Image search: [Google]
yuki.jpg
104KB, 984x927px
Old: >>51449718
What are you working on, /g/?
>>
Generics without partial specialisation and lookup are shit
Languages without macros are shit
C# is shit
>>
reposting from last thread

whats the best way to learn lisp?
reading SICP?
or
following the MIT SICP lectures?
>>
>>51457781
the best way to learn lisp is not at all
>>
>>51457506
Fair enough. I am new and have not fully accrued the vocabulary. What I meant to say is that that would be simpler if I used filter and fold. I didn't know filter or fold at the time then, thus the unreadability.
>>
>>51457831
bro... i hope one day you will have the lightbulb moment and see the brilliance of lisp
>>
>>51457781
Why not both?
>>
>>51457781
lisp is not a programming language. You do not learn lisp. You learn *a* lisp, you learn *a* lisp *dialect*.

Fuck off you uneducated slob
>>
does
n * 2.0
ever have better accuracy than n + n

does
a * (b + c * 2.0) / 3.0
ever have better accuracy than
a * (b + c * 2.0) * 0.3333333333333333
>>
>>51458067
i know retard. but i'm not learning dialect specific stuff. i'm learning stuff that's common to all the dialects. so you could say i'm learning lisp
>>
Daily reminder that all lisps are speech impediments.

If you have a lisp, you are autistic.
>>
>>51458084
no
yes, according to the data format. Although the second might be quicker on some platforms that don't have single cycle floating point division.
>>
>>51457781
You don't read SICP to learn lisp. This is just a side effect.
And you should do both.
>>
File: wouldyouliketoknowmore.jpg (16KB, 355x151px) Image search: [Google]
wouldyouliketoknowmore.jpg
16KB, 355x151px
>be me
>do C# winforms / wpf / asp.net stuff
>lots of small, simple, one-man projects
>bored as fuck

Does programming in the real world ever get interesting?
>>
>>51458142
no
>>
Java or C# for hobbyist?
>>
>>51458142
Learn something that isn't a winkek, codemonkey language.
>>
>>51458171
Like what? Can I get a job doing it?
>>
>>51458142
>>51457736
>>
>>51458193
Not everything you do has to be about getting a job.
Do you even enjoy programming?
>>
How does one who is familiar with C/C++/Java/Haskell and some other languages learn python?
>>
>>51458224
I used to when the simple stuff was more difficult, but now it just feels straight forward. There's no challenge in it. And while I do enjoy programming, I enjoy money more (plus I made shit money until I moved into programming, so kinda behind).
>>
>>51458308
Just read the official Python guide and use the Python docs to look up specific functions.
>>
>>51458308
https://www.codecademy.com/learn/python
https://automatetheboringstuff.com/
>>
>>51458166
why not learn both and then choose the one you like more? (hint: it's C#)
>>
File: madeinchina.png (43KB, 1037x981px) Image search: [Google]
madeinchina.png
43KB, 1037x981px
>Academic code
>>
>>51458166
C# is better in almost every way.
>>
>>51458567
>almost
[which?]
>>
I'm triying to make some bash that allow me create users in my LDAP domain introducing only the firstname, lastname and username
I've got something like this

 #!/bin/bash###############################################
#VAR1=$(tail -n 1 /root/ldap/availableuid | cut -f1)######
#VAR2=$(tail -n 1 /root/ldap/availablegid | cut -f1)######
#echo "before uid: $VAR1"#################################
#echo "before gid: $VAR2"#################################
#let "VAR3=$VAR1+1"#######################################
#let "VAR4=$VAR2+1"#######################################
#echo $VAR3 >> /root/ldap/availableuid####################
#echo $VAR4 >> /root/ldap/availablegid####################
>>
>>51458166
java

>>51458567
java is cleaner and more similar to C++
>>
>>51458851
>java is more similar to C++ than C#
hello australia
>>
>>51457707
>>>/out/
>>
>>51458851
>java is cleaner and more similar to C++
How is it more similar to C++? It has some things in common with it that C# doesn't, sure, but the opposite also holds true. In fact, other than a few syntactic differences, C# is probably more similar since it has:
>pointers
>structs
>unions (kind of)
>operator overloading
>actual destructors
>multiple inheritance
>default/optional arguments
>had lambdas for a lot longer than Java
>>
>>51457781
Common Lisp has a free textbook.
http://www.gigamonkeys.com/book/
I know Clojure is DUDE VIRTUAL MACHINES LMAO but it has the most momentum of all the Lisp dialects right now.
>>
Whats a good way to learn how to make Android apps if I already have a lot of experience with Java?
>>
For those who want to program, but don't know what to work on:
https://better-dpt-roll.github.io/
>>
>>51459124
Use the official tutorial. They walk you through how to make a full app from start to finish, brushing upon every subject you'll need to make something yourself.
https://developer.android.com/training/index.html
>>
>>51458851
C# is far more similar to C++ than Java is. In fact, I don't think there's a single thing Java has over C# concerning similarities to C++.
>>
>>51459153
>https://developer.android.com/training/index.html


Looks good thanks.
>>
File: dpt roll.png (127KB, 546x486px) Image search: [Google]
dpt roll.png
127KB, 546x486px
>>51459134
everyone knows this is the best /dpt/ roll
>>
>>51459200
>official
>>
>>51458897
>the name is all that matters

>>51458986
>a few syntactic differences
>a few
kek
>>
File: wall.jpg (517KB, 1536x1536px) Image search: [Google]
wall.jpg
517KB, 1536x1536px
>What are you working on, /g/?
Image mosaic generator.
Since choosing C means writing a lot from scratch, I just got most of the basic stuff like normalization and bilinear filtering working.

>pic related, normalized image wall from random /a/ thread
>>
I need project ideas.
A local company is hiring programmers, but it's all C++.
I know basic C++, I took a class on it in college, but I haven't used it (at all) since then so I'm a little rusty.
>>
>>51459361
http://www.cplusplus.com/doc/tutorial/
>>
>>51459364
I know C++, I just need projects to work on so I get comfortable with the syntax.
I've been programming the last 5 years in Java for work.
>>
>>51459404
How do you program in Java for 5 years without attempting suicide? Or did it not let you allocate a noose?
>>
>>51459430
This
>>
>>51458603
my nigga have you tried AWK
>>
>>51459349
>my dick hurts, stop that
What?
WHAT?

>that girl with the weird black marks on her
>>
>>51459430
Don't believe the /g/ memes. Java isn't a bad language, and the JVM is a marvel of technology.
>>
>>51459534
>Java isn't a bad language
Java dindu nuffin wrong
>>
>>51458565
looks intersting.

what is this ?
>>
Java screams "corporate meddling". It has no redeeming features besides inertia.
>>
So, what's a good place to get started with AI development?
>>
>>51459653
ok NEET
K...KEEP ME POSTED
>>
>>51459665
Google, Microsoft or Facebook, they're working on turning their botnets into skynets
>>
>>51459666
If you actually had a job writing Java and weren't from India you'd agree with me.
>>
>>51459690
But I want to make my own skynet first.

But seriously, is there a good introductory textbook or something that can get you acquainted with the basics? There's not a whole lot showing up on Amazon.
>>
shutup u cunts
>>
>>51459738
k keep me posted

positively euphoric
>>
>>51459534
Sure the JVM is pretty impressive, but Java is a verbose piece of shit. In order to pass functions, I have to encapsulate them in interfaces? Fucking disgusting.
>>
can someone give me a concrete example of 'dependent types'?
>>
>>51459534
>JVM is a marvel of technology
Good shit is still shit
>>
File: muhskynet.png (198KB, 597x680px) Image search: [Google]
muhskynet.png
198KB, 597x680px
>>51459735
Don't let the Erlang part fool you, the concepts are universal. Erlang is pretty well suited for growing neural networks, though, if that's your thing.
>>
>>51459735
Coursera has several courses on Machine Learning. That's a good place as any to start.
>>
>>51459735
Artificial-Intelligence-A-Modern-Approach-3rd-Edition.pdf
>>
File: lol.jpg (196KB, 731x900px) Image search: [Google]
lol.jpg
196KB, 731x900px
>>51457707
I just made a Java RSA keygen and encrypter/decrypter but I only programmed it to accept small numbers <10,000.

How do I go about making it able to handle large messages and text files? From what Ive read online its something like file-> bytestream ->biginteger -> encrypt/decrpty individual chunks

also, how can someone encrypt/decrypt a message with out the product of the two secret primes, n? if anyone actually cares about this see my SO question

https://stackoverflow.com/questions/33849823/sending-and-receiving-large-rsa-encrypted-cyphers

thnx <3
>>
>>51459230

NIce trolling, m90
>>
>>51458084
> does
> a * (b + c * 2.0) / 3.0
> ever have better accuracy than
> a * (b + c * 2.0) * 0.3333333333333333
Yes.

If b+c*2.0 is a multiple of 3, then
> (b + c * 2.0) / 3.0
will be an integer, while
> a * (b + c * 2.0) * 0.3333333333333333
may or may not be depending upon which side the rounding falls.

More generally, 1/n cannot be represented exactly unless n is a power of two. So dividing by n and multiplying by 1/n should give different results. Sometimes they'll give the same result simply because the rounding error happens to be in the correct direction to compensate for the inaccuracy in the value of 1/n.
>>
I made this hack to save everything that someone streams to a file.
anyone know how to improve it?

I'm thinking it needs to mark streams with the starting time rather than the ending one, and to contain the stream title.

#!/bin/bash
# watch a given channel that livestreamer suports, and catinates everything aired on it to a file.
if [ -z "${1}" ]; then
echo "usage: <command> <URL> [<extra filename content>]"
return
fi

FILENAME=stream"${2}".mp4
#ATTEMPT=1
#while sleep 0.5 ; do livestreamer -p "tee -a stream\"${2}\".mp4" "${1}" best && date; echo Attempt number $((ATTEMPT++)). ; done
while sleep 0.5 ; do nice livestreamer -p "tee -a \"${FILENAME}\" " "${1}" best > /dev/null 2>&1 && ( date ; mv -- ./"${FILENAME}" ./"${FILENAME}"-"$(date)" ) ; done
>>
>>51459772
Think about C++'s std::array<T, N> type, which encapsulates an array T[N] and provides compile-time bounds checking. Now imagine allowing N to be determined at runtime from something like user input, such as with std::vector<T>. Now you have to choose between having bounds checking with runtime overhead, or having none at all. Dependent types allow you to ensure at compile time that there will be no out-of-bounds errors without adding any unnecessary checking at runtime (i.e. a runtime check can be done once and then knowledge that the index is less than N can be "shared"). You could even take it a step further and allow T to be specified at runtime.
>>
>>51459718
>what is android
there is literally nothing wrong with java
>>
>>51459985
and how would this be implemented? does it require dynamic typing?
>>
File: ezjvcv.png (7KB, 399x201px) Image search: [Google]
ezjvcv.png
7KB, 399x201px
>>51459925
>http://manpages.ubuntu.com/manpages/utopic/man1/livestreamer.1.html
>File output options
> -o FILENAME, --output FILENAME
> Write stream data to FILENAME instead of playing it.
>
> You will be prompted if the file already exists.
read the fucking man page
>>
>>51459985
You could constrain functions to ensure you only get valid input, with current C++
>>
>>51459863
> I just made a Java RSA keygen and encrypter/decrypter but I only programmed it to accept small numbers <10,000.
Did you actually write RSA encryption/decryption or just a function which computes (x^e)%m?

Because there's a lot more to RSA than modular exponentiation. In particular, you need a padding scheme such as PKCS#1-v1.5 or OAEP, which is far from trivial.

Also, key generation can't just pick any two suitably-sized primes and multiply them. You have to check for weak keys (e.g. those where p-1 and q-1 have common factors other than 2, or those where p-1 or q-1 only have relatively small factors).
>>
Best way to learn Java quickly?
>>
>>51460038
You need language support for dependent types. So Agda, Idris, Coq, etc. The issue with dependent types right now is that there aren't any languages suitable for general purpose programming where both performance and safety are concerns, which is where dependent types can really shine, especially when you add linear types.

>>51460057
Not if the notion of validity isn't constant at compile time, like if the upper bound is determined from user input. C++ has type-level programming, same as Haskell with extensions like DataKinds, GADTs and TypeFamilies.
>>
>>51460099
Do you have prior programming experience and just need a crash-course in Java syntax and language features?
Yes: Java in a Nutshell.
No: Head First Java
>>
>>51460056
That doesn't give me the option to append to the file though.

Thanks for reminding me though.
>>
>>51460136
so concatenate them together with ffmpeg
>>
>>51459892
do you have an example?
>>
>>51460124
If validity isn't available at compile time, there will be overhead.
>>
>>51460124
that's my question, how would the language (compiler/runtime) implement such a feature?
>>
>>51460186
nvm i tested it and a lot of numbers differ on the lowest decimal
>>
>>51460169
This thing is meant to be set and forget.
The only reason I made the script stick everything together was to make handling files easier.

Can you think of a way to get the name of the stream without interrupting the recording?
Like, is there some way to fork off a process to get the title and set it in a shell variable so I can use it for naming the file after it's done? Getting the filename after it's done may not be possible.
>>
>>51460013
Java is the most verbose language in popular use. Other problem include:
>no structs
>no points
>no lambdas's (until very recently)
>native interop is a huge pain
>no unsigned integers

It's generally just been incredibly slow to pick up modern language features in recent years. Worst of all C# pretty much does almost everything Java does, has similar syntax, but has none of the problems listed above. It also has a mature ecosystem and labour pool. There is no reason to use Java over C# in new projects unless you absolutely need to use a specific Java based technology.

Android uses Java because it was fastest, easiest to develop in language that was available to freely implement at the time. Google was certainly never going to use C# in Android. Though Xamarin did port most of android to C# as a proof of concept and found it ran faster using mono.
>>
>>51460303
>it ran faster using mono
no and the apk sizes are ridonk
>>
>>51458565
You need to learn to have comments or descriptive variable names, because that is unreadable as fuck.
>>
>>51460403

It's very likely he didn't write it. That's the kind of code you get when you let non-programmers have their hand at writing a program.

Especially mathematicians.
>>
>>51460365
Benchmarks right here:
https://blog.xamarin.com/android-in-c-sharp/

I'm referring to the entire OS being ported to C#, not just the apps.

But there's also benchmarks out there show that mono is faster than native Java apps for at least some things.

Xamarin will make you're APK about 4.5mb bigger. Obviously only worth using when the benefits of using C#/F# to make apps outweighs the drawbacks of the extra space needed.
>>
>>51460196
It's not really overhead if it's strictly necessary. The overhead I was referring to is like using std::vector::at() instead of std::vector::operator[]. If you use the same index multiple times, the bounds check inside of at() will be wasted work. So you use operator[], but then you have to always remember to check at least once to ensure that the value isn't out of bounds. Dependent types allow you to verify at compile time that if a check is needed, it's been done.

As a really concrete example, you'd have a proposition type that the index is within the bounds, and require a proof in order to get the element at that index.
-- definitions are irrelevant here
_<_ : U32 -> U32 -> Set
less : (m : U32) -> (n : U32) -> Maybe (m < n)

Array : Set -> U32 -> Set
get : (ind : U32) -> Array a len -> (ind < len) -> a


>>51460207
Usually the language will base itself off of a dependent type theory, typically Martin Loef's (MLTT). Implementation isn't as tough as it sounds; a minimal dependent type theory AST and checker only takes a few hundred lines in Haskell.

Dependent typing also only really works if you can guarantee referential transparency (purity) and totality. However, this doesn't preclude manual memory management, which may not seem intuitive at first.
>>
>>51460424
>But there's also benchmarks out there show that mono is faster than native Java apps for at least some things.
for absolute garbage biased benchmarks maybe

>Xamarin will make you're APK about 4.5mb bigger.
nah it's a lot more than that. a hello world in xamarin will be like 11 MB and then it will get even bigger when you use more of the standard library or whatever
>>
>>51457781
HtDP2e will be the best for this, but an SICP is fine too.
>>
>>51460440
Why can't you just have a contract with a function that says the result is constrained to lie within bounds?
e.g. array.last (where the size cant be 0)
>>
>>51460424
>you're APK
>you're
kill you'reself
>>
>>51460080
yeah I just did the (x^e)%m thing
one guy on SO told me to just use RSA for encrypting other keys and use AES for the actual message... if I did this I assume I'd still need the padding scheme for AES? thanks for the help m8
>>
>>51460303
>>no structs
It's an OOP language. Use a class.
>>no points
Do you mean pointers? If so, there isn't much use for pointers in Java. The desired behavior (passing by reference) is already done by default for objects.
>>no lambdas's (until very recently)
There are lambdas. Invalid criticism.
>>native interop is a huge pain
native T someFunction(some parameter);
Then you just write your accompanying function in C/C++.
>>no unsigned integers
unsigned Integer (not int!) utilities were added in Java 8.

>There is no reason to use Java over C# in new projects
Our server runs Debian, our developers run Mac, and our clients run Windows.
Java lets us have one codebase to maintain that we can deploy on any platform, with functional and native-looking GUIs.
Plus, since it's JVM-based, we can use any JVM-based language for any of our projects and integrates into our existing codebase with no problems. We've been using Scala a lot lately; it's pretty nifty.
>>
>>51460502
That's exactly what's happening, but instead of being some weird addition to a less expressive type system, dependent types allow you to encode it first-class as part of the standard library, which makes it easier to understand and modify.
>>
>>51460548
>oop can't have structs
>the purpose of pointers is passing by reference
>unsigned integers weren't added till verison 8
jesus christ
>>
>>51460468
>for absolute garbage biased benchmarks maybe
Why do you say that? Why would mono be any slower than native Java?
By virtue of the fact that C# has support for structs, pointers and SIMD would make it intrinsically faster for many things.

>a hello world in xamarin will be like 11 MB and then it will get even bigger when you use more of the standard library or whatever
Google is your freind
https://developer.xamarin.com/guides/android/advanced_topics/application_package_sizes/
It's about 11mb in debug builds, not distribution builds, which will use a linker.
>>
>>51460583
How does it know that you've written a function that can't exceed the bounds?
>>
>>51460080
Why would p-1 and q-1 sharing large factors reduce security? Can you link me a paper on it? The whole idea of RSA is that the public doesn't know p-1 and q-1.
>>51460303
Anonymous functions aren't that big of a deal if functions aren't first class.
>but but muh interfaces
Absolutely disgusting.
>>
New to programming, been learning c++ for about 3 months now.

Working on recreating Minesweeper, and I've almost got it done.
The only things left are to make the input less clunky (using stringstream, maybe?) and fix how the program acts when you select a square on a pocket of zeros. You can see it didn't uncover D8 even though it was supposed to.
>>
>>51460548
so much retardation in one post.

>It's an OOP language. Use a class.
So is C#. Structs are extremely useful as you can assign them on the stack. Extremely useful for performance.

>If so, there isn't much use for pointers in Java
In C# pointers are used to easily import native methods with one line of code and interact with it. Otherwise they are great for getting very high performance. Image manipulation is a good example. Non bound checked arrays are useful here too, which Java does not have.

>Then you just write your accompanying function in C/C++.
You don't need to write any C/C++ to use native with C#. Just one line to reference the native assembly and the name of the function you want to import.

>unsigned Integer (not int!) utilities were added in Java 8.
Fair enough. About time. Are they primitives?

>Our server runs Debian, our developers run Mac, and our clients run Windows.
what is mono.

>with functional and native-looking GUIs.
What are you using to make these "native-looking" GUIs?

>We've been using Scala a lot lately; it's pretty nifty.
Kill yourselves. Twitter was using that years ago and stopped because they realised it's a huge clusterfuck of terrible design decision:
https://www.youtube.com/watch?v=uiJycy6dFSQ

.NET has F#, which is actually good.
>>
>>51460829
It's ok anon, nobody on /g/ can uncover a d8
>>
File: 1444888760231.jpg (57KB, 500x417px) Image search: [Google]
1444888760231.jpg
57KB, 500x417px
>Programming in Java
>>
>>51460705
I'm glad you brought that up, and the short answer is that it doesn't. It obviously can't enforce anything dealing directly with FFI, including manual memory management.

In practice, this is okay. Since most functions that directly do FFI will just be thin wrappers, it's pretty hard to get them wrong, so you don't care if the compiler can help you there or not. What the compiler can prove is the correctness of a function, assuming it's built on top of correct functions. This means that library users can actually say with confidence that a bug occurred upstream, and library developers have an easier time tracking down said bug.
>>
>>51460904
Ah, I get it.

If you want an analogy, const in C-like languages.
>>
>>51460936
Sort of, yeah. If a const variable is changing somehow, and you never did anything silly like take a pointer to it and coerce it to mutable, then you know that it's not your fault.
>>
>>51460988
Does that mean they're monadic?
>>
>>51461031
Monads don't really have anything to do with this.
>>
>>51460126
Thanks! I've downloaded Head First Java but it looks like I'd benefit more from having the physical copy so I went ahead and ordered it. Any other suggestions?
>>
>>51461043
I bet you money it's related.

It constrains chained operations.
>>
I'm about to finish my "programming for mathematicians" module where we have been taught Java. The furthest we have gotten in the module is learning about objects and inheritance. Is there a lot more to be learned by sticking with Java or should I move onto C/++. My interest is solely in mathematics and scientific computing.
>>
>>51461071
Move on to C++.
>>
>>51461071
I don't know much about this, but it seems that a LOT of scientific and math-related computation and visualization is moving over to python.

You might want to check out Anaconda (a Python distribution pre-packaged with popular data science tools): https://www.continuum.io/
>>
>>51461071
If you like mathematics you'll love Scheme. I don't know of a mathematician familiar with Scheme who doesn't like Scheme.
>>
>>51460904
On a side not, it's worth mentioning that some dependently typed languages can translate type-level assertions to normal assertions so that the program can perform run-time checks for code that isn't functionally pure. I'm not sure about Idris/Agda/Coq but F* can do this and I'm fairly certain ATS is able to do it as well.
>>
>>51460526
> one guy on SO told me to just use RSA for encrypting other keys and use AES for the actual message.
Indeed. For performance reasons, you don't use RSA for encrypting "bulk" data, only keys, hashes, tokens, etc.

> if I did this I assume I'd still need the padding scheme for AES?
Padding is part of RSA. It turns a sequence of bits (which must be smaller than the modulus, preferably much smaller) into the integer x in "(x^e)%m". Together, the padding and the modular exponentiation form a cipher. And the padding is the hard part (some languages have modular exponentiation as a built-in function, e.g. Python's pow() function has an optional third argument for a modulus).

Once you have that, you'd generate a random AES key, encrypt the message with that key, then encrypt the key with RSA and include it with the message.
>>
hey /dpt/ this is in c++ and i have to find the longest increasing sublist of an array of mountains. i'm trying to find it dynamically by having an array of best increasing sublists, where a sublist is the "best" if it has the lowest value possible. so then by the end, the last and therefore longest best increasing sublist will be the longest increasing sublist for the entire array. but it doesn't work at all and i'm having an issue pinpointing why
// Function longestIncreasingSublist inserts BestIncreasingSublists into sublistArray.
// It returns the location of the longest increasing sublist within this array.
int longestIncreasingSublist(BestIncreasingSublist *sublistArray, Mountain *mountainArray, int numberOfMountains, int sublistLength)
{
for(int i = sublistLength; i > -1; i--)
{
if(mountainArray[i].elevation < mountainArray[sublistLength].elevation)
{
BestIncreasingSublist* newSublist = new BestIncreasingSublist;
newSublist->mountainArraySpot = sublistLength;
newSublist->next = sublistArray[i+1].next;
sublistArray[i+1] = *newSublist;
}
else if(i == 0)
{
BestIncreasingSublist* newSublist = new BestIncreasingSublist;
newSublist->mountainArraySpot = sublistLength;
sublistArray[0] = *newSublist;
}
}
if(sublistLength < (numberOfMountains-1))
{
longestIncreasingSublist(sublistArray, mountainArray, numberOfMountains, sublistLength+1);
}
else
{
return sublistLength;
}
}


i have a trace
printf("sublistArray[%i] = newSublist\n", (i+1));
printf("newsublist.mountainArraySpot = %i\n", sublistArray[i+1].mountainArraySpot);
if(sublistArray[i+1].next != NULL){
printf("the one after in in the chain is %i\n", sublistArray[i+1].next->mountainArraySpot);}
at the end of the first if statement, the one within the for loop, and the "the one after in in the chain is..." is never getting printed out. all my other traces are. pls halp
>>
>>51461185
here are my structures
const int maxNumMountains = 100;
const int maxNameLength = 100;

struct Mountain
{
char name[maxNameLength];
int elevation;
Mountain()
{
elevation = 0;
}
};

struct BestIncreasingSublist
{
BestIncreasingSublist* next;
int mountainArraySpot;
BestIncreasingSublist()
{
next = NULL;
mountainArraySpot = -1;
}
};
>>
>>51461185
>unnecessary repeated code
>single statements in { } blocks
disgusting
>>
>>51461216
>>single statements in { } blocks

This is a good thing.
>>
>>51461216
i wouldn't have duplicated the sublistArray[i+1] = *newSublist; vs sublistArray[0] = *newSublist; parts, but they can't be merged. one of them sets it equal to i and the other to i+1
>>
>>51461255
Holy shit, why live?
        BestIncreasingSublist* newSublist = new BestIncreasingSublist;
newSublist->mountainArraySpot = sublistLength;
if(mountainArray[i].elevation < mountainArray[sublistLength].elevation)
{
newSublist->next = sublistArray[i+1].next;
sublistArray[i+1] = *newSublist;
}
else if(!i)
sublistArray[0] = *newSublist;
>>
>>51461068
Monads, in that sense, are more of an approximation or encoding of linear types in languages that don't have any notion of linearity.

The language I'm developing has both dependent and linear types built into it, so you don't need monads to express operations that need to be sequenced, you can just do something like this:
main : IO ()
main = let
x, io = read I32 io
in write (2 * x) io

Of course, it's possible (and quite desirable) to write a monad that can do this automatically, it's just not necessary.

>>51461152
Can you elaborate? I'm not very familiar with F* or ATS.
>>
I'm trying to use Python to rename every file in a directory to a random number.
but i just don't know to proceed from this point, i think i need a var that includes all .jpgs in the folder

here is my code so far
import os
import random

newname = random.randint(10000000, 20000000)
directory = ('D:\\b')

for i in directory:
os.rename(i, newname)
>>
I'm thinking I should make a github so I can have a portfolio to point to.
Should I start one now, even if the only thing I have right now are codeeval solutions?
>>
>>51461185
>>51461215
http://pastebin.com/UwEKMi1X
here's a link to the complete tracing of it
>>
>>51461316
To clarify: in that code example, the "io" values are linear. You obviously can't duplicate or throw out the world.
>>
>>51461185
i'm 60% sure the problem is somewhere in the

BestIncreasingSublist* newSublist = new BestIncreasingSublist;
newSublist->mountainArraySpot = sublistLength;
newSublist->next = sublistArray[i+1].next;
sublistArray[i+1] = *newSublist;

portions but i don't know what it is
>>
>>51461419
When you recurse, is it supposed to return that?
>>
>>51461316
ATS and F* both have a bit more of an emphasis on side-effecting code (since they're both more closely related to the ML family as opposed to Haskell and are very focused on general purpose programming) so the compilers try to help you out with that. In F*, pure, total functions are marked as `Tot` in their type signature, while side effecting functions are `ML` (since they behave like ML functions). Functions that are marked as `ML` don't get the same treatment as pure functions -- any attempt at doing so would result in 0 difference during runtime and no actual guarantees during compile time. Instead, it tries to translate the types into normal code. So if you have a function that reads in a string and converts it to an integer, then you pass that to a (pure) functions that finds the nth element in an array, the compiler is able to insert a check (like a call to an assert function) that will basically crash the program if the number entered is less than 0 and greater than or equal to the length of the array.
>>
>>51461352
Yes, it allows you to prove that you know programming.
>>
>>51461350
    directory = ('D:\\b')

for i in directory:

That will just iterate over the characters "D", ":", "\\" and "b".

You need
    for i in os.listdir(directory):
>>
I'll preface with I'm a Linux, Python, Ansible user.

My main two things this week are:
1. Migrating our entire company's infra over to AWS and making it completely immutable. When I'm done every action from commit to deployment to rolling restarts of the autoscaling groups with new gold images will be 100% autonomous and automated.

2. I started a CS:GO trading, betting and jackpot service with a friend. Have to learn C# for the bots though :/
>>
>>51461495
Also, do certain kinds of usernames make you look unprofessional?
I'm trying to think of one because every combination of my first+last name is taken and the usual username I use brings up too many anime and 4chan-related things on google.
>>
>>51461504
Just did it with another method, works great!
Ignore variables names, i'm not very smart

import glob
import os
import random
while True:
for f in glob.glob('*.jpg'):
new_filename = random.randint(100000000, 200000000)
new_new = str(new_filename)
new_new_new = new_new + '.jpg'
os.rename(f,new_new_new)
>>
>>51461547
Yes. Be careful with your username.

Try adding a delimiter like _ or your middle name (or both)
>>
>>51461547
It's weird, but a lot professionals I see on GitHub use anime profile pics and all. I don't think most (or at least many) employers care.
>>
File: csci instructs.png (42KB, 1521x480px) Image search: [Google]
csci instructs.png
42KB, 1521x480px
>>51461459
it's really more of a void function. it fills up a formerly empty array of bestincreasingsublists and then returns the spot where the last one is, which is the longest increasing sublist which is what i'm really trying to find. the array spots in the bestincreasingsublist array stand for how many parts of the mountain array it's looked at. so bestincreasingsublist[0] has only looked at the first mountain, and then [1] has looked at the first one and the second one, etc. my prof says this is the way it should be done. pic related is the instructions for the algorithm
>>
>>51461557
What's a glob? Is it like a frob?
WE NEED TO KNOW
>>
>>51461488
Oh, I see. The types I wrote in >>51460440 show how I deal with validating runtime values -- you have to pattern match on the result of the comparison to either get the proof or handle failure. I'm not a big fan of just crashing, especially on something that should be benign like incorrect user input.
>>
>>51461595
I have no idea what that module is or do, will take a look tomorrow
It's vanilla though, didn't have to install anything
>>
>>51460829
That's not C++, that's just C.
Just change your file extensions from .cpp to .c and use gcc instead of g++ if your not going to actually use any C++ features.
>>
>>51461639
A lot of people are a big fan of crashing.
Crashing means it's a lot less likely you've permanently corrupted data (or performed an unintended action).
>>
>>51461582
They're popular and successful enough to be different.
That's why employers dont care.
>>
Somebody say Frob?
>>
OMG I TOTALLY GET THE TOWERS OF HANOI PROBLEM NOW
Not quite worth staying home on a Saturday, but still...
>>
>>51461704
No, just /*fro\
\
b*/
>>
>>51461639
Yeah, it's very much an experimental approach to dependent typing. It haven't used F* or ATS enough to really know how well it works in practice, but I think the idea comes from the sort of approach to errors that governments, militaries, stock market companies, etc. use, which is basically crash if anything goes wrong to reduce potential damage to the system.
>>
>>51461698
>>51461746
I guess that's a good point. In that case, I may make it possible to write pseudo-partial functions that can crash and produce an error message + trace, although I think I'd make availability depend on a compiler switch.

Personally, I'm thinking of things from the use case of programming interactive, performance sensitive applications like games or simulations, not hard real time systems. But it would be crazy to write a super-safe language and tell the systems programmers to take a hike.
>>
>>51461575
github doesn't accept underscores in names.
just hyphens and you can't start or end names with them.
>>
how do i make a char in c++ act like an integer
char a = 102;
std::cout << a << '\n';

i want this to print 12, not f
>>
>>51461803
monad  
m
d o
a n
n a
o d
m
danom


error ceases execution chain, possibly starts alternative chain
>>
>>51461803
Since these functions that might crash are already impure, it might be possible to implement an exception type (or something like that) to help out with stack traces and also allow you to recover from a potential crash further down the call stack.
>>
>>51461856
std::cout << static_cast<int>(a) << '\n';
>>
>>51461856
>i want this to print 12
meant to say 102 desu
>>
>>51461856
std::cout << int(a) << '\n';
>>
>>51461887
>>51461879
i know you can cast it but is there truly no simpler way? i want a to be 102, i don't want to coerce it into being 102.
>>
>>51461873
->
>>51461863

maybe monad but instead of value present it's error present
>>
>>51461905
printf
%d
>>
>>51461905
just do it the C way, (int) a.
>>
>>51461873
That's what I'd already be doing, though. I originally planned to completely disallow crashing, you'd have to handle errors all the way down (which encourages you to PREVENT errors using types in the first place).

>>51461863
Monads just reduce the boilerplate from the "pattern match on result to get either value or error" idiom.
>>
File: shit.jpg (36KB, 583x310px) Image search: [Google]
shit.jpg
36KB, 583x310px
>>
>>51461940
>i know you can cast but can you do it without a cast?
>just use a c style cast
cfags everyone
>>
can someone pls help me?
ListCell* newListCell = new ListCell;
newListCell->value = x;
newListCell->next = listArray[i+1].next;
listArray[i+1] = *newSublist;


it's C++ and an array of lists. the first value at each spot is created fine, but it always points to null instead of the rest of the list it's becoming the head of and i can't see why
>>
File: 5e4aa8e0f67fd6ea.png (169KB, 305x365px) Image search: [Google]
5e4aa8e0f67fd6ea.png
169KB, 305x365px
Which FOSS project needs the most help? I want to help them out. I am thinking HURD, any other ideas?
>>
>>51462212
>wants to cast without using casts
>>
>>51462276
>Stolman
>Supporting open sores
>ever
>>
>>51462276
They wont let you develop HURD if you use the acronym FOSS kek
>>
>>51462261
more context?
>>
>>51462279
Do it the enterprise way.
int toInteger(char c)
{
return c;
}
>>
>>51462297
Fine "FREE" software
>>
File: 1439137772329.jpg (10KB, 240x200px) Image search: [Google]
1439137772329.jpg
10KB, 240x200px
>>51460893
>>
File: 1436448774147.png (60KB, 470x698px) Image search: [Google]
1436448774147.png
60KB, 470x698px
>Tfw i am a shit programmer

I guess i am too stupid for this
>>
Can someone tell me how to print a list out with each string on one line in python. For instance if the list were ["red", "green", "blue"] it would print as

red
green
blue
>>
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2019' in position
0: character maps to <undefined>

What is best alternative to run python in windows?
Command prompt is annoying.
>install linux
gtfo
>>
>>51462338
for x in ["red", "green", "blue"]:
print x
>>
>>51462338
x = ['red', 'green', 'blue']
[print(v) for v in x]
>>
File: 1380676804528.png (375KB, 996x998px) Image search: [Google]
1380676804528.png
375KB, 996x998px
> first job out of school
> primary job role is to work on infrastructure automation
> within a year 8+ other teams want to use it and it becomes a full-time job teaching them to maintain it
> no longer get to work on automation

On the one hand, it looks like I could probably get promoted soon. On the other hand, a kid fresh out of school shouldn't be able to fix shit this quickly in a multi-billion dollar company. It's a fucking embarrassment.

Don't let the tech-debt boogeyman get you too.
>>
>>51462304
i'm
>>51461185
i tried rephrasing the part i think is the issue. BestIncreasingSublists are list cells
>>
>>51462336

If you suck at programming, you can always try web development!
>>
     while (sorted)              // 1
if (values[first] > pivot) // 2
sorted = false;
else
{
first++;
sorted = (first <= last); // 3
}


So how many compares is this? Does java run a compare on the while call? I've seen better implementations of this but this is from my text book. For example, there's ways to not nest an if inside the while loop.
>>
Do I really need to learn java to make an android application?
I'm half way though python and started some C++...
>>
File: 65258007.jpg (82KB, 461x403px) Image search: [Google]
65258007.jpg
82KB, 461x403px
>>51462399
>>
>>51462486
You can use C++ for Android development, but it isn't recommended unless you really need the performance. The installation, compilation, and support is all messed up if you don't use Java.
>>
>>51462457
    while(sorted) { // 1
if(values[first] > pivot) { // 2
sorted = false;
}
else {
++first;
sorted = first <= last; // 3
}
}
>>
>>51462486
it's strongly recommended to learn java for android dev but it's not even that hard. hard compared to python but easy compared to C++
>>
>>51462486

Yes. Even if you push most of the business logic into some other language through the JNI, you still need some Java for the interface. All of the libraries on Android for handling the UI are in Java.

This is the only thing wrong with Android.
>>
>>51462600
>This is the only thing wrong with Android.
This is bait.
>>
>>51462537
I wasn't concerned with formatting to be honest. It looks much like that in the code I had just fucked up the post while deleting my personal comments.
>>
>>51462600
>wrong

I detest the accusation.
>>
>>51462682

Java's all fine and dandy, but why not make a C library for UI shit, and let other languages make bindings for it, like everything else does?
>>
>>51462616

You're right, there's one more thing wrong with it - it doesn't have a root account by default, and companies are allowed to use the Android trademark while providing locked down bootloaders.
>>
>>51462308
kek, I exhaled sharply through my nostrils.
>>
>>51462439
But it is programming too
>>
>>51462336
no worries, you can still get a high paying job.
>>
>>51462798
How? I can't even do fizzbuzz... Fuck
>>
File: erlang.jpg (10KB, 254x406px) Image search: [Google]
erlang.jpg
10KB, 254x406px
We've just started functional programming at uni with Erlang. The task was to make a program that solves Towers of Hanoi for n disks.

Did that, but there's an optional bonus task I want to sink my teeth into but have spent the past five hours making no progress with: write function(s) that will solve the problem from any arbitrary (but valid) starting configuration.

Without straight-up telling me the answers, if anyone could push me in the right direction that'd be lovely.
>>
>>51462861
I get that I'm probably meant to try and rearrange the disks to the ideal start position, then just call my original
solve()
on that state, but I can't figure out how to recursively bring everything to that point.
>>
>>51462819
really? :(

You really should try web dev then
>>
>>51462861
differential evolution is always the answer, so what is the question
>>
Am I allowed to copyright a repo I upload to github?
Would the words "All Rights Reserved" suffice?
>>
>>51463129
https://help.github.com/articles/open-source-licensing/
>>
>>51463129
You can, but if you do you're probably being an asshole. Why not just avoid publishing it to github in the first place?
>>
>>51457707

Currently learning c++ from Stroustrup book.

Compiling on ubuntu/gnome with g++ command.

Get tons of errors first one is I need to use -std=c++11 or -std=gnu++11 experimental compiler options.

Does this mean my current version sees C++11 as experimental? Will it even work if I get around to trying something even newer like something added in 2014? Is this common for c++? Am I misinterpreting everything this is a pretty up to date version of the distro.
>>
>>51463129
You are a retard.
>>
>>51463189

It does compile if I use the option. How do I run the file it creates?
>>
>>51462957
w-wha
>>
>>51463145
http://choosealicense.com/
>>
>>51463224
it can solve literally anything
>>
>>51463206

I gave the compiled file a name with the -o command. Should I have included a file extension? Might be my problem with linux not wanting to run it.
>>
Anyone here familiar with Go?
I need some help parsing some weird xml shit.
I'm trying to parse it by creating structs that it can be unmarshaled in to.
The issue is that the tags aren't unique
<dict>
<key>frame</key>
<string>{{1125,225},{224,224}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{224,224}}</string>
<key>sourceSize</key>
<string>{224,224}</string>
</dict>


Can this shit be unmarshaled like this, or do I need to go about it in another way?
>>
>>51463257
Obviously that is some shitty hashmap.
>>
>>51463206
./a.out
>>
>>51463272
well, shit, so it would seem, thanks
>>
>>51463257
import lxml
>>
>>51463189
C++11 is the newest version of C++, it's not experimental; it works very well. I always use the -std=c++11 flag for my C++ code because I love so many of the C++11 features, don't worry about compatibility because all of the popular C++ compilers support it
>>
>>51462347
python on os x
>>
>>51463257
Just map it into a slice

Look at the example
https://golang.org/pkg/encoding/xml/#Unmarshal
>>
>>51463237
Can you elaborate at all? I'm reading everything I can find and it's not clicking.
>>
>>51463320
>C++11 is the newest version of C++
>>
>>51463129
>proprietary license - please don't steal :^)
>>
>>51462347
a UTF-8 (see: not cp437) terminal
>>
I'm transferring to a college and they're telling me none of my CS credits are transferring because they weren't "math-based." Was my advisor an idiot or am I really that fucked?
>>
How do I declare a 1-byte integer in C++?
>>
>>51463542
char name;
>>
>>51463542
int8_t dicks;
>>
>>51463146
I need something in my portfolio.
>>
>>51463382
>>51463320

So why does this ubuntu/gnome distro I downloaded 2 months ago need a special option to use code from anything 2011 or newer? Can I just expect linux compilers to be behind as fuck?
>>
>>51463542
signed or unsigned?
>>
>>51463575
What if you have code from >4 years ago that you want to compile?
>>
>>51463590
Then use today's compiler because it will work?
>>
Work is frustrating. I'm rewriting some software for my job and there is a field that has three different names throughout the program and database.

I'm also frustrated with our clients (governments). We ask them to send CSV files and many of them fuck it up so bad that we have to write a custom parser just for them. One would think that CSV files aren't that complicated, but it's apparently too complicated for a lot of government programmers.

Our build system and dependency management is a mess. We have half a dozen repositories and it's not that uncommon that projects have to pull from several of them because two dependencies in the same repository will have a version conflict with each other. We use Ant/Ivy. Years ago they tried to standardize it. It was a complete and total failure. So now we have a dozen "standard" Ant/Ivy configurations depending on the type of project, but they are still so fucking terrible that the reality is that people have to write their own anyway because out of the dozen different ones they have, they still aren't likely to do what you need or even work at all.

Security is a fucking joke. A lot of big companies have gotten hacked or had leaks so our top priority lately has been security. If you ever want to see a classical case of "security theater", this is it. Everything they've done has just made getting real work done more difficult. When I asked the lead architect about actually encrypting our sensitive data, the one they they really should be doing, the answer was that it was too difficult. Keeping libraries up to date which may have security vulnerabilities was also "too difficult".

My title is "software engineer", but it sure doesn't feel like a lot of engineering is going on. I'm just thankful our software isn't safety critical. A lot of people would die.
>>
>>51463590

Then use a command to use the old stuff? All the tutorials I am seeing dont use that command to do current stuff and it makes me think I am fucking up somewhere.

Also this >>51463605 wouldnt a current compiler be ready for old code?
>>
MICROSOFT VISUAL STUDIO
COMMUNITY VERSION FREE
ITS 2015 EDITION
seriously stop using your shitty ides
>>
>>51463575
Depends on the compiler version. Compilers support different standars and also use different ones as their default. Newer versions of compilers will default to C++11 or C++14, with older compilers you will need to explicitly tell it to use the newer standard with -std option (nothing bothersome also given that the compiler supports it).
>>
>>51463625

But I want to work on my linux laptop. And I am used to vim I kinda like doing everything in the terminal window.
>>
>>51463617
Code finds a way, anon.
>>
>>51463637
I think it plainly stated that you have a parameter name in your prototype without it's type.
>>
>>51463637
You need to specify what kind of type num is.
>>
>>51463637
the prototype should have either just the TYPES of the parameters or types AND var names
>>
>>51463641
>kinda like doing everything in the terminal window.

Doing things in a terminal window for the sake of doing them in a terminal window is second to none in terms of faggotry.

I swear if I hear the word 'productivity' one more time...
>>
>>51463617

This is just life anon. People literally do only what they have to in ever field and profession. A giant pile of shit barely holding together seems sadly inevitable.

I like this optimism though. >>51463651
>>
>>51463625
not free, fuck off
>still no good C support
>needs windows
>needs a nasa-tier machine to run on
>>
>>51463687

Its not productivity Im muddling through learning here. I just like not have to switch between shit.

Someone how I suspect vs wont work on linux anyways and I dont want to vm on my laptop though its probably not that difficult.
>>
>>51459200
Speaking of which, where is benchmark guy?
>>
>>51463703
>>still no good C support
Because it primarily focuses on the superior upgrade that C++ is.

>>needs windows
Unfortunately, I wish I could run MSVS on Linux.

>>needs a nasa-tier machine to run on
False. I have a Windows development machine with a chip from 2007 and barely 4 GB of RAM and it works just fine.
>>
>>51463703
Visual Studio 2015 Community is free

>Nasa tier
>16 bit
>4kb RAM
>70kb ROM
>>
>>51463687
A lot of people on /g/ use vim and do things in a terminal window not because it's more productive but because they are ignorant elitists. They read about computing legends like Dennis Ritchie and how they worked in the 70s and want to emulate them. They dismiss modern IDEs because they think they are for "code monkeys". They have a typical "everything was better in the past" type of mentality that you often hear from baby boomers when they talk about The Beatles. I also think they want to impress strangers. I suspect that half the people in this thread are the kind of people who open a bunch of terminal windows on their laptop at school or at Starbucks and are just hoping that someone notices it and thinks they're some uber hacker straight from The Matrix.
>>
>>51463720

It doesn't need a video card or anything right? With a modern processor you could run a vm with some kinda of invisible option you wouldn't even know its windows. You would take a minimal performance hit but not much worse thing would be the windows image for the vm taking up hard drive space.

Hell I might try this I was learning how to do hardware pass through weeks ago and just a vm withotu hardware is easy enough.

Well fuck compiling would be fucked though.
>>
>>>51463657
>>51463661
>>51463670
Holy shit I am retarded. Sleep deprivation, I'll blame sleep deprivation.
>>
>>51463740

What if I just want to do all my code in the same text editor with some mods on it? That is the biggest thing for me. Also the terminal windows means no mouse just commands to get out compile go back in whatever.
>>
>>51463720
>Because it primarily focuses on the superior upgrade that C++ is.
Only if you are a retard C++ can be considered superior.

>Unfortunately, I wish I could run MSVS on Linux.
I wonder why.

>False. I have a Windows development machine with a chip from 2007 and barely 4 GB of RAM and it works just fine.
And I have a intel atom with 1 GB RAM and it does NOT work fine.

>>51463738
https://www.visualstudio.com/en-us/mt171547.aspx
lolno
>>
>>51463789
>if it has a license attached it isn't free
>>
Using IDEs is necessary and useful only in shitty languages such as Java, C#, and C++.

>>51463812
Are you fucking dense? This is a non-free license.
>>
What is so good about VS anyways?
>>
File: 1447721376640.png (320KB, 1979x1346px) Image search: [Google]
1447721376640.png
320KB, 1979x1346px
>>51463788
This. I would love to learn vim/emacs just because my hands would never have to leave the keyboard.
>>
>>51463836
>available for free
>not free
>>
File: 1441571231201.jpg (61KB, 500x375px) Image search: [Google]
1441571231201.jpg
61KB, 500x375px
>>51463812
>The software may prompt you from time to time to obtain a license key, such as by signing into a Microsoft account. If you do not obtain and enter a new license key when prompted, you may not be able to use the software and access your data in the software.
>Microsoft can legally assfuck you at any given moment
>free
>The software may collect information about you and your use of the software, and send that to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may opt-out of many of these scenarios, but not all, as described in the product documentation.
>Microsoft can legally spy on you at any given moment
>free
>>
>>51463853
It has hipster metro GUI that impresses children, it is nice for creating windows for Visual Basic, it is made by microsoft(R) and supports the latest enterprise practices.
>>
>>51463879
Free as in freedom you dumbfuck.
>>
>>51463882
>you need a microsoft account so they can spy on you and tell you aren't just throwing away keys for other people to use
>they spy on you like everyone else
so what
>>
>>51463893
Holy shit that's stupid.
Possibly the dumbest thing I've seen in /dpt/ in the past month or so.
>>
>>51463895
>>51463882

Its got to be piratible.
>>
>>51460829
Grab SFML or SDL and draw at least a window with colored boxes.
>>
>>51463895
>they spy on you like everyone else
>so what
Get the fuck out of my face with this garbage, you kekold.
>>
>>51463909
just started on /g/ last month, huh? yeah, me too. what the fuck is this board's obsession with that hobo-lookin dude, rich stamford? stalwart? idek lmao
>>
>>51463927
Got anything to hide?
>>
>>51463927
>they know what code I'm writing and running
>this is the same as my wife getting with other guys

fucking librarians, every time
rand go home
>>
>>51463788
If you really prefer it, then go for it. That's fine. I just get annoyed at the elitists who often show up to DPT and start this "real programmers only use the terminal" bullshit. Whenever I hear that, I know they've never worked on a real project. Many of them are still in university and think they know more than the entire rest of the software development profession.
>>
>>51463708
>Someone how I suspect vs wont work on linux anyways

It won't, but there are plenty of good IDEs on ganoo/loonix anyway.
>>
>>51463939
>tfw MS has something to hide by keeping their code closed
>>
>>51463939
Once MS open sources all their code, I will open source all of mine. Until then, it would be an uneven exchange of code.
>>
>>51463948

And truth be told, working with some languages and no IDE is akin to jumping off a bridge without a bungee cord.

The only thing you'll have accomplished in short order is killing yourself.

I'm looking at you, Java.
>>
Seriously, if you use the internet, you can't bitch about being spied on.
>>
File: 1427472122498.png (284KB, 3500x3500px) Image search: [Google]
1427472122498.png
284KB, 3500x3500px
>>51463909
>>
>>51463983
conversely, this is the internet
I'll bitch about whatever the fuck I want to
1. you're a faggot
2. >tfw no gf
>>
>>51463882
>>Microsoft can legally spy on you at any given moment
You're being spied on either way.
>>
>>51463970
>Not freeing your code
found another faggot.
>>
>>51464002
>2. >tfw no gf
>>>/r9k/
>>
>>51464006
If my traffic is encrypted, and the other end isn't leaking anything, then all the NSA is collecting is garbage.
For the part that is unencrypted, well, no reason to give anyone more than what they're getting already.
>>
>>51464006

Just because someone wants to rape your ass doesn't mean you should just give up and not fight it.
>>
>>51464037

And that's why everyone should carry a gun. :)
>>
>>51464037
Maybe stop working for ISIS?

Seriously, unless you live in Germany or Sweden you don't need to hide shit from the government.
>>
>>51463738
>>16 bit
>>4kb RAM
>>70kb ROM
there's no way that can run visual studio 2015 community
>>
>>51464053
>you don't need
Fuck off with this idiotic fallacy already.
>>
>>51464054
If it can put a man on the fucking moon it better run some shitty IDE
>>
>>51464037
There's a difference between physical violence and being observed in public (internet is a public place). When you go to a store, do you tell the cashier to not look at you because it violates your freedom?
>>
>>51464058
>the truth is fallacious
Go home lolbertarian, or I'll step on you with my big government boot.
>>
>>51464069

It ain't the bill of needs, son. No unreasonable searches, m80. :)
>>
I just started using git from the command line, and I ended up having to delete my repo 3 times before I pushed it correctly.

I feel like I'm gonna fuck something up every time i
git push origin master
.
How the hell do people do things like maintain separate branches and pull requests?
>>
>>51464069
Post your full name, phone number, address, date of birth, social security number, card card numbers with security codes, and your place of employment right now.
>>
>>51464065
>being observed in public (internet is a public place)
what you do in your fucking IDE doesn't need to get broadcasted to the jews
>>
>>51464083
Fuck off, you don't work for my government
>>
>>51464079
They actually learn how to use the software instead of blindly typing in commands. Also pull request is not a feature of git, it's a feature of Git hosting websites, in the end it's just a signed off patch.
>>
>>51464053

Yes you do and corporations are probably worse. That is if the gov isnt getting hacked this week and leaking what they have on you.
>>
>>51464097
Woah, I thought you didn't have anything to hide? Put that tinfoil hat on harder.
And last I checked, Microsoft isn't the fucking government.
>>
File: academia_vs_business.png (40KB, 740x382px) Image search: [Google]
academia_vs_business.png
40KB, 740x382px
Ive a bit more than 24 hours to program the programming project of the semester.
>>
>>51464065

What does that have to do with my ide or os spying on me in my home and sending out the info.
>>
>>51464116
>That is if the gov isnt getting hacked this week and leaking what they have on you.
And? Are you a degenerate that would be ashamed of his actions if your neighbours or family found out? In that case it's maybe the time to rethink your life decisions.
>>
>>51464119
I have plenty to hide from you, from the government is a different matter, rand.
Microsoft aren't the ones tapping the phone lines.

>b-but it's one rule for the government and another for me!
no shit
>>
>>51464079

Git is pretty complicated or at least more complicated then it first seems.

Worse it will seem ok to a beginner once they have a few commands down then bite them in the ass when they step on a hole.
>>
File: sussman shig.jpg (71KB, 500x375px) Image search: [Google]
sussman shig.jpg
71KB, 500x375px
>>51459797
>"""""""""""neural""""""""""" networks
>>
>>51464135

How about I keep doing my filthy shit in private instead.
>>
>>51464142
The discussion originated with Microsoft legally collecting whatever information they wish, you fucking faggot.
I have no need nor desire to give them any information. Calling anyone who values their privacy a libertarian is idiotic, and simplistic in the extreme.
>>
>>51463620
The new version might not be backwards compatible (I say might because I think it is backwards compatible, but you can't always be sure), and most software is written in the older version, so that's why you have to specify.
Any C++ project that uses a Makefile already supplies a fuck ton of option (optimization -OX, warnings -Wall, debugging -g, linking -L, -l, include paths -I) so adding an extra option is no big deal if you're using the latest C++ revision.

A lot of times if you do something wrong and it's because of your C++ version and the compile flags, it will give you an error specifically saying "THIS FEATURE REQUIRES C++11", so as long as you read the error messages you should be okay.
>>
>>51464165

Why the fuck do Americans forget shit so quickly?
>>51463895
>>51464006

Guess what, Microsoft aren't stealing your corporate secrets and they aren't laughing at your browsing history. They're using it for A) what they fucking say and B) giving it to the government when you break the damn law
>>
>>51464189
It literally doesn't matter what they are using it for, there is no guarantee that A) They are transmitting or storing it securely and B) They won't sell it to someone who fails condition A)
The fewer the parties that hold my personal information, the lower the chance is that someone will get a hold of it and use it maliciously. It's a very simple concept, and the same one that fuels your instinct not to post YOUR private information in this thread.
>>
>>51464189
5 shekels have been added to your bank account
>>
>>51464220
>I care about the government having access X
>I care about Microsoft having access X
>I care about you having access

The only thing that worries me is my country getting more and more hate speech esque laws
>>
class Player
{
private:
str name;
str role;
i32 hp;
i32 mp;

static u32 player_count;

public:
/* constructors */
Player(str, str, i32, i32);
Player();
~Player(); // deconstructor

/* getters */
str getname() { return name; }
str getrole() { return role; }
i32 gethp() { return hp; }
i32 getmp() { return mp; }
static u32 getplayer_count() { return player_count; }

/* setters */
void setname(str n) { name = n; }
void setrole(str r) { role = r; }
void sethp(i32 h) { hp = h; }
void setmp(i32 m) { mp = m; }

void tostr();

};

g++:
undefined reference to `Player::player_count'

visual studio:
unresolved external symbol "private: static unsigned int Player::player_count"

what the fuck am i doing wrong? why is player_count being such a bitch?
>>
>>51464247
I care about anyone having my personal information, as I said, the more times it is transmitted, and the more parties that are in possession of it, the greater the chance is that it will be used in a malicious manner.
Furthermore, it's in the fucking constitution, so I damn well have a right to privacy as far as the government is concerned.
>>
>>51464257
did you initialise it?

actually, it's private, can you even initialise it?
>>
>>51464289
well you can always use peerblock
>>
>>51464292
i didn't initialize it, i thought that if you don't initialize an integer its value is set to 0, is that wrong?
>>
>>51464257
> "// deconstructor "
> custom str datatype
>>
>>51464333
str is just a typedef for std::string
>>
>>51464317
Yes. Very, very wrong.

The next time someone asks you to pat yourself on the back
don't do it
>>
>>51464313
Placebo at best. Any type of network blocking will have to be done external of the compromised system to have any decent measure of certainty.
Also, I'm not going to use software that I have to use extra software to block network connections to.
>>
>>51464336
You could just do:
using namespace std;

What is wrong with you?
>>
>>51464333
All those fucking getters and setters that are just

getx() { return x; }
setx(newx) { return x = newx; } (should be if he didn't make em void)

jesus christ
>>
Don't ever follow this guys advice: >>51464354
[spoiler]it's dumb[/spoiler]

do this /inside/ the class
using string = std::string;
>>
>>51464257
Player count should be known by the class who is responsible of spawning players.
>>
>>51460421
>hating on mathematicians
that's probably an engineer or experimental scientist. good mathematicians clean up their calculations as much as possible.
>>
>>51464375
Yeah hipster use the flashy new typedef.
>>
File: d.jpg (12KB, 400x400px) Image search: [Google]
d.jpg
12KB, 400x400px
>>51464339
got it, i initialized it to 0 and its working fine. thank you.

>>51464354
then i have string. i want str

>>51464360
i apologize, i'm new to oop. how should i be doing it then?

>>51464375
i don't want it just inside the class. i included a header file that has this:
#include <string>

typedef char i8;
typedef unsigned char u8;
typedef short i16;
typedef unsigned short u16;
typedef int i32;
typedef unsigned int u32;
typedef long long i64;
typedef unsigned long long u64;
typedef float f32;
typedef double f64;
typedef std::string str;
>>
>>51464406
Use this:
http://www.cplusplus.com/reference/cstdint/
>>
Any good programming forums/IRC outside of /dpt/?

>>51464406
Including a header like that is OK for personal projects but I wouldn't do that in any production code / libraries. I just write out std::string every time. As for integer types you should use <cstdint> because its standardized.
>>
>>51464406
This is retarded. Nobody can gurantee how many bits these types really are. use stdint.h instead.
>>
>>51464406
>Being a special snowflake
>Not using stdint
>>
>>51464428
>>51464430
>>51464446
>>51464436
thanks, i had no idea <cstdint> existed
>>
>>51464428
>>51464430
>>51464436
>>51464446
Give the guy a break already, he probably just didn't know about cstdint, don't need to tell him so many times...
>>
>>51464406
it's not that getters and setters are inherently bad, and if you're doing a uni course you'll probably get higher grades for it, it's that they're overused as fuck

with name for instance, literally no reason to have getters/setters
//
don't do that other bit
just use the built in types, seriously
prefer std::string to str
>>
>>51464430
##programming in freenode I guess. Then you have evangelists of each language with channels of their own.
>>
new thread when
>>
>>51464459
When I posted that the other posts weren't there.
Retard.
>>
>>51464400

I dunno, I've seen a lot of bad code by mathematicians.

But you're spot on with the rest. Especially mechies. Their matlab code cannot be saved.
>>
>>51464476
this is the last one
>>
>>51464463
so what should i do instead? have the member variables as public?
>>
>>51464257
you suck at "OOP"
>>
>>51464493
yes, or protected and the classes using it can be friend classes
>>
>>51464479
>Retard.
/dpt/ so hostile.

>>51464493
I used to believe in encapsulation but then I realized it was a waste of my time. I keep stuff that is "public" (read/write by external sources) as public. It'd be different if I was using C# because they have neat features for that stuff, and I wouldn't be writing Java so there is no hypothetical there.
>>
>>51458565
>python
>>
>>51464522
>I used to believe in encapsulation but then I realized it was a waste of my time. I keep stuff that is "public" (read/write by external sources) as public.
retard. that's not what "encapsulation" is for
>>
>>51464529
We need less people like you in the world.
>>
>>51464544
Less people that know what Python is.
Literal carcinogens.
>>
>>51464544
python is a disgusting, pathetic excuse of a language. there is no rigor to it. its users and its creator are unwarrantedly smug about it too
>>
>>51464488
well, it was good knowing you, /dpt/ ;_;
o7


j/k, this general is truly SHIT, I only come here to laugh at, and feel sorry for, the ones that give a fuck about what /dpt/ thinks
>>
new thread
>>51464580
>>
>>51464542
Encapsulation is about wrapping everything in functions so that custom set/get functions can be integrated without headaches in your other source code.

>>51464552
I really don't want to argue with you right now, but if you feel that strongly against Python then you really have lost touch with reality.
Python is by no means perfect but what it succeeds in it does very well and I'm glad that it exists. (coming from a FP fanboy who writes all of his code in C++ and has a very good grasp of low and high level programming, not just some Python shitter)
>>
>>51464576
>rigor
What exactly do you mean by that? You mean it's too easy to use or what?
It's a tool, not an academic course in computer science or computer architecture.
>>
>>51464593
>Encapsulation is about wrapping everything in functions so that custom set/get functions can be integrated without headaches in your other source code.
in that code it's just a direct get and set and you have the logic that determines the values outside the class which breaks encapsulation you massive retard
>>
>>51464610
it's sloppy. it can hardly be used for anything more than tossing together a crappy script that uses some crappy pre-made library. it's paint-by-numbers "programming"
>>
>>51464617
That's what Unis teach encapsulation as.
The only real purpose it serves is that if you change the implementation the interface can stay the same.

It's retarded most of the time.
>>
>>51464642
Sloppy? You still aren't explaining exactly what you mean by this.
>it can hardly be used for anything more than tossing together a crappy script that uses some crappy pre-made library
Because of the performance issues? I think most people consider Python a scripting language first and foremost, and performance is not the highest priority with that type of language.
>>
>>51464649
THAT form of "encapsulation" is retarded. actual encapsulation is not. think of it as if you had an actual, physical object. if you turn on your car for instance, you don't have to fiddle with the fuel injectors and whatnot, you just turn the key or press a button. THAT is encapsulation.
>>
>>51464670
duck typing, disgusting syntax mainly. performance too. prefers to work incorrectly instead of failing with a clear error
>>
>>51464617
Calling me a retard really isn't helping me understand your argument

>>51464677
Not everything in a program is a fuel injector. When do you encapsulate and when do you not?
I'd rather not encapsulate when I don't need to if encapsulating is going to make all my code annoying to write and lengthy and verbose.

>>51464642
It's great for learning programming, or for making scripts, or even for non-high-performance programs like web stuff. My girlfriend is taking an intro to programmin (Python) course that is very rigorous, doesn't rely on libraries too much, and teaches everything from string manip, recursion, to loops and conditions, to status and pass-by-value semantics, and OOP.
Python lets you write code that works very easily without struggling with dumb shit like in C or C++. It's an interpreted, dynamically typed language like JS, Ruby, Perl etc. and it is one of the best ones too. The syntax is very readable and consistent and the semantics and design are also consistent too.

>prefers to work incorrectly instead of failing with a clear error
If anything, Python does this MUCH LESS than its competitors: PHP, JavaScript etc.
>>
>>51464700
>python is good because it's not as bad as PHP and javascript
>>
>>51464700
Sorry:
*programmin -> programing
*status -> states
>>
>>51464718
>this programming language is good because it's not as bad as other programming languages
well done
>>
>>51464718
>>51464728
NOT ALL PROGRAMMING IS HIGH PERFORMANCE C CODE.
Sometimes you just want to write something that works, and if you do your choices are PHP, JS, Python, Perl and Ruby. And Python is probably the best option there. I also gave reasons why it's good beyond comparisons:
>The syntax is very readable and consistent and the semantics and design are also consistent
>It's great for learning programming
>for non-high-performance programs like web stuff

I hate arguing with people like you.
>>
>>51464750
>NOT ALL PROGRAMMING IS HIGH PERFORMANCE C CODE
triggered the fuck out holy shit
>>
>>51464728
>being better than the absolute bottom of the barrel webdev """"""""programming""""""""" languages means it's good
>>
>>51464750
>Sometimes you just want to write something that works, and if you do your choices are PHP, JS, Python, Perl and Ruby.
>>
>>51464761
>implying you can do fast and dirty prototyping faster in your precious C
>>
>>51464750
there is no middle ground for you, is it

just use java or C#
>>
File: 1415430716703.jpg (23KB, 396x385px) Image search: [Google]
1415430716703.jpg
23KB, 396x385px
>>51464781
>using Java
>>
File: 1386094988354.jpg (32KB, 312x342px) Image search: [Google]
1386094988354.jpg
32KB, 312x342px
>>51464839
>java
>absolutely disgusting
>C#
>ah, much better
>>
File: 1412708078568.jpg (9KB, 316x202px) Image search: [Google]
1412708078568.jpg
9KB, 316x202px
>>51464896
>using a language developed by Microsoft
>>
How shit of a solution is this for the fizzbuzz question:

"Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

for (int i = 0; i <= 100; i++)
{
if (i % 3 == 0 && i % 5 == 0)
cout << "FizzBuzz" << "" << endl;
else if (i % 3 == 0)
cout << "Fizz" << "" << endl;
else if (i % 5 == 0) cout << "" << endl;
else cout << i << "" << endl;
}
>>
>>51464926
looks normal

but you left out the Buzz and why the
<< ""
>>
>>51464926
if (i % 3)
if (i % 5)
fizzbuzz
else
fizz
else
if (i % 5)
buzz
else
i
>>
>>51464948
Oh shit, didn't even realize i left out. Originally i was gonna print it all on one line but i realized it would've been too long so i just used endl instead of spaces

>>51464958
Interesting
>>
>>51464991
still suboptimal
write the output manually
>>
>>51464774
>prototyping
You're supposed to figure shit out in your head or in pseudocode. Not my fault you spew out buggy code by default.
>If you want more effective programmers, you will discover that they should not waste their time debugging, they should not introduce the bugs to start with. -Edsger Dijkstra
>>
File: 1441585298029.png (148KB, 2500x1645px) Image search: [Google]
1441585298029.png
148KB, 2500x1645px
>>51465710
>I make perfect code the first time I type it
>>
>>51465710
this. fucking normies will cobble some crap together in weeks and then spend months and years debugging it when they could have just made it properly in the first place
>>
>>51465762
Never said that. I clarify and plan out what I am going to do before I start writing code.
>There are very different programming styles. I tend to see them as Mozart versus Beethoven. When Mozart started to write, the composition was finished. He wrote the manuscript and it was 'aus einem Guss' (from one cast). In beautiful handwriting, too. Beethoven was a doubter and a struggler who started writing before he finished the composition and then glued corrections onto the page. In one place he did this nine times. When they peeled them, the last version proved identical to the first one. -Edsger Dijkstra
>>
>>51465902
Your quotes clearly imply that you write bug-free code "by default." You're full of shit, and write trivial programs at best.
>>
I'm new at this stuff. Let's say I'm learning python as of right now, about half way through Thinking Like a Computer Scientist, and I'm taking my first programming class which will be based on Java next semester. Should I just finish up this book on Python or should I get a head start on Java?

I'm thinking it might be better to just finish learning Python, and then when I start doing Java next semester I'll start fresh and I'll be able to at least learn quicker having gone through Python. Advice?
Thread posts: 385
Thread images: 31


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.