[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
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: 21
File: 1334682645405.jpg (475 KB, 1024x1076) Image search: [Google]
1334682645405.jpg
475 KB, 1024x1076
Old /dpt/ at >>51748143

What are you working on?
>>
First for for.
>>
>>51755311
Visual based is the best programming language
>>
>>51755333
First foreach.
>>
>>51755311
>What are you working on?
My local to remote GPU RDMA benchmarking program.
>>
>>51755311
op god
>>
>>51755346

Man, I love foreach.
>>
>>51755311
>What are you working on?
implemented Dijkstra's algorithm in Haskell
>>
>>51755402
foreach around
>>
>>51755311
Looking for a pdf version of HtDP to download, does anyone have it?
>>
>>51755402
webfag confirmed
>>
>>51755411
gay
>>
>>51755508
std::vector<int> container;
container.push_back(3);
container.push_back(2);
container.push_back(1);

for (auto& element : container)
{
std::cout << i << " ";
}
std::cout << "imblygin!" << std::endl;
>>
>>51755517
What are you working on?
>>
Why does bitcoin use disposable addresses? Why doesn't it just send funds directly to the recipient's public key?
>>
>>51755535
Rewriting Haskell in Python
>>
>>51755535
my hangover
and a virtual ant farm
while calling you gay on dpt and irc
>>
>>51755540
A key is not an address, and your public key does not ensure privacy
>>
>>51755555
cheggem.
>>
>>51755555
>while calling you gay on dpt and irc
What channels do you frequent?
>>
>>51755529
for (const auto& i : {3, 2, 1})
std::cout << i << ' ';

webfag confirmed
>holy shit yours wouldn't even compile
>>
File: g.jpg (668 KB, 700x3697) Image search: [Google]
g.jpg
668 KB, 700x3697
>>51755570
chegged
>>
>>51755586
btw shouldn't pass ints by const reference, this was just pointing out you were passing them by non-const reference
>>
>>51755586
>arrays and vectors are the same
webfag pls
>>
>>51755576
##programming @ freenode
>>
>>51755623
>preferring a vector to a literal
>>
File: goku.webm (3 MB, 512x384) Image search: [Google]
goku.webm
3 MB, 512x384
Ask your beloved programming literate anything.
>>
>>51755654
Does P equal NP?
>>
>>51755674
probably.
>>
>>51755641
>pretending that arrays and vectors are the same
>>
File: 1443637703847.jpg (149 KB, 811x1000) Image search: [Google]
1443637703847.jpg
149 KB, 811x1000
>tfw done with my first compsci course
Now I got time for SICP
>>
>>51755722
>resizable array = vector
lel, c++ fags at their finest.
>>
Can I learn C++ from only the web and still be good?
>>
>>51755722
>putting the same words in someone's mouth twice
>>
>>51755529
>element
>i
ask me how I know you're a jsfag
>>
>>51755722
>thinking an braced initializer list is an array
>>
File: 1311195124482.jpg (95 KB, 1027x651) Image search: [Google]
1311195124482.jpg
95 KB, 1027x651
>>51755529
>>
>>51755749
well, what more would you need
>>
>>51755626
>freenode
confirmed SJW faggot
rizon is where it's at big bois
>>
>>51755802
>thinking it's not
>>
>>51755822
I don't know, will programmers that learned at school look at me weird? will I even get hired?
>>
>>51755841
>literally not knowing C++
>>
>IRC
Keep the memes coming kids!
>>
>>51755599
what the fuck

also

double chegged
>>
>>51755867
i think it should be enough
>>
>>51755879
>trying to weasel his way out of this
>denying that he is literally creating an array
>when the original example used a vector
>>
>>51755918
>the original example didnt work
>the original example was shit anyway
>improved original example by replacing vector
>hurr durr why you change my webfag code to non webfag code
>still thinks a braced init list is an array

literal retard
>>
>>51755837
>going to the biggest network out there means you are a SJW
mental retardation, the post.

>>51755885
>>IRC
>Keep the memes coming kids!

>kids!
yeah kid, gtfo
>>
stupidos can't learn by themselves
>>
>>51755508
>webfag

Most languages have it in some capacity.
>>
>>51755955
Hey there big boy ;)
>>
>>51755901
It's the furry /g/entooman
>>
>>51755988
underage b&
>>
>>51755954
I'm not that guy but inializer lists are just wrapped arrays so the faggot is half right
>>
>>51756007
Your ability to recognize an obvious joke is pretty legendary. Unless this is a joke playing off a joke, in which case we're no longer on speaking terms.
I'm 26 for the record.
>>
>>51755954
>improved
Nice autism
>>
solved the 8th day of code advent

