[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 27
File: CTbs4tmWEAAQhdc.jpg (66 KB, 920x705) Image search: [Google]
CTbs4tmWEAAQhdc.jpg
66 KB, 920x705
Previous thread at >>51436784

What are you working on, /g/?
>>
So if yall had to write a web app (or something thats based on an ssh server), what language would you use?

Right now I'm working on my senior project, and I'm making a web app ((honestly don't even know what to call it, if it even does qualify as a web app).

Basically, its for elementary school Science Fairs. Right now, most science fairs have all the volunteer judges score everything by hand on paper, then after all projects are graded the judges sift through every paper to determine the winner for each category.

I'm using .php and .sql, and an ssh server w/ MariaDB. So basically, upon login you can log in as either an administrator (if you have permission) or a judge.
>upon judge logging in, they can view all the different categories
>click on "view category" to view all the students they have scored for that respective category
>can add/edit/delete student scores, but only the students THEY have graded
>judges cant see other judges project scores or the students theyve graded
>admin can import a .csv file for a list of judges, which will add usernames and passwords for the list of judges, which they will then give to the judges prior to the competition so they can log in
>unique judgeID is generated for each judge using AUTO_INCREMENT
>admin can also import .csv file for a list of participating students, w/ their names, what grade they are in, and their project category
>unique studentID generated using AUTO_INCREMENT
>also thinking I might need a projectIDnum for each student, that can be associated w/ multiple judges scores
>admin can click a generate winners button that queries to find who the winner of each category is

Do yall think theres a better way of doing this than in php (and maybe some HTML)? I'm pretty set on doing in like this, but what would yall do in my case?

I don't think its going to be that hard b/c I've worked w/ php a bunch (and am currently taking a class on html, javascript, CSS, and jQuery).
>>
>>51443261
who is this seabound peepeehound?
>>
I want to put a source code analyzer on my build server
Any suggestion what I should use, /g/?
>>
>>51443330
Language?
>>
>>51443305
well meme'd, friend
>>
>>51443346
Java, but it would be nice if it also supported some webdev and other languages
>>
>>51443281
>yall
do you even code switch
>>
What's the most strongly-typed language of all time?
>>
>>51443261
is there a $1 equivalent in perl?
I want to modify a perl script so when I type (program) (word) it takes the word in and does it's thing with it.
>>
>>51443398
$ARGV[0]
>>
Who here /perl6/?
>>
>>51443395
Binary electronics
>>
>>51443364
http://www.coverity.com/
>>
>>51443466
Okay, but like a Turing machine, for instance, is like the weakest-typed machine mathematically allowed in the physical universe.
>>
>>51443476
Do you also have something opensource
>>
Self teaching python here, and I'm a little stuck

>Write a program that reads integer values until a
0 value is encountered, then writes out the sum of the
positive values read and the sum of the negative values
read

I understand the need for a while loop, but I can't seem to structure it right.
>>
>I'm overjoyed that I actually hurt your feelings. I wish I could hurt your feelings so much you would commit suicide. sadly, this has failed, and now the world has to live with an amoral creep who considers himself above ethics and reproach. you are clearly a psychotic monster, beset with hatred and malice towards everything that hurts you, and you're so out of touch with reality to begin with that your fantasy world is taking over, and hence it is in fact impossible to hurt you, any more than you constantly hurt yourself. this is also why you have to imagine what my day is like, and post your literally insane imagination. any remnant of sanity would have held you back from such levels of psychotic behavior.

>you should consult a psychiatric ward and have yourself committed before you actually kill someone in your deranged, psychotic state, filled as you are with hatred and malice towards people who didn't stop hurting you when you screamed "please don't hurt me" to yourself, only.

>the only thing I regret is that I didn't see your fantastic stupidity as a result of your shattered psychology -- it's fairly uncommon to be so fucking retarded because of a psychological problem, but clearly, you have been immensely stupid all your life, and now that I come and hurt your stupid feelings, so you turn on me like a vicious and mad dog -- and that's exactly what you are to me: a mad dog in need of a bullet through his sick brain before he actually manages to hurt someone or himself.

>do the world a huge favor and commit suicide tonight.

naggum would have loved /dpt/ and we're poorer off for his absence also lisp
>>
>>51443504
I know clang does static analysis, but that won't help you.
>>
>>51443395
"strong" typing is subjective. But even assuming that there's a valid answer to that question, it's probably something that is essentially unknown outside of the CS department where it was invented.

Among mainstream languages, I think it would have to be Haskell. E.g. there are a ton of distinct numeric types and type classes with different operations (e.g. Fractional has / while Integral has div) and there are no implicit conversions (even for widening conversions). There aren't even explicit conversions if the conversion is lossy; e.g. converting RealFrac to Integral requires choosing one of truncate, round, ceiling or floor, depending upon the desired rounding direction).
>>
>>51443434

I made a few example scripts while skimming through the documentation and perl-5-to-6 guide but haven't been further enticed to start a larger project in it.

I'm still using Perl 5 for two other projects and having a blast.
>>
>>51443577
Well at a certain point it stops being "stronger" or and just becomes more expressive, etc. Idris is more expressive/powerful than Haskell and Coq is more expressive/powerful than that.
>>
>>51443577
I think this is a good answer. Interestingly, Agda is maybe the weakest-typed language ever.
>>
Is there a way to get the terminal bell to ring when a job has finished? bash
>>
>>51443577
haskell is a strong statically typed language, but there are examples of strong dynamically typed languages (e.g. lisp).

You're right that "strong" and "weak" typing aren't well-defined, but I guess in common terms it has to do with whether you can use a type out of context in a way that people think is significant (and for some reason most people think you should be able to use an integer in a floating point context for instance).
>>
how can i make circular classes in either java or scala:

public class Person {
private String name;
private int age;
private Set<Group> groups;

public Person() {
}

public setName(String name) {
this.name = name;
}

public setAge(int age) {
this.age = age;
}

public setGroups(ArrayList<Group> groups) {
this.groups = groups;
}
}

public class Group {
private List<Person> persons = new ArrayList<>();

public Group() {
}

public setPersons(List<Person> persons){
this.persons = persons;
}

}

public Shit {
Person p1 = new Person();
p1.setAge(20);
p1.setName("FAG");
Person p2 = new Person();
p2.setAge(20);
p2.setName("FAGGOT");

Group friends = new Group();

// cycling references

}
>>
File: lain.gif (1 MB, 800x602) Image search: [Google]
lain.gif
1 MB, 800x602
>>51443261
My Lain/RMS/Linus VN.

Linnus and Stallman are fighting.
>>
>>51443330
http://fbinfer.com/

Fact: Compiling this sucks. Works well after that though.
>>
>>51443682
Call stallman richard or call linus "torvalds"
you're being inconsistent
>>
>>51443658
> (and for some reason most people think you should be able to use an integer in a floating point context for instance).
Well, integers and floats are both subsets of the reals, and most functions which operate on floats would work for any real if you could actually implement reals on a computer.

JS even manages to scrape by while using floats for all "numbers" even though integers are far more common in typical JS code (JS isn't exactly the leading candidate to replace Fortran for numerical algorithms).
>>
>>51443742
reals don't exist
>>
>>51443509
Try writing the solution in pseudocode first, then use the pseudocode as comments to structure Python.
def add_values(value_list):
# Initialize two numbers for positive and negative values, respectively.
# For every value in the list:
# If the value is positive:
# Add it to the positive number.
# If the value is negative:
# Add it to the negative number.
# Return the numbers


# While there is more input:
# If the value is 0:
# Print the result of the addition function.
# If the value is not 0:
# Add the value to the list of non-zero values.

The rest is just language specifics. You have to learn how to think in terms of algorithms and data structures unless you want to be a Rails developer into your 80s.
>>
I'm stuck on the memory of my hobby OS. I'm sick of c and think I might rewrite a good portion in assembly. The basic cpu interfacing code (gdt, idt, irq's tss, probably memory) will definitely be redone.
>>
>>51443261

School project... Wrapping xml into QT objects, Same XML is also parsed for web via RUBY. Server django link both.

Ugghg it's working somehow.
>>
>>51443281
Go. I know, it's a meme language, and it's for retards. But the standard library makes it straightforward as fuck to write a huge variety of apps. The standard library has packages for:

* HTTP
* HTML (templates and parsing)
* SQL (there are drivers for MariaDB, MySQL, PostgreSQL, and others)
* CSV
* SSH (both client and server)

Some of the syntax is a little different than most curly-brace languages, but you get used to it very quickly; it takes maybe a day to learn the language.

PHP is a horrible language and I really recommend trying basically any other alternative (besides Perl).
>>
>>51443823
Switch to Rust, Go or D. Writing an OS in assembly stopped being a good idea in 1970.
>>
>>51443846
of the three which would you suggest? What are the comparative advantages to each?
>>
>>51443261
that picture pleases me
>>
>>51443846
>>51443859
Also how well do they integrate into make? I don't want to overhaul that monstrous shit-pile yet.
>>
>>51443859
Go for dem dere libraries. It's has similar strengths to C in that regard. I've never used make.
>>
>>51443891
How do you manage large scale builds then?
>>
>>51443859
Go and D are garbage-collected, making them terrible candidates for an OS. I think he might have been joking with this post. Rust is designed to be a replacement for C and C++, so it would actually be a (pretty cool) candidate for writing an OS, but C still has the upper hand in terms of speed (https://benchmarksgame.alioth.debian.org/u64q/rust.html).

What do you mean by "integrate into make"? A makefile just specifies commands to run in order to generate targets. You can use any language with make.

That being said, Rust has a built-in tool designed for managing and building projects called Cargo, and almost all Rust projects use it. Go also has tools that are designed to automate building packages. You could just run compile commands from a Makefile, but you might as well use the language tools, since they are designed to simplify and organize building/managing projects.
>>
>>51443896
I don't know anything about writing OS or system stuff, I just know that those three languages are seen as viable successors to C in regard to how it is currently used as a low-level language.

Check this out m80.
https://www.quora.com/Which-language-has-the-brightest-future-in-replacement-of-C-between-D-Go-and-Rust-And-Why/answer/Andrei-Alexandrescu
>>
>>51443928
I wasn't joking, I'm just a noob. I never thought about the implications of an OS with language-level garbage collection lmao desu senpai.
>>
>>51443930
OS-level programming is really out of the scope of any garbage-collected language. Go and D can replace C in a lot of the contexts in which C is used currently, but something as low-level as the OS needs to be as fast as possible and is going to run into issues with GC pauses.
>>
Hello /g/ I am an enormous fucking retard. I have some spreadsheets that I need to parse out the information from and put into a database. The general flow will be a frontend written in HTML controlled by javascript that communicates to a tornado web server that communicates with a postgresql database. How do I get the excel spreadsheet into a format that can be passed to the javascript? I wanted to just pass the file to javascript and do the parsing there, but I'm not sure how to do that. So my second approach was to just parse it in HTML and pass javascript a cvs, but I'm not sure if that would work or how to do it? Are these things I should know?
>>
>>51443950
It amazes me how much traction C still has after almost 50 years now.
>>
>>51443930
>I don't know anything about writing OS or System stuff


dude... how do you expect to make informed criticism or advice when you are, in fact, uninformed?
>>
>>51443971
Why not export it as xml and use XSLT to make it into something nice in html.
>>
>>51444026
>chinese cartoon usenet newsgroup
>information
>>
>>51443928
Thank you. I'll admit the make question was a bit silly. I'll stick with my original plan then.
>>
>>51444049
It's for a senior project in which the user needs to be able to upload the excel files onto the website and go from there. I've never worked with XML before, but am willing to learn based on how much nicer it looks format wise. Would there be a way to convert from excel to XML in html or javascript?
>>
>>51443972
>It amazes me how much traction C still has after almost 50 years now.
C was invented only 10 years after the first programming language
>>
>>51444108
Yeah, but Algol is totally dead, and Fortran is only used for legacy maintenance, while people are still writing in C for novel applications in 2015.
>>
>>51443631
>Interestingly, Agda is maybe the weakest-typed language ever.
Why would that be?
>>
>>51443682
I think there should be some buildup, maybe use the interjection? Or are you saving that for somewhere better?
>>
>>51443971
>senior project
>parsing in html
is this bait
>>
>>51444141
It's absolute madness.
>>
>>51443775
Why not just maintain two sums instead of maintaining a list? O(n) vs o(n^2) and it uses less memory too.
>>
>>51444207
Whoops, scratch the O(n^2) bit I'm retarded, but at least you don't have to keep a list.
>>
>>51444223
Yeah, you're right. Nice catch.
>>
>>51444136
Because it's a much better language than Algol or Fortran. It maps extremely well to hardware and the syntax is much less verbose than either Algol or Fortran.
>>
>>51444265
Yeah, exactly.
>>
>>51444136
>Yeah, but Algol is totally dead
for no reason other than it did not fit as well into tiny memory of personal computers of the time

>and Fortran is only used for legacy maintenance
Fortran is the fastest programming language and is the go to language for heavy number crunching on super-computers
>>
>>51443480
It's like a horshoe. The two extremes look similar.
You can make any program in C only using integers. (ok maybe function pointers too)
>>
File: C.png (136 KB, 2000x2126) Image search: [Google]
C.png
136 KB, 2000x2126
>>
>>51443930
>Check this out m80.
>https://www.quora.com/Which-language-has-the-brightest-future-in-replacement-of-C-between-D-Go-and-Rust-And-Why/answer/Andrei-Alexandrescu
Both the designers of D Walter Bright and Andrei Alexandrescu have always backed off from claiming that D is a replacement for C++ and Ive always wondered why considering everything about D's design is trying to improve on C++. Now Andrei has finally revealed where all his prejudices lie, he is clearly sold on C++'s inheritence style OO which blinds him from seeing that is what makes C++ a bad and overly constraining language. The problem with C++ is that inheritence is rarely an appropriate abstraction so that you have to rely on design patterns to break out of those monotone way of programming. You also have to rely on generics break up the type restraints that inheritence puts on everything, so really generics is an abstraction to undo a bad abstraction. Refactoring code in C++ is a bitch to the point that even IDEs have to supply tools to do it for you. So its pretty easy now to see why he slams Go and Rust for lacking abstractions. He is so used to seeing 10 .cpp files worith of class declarations just to run 100 lines of code inside the main function that when that is all missing he thinks these languages 'lack abstractions' and take a simplified 'ants view of programming problems'. The forced OO paradigm might work fine when you have thousands of code monkeys pounding out enterprise code for a fortune 500 corporation, but for programmers who want to get things done, the OO hammer is what actually over simplifies everything and turns every problem into a nail. He also discredits his own language for being to slow due to gc to handle the tasks that C++ does. If you have well defined areas in your program that you can manage manually that might be true, but there is a law of diminishing returns where the mental energy spent to track memory is not worth that extra 5% pf execution speed.
>>
File: menu.png (588 KB, 814x637) Image search: [Google]
menu.png
588 KB, 814x637
Just trying to think of some ideas regarding this "Life in the fast Lain" Visual Novel.

Does anybody have any suggestions? Tips? The github's here. Please feel free to do whatever the fuck you want.
https://github.com/gitgood/Living-in-the-fast-Lain
>>
>>51444882
your dialog is shit
no seriously, it's all shit
>>
>>51444849
>assuming anything good can come out of OO
why do people still do this?
>>
Why does string manipulation in C have to be such a pain in the ass?
>>
>>51444927
It's the best dialog, the fuck are you reading.
>>
>>51444965
It's an array of characters.
>>
>>51444882
change the license to GPL.
It's a game about stallman, anything else would be insulting.
>>
>>51445001
>anything else would be insulting.
The game is 90% making fun of him though
>>
>>51445012
what's the point if he'll never even play it?
I don't think he even has xorg installed on his computer.
>>
>>51444978
I don't know, angry Stallman is a bit out of character and for some reason Linus and him clash right off at the start of class.
>>
>>51445030
Any benis?
>>
>>51445030
Gitgood here, the torvalds/RMS interaction is a temporary placeholder (as is pretty much everything at the moment).

They're meant to be rivals, but for Lain's affection.

Angry Stallman is out of character? Maybe in the way I've made him angry, but he gets angry all the time m80.
>>
>>51445070
He really doesn't get angry in the conventional sense.
He gets angry unpredictably.
>>
>>51445107
Like when people are late to a lecture.
Game is shit though.
>>
File: interview.jpg (135 KB, 569x422) Image search: [Google]
interview.jpg
135 KB, 569x422
>>51443261
>It says here that you're proficient in java.
>Could you write me function that, say, swaps the values of two integers? Yeah, do that real quick if you would. Shouldn't take very long, right?
>>
I want to get into programming, /g/, and I think a good place for me to start is by learning how different it is from scripting. I understand that scripts use an interpreter, while programs use a compiler, but how does that look on the user's end? I understand in windows it's stored in an executable file, but what if I wanted to run something that could be run independent of an OS?
>>
>>51445309
Scripts are just interpreted programs. It doesn't look different on the user's end. If you wanted to make program portable, you would distribute it as a text file with an extension specific to the language it was written in, e.g., hello.c.
>>
#include <iostream>
#include <string>

using namespace std;

int main() {
cout << "Are you going to fuck?" << endl;

string yes = "Yes";
string no = "No";
string input;

cout << "Please enter Yes or No: ";

cin >> input;

if(input == yes)
cout << "Cum in that pussy!" << endl;
else if(input == no)
cout << "There is no no!" << endl;

return 0;
}
>>
File: IMG_0496.jpg (270 KB, 2208x1242) Image search: [Google]
IMG_0496.jpg
270 KB, 2208x1242
Studying to get my dream job at Joyent in three years; what does "move up and down the stack" mean?

https://www.joyent.com/about/careers/software-engineer
>>
>>51445271
>"Java doesn't have functions."
>"You're hired."
>>
>>51445271
void swap(int *a, int *b)
{
int tmp = *a;
*a = *b;
*b = tmp;
}
>>
>>51445378
thankfully rust has a code of conduct which forbids such a filthy triggering patriarchal program from compiling
>>
>>51445378
please put fucking brackets around your if statements dont be a god damn PLEB
>>
>>51445309
Unless the script uses OS-specific commands, it should be executable in any OS. Compiled programs need to be re-compiled for every OS, unless the program compiles to byte-code for some virtual machine (ie Java), in which case in can be run on any machine with the virtual machine installed.
>>
>>51445417
>Ah... I see.
>I think we're done here.
>Don't call us, we'll... call you...
>>
developers developers developers developers.
developers developers developers developers
evelopers developers developers developersd
velopers developers developers developersde
elopers developers developers developersdev
lopers developers developers developersdeve
opers developers developers developersdevel
pers developers developers developersdevelo
ers developers developers developersdevelop
rs developers developers developersdevelope
s developers developers developersdeveloper
developers developers developersdevelopers
developers developers developersdevelopers
evelopers developers developersdevelopers d
velopers developers developersdevelopers de
elopers developers developersdevelopers dev
lopers developers developersdevelopers deve
opers developers developersdevelopers devel
pers developers developersdevelopers develo
ers developers developersdevelopers develop
rs developers developersdevelopers develope
s developers developersdevelopers developer
developers developersdevelopers developers
developers developersdevelopers developers
evelopers developersdevelopers developers d
velopers developersdevelopers developers de
elopers developersdevelopers developers dev
lopers developersdevelopers developers deve
opers developersdevelopers developers devel
pers developersdevelopers developers develo
ers developersdevelopers developers develop
rs developersdevelopers developers develope
s developersdevelopers developers developer
developersdevelopers developers developers
developersdevelopers developers developers
evelopersdevelopers developers developers d
velopersdevelopers developers developers de
elopersdevelopers developers developers dev
lopersdevelopers developers developers deve
opersdevelopers developers developers devel
persdevelopers developers developers develo
ersdevelopers developers developers develop
rsdevelopers developers developers develope
sdevelopers developers developers developer
developers developers developers developers
>>
>>51445417
That's C. Java doesn't have pointers bro.
>>
>>51445431
Lol CS 101 expert here. If statements that only have one expression following don't need brackets, in the actual world people would laugh at that kind of shit.
>>
>>51445456
What's wrong with it?
>>
>>51445483
It's actually convention to maintain the brackets, even if they aren't required.

Unless you're working on some babby-tier startup code, in which case yes, please do get rid of the brackets because "We're going to architect it so we can keep it this clean!"
>>
>>51445498
>2015
>being this new
ISHYGDDT
>>
>>51445498
everything
>>
>>51445483
>not having brackets in-case you need to go in later and add more
Literally why not just add the brackets?
>>
FAGGOTS
>>
>>51445415
Doesn't it have lambdas now?
>>
File: 1446727603848.png (581 KB, 720x540) Image search: [Google]
1446727603848.png
581 KB, 720x540
>decide that I've finally had enough of Visual Studio's bullshit after using it for years
>decide to switch to MonoDevelop
>pretty good but took days to learn everything and write an add-in to keep the syntax highlighting working with large source files
>learn today that Microsoft is working on a version of Visual Studio that doesn't install 6 gigabytes of adware
>>
>>51445409
You can work on all ends of the product, you're not just a specialized monkey.
If you have to work on the web frontend, you're there. Web backend? Good to go. Coding desktop UI? Yup! Desktop internals? Sure thing!
Device drivers? You betcha!
>>
>>51445515
>>51445517
I'm being serious.
What do you jobless smarmy shits have to say about code that just works?
>>
Is regex the ultimate transcompiler?
>>
File: payload.jpg (33 KB, 300x300) Image search: [Google]
payload.jpg
33 KB, 300x300
>>51445498
nothing, just dpt being dpt
>>
>>51445532
Java doesn't have pointers.
>>
File: 1415803691036.jpg (24 KB, 450x465) Image search: [Google]
1415803691036.jpg
24 KB, 450x465
>Couple people keep trying me to get to work with them on a project
>Sure that sounds fun
>Okay we need you to handle this part
>Okay sure, what do you have so far so I know what we're hooking together?
>Here are the repos!
>Nothing but example code copy+pasted from stackoverflow

Well so much for that.
I need a project to work on in my free time, /dpt/
>>
>>51445518
Because code readability. Seriously, CS 101 will teach people to always use brackets. I've worked for iRobot and interned at IBM now, none of the devs would actually always throw brackets in unless they were brand new.
>>
>>51445554
Charge them money.
>>
>>51445532
see >>51445548
nothing about your code is close to anything that would function dummie
>>
>>51445554
Here you go, Big Guy.
https://better-dpt-roll.github.io/
>>
>>51445459
developers
>>
File: image.jpg (3 MB, 3264x2448) Image search: [Google]
image.jpg
3 MB, 3264x2448
Studying to get my dream job at Joyent in three years; what does "move up and down the stack" mean?

https://www.joyent.com/about/careers/software-engineer
>>
>>51445532
See >>51445470
You clearly just google a swap value example. But that's for C, or maybe C++. It wouldn't work, at all.
>>
>>51445602
I think they mean like stack frames, for instance
>>
>>51445602
We meme non?
>>
>>51445602
>dream job at Joyent
wat
>>
Can anyone recommend a language that's like C++ but with better macros?
or alternatively one that:

has good templating (C# go home)
has operator overloading
has manual memory management
is not interpreted
has lambdas
has macros
>>
>>51445700
Yo, look up Clojure. Shit is magic. May not include everything you listed, but fuck if it's not beautiful. In terms of everything you're asking: Nope, C++ is really the only one.
>>
>>51445710
fuck is C++ really the best language
goddamn it
>>
/dpt/ I am having a brain fart pls help

I have a list of N items.

I want to split this list into a grid when one dimension (rows or columns) is specified

So if I have a list of 8 items, and I specify a column size of 3, I would need 3 rows.

Whats the most efficient way to find out that I need 3 rows?

My naive way:

int rows = 8/3; // at least two rows
if(8%3 > 0) {
rows++;
}


Can I do this nicer? I feel like Im just missing something obvious
>>
File: golang.jpg (247 KB, 680x697) Image search: [Google]
golang.jpg
247 KB, 680x697
>>51443930
Google Golang has NO HOPE of ever replacing C.
Let's see where it fails:
* Has no ternary operator
* Has no generics
* Has no object-oriented facilities
* Has no macros to let you half-assedly implement the two previous features

It's hopeless, worthless shit.
>>
>>51445717
There's no "End all be all" language.
I typically do C++/MIPS & IA32 ASM/Java and Clojure, and couldn't use just 1 to do everything, besides probably C++.
>>
>>51445602
>dream job at Joyent

Do you have a kek fetish?
https://www.joyent.com/blog/the-power-of-a-pronoun
>>
>>51445737
sounds just like C
>>
>>51445737
Forgive me senpai.
>>
>>51445752
how embarrassing
>>
>>51445751
>and couldn't use just 1 to d o everything, besides probably C++
Ex-fucking-actly.
>>
>>51445719
that's really the best way

int rows = (N / Columns) + (N%Columns ? 1 : 0);

inb4 !!(N%Columns)
>>
>>51445806
hmmm.... okay I guess. I feel so dumb all of a sudden man, what's wrong with me
>>
>>51445820
Low self-esteem. Just keep practicing breh. You're gunna make it if you keep trying!
>>
>>51445602
JS, HTML & CSS is the top of the stack. Databases the bottom. In the middle is server side frameworks, web services, etc.
>>
>>51445737
Go definitely won't replace C, but those aren't the reasons.
>>
>>51445820
on the other hand, if you weren't using ints, it would just be ceil(N/Columns)
>>
>>51445845
That sounds retarded. I thought they were talking about programming in general, not web development. Why did that guy post this in /dpt/ and not /wdg/ aqa /sqt/?
>>
>>51445863
Is it possible the result of the division is slightly greater than the integer result?

ie can the following happen:
8.0/4.0 = 2.00003
>>
>>51445752
Sounds like a great company to work for, what with the SJWs telling you your code is oppressive and whatnot.
>>
Is there a way I can get g++ to yell at me about unused functions in my code?
>>
>>51445719
(8+2)/3

in other words:

x = (n+(m-1)) * m

to round up n to nearest m integer multiple.
>>
>>51445737
>object-oriented facilities
>C
>>
>>51445752
you know things are fucked when companies openly spout this bullshit and think it is perfectly acceptable

>>51445894
Do you actually think they're not SJW?

>>51445882
>aqa
lol
>>
>>51445904
eh division, not multiplication there:

x = (n+(m-1)) / m
>>
>>51445897
That warning is enabled by -Wall
>>
>>51445889
8.f/3.f > 8/3 if that's what you're asking
I dunno otherwise, sounds like a flaw
>>
>>51445889
Working with integers in floating point won't lead to accuracy errors, unless you're using very large numbers.
>>
>>51445889
Fucking floating point math.
>>
>>51445911
Nope, not sarcasm. Worked for a company already that had that kind of bullshit in a company blog we were all "encouraged to read to keep up with social and business-based ethical issues". Really it was just a fat lesbian and a guy from HR that told everyone how they think human interaction should be vs. reality.
>>
>>51445936
I have that enabled and it doesn't tell me anything about my function usage. I believe you're thinking of unused variables.
>>
>>51445925
neat
>>
>>51445907
You forgot to >Generics >C as well.

Not that it matters; I wrote the last point for a reason.
>>
>>51445975
What does -Wunused-function say?
>>
>>51445974
>start using their arbitrary logic against them
>not enough men in HR
>men start to go into HR, control how companies operate
>no more of this sjw bullshit

>tfw it's all a dream
>>
>>51445975
Weird. I tried writing a trivial program with an unused function and compiled with -Wall -Wextra and even -Wunused-function, and got no warning for both GCC and Clang.
I'm not sure of the exact semantics of it, but I have definitely been warned for an unused function in the past.
>>
>>51446051
>>51446085

Just tried that and it doesn't tell me anything. I even wrote a new function specifically to test it.
>>
>>51445975
It will only warn about static functions.
>>
>>51443261
Desktop Editor for a shareable desktop for my Custom Desktop UI
Currently stuck on a problem http://stackoverflow.com/questions/33801825/handling-editable-objects?noredirect=1#comment55443673_33801825
>>
>>51446104

Ahh, I made my test function static and it does warn me about that. Interesting.

Can I make it search for a specific unused function or something like that? Basically, I have old code I'm working on updating and cleaning up and I'm certain that several functions aren't being used so I'd like to just remove them to get rid of clutter.
>>
>>51445752
>>51445692
>>51445653
>>51445635
I like Bryan Cantril

Google Ubuntu slaughters kittens
Or Fork yeah, rise of Illumos
>>
>>51446209
>2015
>not programming in Go using virtual Ubuntu in Windows 10
>not uploading it to github and tumblr
>>
File: i-need-some-muscle-over-here.png (2 MB, 2048x1185) Image search: [Google]
i-need-some-muscle-over-here.png
2 MB, 2048x1185
>>51446224
>>
>>51446209
>https://www.joyent.com/blog/the-power-of-a-pronoun
>>51446209
>I like Bryan Cantril

Why?
>>
>>51446224
He only mentioned the login process slaughters kittens
>>
Is there any feeling more deflating than waking up the day after a long programmin bender, reading back your code, and realizing some really obvious design mistake?
>>
>>51446297
waking up next to a woman and realizing you're going to have to talk to her
>>
>>51446297
I'd rather realize it during review than when I'm trying to make something work that won't because of said mistakes.
>>
>>51446297
Have your ever watched your firstborn son die in your arms before his 18th birthday?
h-hold me brehs
>>
>>51446316
breh...
>>
File: 1427076754047.jpg (38 KB, 500x544) Image search: [Google]
1427076754047.jpg
38 KB, 500x544
>>51446316
damn dude.
sorry.
>>
>>51446316
Have you ever watched your firstborn son die in your arms on his 18th birthday?
>>
>>51443261
>>51443863
>>51443305
https://www.youtube.com/watch?v=Emo6MyWAaqY
>>
>>51446319
Pls good sir I'll seed good promise thank you

[email protected]
>>
>>51446373
Maybe look up error number 150..
>>
>>51446247
He's passionate about the operating system mattering now more than ever when most people think it's a solved problem. He is against Linux and Windows and promotes smartOS and other Illumos based oses. He is articulate and a great leader as his involvement with docker has shown. I want to work with people like that
>>
>>51446373
Do we do SQL?
I mean it's not exclusively web, right?
>>
>>51446395
cishet scum watch your fucking pronouns
>>
Getting the error code
ERROR 1005 (HY000) at line 126 in file: 'isefDatabase.sql': Can't create table 'isefPROJECT' (errno: 150)
ERROR 1005 (HY000) at line 140 in file: 'isefDatabase.sql': Can't create table 'isefSCORE' (errno: 150)


The tables in question are
create table isefPROJECT (
studentProjectID int NOT NULL AUTO_INCREMENT,
isefDIVISIONNum int NOT NULL,
isefCATEGORYNum int NOT NULL,
isefSTUDENTFName VARCHAR(20),
isefSTUDENTLName VARCHAR(20),
projectScore int NOT NULL,
FOREIGN KEY (projectScore) REFERENCES isefSCORE(projectScore),
FOREIGN KEY (isefDIVISIONNum) REFERENCES isefDIVISION(isefDIVISIONNum),
FOREIGN KEY (isefCATEGORYNum) REFERENCES isefCATEGORY(isefCATEGORYNum),
PRIMARY KEY(studentProjectID)
)ENGINE=InnoDB;


create table isefSCORE (
projectScore int NOT NULL,
judgeID int NOT NULL,
studentProjectID int NOT NULL,
FOREIGN KEY (studentProjectID) REFERENCES isefPROJECT(studentProjectID),
FOREIGN KEY (judgeID) REFERENCES isefJUDGE(judgeID),
PRIMARY KEY (projectScore, studentProjectID)
)ENGINE=InnoDB;


What the fuck is wrong? I've checked and rechecked the Primary Keys and Foreign Keys
>>
>>51446418
look up the error code faggot
>>
>>51446387
I know what the error number means. It means somewhere, my Foreign Key constraints are fucked up. But I cant find it for the life of me.
>>
>>51446395
Docker is a shitty forced meme that prevents people from exploring better container setups!
>>
I'm reading the chromium docs. All I wanted was to write my own custom little browser based on it.

I wasn't expecting the project to be so welcoming. The documentation is just so good. They have design docs and high level overviews of the entire codebase and walkthroughs and how tos and they literally explain all the key ideas and abstractions that are used in the code. I suppose THIS is the difference between a real FOSS project and some hipster in his basement who won't give you the time of day on his shitty freenode IRC and instead expects you to spend months reading every single file in the code base before becoming familiar enough with it to contribute a random fix or feature.

Did you guys know that Chrome/Chromium's Google-y features are fully modular, self-contained and separate from the core "web content" functionality?

https://www.chromium.org/developers/content-module

Apparently, I can just take the awesome core browser, cherry pick all the features I want and implement mine on top.

It's perfect
>>
>>51446460
NO
GO AWAY
CANCER
>>
>>51444849
>being this mad at sepples
>>
Why does codecademy choke up on code that runs fine on my computer?

*** glibc detected *** <tmp>/binary: free(): invalid pointer: 0x0000000002195242 ***
>>
>>51446481

Why you mad though
>>
>>51446518
Probably got some undefined behavior somewhere.
>>
>>51445459
ballmer pls
>>
>>51445470
everything in java is a pointer
>>
>>51446460
>I suppose THIS is the difference between a real FOSS project
no, this is the difference between a project that has hundreds of six-digit salary employees working on it full time, compared to a small amount of people working on a hobby project
>>
How does Ada handle narrowing explicit type conversions? Does it display an error message when there is loss of data?
>>
File: samuel-johnson.jpg (20 KB, 421x512) Image search: [Google]
samuel-johnson.jpg
20 KB, 421x512
>>51446564
>>
>>51446541
I only have 2 frees and they're both things I malloced myself.
>>
>>51446564
no everything in java is objayct
>>
>>51446446
Docker totally surpasses Virtualbox and VMware in performance. It's only second to KVM but smartOS comes with hat by default. It's also ported correctly not gimped from Linux
>>
>>51446312
kekd
>>
>>51446413
>>
>>51446564
Reference, not pointer. Primitive types are exceptions.
>>
>>51446635
>>51446643
some do while others do what they're told to do.
>>
>>51446646
why are you comparing a container system to virtual machine systems now? that's not at all what i was suggesting. there are other container systems, you know. ones that people should know and understand because they offer a lot of good options, but docker's been pushed so hard people actually think docker's the only container system in the world.
>>
>>51446706
>Reference, not pointer
they're's a difference?
>>
>>51443261
Obviously this creates positive recursion but its fun to think they use bigger cranes to unload those cranes.
>>
>>51446771
are cranes composable? could we compose together smaller cranes?
>>
File: cold-rain.png (140 KB, 368x368) Image search: [Google]
cold-rain.png
140 KB, 368x368
>>51446727
>>
>>51446785
let crane = crane<crane>
>>
Rate my strrev function.
void strrev(char *str)
{
int j = strlen(str) - 1;
int k = 0;
char c;
while (j > k)
{
c = *(str+j);
*(str+j) = *(str+k);
*(str+k) = c;
j--;
k++;
}
}
>>
>>51446910
not O(1)
0/10
>>
>>51446910
>Not passing in the string length as an argument
It's shit.
>>
I'd like to learn at least some basic programming, which language should I start with and what resources should I use to learn it?
>>
>>51447016
learn some basic programming here
https://en.wikipedia.org/wiki/BASIC
>>
>>51447016
work on the codeeval problems starting with the easiest one and work your way up.
you can learn the language on the way
>>
>>51445602
'the stack' is an euphemism for their cock
>>
>>51447016
Go through the Python tutorial.
https://docs.python.org/3/tutorial/index.html
>>
>>51447016
http://www.cplusplus.com/doc/tutorial/
>>
>>51443281
Python + Flask + SQLAlchemy + PGSQL
>>
>>51447002
>using strings too stupid to know they're own length
>>
please use an anime image next time.
>>
Pic related arrives tomorrow

Currently in an unrelated engineering discipline but I want to get into programming/CS

I've taken up to calc 4 (diff eqs) so hopefully my body is ready.

Dont see the need to go back for another degree unless it's a masters paid by my company desu

my body is ready
>>
>>51447169
Very rarely would you use calculus in programming. Algebra is much more useful.
>>
I'm getting a headache trying to visualize algorithms in my head.
Doing them on paper doesn't really help.
Does this go away eventually?

I felt the same thing when I was first starting with programming.
>>
>>51447140
>>51447002

>not encoding the size as the first sizeof(size_t) characters of the string
>>
>>51447192
strlen returns a size_t, so that isn't an issue.
size_t strlen(const char *s);
>>
>>51447192
Pascal strings are dumb.
>>
>>51447189
Think of it logically, as in a series of causes and effects. You just have to string them together, one at a time. Anytime you go back to a place when you didn't need to, you've added unnecessary complexity.
>>
File: hTVBHcx.gif (2 MB, 300x167) Image search: [Google]
hTVBHcx.gif
2 MB, 300x167
Making a basic server and client.

Client can successfully GET index.html from websites like google.
When I try to do a GET from my server, I am able to get all the data and write it into
a new file like when connecting to other websites, but on the last bit of info from my
server, the client crashes during writing to the new file.
When trying to ask for index.html from my server using my browser, I get the file, but
I can see the tab still trying to load, and I see that my server gets pinged twice with
a data value of 0, so I assume there must be flags or something that the browser is sending,
probably asking what the hell my server is doing.

tl;dr: I'm guessing this has to do with the format of the data I'm sending in the packets.
How is the data in packets supposed to be formatted? Does each one need to end with CRNL,
or just the last one? I can't seem to find any information about this online, but I'm probably
just not searching for the right terms.
>>
>>51447185

Calc4 is half diff eqs half linear algebra
>>
>>51447140
>they're
this meme has gone too far

kill you'reself
>>
>>51447210
Did you send a "Content-Length" header?
Is it accurate?
>>
>>51447227
NO meme goes to far, kill your are self
>>
>>51447201
>O(n)
>>
>>51447201
>strlen
>O(n)
>buffer overflows

lmao

>>51447204
They were dumb because they literally restricted your string to 255 characters.

struct text {
size_t size;
char[] pointer;
};


Describes pretty much the same arrangement if we assume no padding is added for alignment: a string with sizeof(size_t) bytes length prefix. Guaranteed to be able to store any object size in the underlying platform.
>>
>>51447210
>Making a basic server and client.
>not master and slave
sjw pls
>>>/temblurs/
>>
>>51447261
Now pointer arithmetic doesn't work.
>>
File: 2015-11-20_23-57-12.png (18 KB, 703x305) Image search: [Google]
2015-11-20_23-57-12.png
18 KB, 703x305
>>51447240
Here's my code for sending a file to the client.
What do you mean by content-length header? As in the strlen(data) argument which is given to send?
Or am I supposed to send a packet that tells them how much data overall to expect? This is over TCP, in case it matters.
>>
>>51447261
Pascal strings (regardless of the size of the length field) are dumb because they make slicing/sub strings/ranges cumbersome - have to either make a bunch of extra allocations and copying or sneak in and temporary replace a few character with the size byte(s) which makes for terrible interfaces and you can't make anything read-only.

ptr + length pair is the best, period.
>>
>>51447293
TCP is a streaming protocol so when "not all data was sent" it's actually OK, all you have to do is chop the buffer and keep sending in a loop until you sent the entire data buffer. Probably unrelated but just saying.
>>
>>51444318
>Fortran is the fastest programming language
this has been wrong since C99 introduced strict aliasing. C and Fortran are theoretically equally fast.
>>
>>51447300
>ptr + length pair is the best, period.
wrong as usual.
>>
>>51447341
Thanks Anon, I didn't know how to come back from that one.
>>
>>51447344
Nope.
>>
>>51447293
Here is an example HTTP reply packet:
HTTP/1.0 200 OK\r\n
Content-Type: text/plain\r\n
Content-Length: 12\r\n
\r\n
Hello World!\r\n

Does your reply look something like that? Not setting 'Content-Length' pretty much fucks with every implementation, as there is no in-band way of knowing if you've finished.
>>
>>51446639
buffer overflows can corrupt the heap. Run Valgrind on it.
>>
>>51444318
>and is the go to language for heavy number crunching on super-computers
not really, c++ is.
>>
>>51447341
>C99 introduced strict aliasing
shit I meant to say 'restrict qualified pointers' instead of 'strict aliasing'.
>>
>>51447373
nevermind, I just rewrote it
turns out one of my loops was writing off the end of an array by exactly 4294967295.
>>
>>51447272

Why wouldn't it? I know the size, I know where the actual string starts. I use that exact structure in my code. Everything works fine. It even automatically includes a hidden NUL at the end of the buffer so I can just pass the pointer to regular C string APIs and it will just work.

Actually, it's not really a string in my code, it's a general memory structure with an assorted set of much safer and optionally instrumented functions matching and exceeding the stdlib's mem* functions in convenience and safety. I never use the str* functions due to their problematic null pointer handling.

My actual string type is just that memory structure plus an encoding tag. I use the ICU libraries to implement a true text processing API instead of "string" manipulation, which is literally the same thing as array operations and memory manipulation anyway.

>>51447300
>have to either make a bunch of extra allocations

I can see this being a problem for embedded software. I'm not actually sure whether it'd be practical to pass these structs around by value and allocate them on the stack.

>and copying

You can use copy on write to optimize this. I've studied the implementations of several programming languages which do this and it's really cool.
>>
>>51447341
strict aliasing doesn't really matter, compilers will emit multiple versions + a simple runtime branch to one or the other depending on if the pointers overlap or not, or the inner loops are written in assembly anyway (really performance critical number crunching stuff are and always will be in assembly because you want access to processor specific instructions, flags, carry and carry-less arithmetic, etc).
>>
>>51446988
<3 lazy evaluation
>>
>>51447362
Yup.
>>
>>51447439
see
>>51447392

Aliasing requires an extra memory operation or branch, which is reasonably costly. The difference between C90 and Fortran should make a very small difference. The compiler's optimizer will make a much buffer difference though.
>>
>>51447497
>The compiler's optimizer will make a much buffer difference though
well I should really go to sleep
>>
>>51447435
>You can use copy on write to optimize this.
There's no need to optimize anything, COW will still be slower (since it's still some code which need executing, even if just testing a dirty bit), just separate out the pointer and the length (or use two pointers) and you have all the advantages, it's only a tiny structural change in the type, but the interface and the user code is exactly the same. No reason to pack the length field together with the string data.
>>
>Writing a unit test
> temp = 8k, base64 encoded binary string
>assert something(X) == bas64:decode(temp)
>>
>did a codility test for an internship
>got selected over another guy i know from one of my classes
>turns out he cheated and got dropped a week into it because he didn't know dick

feels sort of good but also I am upset
>>
>>51447497
>Aliasing requires an extra memory operation or branch, which is reasonably costly.
The branch is practically zero cost - if we're talking about some number crunching inner loop a single extra compare and jump to another version of said loop can't even be meaningfully measured, it disappears as measurement noise.
>The compiler's optimizer will make a much buffer difference though.
C and C++ compilers these days actually says "fuck it, I'll emit two versions of the function/loop, one where I assume nothing overlaps and go full vector, and one where they potentially alias, then just a branch to one or the other by comparing the actual addresses at runtime"
>>
>>51447016
C because there's heaps of "learn X for C programmers" tutorials

also if you can undertand pointers you are better than like 90% of code monkeys out there
Thread replies: 255
Thread images: 27

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.