func solveEighthDay() -> Int {
let input = getInput().componentsSeparatedByString("\n")

return input.map({($0.characters.count, ((
($0["\\\\\\\\"] ~= "~" // replace //
)["\\\\x.."] ~= "~" // replace escaped hexadecimal
)["\\\\."] ~= "~")) // replace escaped character
}).reduce(0) {$0 + ($1.0 - ($1.1.characters.count - 2))}
}
>>
>>51756022
>vectors are just wrapped arrays on the heap
>>
>>51756048
I was strictly referring to stack allocated arrays
>>
>>51756040
>replacing webfag shit with non webfag non shit is autism

>push_back(3); push_back(2); push_back(1)
>>
>>51756029
backpedal harder, enjoy your b&
>>
>>51756046
/me projectile vomits
>>
>>51756070
Will do. Enjoy wearing your mother's skirts!
>>
>>51756066
And I was strictly referring to braced init lists
>>
File: g-furries1.jpg (423 KB, 1318x2275) Image search: [Google]
g-furries1.jpg
423 KB, 1318x2275
>>51755995
>>51755901
Pic related


>>51756069
>doesn't understand the example being that you can for-each any STL container
Absolute autism
>>
>>51756071
Regex is pretty disgusting
>>
File: g-furries2.jpg (316 KB, 1327x1369) Image search: [Google]
g-furries2.jpg
316 KB, 1327x1369
>>51756110
>>
>>51756110
holy shit, kek
>>
>>51755749
Very few people manage to become decent at programming without going through a rigorous education, so I don't know, are you one of these special snowflakes? It will take you years and lots of effort, but it can be done.
>>
>>51755749
If you want to purely be a basic code monkey, sure
>>
>>51756069
std::vector<int> container{3, 2, 1};


That's an initialization list for a container, you autistic sperglord. What you are doing is creating an int array.
>>
>>51756110
>is a webfag
>thinks writing shit code to do a for each on a completely unnecessary STL container proves he isnt a webfag
>>
>>51756091
which are defined by the standard to be deduced as std::initializer_list
>>
File: g-furries3.jpg (569 KB, 1343x2690) Image search: [Google]
g-furries3.jpg
569 KB, 1343x2690
>>51756130
>>51756128
>>
>>51756170
Which strictly aren't arrays. I don't even think the standard guarantees a braced init list must be a contiguous array (it might though).

>>51756158
I'm saying the push_back() push_back() is fucking retarded. You could've done that, or you could've not used a container where it's completely fucking redundant.
>>
>>51756162
>>thinks writing shit code to do a for each on a completely unnecessary STL container
>completely unnecessary STL container
>unnecessary
Like creating a expensive as hell std::initializer_list ???

GTFO webfag
>>
File: senile.png (47 KB, 1871x280) Image search: [Google]
senile.png
47 KB, 1871x280
my professor gave me a 50% on an assignment because i "used an array instead of an adjacency list" which is "unacceptable". and yet i did have an adjacency list, which was inside of an array of vertex structures, which was inside of a graph structure. guess what the directions say to do?
>>
>>51756193
>Which strictly aren't arrays
they're just wrapped arrays, nothing else
>>
>>51756193
>Which strictly aren't arrays.
No, they can be implemented as a linked list making it expensive as fuck.

>You could've done that, or you could've not used a container where it's completely fucking redundant.
The point was that you can use for each on any container, you huge fucking autistic piece of shit.
>>
Anti-functional programming religious nutcases never fail to amuse me.
>>
>>51756221
>they're just wrapped arrays, nothing else
They're not

>Initializer lists may be implemented as a pair of pointers or pointer and length. Copying a std::initializer_list does not copy the underlying objects.

>The underlying array is not guaranteed to exist after the lifetime of the original initializer list object has ended. The storage for std::initializer_list is unspecified (i.e. it could be automatic, temporary, or static read-only memory, depending on the situation).
>>
>>51755341
right, and trump will be the best president
>>
>>51756207
>initializer list on the stack
>expensive

>>51756221
strictly, they may well be implemented as arrays, but it's certainly not "creating an array" in the sense of an array variable.
>>
>>51756224
How was that the fucking point? The fucking point was trying desperately to prove you aren't a webfag. You failed miserably.

>>51756254
You're supposed to say something that isn't true
>>
>>51756258
See >>51756245

They may be implemented as a list of pointers, which is more expensive than just creating a vector.

If you weren't a webfag you would have read the standard and know this.
>>
>>51756281
>webfag
See >>51756289

GTFO webfag
>>
>>51755555
Quints of destiny have spoken.
>>
>>51756245
>may
>the storage is unspecified
>>
>>51756156
what is the difference between a code monkey and a skilled programmer?
>>
>>51756213
you're probably just retarded. you think you're smarter than your professor? go fuck yourself
>>
>>51756307
It's unspecified, meaning that it is an implementation detail.

This means that element lookup of an initalizer list may be O(n) (including costly memory lookups).

Vectors, on the other hand, are guaranteed O(1) lookup. In this case, traversal is O(n) any way, but initializer_list may mean two memory lookups instead of just one.
>>
>>51756289
cpp reference

"__A braced-init-list is not an expression and therefore has no type__, e.g. decltype({1,2}) is ill-formed. Having no type implies that template type deduction cannot deduce a type that matches a braced-init-list, so given the declaration template<class T> void f(T); the expression f({1,2,3}) is ill-formed. A special exception is made for type deduction using the keyword auto , which deduces any braced-init-list as std::initializer_list"

"Also because braced-init-list has no type, special rules for overload resolution apply when it is used as an argument to an overloaded function call."

"for ( range_declaration : range_expression ) loop_statement"
"range_expression - any expression that represents a suitable sequence (either an array or an object for which begin and end member functions or free functions are defined, see below) __or__ a braced-init-list."
>>
>>51756245
>Since C++14
>The underlying array is a temporary array, in which each element is copy-initialized (except that narrowing conversions are invalid) from the corresponding element of the original initializer list. The lifetime of the underlying array is the same as any other temporary object, except that initializing an initializer_list object from the array extends the lifetime of the array exactly like binding a reference to a temporary (with the same exceptions, such as for initializing a non-static class member). The underlying array may be allocated in read-only memory.
>>
>>51755674
no
>>
>>51755674
maybe
>>
>>51756351
That does not contradict that it may be implemented as a linked list, mang.
>>
>>51756355
found a reference in the std draft
>http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3797.pdf
>page 210 paragraph 5
>>
>>51756311
Code monkeys do the drudgework and churn out thousands of lines of code each day, very much like workers in Chinese sweatshops are assembling iPads. Curiously enough, skilled programmers hardly ever do any actual programming but rather envision the software at large by writing design documents and class diagrams, that's why they are usually referred to as Software Architects or Software Engineers.
>>
>>51755955
everyone on freenode is a pretentious asshole and/or a redditor
>>
>>51756467
more relevant:

>An object of type initializer_list<E> provides access to __an array of objects__ of type const E.

>[ Note: A pair of pointers or a pointer plus a length would be obvious representations for initializer_list. initializer_list is used to implement initializer lists as specified in 8.5.4. Copying an initializer list does not copy the underlying elements. — end note ]
Pair of pointers/pointer+ length is literally telling you how the /array/ could be written.
>>
>>51756497
>skilled programmers draw class diagrams
>software architects or software engineers
>>
So far im working on this project:
https://github.com/MauricioTorre
>>
>>51756511
>pair of pointers
template <typename E>
struct initializer_list_elem
{
E* elem;
initializer_list_elem* next;
};
>>
>>51756548
I've already reported you to Github for offending my sensibilities.
>>
>>51756176
>>51756128
>>51756110
>>51755599
wtf
>>
>>51756550
are you retarded
>>
>>51756110
>I think of it as more of a "sanctuary" than "battlestation"
Fucking lost
>>
>>51756550
>>51756594
template <typename T>
struct initializer_list
{
T *_begin, *_end;
}

1) it's a wrapper for an array
2) that's an element. it says 2 pointers for the list.
3) it says as an alternative "a pointer and a length"
>>
>>51756616
*const T
>>
>>51756630
const T* const
>>
ITT: webfags and furries
>>
>>51756521
Well where do you draw the line? You either have the wits or you're a monkey.
>>
>>51756650
>/dpt/ has moved on from the minutiae of The C Standard to the minutiae of The C++ Standard
So this... is what progress feels like
>>
>>51756650
you're right, i should commit harakiri immediately
>>
>>51756550
Besides, nobody is retarded enough to actually use a linked list for anything.
>>
>>51756745
Linked lists are literally better than arrays.
>>
>>51755311 (OP)
I find myself writing scripts every so often but, almost every time its in a new language. Usually I'm reading wireshark outputs and making some sort of analysis script. But because I'm switching languages so often I don't think I have a good enough base in any single one. I find I have to lookup syntax and how to approach problems all the time.
>>
>>51756767
>>51756745
NOT FUCKING AGAIN YOU SHITLORDS
>>
>>51756506
and so are people in 4chan, even behind their anonymity. your point being...?
>>
>>51756769
OP !w24LdKi0cI
>>
>>51756683
I'm a noob webfag. rate my website pls: http://www.nask.co
(note: it doesn't need flash/JS to work)
>>
>>51756798
Yes. The fire rises.
>>
>>51756823
http://nask.co/hear/9X2ZQvxELM
>>
I'm working on a PHP project with a database and I'm stuck on this stupid problem (it might be simple but I haven't worked with PHP in a while):

This is my folder structure:
index.php
config.php
templates/
header.html
footer.html
...
library/
functions.php
crawl.php
parse.php
...


config.php contains database username, password, an array with IDs etc. and needs to be accessible for index.php and any of the files in library.
functions.php uses include_once to include all other files in that folder, so I only need to include functions.php to have access to all my functions.

What's the best way to include the config.php and how should I save the data within the config.php so I have access to its data from both root files as well as library files?
>>
>>51756825
Fire, walk with me
>>
>>51756844
rate my website pls: https://www.youtube.com
sorry i meant https://www.youtube.com/watch?v=dQw4w9WgXcQ
>>
>>51755411
too edgy
>>
std:: is pronounced "stud"
>>
>>51756844
http://nask.co/hear/E4prud5wfm
>>
>>51756877
it's pronounced std scope
>>
>>51756877
if you're a sepples guy, then unique_ptr also called "unique puttr"
>>
>>51756877

It's more like "stood"
>>
>>51756922
*a mistake
>>
what's wrong with using lists if you're using java and writing some desktop application for modern pcs, not 1995 toasters?
>>
>>51756963
>what's wrong
>lists
>java
>modern pcs
>not 1995 toasters

nice great rod m8
>>
>>51756963
:)
>>
>>51756877
I pronounce it as 'ass titdy'
>>
>>51756984
if you're not using C why should I care about using a list that contains less than 100 elements?

I'm not making something complex like working on google databases.

I don't think most of us will ever get to work on something as complex.
>>
>>51756877
study::grad_tier<>()
>>
>>51757034
Because a vector or array is faster and provides random access.
>>
>>51757049
even in your meme pictures, the diference is the same if the list size is less than 1k elements.

>oh no, my 3k gaming pc will use a few more kb
>>
>>51757073
>memory
>not processor cycles
>wanting to limit access

array: a[4]
linked list: a.begin.next.next.next
>>
>>51757133
.next
>>
>>51757133
>machine cycles cost more than the ease of development
just get a newer PC you neet.
>>
>>51757034
stay pleb

at least use an ArrayList, not a LinkedList
>>
>>51757162
>he is too dumb to learn how to use arrays
>>
>>51757162
>linked list
>ease of development
gr8b8m8(r88/8)itl8ond8w/k8(f8)bitir8(noh8)
>>
>>51757162
Arrays are easier to use.
>>
>>51757194
>>51757207
>>51757208
arrays can't be resized and I rather have some dynamic elements I can put and pop.

besides lists are easy to use.

I'm not making a google database application so my lists sizes are usually pretty small (less than 1k elements).

Also it comes out of the box in most standart libraries.
>>
>>51757246
vectors can be resized
lists are not easier to use
vectors are out of the box in most standard libraries
>>
>>51757246
ok
>>
File: Valutron.png (17 KB, 750x216) Image search: [Google]
Valutron.png
17 KB, 750x216
>>51755311
The algorithmic language Valutron.

Valutron stands for Functional Programming Language Built on the Lambda Calculus with Object-Oriented Characteristics. It is a powerful programming language deriving primarily from Scheme (as defined by R6RS) and from ISO Lisp (from which it heavily borrows from iLOS, the ISO Lisp Object System). A very powerful object model is provided, as is a high-speed trace and sweep garbage collector.

This object model is one unique feature of Valutron. Another is V-expressions. These constitute an alternative syntax option which is algebraic in style.
>>
>>51757264
But anon, you actually haven't completed anything
>>
>>51757264
get a fucking trip code so we can filter you

are you tetsumi or someone else?

at least come up with something new before you post it again. this thread is mostly the same people posting over and over so most up of us have seen valutron a number of times already
>>
>>51757246
>arrays can't be resized
Yes they can.
>besides lists are easy to use.
Nope.
For one thing they don't have random access, so that means many common algorithms and usage patterns aren't available (or only available at extreme cost, like n*n complexity)
But the main point is that they actually can have identical interfaces - as in the case of Java with ArrayList.
So why would you ever use a linked list?
>>
File: snapshot37.png (73 KB, 1095x750) Image search: [Google]
snapshot37.png
73 KB, 1095x750
>>51757271
I just did actually.
>>
>>51757316
>arrays can be resized
get this madman out of here

vectors can be resized, arrays cannot.
you can make a new array that includes a part of the previous array (elements and/or memory)
>>
>>51757316
why should I care about worse performance if I'm not making a C software and my lists use less than 500 elements?

I care more about having something that I can finish in 15 minutes than some autistic waste of time looking up maximum performance over smaller sets of elements that are pretty much irrelevant since modern pcs are so fast.
>>
>>51757337
Arrays (i.e the data structure, not the C or C++ term) can be resized.
>>
>>51757369
they're not real arrays
real arrays have immutable size
real arrays can exist on the stack
>>
>>51757358
>I care more about having something that I can finish in 15 minutes
Then use an array, it's the simplest and most easy to use data structure.
>>
>>51757375
>they're not real arrays
Yes they are.
>real arrays have immutable size
Nope.
>real arrays can exist on the stack
Completely irrelevant to the definition of an array (data structure), it's an implementation detail.
Also stacks can be resized.
>>
>>51757381
Most of the time I don't know how big would be the size of the collection and I don't give a fuck about making new arrays if I need a bigger set.
>>
File: memes.jpg (50 KB, 696x434) Image search: [Google]
memes.jpg
50 KB, 696x434
>>51757404
>the stack
>stacks
>>
>>51757413
>Most of the time I don't know how big would be the size of the collection
Arrays work just fine for that.
But you're also wrong, most of the time you DO know the maximum size (unbounded sizes are often pathological and something you wanna guard against anyway), and for a "15 minute project" it's probably not even big number.
>I don't give a fuck about making new arrays if I need a bigger set.
No need, just resize in-place.
>>
>>51757424
Stacks is the plural form of stack.
>>
>>51757482
https://en.wikipedia.org/wiki/Stack-based_memory_allocation
>>
>>51757499
Read the first sentence.
>>
>>51757465
List<faggot> you;

you = new List<faggot>();

void AddFaggot()
{
you.add(new faggot());
}

void KillFag(int index)
{
you.removeat(index);
}

That's all I need.

I don't need to care about autistic diferences between all the data structure flavours.
It works for me and have good performance since I'm using really small sets.
>>
>>51757482
We're not talking about the data structure, we're talking about memory.
When you declare a variable, it is on the stack.
When you malloc memory, it is on the heap.
1st meeting of your first programming-related class should have taught you this.
>>
>>51757508
Read any other sentence.
>>
>>51757520

std::vector<faggot> you;
you.push_back(faggot());
you.erase(you.begin() + index);

hey guess what

you[5]
you[3]
you[arbitrary index]

not
you.begin.next.next.next.next
>>
>>51757520
>you = new ArrayList<faggot>();
now it's an array, same code, and it will run better.
>>
>>51757542
I'm using java.

>>51757558
why should I care?
what's the diference?
>>
>>51757568
the difference that you care about (i.e. not the performance gain) is you can access an element by its index (random access) and not have to go through every previous element to do it
>>
>>51757246
Use an ArrayList.
>>
>>51757521
>When you declare a variable, it is on the stack.
>When you malloc memory, it is on the heap.
Implementation defined and not even true - global variables are not on the stack.

Might wanna actually learn what you're talking about before trying to come off like a smartass.
>>
>>51757597
I was providing the most basic and watered down definition, because I felt that is what anon needed.
>>
>>51757523
Why?
>>
>>51757609
>I was providing the most basic and watered down definition
For what purpose?
Did you have a point?
>>
>>51757542
Sure you buy yourself some syntactic sugar, but resizing vectors can take a lot of time while lists can grow in constant time, anytime! That's why the Linux kernel uses lists all over the place actually.
>>
>>51757625
To clarify that we were talking about the stack, not stacks.
>>
>>51757643
Stacks is just the plural form of stack.
Do you not understand basic English?
>>
>>51757664
He's right, static variables don't go on the stack, which he obviously knew because he isn't baiting someone into falsely replying that they do.
>>
>>51757626
>but resizing vectors can take a lot of time
No, they are amortized constant time (or logarithmic, which is the same as constant in practice).
>That's why the Linux kernel uses lists all over the place actually.
That's not the reason.
>>
>neither RoboVM customers nor us, as the maintainers of RoboVM, have realized any benefits to sharing the products source under such liberal terms. While we are strong believers and supporters of OSS -- as evident from our contributions to various projects such as libGDX -- RoboVM’s continued development and longevity requires a competitive and healthy business.

Remind me again how I benefit from contributing to open source?
>>
>>51756046
Does it handle the edge case?
>>
>>51757707
Yes, that's what the ugly
["\\\\\\\\"] ~= "~"
is
>>
I feel so empty when implementing data structures in C++ rather than C, because they're already in the C++ standard... Should I just implement them in C? I'm reading one of those data structures & algos books.
>>
>>51757726
I'm not sure if we're talking about the same thing (hard to deduce from this mess) but I'm talking about this:
>"ubgxxcvnltzaucrzg\\xcez"

It's supposed to output ubgxxcvnltzaucrzg\xcez without translating \xce afterwards.
>>
>>51757767
If you want to go around implementing bog-standard data structures and feel worth-while doing so, then yeah do it in C.
>>
File: udod5Kv.png (301 KB, 1926x1458) Image search: [Google]
udod5Kv.png
301 KB, 1926x1458
>>51757782
Yes.
>>
>>51757782
It doesn't matter what you replace it with, as long as it becomes a single character
>>
>>51757829
That's the thing, you DO NOT replace \xce in THIS SPECIFIC case, and it has to remain 3 characters, otherwise it won't pass.
>>
>>51757832
Don't care enough, I wanted to catch up.

>>51757849
I passed the problem all the same
>>
File: Cray_Chapel_Logo.png (21 KB, 200x132) Image search: [Google]
Cray_Chapel_Logo.png
21 KB, 200x132
/* This test uses Chapel's data parallel features to create a
2 * parallel hello world program that utilizes multiple cores on a
3 * single locale (node)
4 */
5

6

7 //
8 // This configuration constant indicates the number of messages to
9 // print out. The default can be overridden on the command-line
10 // (e.g., --numMessages=1000000)
11 //
12 config const numMessages = 100;
13

14 //
15 // Here, we use a data parallel forall loop to iterate over a range
16 // representing the number of messages to print. In a forall loop,
17 // the number of tasks used to implement the parallelism is determined
18 // by the implementation of the thing driving the iteration -- in this
19 // case, the range. See $CHPL_HOME/doc/README.executing (controlling
20 // degree of data parallelism) for more information about controlling
21 // this number of tasks.
22 //
23 // Because the messages are printed within a parallel loop, they may
24 // be displayed in any order. The writeln() procedure protects
25 // against finer-grained interleaving of the messages themselves.
26 //
27 forall msg in 1..numMessages do
28 writeln("Hello, world! (from iteration ", msg, " of ", numMessages, ")");
>>
>>51757874
>parallelised hello world
E N T E R P R I S E
N N N
T T T
E E E
R R R
P P P
R R R
I I I
S S S
E N T E R P R I S E
>>
I'm seeing lot of anons taking clojure. I started it. Looks great.
>>
why does it seem like everyone knows about programming these days. even just last year, you'd only see the subject confined to /g/ and only within /dpt/. now every thread on /g/ is some idiot asking which language they should choose. and sometimes there's a post mentioning programming on other boards.
>>
I want to make a CDN for my own website. anyone knows a good platform for distributed file storage, and/or a guide on how to deal with this shit?
>>
>>51758114
people are asking what language to choose because they're realizing that it's a great field to get into right now.

i guarantee you that 99% of the people asking will never follow through though, or they'll learn the absolute basics and then give up when it gets a little bit difficult.
>>
>>51758114
if you're a man and can't program, you're a retard
>>
>>51758114
most people know *of* programming. Most can't do it for shit.
>>
>>51758114
The part of the board we had in the past that liked the talk about videocards that were being released and new CPUs and stuff is no longer large. People interested in technology are far more likely to get in to programming than any of the other angles to approach the field from.
That and just the general seemingly infinite demand and possibilities in the field.

When we had the first dpts on /g/ they were sometimes multi day threads and every now and then we would go for a time without a thread since nobody could be bothered to create one. The population of /g/ has changed quite a bit.
>>
>>51758114

>Why are people talking about programming on the technology board?
>>
File: quote.jpg (98 KB, 728x546) Image search: [Google]
quote.jpg
98 KB, 728x546
I started reading a book about Java
Some of you people seem to dislike Java. What makes C++ or some other language superior then?
>>
>>51757689
> No, they are amortized constant time (or logarithmic, which is the same as constant in practice).
Append to vector is required to be amortized constant time. Whether that's equivalent to actual constant time depends upon your requirements. If you just care about overall throughput, they're equivalent. If you're writing real-time code where the resize operation will screw you, they're not (but then your list needs hard O(1) allocation, which isn't trivial).

In most cases, you wouldn't choose list over vector because of amortized O(1) versus actual O(1) for the append time. If you (legitimately) choose list, it's almost always because of O(1) versus O(n) insertion.

If you don't need O(1) insertion, you'd use vector. Better constant factor for iteration and O(1) indexing rather than O(n).
>>
>>51758216
hating java is a meme

it can't be used for kernel or driver development, but it's a relatively fast and robust language. easy to get a job in since every major corporation uses it.
>>
>>51758215
reading comprehension is clearly not your forte, my foolish friend
>>
>>51758278

>why does it seem like everyone knows about programming these days
>>
Why is valgrind reporting that strlen is acting on unterminated char arrays?
I don't even have string.h loaded.
>>
>>51758268
No point in using it over C#, except for jobs.
>>
>>51758268
> it can't be used for kernel or driver development,
And what's more: C# is virtually the same but just.. better - especially now that it's all being open-sourced and multiplatformified
>>
File: sussman shig.jpg (71 KB, 500x375) Image search: [Google]
sussman shig.jpg
71 KB, 500x375
>>51756745
(cons are (cons you (cons faggot (cons a (cons huge nil)))))

that's a syntax tree btw
>>
>>51758132
anyone? should I ask wdg?
>>
>>51755311
right now i am writing pseudo code to define the thought process of an AI.

I am basing it on human thought process of conditioned response to stimuli. Self preservation being the foremost instinct that drives human behavior, and a reward process that motivates the AI to perform certain tasks.
>>
>>51758339
>except for jobs

Well that is a pretty valid point then, if you ask me.
>>
>>51758406
What do you need distributed file storage for? You can use almost any cloud computing platform for that shit.
>>
>>51758412
what is the end game here? game? sentient robots?
>>
>>51758437
I didn't say it wasn't. But the language on it's own terms, is not that good compared to others that exist. That's why almost everyone hates Java.
>>
>>51758308
you can stop proving to us that your reading comprehension is poor now. we get it, you're dumb
>>
>>51758446
I want to create something that can truly evolve in real time, instead of waiting billions of years.
>>
>>51758477
so neural networks?
>>
Are Rust/Go programmers employable? I need a break from C#.
>>
>>51758319
Maybe some library function is using strlen()?
>>
>>51758571
HAHA

no.

Well, you might have some luck with Go if you're good and look hard.

Try F#. Literally the best language. Good chance you can sneak it in in some C# shops, and as a bonus become unfireable if no one else knows F#.
>>
Every mediocre kid with a book could start programming in less than one month. programming could become an oversaturated field. how does this make you feel?
>>
>>51758605
There will be plenty of work that needs to be done quickly and plenty of work to rewrite the work done quickly.
>>
>>51758442
media files: mp3, ogg, mp4, webm
I have some credit for cheap VPSs in digitalocean (don't have money for anything else), I need some advice on how to do it, the problems that I might have and so on.
I made this website so I could learn, at least the basics...
>>
>>51758605
I'll still have good work because I'm actually good. Just because you know how to code doesn't mean you're not shit.
>>
>>51758605
every mediocre kid could start learning math and become an engineer in less than one month, engineering could become an oversaturated field
>>
>>51758647
i mean why not use a single server. Are you planning on storing so much stuff to need distributed storage?
>>
>>51758639
>>51758649
>>51758654

nice try NSA shills. i know you guys have been trying to get more programmers in the US to counter chinese hackers but don't be so obvious about it
>>
>>51758605
Couldn't give less of a shit. I actually enjoy programming, which inherently puts me above 99% of every mediocre kid. Plus programming is easy to learn, but it's hard to master. Most get discouraged when they realize how hard it is to program useful shit outside of codecademy.

While the job market might become saturated with "programmers", I can never see it becoming saturated with "good programmers" or even "not terrible programmers".
>>
>>51758268
>it can't be used for kernel or driver development
It absolutely fucking can, they were fucking using it for fighter jets.
>>
>>51758695
this. There's been a shortage of programmers consistently since the 80's, even though there's tonnes of jobless CS graduates. Turns out companies only want to pay you a salary if you're good.
>>
>>51758695
the industry today doesn't need the best of the best. it only needs the people to get the job done. how does this make you feel?
>>
>>51758605
see >>51758141

>>51758660
well, right now my website isn't using much storage, but I want to make my website popular... videos, and sometimes the audios too, generally use a lot of space, so that's why
>>
>>51758702
I don't think you know what a kernel is anon.
>>
>>51758730
You realize embedded java chips enable you write bootloaders in java let alone kernels right?
>>
making testing C scripts for my undergraduate students in intro to C

memleak.c

#include <stdio.h>
#include <stdlib.h>
void leak(void);
main() {
int i;
for (i=0; i<10000; i++) {
leak();
}
}
void leak(void) {
int *a;
a=(int *)malloc(1000*sizeof(int));
if (a==NULL) {
printf("Failed to allocate memory\n");
exit(1);
}
/* This is a memory leak unless I free a */
free(a);
return;
}
______________________________
maxmem.c

#include <stdio.h>
#include <stdlib.h>
main() {
int *array;
long n=1000;
while (1) {
array=(int*)malloc(n*sizeof(int));
if (array==NULL) {
printf("Failed to allocate %ld ints\n",n);
exit(1); }
printf("Successfully allocated %ld ints\n",n);
free(array);
n*=10;
}
}

_________________________

Does anyone have any memory allocation or memchecker scripts I can discuss for their final labs? Also pic is their final, r8 please. It's meant to be a fun final
>>
>>51755654
sauce ?
>>
>>51758719
>>51758660
crap, I'm retarded and didn't actually repond to the question... I want to use these VPSs both as storage and for file processing. plus digitalocean VPSs don't give you twice the disk space when you pay twice the price... so I'll be using many servers
>>
>>51758718
>it only needs the people to get the job done.
and very few are good enough to do that. Software projects have very high failure rates compared to other industries. It's worth paying a lot of money for someone good who won't fuck things up, then paying for 10 mediocre programmers who produce slow, bugger, unimaginable garbage that they just have to hire much better programmers to clean up the shit they took later anyways.
>>
>>51758364
>tree
>linked list
pick one
>>
>>51758752
use something like Azure storage, which just abstracts the whole concept of file storage for you.
>>
>>51758746
You might as well skip the whole text and just write "make this pseudocode into C code"
>>
>>51758755
You don't do either of those things exclusively. You hire a few pretty good dudes and some mediocre programmers that more or less can be replaced without too much difficulty (obviously still harder than hiring for a fry cook position). Ideally they all get along and stick around and the general skill level rises and they go back and refactor their shit.

People that come in and try to tear everything apart because they think it sucks are usually full of shit. Usually they think it sucks because they can't imagine more than one way of solving the problem and doing it any other way means it sucks.

But of course all of medical records software pretty much sucks, so you've got that point on your side.
>>
>>51758718
I have bash scripts that write more/better code than some of the people I've worked with. If you want to talk in terms of how many jobs you can put on my desk and have finished by the end of the day, I'm a pretty good investment.

You could start teaching programming as part of the core curriculum worldwide, and I wouldn't be worried about my job security.
>>
>>51758776
I don't have money for that shit, and since I live outside the US, I probably won't even get anything for free. also, as I said, I want to use them for two things at once.
(I'm a NEET... I'm trying to become a non-NEET, or a rich NEET, whatever comes first (: )
>>
>>51758811
Can't help it, I was an undergraduate molecular biology major lol, I like explaining concepts eagerly and basically fluffing documents
>>
>>51758847
Then how can you afford Digital Ocean shit
>>
>>51758847
Ethan is that you?
>>
>>51758864
free credit from https://education.github.com/pack + $5 in paypal
I actually have > $100 in credit for amazon... but I don't have a credit card, so I can't use it.
btw, I can suggest that, for example, if you want your own website for free, you can use openshift.
I'm poor, so I've had to find ways to get stuff for free...

>>51758926
no
>>
>>51755311
Learning about Big-O, Big-Ω, and Big-θ
>>
>>51758960
You're a Big ϕ
Thread replies: 255
Thread images: 21

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.