[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: 23
File: smug_tokitsukaze.png (53 KB, 168x140) Image search: [Google]
smug_tokitsukaze.png
53 KB, 168x140
Why are you slacking off?

>>53788879
>>
>>53796488
First for D
>>
File: Hibiki_TeddyBear_Edited.png (2 MB, 1504x2194) Image search: [Google]
Hibiki_TeddyBear_Edited.png
2 MB, 1504x2194
Hibiki
>>
>>53796494
there's too many words in the google results
>>
>>53796542
I'm not doing your assignment for you pal
>>
180 08 BROMAL 74 27 99 14. Boris, Roman, Olga, Mikhail, Anna, Larisa. 7 4 2 7 9 9 1 4
>>
>>53796569
yeah you are, now tell me how to use semaphores with code examples with easy to understand comments that use small words
>>
>>53796603
wew
>>
>>53796603
'no'
>>
>>53796658
might want to rethink that, white boy
>>
>>53796682
Or what?
>>
Why is Python so comfy?
>>
>>53796724
Because you enjoy penis
>>
>>53796696
or i'm gonna fuck that lily white ass of yours. yeah, spread that shit, spread that lily white ass, lil' nigga
>>
>>53796746
Let's not fight. It really is quite neat to program in. I enjoy my own penis, yes.
>>
>>53796758
I'm a swede so you're only making me happy
>>
Why are you guys not using visual basic????
>>
>>53796785
It feels really ugly to code in.
>>
>>53796831
Visual studio has a really nice ui imo. I've used tons of programs and Visual Studio is so far my favorite.
>>
>>53796767
comfy perhaps. But when you actually want to get shit done, there's far better alternatives.
>>
>>53796884
If you're using Visual Studio you might as well just write C#.
>>
>>53796884
No no, not the IDE. The language itself. I was forced to use Visual Basic .NET and the Entity Component Framework? for a summerjob, writing a GUI interface for managing some parts for a production line. It just felt really bad/unnatural -- the syntax of the language that is. I quite disliked it, after having written Python etc. for a long time. It didn't even go away after a few weeks, so me getting used to it wasn't the problem either.
>>
>>53796917
A lot of it looks like pseudo code honestly just type do this and it will actually do it.
>>
>>53796886
I do get shit done really quickly with Python. I suppose it depends on the use-case. Could you name an example where you yourself wanted to "get shit done" and clearly Python wasn't the right choice?

For CPU intensive tasks, yes, Python is not the best choice, but what are you talking about exactly if not about such a scenario?
>>
>>53796886
>there's far better alternatives
like?
inb4 c/c++
>>
>>53796951
>Could you name an example where you yourself wanted to "get shit done" and clearly Python wasn't the right choice?
Literally everything.

A simple script for renaming files? F# is better

A large complex game or application? Again F#
>>
>>53796975
c/c++
literally any non-scripting language
>>
>>53796977
I disagree completely, but to each their own. You just don't like Python for other reasons and conclude that it clearly must be worse then than your favorite other language X. That's fine, but not really based on fact.

Renaming a file in Python is literally

import os
os.rename('a', 'b')


Not sure how much quicker/easier you could make this.

Or:
for root, dirs, files in os.walk(path):
# do something here
pass
.
>>
>>53796996
That's dumb. For non-CPU-intensive tasks C/C++ clearly aren't better or quicker. This is just shallow trolling and quite dumb to read.
>>
>>53797020
>pass
That's where python designers failed.
>>
File: IMG_20160326_200633.jpg (958 KB, 1944x2592) Image search: [Google]
IMG_20160326_200633.jpg
958 KB, 1944x2592
This isn't exactly a programming question.
I saw this on a machine walking through an arcade the other day, and I was wondering what it means exactly.
Some assembly instruction tried to access invalid memory?
>>
>>53797068
Ahhhh yes, let me just crack open my sdaemon.exe error code reference book...
>>
>>53797040
tbf I'm not sure why he included pass, it isn't necessary.
>>
>>53797068
>instruction tried to access invalid memory
yep, that's the proximate cause
>>
>>53797084
I guess I should have asked if there is enough information in that prompt for us to really know what's going on, or if it all depends on the application.
>>
>>53796488
Because I'm disgusted by everything and everyone.
>>
>>53797068
>invalid memory?
The memory doesn't have to be invalid per se. The process might not have permission to read from that memory address, for example.
>>
>>53797068
My guess would be someone tried using a pointer to a certain spot in the heap that was already in use.
>>
>>53797068
The program tried to access address 0x18 which was probably outside the range of the assigned virtual addresses, and segfaulted.
>>
>>53797093
It is.
def donothing ():
def dosomething ():
print 'foo'


That code ain't valid. It should, but it isn't.
>>
>>53797093
It is. Try to run that code without pass. pass is a result of structuring code with indentation -- it's needed when you have a control-structure that ends with a colon and would have an empty line below it elsewise. The comment doesn't count.

It's not really a design-flaw, but I couldn't be bothered to explain it.
>>
>>53797112
>referenced memory @ 0x18
something tells me it might be indeed trying to access an invalid region
>>
>>53797068
I honestly always wondered why these error messages phrase it like
>The memory could not be "read"
I mean, why the quotation marks? It's like it's making fun of the term reading when it comes to memory.
>>
>>53797121
>>53797125
I assumed that the comment would be replaced by statements.
>>
File: 1442288627901.jpg (52 KB, 604x604) Image search: [Google]
1442288627901.jpg
52 KB, 604x604
I wanna make an app that suggests formula amounts for bottle feeding for babies by age and weight. I have an idea of the code I'd have to write. I suppose I can do a bunch of if/else arguments for the age/weight but would I need to store the suggested amounts in an array to be logged after the age/weight is processed? It'd probably all be strings, but videos would be cool too. Is it okay for arrays to be a bunch of strings? And can you store videos into an array?
>>
>>53797020
>You just don't like Python for other reasons and conclude that it clearly must be worse then than your favorite other language X
That's a huge presumption on your part. You seem to have come to this conclusion without any basis on fact without a hint of irony. Nice job.

open System.IO
for fileName in Directory.GetFiles(path) do
File.Move(fileName, fileName + "shit")


It also happens to be statically typed, and faster. And i can use it as part of much more sophisticated applications that python is not suited for.
>>
>>53797167
Ah yes, then pass isn't needed -- you are right. That's why complaining about pass:

>>53797121

Is dumb. You probably won't use it in your Python script, and I guarantee you, you won't see it more than a few times even in huge code-bases -- unless they use Mixin classes really heavily or something.
>>
>>53797188
What do you mean videos?
>>
File: 1454651517693.jpg (177 KB, 1075x1125) Image search: [Google]
1454651517693.jpg
177 KB, 1075x1125
>LDAP goes poof
>"Why do we use active directories? the Jira connecter isn't working"

Ah, so that's why middle managers hate programmers.
>>
>>53797120
Remember that the prompt says "referenced" memory and not "dereferenced" so that's what is throwing me off.
>>
>>53797221
Short demonstrative videos of me preparing the bottle with the specified amount of formula/water.
>>
>>53797167
I often use noop functions.
>>
>>53797230
get paid pupper
>>
>>53797230
get paid pupper
>>
>>53797200
It's longer. And "faster" really? Do you really think the bottleneck of renaming files on your HDD/SSD is the CPU? Goddamit man.

And yes, that's the conclusion I came to because nothing else made sense; but you really told me, bro. Awesome.

> And i can use it as part of much more sophisticated applications that python is not suited for.

For example? Specifically not CPU-intensive applications, as I have mentioned that I'd agree with you on that point, however what sophisticated application isn't Python suited for? Consider that the original BitTorrent client was implemented in Python for example.
>>
>>53797250
Was for >>53797202
>>
>>53797244
It is most likely using "referenced" in the informal sense, as in the instruction tried to "look at" memory in 0x18.

The word "dereference" is generally used in terms of pointers, but "reference" doesn't have a specific meaning like that.
>>
>>53797250
ok. I don't see why you would, but sure.
>>
>>53797281
Future functions that will be implemented but aren't.
>>
>>53797292
Sure alright. In that case pass makes sense, but it usually isn't part of actually developed projects, and usually it wouldn't even make it into the repo I assume.
>>
>>53797260
>It's longer.
it's not
>And "faster" really?
yes
>Do you really think the bottleneck of renaming files on your HDD/SSD is the CPU?
no.

>that's the conclusion I came to because nothing else made sense
Perhaps then you should be more aware of what you don't know then. Next time someone tells you they know a language that's better than python, instead of assuming the must be wrong, ask them why.

>Specifically not CPU-intensive applications
I mean CPU-instensive applications, I know you agree with me, it's still useful. I also mean complex large programs, to which dynamic typing is utterly unsuited for.

>Consider that the original BitTorrent client was implemented in Python for example.
And Facebook was written in PHP.
>>
>>53797248
You'd be better off storing links to the videos in an array rather than like storing the actual video content in an array. Just pick the right index, get the link and open the video with the systems default video player, or have them on youtube as private videos and open them in a new window or embed them in your app.
>>
>>53797322
Correction: Should be unlisted rather than private
>>
>>53797310
What I wanted to point is how python designers are incompetent. Indentation should be enough, but they're unskilled developers.
>>
>>53797200
>>53797020
rni a.txt b.txt 


Or if you want to use Powershell from within C# for some hacky reason

PowerShell.Create().AddScript("rni a.txt b.txt").Invoke();


Why would you use Python or F# for this?
>>
>>53797319
It is longer. Just count the characters. I put faster in quotation marks because it doesn't matter in this use-cases, and the use-cases I described from the very beginning -- tasks that are not bound by CPU. So it's completely irrelevant.

> Next time someone tells you they know a language that's better than python, instead of assuming the must be wrong, ask them why.
Why? I am finding that out through this discussion -- are you really complaining about the way I lead this discussion with you?

> I know you agree with me, it's still useful. I also mean complex large programs, to which dynamic typing is utterly unsuited for.
Good that we are on the same page about one thing then. Clearly Python is suited for complex large programs, if you consider that many of Google's flagship projects are written entirely or for the most part in Python, the original BitTorrent client is (as mentioned) and Django web applications have a very complex code-base under the "surface code".

> And Facebook was written in PHP.
Yes, your point being? That PHP can also be used to write complex applications? That's not really proving that Python is unsuited for that task.

Condescending prick.
>>
>>53797343
troll.
>>
>>53796488
im slacking off because i'm too dumb to learn programming
>>
>>53796912
Sure. The best IDE. "Useless"
I'm buying a Windows 10 workstation just for my *nix development.
Hope you graduate the GNU clown school someday.
>>
>>53797277
I should probably learn another language besides c++.
>>
>>53797438
I didn't call Visual Studio useless, because I personally love it. Did you reply to the wrong post? All I'm saying is that I'd take C# over Visual Basic any fucking day of the week.
>>
if i have a producer and consumer thread putting and taking things from a buffer, do i need 3 semaphores in total, one mutex, one full, and one empty? why can't i just have one mutex and one semaphore for the buffer?
>>
>>53797462
I think they are somehow mixing up the terms Visual Basic, C# and Visual Studio -- not sure how that is even possible...
>>
>>53797393
>Just count the characters.
No shit, mine is a complete program. Complete yours, then we can count characters.

>are you really complaining about the way I lead this discussion with you?
yes

>if you consider that many of Google's flagship projects are written entirely or for the most part in Python
Bullshit. Google is a C++/Java/JS shop. ANd they've been working like fuck ver the past decade to add static typing to JavaScript. First with GWT, then with Dart and now they've even partnered with Microsoft to use TypeScript. They do this because they know dynamic typing is shit for large code bases, like everyone knows.

I'm not saying JS, Python or PHP can't be used large programs. I'm saying they are not suited for them. The fact that some large projects used any of those does not change that.
>>
>>53797429
(Programming secret: (It's not hard, nerds just make it look it that))
>>
>>53797493
Programming is not hard, good programming is hard.
>>
>>53797462
No, I just didn't bother to read the thread.
The Bulls are losing and I need to take out my agressions on someone don't I god damn.
(also I like to pick on Linux users)
>>
>>53797482
So you deny that Google is using Python? Also I don't think your code works as soon as path isn't equal to the current working directory, unless GetFiles actually returns the full, absolute paths to each file? Oh well -- this is the Python version then

> yes
I don't feel sorry.

import os
for file in os.listdir(path):
os.rename(file, file+ 'shit')
>>
>>53797556
Well I'm also partly a Linux user so you got me there. You can also make fun of me for using vim.
>>
>>53797560
Piss google uses every piss lang any piss enginer likes. Why are you talking about an advertising company in a programming thread?
>>
>>53796488
Reading a kinda lame paper http://arxiv.org/pdf/1603.08262v1.pdf

======================================================
Towards Machine Intelligence
Kamil Rocki
IBM Research, San Jose, CA 95120, USA
Abstract.
There exists a theory of a single general-purpose learning al-
gorithm which could explain the principles of its operation. This theory
assumes that the brain has some initial rough architecture, a small li-
brary of simple innate circuits which are prewired at birth and proposes
that all signi cant mental algorithms can be learned. Given current un-
derstanding and observations, this paper reviews and lists the ingredients
of such an algorithm from both architectural and functional perspectives.
======================================================

FBs paper http://arxiv.org/abs/1511.08130 was better imho
>>
>>53797560
>So you deny that Google is using Python?
I didn't say that at all. I'm sure they use a small bit of lots of langugaes, but python is certain not in widespread use. Probably get's used by researchers.

>unless GetFiles actually returns the full, absolute paths to each file?
it does.

they are pretty much the same, except some of the words in F# are longer. It's not any harder to read. It's also statically typed.
>>
>>53797594
Nah I use Vim as well.
Those Emacs user though...
(I'm about to read the original Stallman emacs paper, maybe I'll get it. Evil was sluggy when I last tried it)
>>
>>53797645
1) All researchers use python
2) Some production code is probably written in python too
>>
>>53796488
Because I'm playing with Swift

import Foundation

struct Person : BooleanType, StringLiteralConvertible {
let name: String
let age: Int

var boolValue: Bool {
return age > 10
}

var description: String {
return name
}

init(name: String, age: Int) {
self.name = name
self.age = age
}

init(stringLiteral value: String) {
let parts = value.componentsSeparatedByString(",")
let name = parts[0]
let age = parts[1]

self.init(name: name, age: Int(age)!)
}

init(extendedGraphemeClusterLiteral value: String) {
self.init(stringLiteral: value)
}

init(unicodeScalarLiteral value: String) {
self.init(stringLiteral: value)
}
}

if Person(name: "Bob", age: 20) {
print("older than 10")
}

if "Bob,23" as Person {
print("older than 10")
}
>>
>>53797675
My point exactly. It's only used by researches because it's popular in the research community. It's often the only language they know. I'm sure a bit have leaked into products as a results, but actual programmer know better than to use that shit.
>>
>>53797615
Sure, great argument. Every company that serves to prove a point you disagree with is "piss" and only an advertisement -- you see where this doesn't help prove your point, right?

>>53797645
You are right, you didn't. Still, I was under the assumption that things like the YouTube code base and many other projects etc. are largely Python. Of course the actual CPU stuff probably isn't, or just Python bindings. I have read this countless times, so I'm pretty sure it's correct.

Yes it's statically typed, and I'm sure that's a huge advantage from your point of view, but it's negligible to me personally. I also think it's possible to manage and write complex code with Python, as is proven by the existence of huge projects written in Python; I can't put this any more clearly.

> Python is not in widespread use
That's completely incorrect, it's hugely popular and is only becoming more popular. I think it topped various popularity lists for programming languages.
>>
>>53797703
For example its very probable that AlphaGo used Tensorflow, so python (though deepmind is known to use torch/lua, so it may be torch).
>>
>>53797675
>1) All researchers use python
and they used perl before that, not an exactly an glowing recommendation
>>
>>53797703
>>53797716
But you seem very sure in your opinion, so I will stop discussing this point now. I hope at some point you might discover some interest for Python, but it really isn't "shit" or as disadvantaged as you think.
>>
>>53797753
> you might discover some interest for Python
I'd rather barricade my indoors bathroom and learn java thanks.
>>
>>53797716
>Still, I was under the assumption that things like the YouTube code base and many other projects etc. are largely Python
I recall youtube is mostly C, not even C++.

>but it's negligible to me personally.
It makes code work faster by catching wide classes of bugs at compile time. Your code is much more likely to run correctly the first time in F#, and you tend to have much more confidence in it being correct generally.

>I also think it's possible to manage and write complex code with Python, as is proven by the existence of huge projects written in Python; I can't put this any more clearly.
I completely agree. Anything is possible in Python, except performance related stuff. But just because it's possible doesn't mean you wouldn't have it done much much faster in a different language. There's a reason large projects are very rarely written in python.

> Python is not in widespread use
In google.
>>
Did you know 2/4 is the global autism day?
>>
somebody rate my simple haskell json lib
https://0x0.st/PmL.hs
>>
>>53797732
A lot of medical subfields still use Perl fyi
>>
>>53797790
Thought ya'll might feel appreciated.
>>
>>53797753
>I hope at some point you might discover some interest for Python, but it really isn't "shit" or as disadvantaged as you think.
I used python many times over the years. It's nice in some ways, but it's not good for getting shit done. I'll happily use it for a job, and have done. But there's far better options out there when you can solve a problem with any language.
>>
>>53797789
>I recall youtube is mostly C, not even C++.
Actually youtube was rewritten into java from python after google purchased it.
>>
>>53797828
I'm talking about today, not historically.
>>
>>53797809
Yeah the hospital IT infrastructure is a mess.
People rail on about Apple, Google & Microsoft when Accenture is literally killing them.
Thank god I ain't a yankee.
>>
>>53797827
You might be happy to know that there's support for type annotations in Python 3.5 out of the box now, and IDEs / Editors will easily be able to infer types and to type-checking using that, before running the code. So at least some part of your worries might be alleviated.
>>
>>53797848
It's still written in java.
>>
>>53797867
Now if only anyone used Python 3...
>>
Anyone knows wtf is wrong here?
(C++)
//A.h
class A
{
public:
static void QueueForDeath(B* who);
private:
std::vector<B*> myVec;
}

//A.cpp
void A::QueueForDeath(B * who)
{
myVec.push_back(who); //I get error C2228 here...
}
>>
>>53797809
and if you're saying medical research still uses perl well that's a motivation to eat better and work out
>>
>>53797881
I do, so it's cool. Most new python libs do too, and old ones are mostly ported. There's also an alternative comment syntax for Python 2 -- so no worries.
>>
Just curious, I don't dabble in interpreted langs too much. Can you write Python 3 libs with an Python 2 API?
(Bulls are winning hell yeess)
>>
>>53797941
You can use the six module for example to easily write a codebase that works with Python 2 and Python 3, yes.
>>
>>53797068
the program most likely segmentation faulted because 0x18 is probably a reserved memory location used for a TRAP or interrupt vector that cannot be accessed with just normal user privileges.

reboot the machine and it'll fix it most likely unless that instruction has been corrupted from some malicious shit
>>
>>53797884
You need a semicolon after your class declaration. More importantly, you can't use a non-static variable in a static method.
>>
so the entire network of the cs department at my university is down... how ironic
>>
>>53797970
>you can't use a non-static variable in a static method.
Fuck I feel stupid now... Thanks anon
>>
>>53797986
What stupid thing I'm doing here besides breathing? It returns a garbage value. It's suposed to sum the elements of the array.

#include <stdio.h>
#include <ctype.h>
int aver(int ar[]);


main(){
int a[10]={2,3,1,5};
printf("%d", aver(a));

}

int aver(int a[]){

int *cnt= a;
int *cnt2= (a+1);
int sum;
printf("the value of cnt is %d and cnt2 %d\n", *cnt,*cnt2);
sum = *cnt + *cnt2;

while(isdigit(*cnt2)){
sum = *cnt + *cnt2;
++cnt2;
++cnt;

return sum;
}
}
>>
>>53798040
everything
>>
Where is that anon making loli raping game?
What progress have you made senpai? :3
Can lolis poo in loo already?
>>
>>53798040
Haha oh my god anon, I can't breathe.
>>
>>53798040
I'm not even sure what you are doing with all that dereferencing, but you return sum in the very first iteration of your while.
>>
File: newTurkey.png (122 KB, 700x560) Image search: [Google]
newTurkey.png
122 KB, 700x560
Babby's first edge detector
>>
File: foundations-of-induction-39-728.jpg (100 KB, 728x515) Image search: [Google]
foundations-of-induction-39-728.jpg
100 KB, 728x515
>>53797732
I don't care about languages anymore. I care about algorithms, especially machine learning, especially reinforcement learning (which really is artificial general intelligence).

Computers have awesome potential for being intelligent slaves that solve all our problems. Computers want to obey us, but we haven't yet found a good algorithm that transforms a computer into a good slave.
>>
>>53798040
Please go to a hospital you're having a stroke.
>>
>>53798090
Nice, make a corner detection now, anon!
>>
>>53798040
jesus christ
>>
>>53798093
Agree, researchers have better things to do than jerk off to languages. Tool's a tool.
Even if it's perl or python or undecryptable fortran.
>>
>>53797479
You can but readers will have priority, allowing starvation.
>>
>>53798144
Then again I'm a son of an Academic Perl Programmer. Probably grew up twisted in the first place.
(Bulls win helll yeeees~~~~zzz)
>>
What does /dpt/ think of FSharp?
>>
>>53798153
alright

how do i use a semaphore to make a mutex in C? do i start it at 0 and increase it to lock it or start it at 1 and decrease it to lock it? my prof said we can't use mutex locks
>>
>>53798181
4chan is written in perl lel
>>
>>53798185
what
You have a textbook right
>>
>>53798040
#include <stdio.h>

int aver(int a[], int size)
{
int sum = 0;
int i = 0;

for(i = 0; i<size; i++)
{
sum = sum + a[i];
}
return sum;
}

int main(void)
{
int a[4]={2,3,1,5};
printf("%d", aver(a, 4));
}
>>
>>53798212
Yeah I guess I\m about the same age as moot and I programmed perl back then.
I had the good sense of staying out of ATDRW though.
>>
File: woohoo.png (3 KB, 130x169) Image search: [Google]
woohoo.png
3 KB, 130x169
Decided to start working on a shitty little hack'n'slash to kill time.
>>
>>53798213
what do textbooks have to do with this? it's a simple yes no or maybe question
>>
>>53798242
I started with perl. Now I don't care though. It's way harder to learn algorithms than languages. I know all mainstream languages + verilog + lisp + asm, but I don't understand many cool algorithms (yet). There are many, they are different and understanding them is hard.
>>
>>53798269
look it up idiot
>>
>>53798258
DETAILS MAN.
>>
/g/-tards, can you even understand what is this about? http://people.idsia.ch/~juergen/compressednetworksearch.html

>tfw nobody to discuss cool rare research with
>>
>>53798369
its because we are all intellectually inferior to you, smart-san.
>>
>>53798369
Ah yes, "Compressed Network Search Finds Complex Neural Controllers with a Million Weights", I've made a few of those in my lifetime
>>
>>53798358

No real details, just a sort of "gimme a monster to fight" procedurally generated monsters with procedurally generated loot.

I'm going to throw a bunch of base stuff in there (Body, Boots, Bottoms, Helmet, Gauntlets, Greaves, Helmet, Shield, Weapon, and Buff Items) which I have classes for, but the item file will eventually be populated with mostly generated content.
>>
>>53798369
>Deep learning
ugh
>>
>>53798403
Language?
>>
>>53797068
>>53797112
>>53797131
>>53797114
The address in question was 0x18.
I think what probably happened here is the program had a null pointer to a struct, and it tried to access a member of it, like this:
struct->member
and the offset of the member was 0x18, hence the address.
>>
>>53798415

cshart
>>
>>53798284
rude
>>
File: D_Programming_Language_logo.svg.png (567 KB, 2000x1516) Image search: [Google]
D_Programming_Language_logo.svg.png
567 KB, 2000x1516
>>53798422
You should resolve that C#
>>
>>53798422
monogame?
>>
How would I go about learning how to program?
>>
>>53798456
Go to university.
>>
>>53798442

Nope, just regular C#. It's not like it's going to be a dungeon crawler or anything, so no graphics besides a few that I need to make.

>>53798438

Maybe I will. It's what Alexandrescu would want.
>>
>>53798460
he wants to learn programming, not useless academia.
>>
>>53798472
t. code monkey
>>
so i have to read in a command line argument that says how many numbers my producer should make. my consumer has to remove items in the same order they are produced. should i have the for loop be in main, or pass it as an argument to producer and have the for loop be in there? we have to print the numbers in the consumer and producer to a text file and they have to line up
>>
File: 1367472762653.jpg (299 KB, 1383x1600) Image search: [Google]
1367472762653.jpg
299 KB, 1383x1600
>doing Bluetooth project
>have no idea what the hell I am doing
>never done communication coding in my 5 years of college
>tfw feel retarded and lazy as fuck
>>
>>53798456
Like with any other skill, read books and practice
>>
>>53798480

so is it multi-threaded or some shit? or it prodcer making all of it in 1 guy and then consumer consuming it in 1 go?
>>
>learn f#
>find out that in large programs, the order that files are compiled in matters
nice meme language
>>
>>53798512
What are some good books?
>>
>>53798529
Depends on what language you want to learn
>>
>>53798386
>>53798387
>>53798406
Its not that hard, actually I'm not a researcher, just amateur that doesn't afraid of reading papers. Searching parameters of neural network by GA is 5 lines of pseudocode.

Didn't you thought that you could use all your dozens of cores to rapidly evolve & test solutions to your problem? Our computers are universal search machines, and yet we use them for stupid shit.

We could literally evolve (at least some form of) AIs in our machines.
>>
>>53798544
Oh, I considered something like this. Basically creating random Python bytecode instructions at runtime and evaluating the resulting function result with some kind of fitness function. But I am almost positive overfitting would be a problem in all scenarios.

I guess I dont know enough about how all the caveats and how to avoid them.
>>
>>53798456
Just pick a language a learn the basics. Basics are iteration, datatypes, variables, arrays, functions, operators, conditional statements, input/output, recursion. Then move on to object-oriented programming. If you have built this foundation there's no stopping you.
>>
>>53798533
What is a fairly basic one?
>>
I have a C tutorial program that has to iterate through the below arrays and output the product of finite values in the array:


double x2[] = { NAN, +INFINITY, -INFINITY };
call_function( "No finite values", x2, 3 );

double x3[] = { 1, 2, 3, 4, 5, 6, 7 };
call_function( "Several finite values", x3, 7 );

double x4[] = { 2, M_PI, NAN, 3, INFINITY, 4 };
call_function( "A mix of finite values and infinities", x4, 6 );



My issue is in the function that does the calculating, I have initialized
double currentProd = 0;
as a counter. C doesn't allow a sort of completely empty initialization (makes it a value of what ever is currently in that mem loc, so for most purposes it's really bad).

So I want to iterate through and have the first finite number assigned to currentProd, then on the next loop multiply currentProd by i (what ever the current is). I want to do it without nesting another if or else to check if currentProd is still 0. Or is that the best way? Clearly I am shit at C.
>>
>>53798518
the directions talk about the producer/consumer threads in the singular
>>
>>53798544
>We could literally evolve (at least some form of) AIs in our machines.
You say you're not afraid of reading papers, but then you throw in that "AI" buzzword
>>
>>53798571
Python.
>>
>>53798518
but it has a buffer of fixed size so they have to be running in parallel. i didn't really read what you wrote first reply
>>
>>53798571
c++

its the only language you'll ever need
>>
>>53798571
You should start with Scala
>>
>>53798608
Delete this.

(Seriously though: this advice is only given by novice programmers who have no real clue about what is actually important or how the real world works)
>>
>>53798571
JavaScript so you can actually use your knowledge to mess around with the web
>>
>>53798518
>>53798586
>>53798600
nm think i figured it out. i'm going to just have a global count variable, set it to the right value in main and then use it as the producer's while loop limit.
>>
>>53798622
you know how i know you're a feminine beta cuck?
>>
File: circlebot.png (67 KB, 960x912) Image search: [Google]
circlebot.png
67 KB, 960x912
>>53798566
>Oh, I considered something like this. Basically creating random Python bytecode instructions at runtime and evaluating the resulting function result with some kind of fitness function. But I am almost positive overfitting would be a problem in all scenarios.

That could work but
1) Not all sequences of bytecodes are legal
2) Python is 100 times slower than C.

I went another route: just implement a simple forward only RNN and search for weights with GA. It worked, but perhaps due to quirky environment and fitness function the robot sometimes stalled (the task was to avoid blobs). With LSTM that could work better.

I'm planning to do it again, now I'd try some simple bytecode of my own. Or a threaded code. The only things that matter are:
1) There should be some sequence of code that produces the solution
2) It is desirable that said sequence would be short and there were multiple variants of it in solution space.
>>
>>53798632
You can mess around with "the web" in any language.
>>
>>53798651
Yes, you fully trust your lust-filled delusions.
>>
File: container_ship.jpg (425 KB, 1920x1080) Image search: [Google]
container_ship.jpg
425 KB, 1920x1080
>>53798438
Shill me on D. Why should I learn a self-proclaimed systems programming language that has a garbage collector? Why shouldn't I learn Rust instead?
>>
>>53798590
AI is not a buzzword anymore, see >>53795093
>>
>>53798632
What are some good books on it? And what do you mean by messing around with the web?
>>
>>53798600

so explain this in detail

you get a command line argument detailing how many times your producer runs and the consumer needs to consume basically after each time producer is called?

if that is true then just use a while loop calling producer first and then consumer.

unless there's some other shit I am missing.
>>
>>53798672
Oh it's like it's 60s all over again
>>
>>53798665
let me guess you use python in your moms basement

such "real world"
>>
>>53798572
Assign currentProd to 1 instead of 0
>>
>>53798657
True, but since most of the existing client-side code on websites is Javascript it's useful to learn and be able to read.

>>53798685
Writing scripts for simple things like removing elements you dislike and stuff, sky's the limit. I don't know of any good books, it's pretty easy to find web resource sthough.
>>
>>53798572
Just make currentProd = array[0], and start your for loop with index 1 ie:
double currentProd = array[0];
for (int i = 1; i < size; +++i)
{
/* your code here */
}
>>
>>53798697
C#, Python, C when it is needed. You have no clue about programming, you only challenge others with buzzwords you got from /g/ and half-truths you collected during your wasted lifetime spent on this board. Go away, be sad and pathetic somewhere else.
>>
>>53798572
#include <stdio.h>
#include <tgmath.h>

int main()
{
double arr[] = { 2, M_PI, NAN, 3, INFINITY, 4 };
double prod = 1.0;

for (int i = 0; i < sizeof arr / sizeof *arr; ++i)
if (isnormal(arr[i]))
prod *= arr[i];

printf("%f\n", prod);
}
>>
>>53798693
idk, if a learning algorithm that after training on gigabyte of data eats your pixel array, char array with question about your pixels and computes a plausible answer in natural language is not AI than I don't know what is AI (this prof guy knows better desu https://www.youtube.com/watch?v=F2bQ5TSB-cE ).

http://i.imgur.com/DRfaNxB.png

Recent 5 years brought lots of breakthroughs in state of art, people are tired of it and move definition of AI even further, so it works. Call it machine learning, it doesn't change what they can do.
>>
File: gnl.png (29 KB, 1108x518) Image search: [Google]
gnl.png
29 KB, 1108x518
everybody knows that power users are on GNL.
>>
>>53798729
lol you're such a beta code monkey

come back when you know about data structures and algorithms aka real world pay
>>
>>53798728
>>53798743
>>53798708

Thanks. I am retard for not thinking of that solution.
>>
>>53798755
>Posts a link to an image.
>On an image board.
>>
>>53798775
as I said, throwing around nonsensical bullshit and empty challenges. You must feel at least a little bit introspective right now -- there's always the chance to change it.

Just go actually learn something useful instead of pandering C++ and being forever stuck on the 4th chapter of the book you bought that's much too big for you, love.
>>
>>53798728
That won't work if the first element is NAN or +/- INFINITY.
>>
>>53798788
Try posting the same image twice on a board. The image is already uploaded in another thread.
>>
>>53798775
Data structures? Algorithms?
>>
>>53798818
That's when you change a pixel or resave it in a different filetype or whatever method you prefer
>>
>>53798830
too much effort.
>>
>>53798775
>come back when you know about data structures and algorithms aka real world pay

Here's what Rob Pike says re: algorigms and data stuckers:

      The following data structures are a complete list for almost all practical programs:

array
linked list
hash table
binary tree
>>
>>53798837
As opposed to uploading it remotely and link to it?
>>
>>53798849
>no stack
The stack is my waifu, shit list
>>
File: question.jpg (32 KB, 600x412) Image search: [Google]
question.jpg
32 KB, 600x412
>>53798040
What the fuck i you doing my nigga?
>>
>>53798860
I suppose people would argue that stacks are a special case of arrays or linked lists.
>>
>>53798824
>>53798849
he's just an idiot spouting nonsense
>>
>Start running my genetic algorithm
>All 6 cores are 100%
>Fan RPM increases

I shouldn't solve problems in a brute-force manner, I should make more stable fitness function and better controller instead.

The task is to evolve a robot that avoids blobs by 1d vision.
>>
>>53798860

Last time we sort-of half agreed that adding deque would cover the missing spot.
>>
>>53798880
>implying the stack is anything like those lowly data structures
Don't talk to me or my son ever again
>>
>>53798858
I just found a link lel
>spend 3 posts discussing image link instead of content

What do you see there, anon?
>>
>>53798880
Yeah, both stacks and queues are usually just abstractions of the listed data structures.
>>
>>53798849

Seems to neglect abstract syntax trees.
>>
>>53798755
>computes a plausible answer in natural language
It's natural in the same way Microsoft Word's UI speaks to you in natural language. Image recognition, even when using neural networks, has no understanding of underlying concepts, only string tags associated with data sets.

I bet you think chat bots like Tay can hold an opinion too.
>>
>>53798849
>Rob Pike
literally "who"

also
>no sorting methods (quick, merge, linear, counting, bucket, radix, etc)
>no stack
>no heap
>no queue (regular? circular?)
>no specifics to array (static / dynamic)
>no specifics to linked list (single? double? sentinel?)
>no specifics to binary tree (binary search tree? AVL tree?)
>no mention of b trees

and that's just scratching the surface
>>
>>53798922

almost all practical programs
>>
>>53798903
>What do you see there
Definitely not intelligence, but I'm not gonna argue it here so carry on.
>>
>>53798406
It's the same annoying faggot that keeps posting about it

>>53798544
>Look at me! Look at me! Look at me! Look at me! Look at me!
Fuck off and actually do something. No one is impressed by your ability to use the search bar on arxiv.
>>
>>53798937
>all that shit by you

ivory tower masturbation
>>
>>53798936
>It's natural in the same way Microsoft Word's UI speaks to you in natural language. Image recognition, even when using neural networks, has no understanding of underlying concepts, only string tags associated with data sets.

Define "understanding". My definition: understanding means computing compact (in inf. theoretical sense) representation of data suitable for further computation.
This neural network falls under my definition, it computes abstract representation of a scene and uses it to answer a question about a scene in natural language. It generalizes to images and questions it has never been trained on.

Of course humans probably have a more versatile and compact representation of the same scene when they see it, so they understand the scene better. But this understanding is still understanding.
>>
>>53798936
>in the same way Microsoft Word's UI speaks to you in natural language
it's saying "please kill me"
>>
>>53798901

Stacks are just vectors or lists with a restricted set of operations.

Vectors are just arrays that can resize. Alternatively, arrays are just vectors that can't resize. Take your pick, really.

>>53798943

Compilers and interpreters aren't practical programs? Programs that process speech aren't practical? To be honest, I think ASTs may see just as much use as BSTs... at least in a lot of my use cases.
>>
in C++ if i have a method definition
    void addAttraction(const Body &other, double &xForce, double &yForce);
is it possible to pass it some element of a double array instead? e.g. if i was to call it like this
            m_objects.at(i)->addAttraction(*m_objects.at(j), totalForceArray[i][0], totalForceArray[i][1]);
>>
>>53798937
I make real world pay and I basically only ever use arrays, lists, and trees, the occasional hash table. That list is pretty accurate imo.
>>
>>53799006
>Compilers and interpreters aren't practical programs?

He says 'almost all' because how frequently are you going to be writing a compiler or interpreter?
>>
>>53799006
>Vectors are just arrays that can resize
What? A vector is an element which has size and direction, or maybe the special case of a matrix that has only 1 dimension.
>>
>>53798418
hooray for someone actually giving the right answer.
>>
>>53799029
And some people make real world pay without programming at all, what's your fucking point?
>>
>>53798960
>Fuck off and actually do something.
I did quite a lot of projects, you have seen them but didn't knew it was me (^:
>>
>>53799023
Why not?
>>
>>53799060
>come back when you know about data structures and algorithms aka real world pay
>>
Any ideas for learning Qt (C++ bindings specifically, but I don't think it matters)? I know the general concepts, I need a semi-serious project now.
>>
>>53799111
do you know the 4chan browser app? "Beerowser" -- just google around. Make a clone, just.. better.
>>
>>53799096
huh ok, haven't read the comment chain far enough.
>>
>Stardew Valley was created entirely by American indie game designer Eric Barone, under the alias of ConcernedApe.[4][5] In 2011, Barone had graduated from the University of Washington Tacoma with a computer science degree, but had not been able to get a job in the industry, instead working as an usher at the Paramount Theatre in Seattle.[6][7] Looking to improve his computer skills for better job prospects, he came to the idea of crafting a game which would also pull in his artistic side.[6] Stardew Valley originally began as a modern fan-made alternative to the Harvest Moon series, as he felt that "the series had gotten progressively worse after Harvest Moon: Back to Nature".[8] Unable to find a satisfactory replacement, Barone began to create a game similar to the series, stating that his intent was "to address the problems I had with Harvest Moon" and that "no title in the series ever brought it all together in a perfect way".[4]
this guy's getting more pussy and cash than you ever will in your pathetic existence
>>
>>53799151
Who are you talking to?
>>
>>53799163
you
>>
>>53799151
ok

man a lot of the people on here have an inferiority complex don't they
>>
>>53799177
wow rude
>>
>>53799049

The majority of applications made are stupid CRUD applications.

The largest applications, used by the largest number of people, process structured text and turn it into something the computer can use.

And if that doesn't persuade you, consider that XML and JSON are just ASTs in code form.

>>53799051

Different kind of vector.
>>
>>53799151
I can't even comprehend how you think this is a success story.
>>
>>53799190
>The majority of applications made are stupid CRUD applications.
booriing.
>>
>>53799190
"vector" for dynamic array is fucking stupid. We already have a name for dynamic arrays: "dynamic array".
All vector does is cause confusion, as you're never really sure if some retarded sepplesfags is talking about mathematical vectors or dynamic arrays.
>>
>>53799201
dehumanize yourself and face to bloodshed
>>
>>53799197
money and popularity

you must not be very smart. its ok, you can make up for it with effort.
>>
>>53799208
Jesus christ what's fucking context. You, an adult person.
>>
>>53799221
Open up your third eye and join the thread.
>>
>>53799208

>Sepples
Hate to break it to you, but they call it a vector in Scheme too... And Java

http://sicp.ai.mit.edu/Fall-2003/manuals/scheme-7.5.5/doc/scheme_9.html

https://docs.oracle.com/javase/7/docs/api/java/util/Vector.html
>>
>>53799208
Do you also get a variable mixed up with a math variable?
>>
>LISP is the best family of programming languages
>C family BTFO
>YFW inferior metaprogramming capabilities
>>
>>53799253
No, you are just being an idiot -- there's no other meaning. Leave and don't come back.
>>
>>53799079
how do i do that?
>>
>>53799273
You didn't think we forgot about you?
The thread is waiting.
>>
>>53799266

Lisp has nice metaprogramming abilities, yes, but don't knock on C++'s ability to do the same. Templates are stupid powerful.
>>
>>53799282
You are scaring me.
>>
>>53799273
Join the thread.
You always knew you were chosen didn't you.
>>
>>53796594
Bravo, Romeo, Oscar, Mike, Alfa, Lima.
>>
Remember that cold winter?

Join the thread like your mothers
Thread replies: 255
Thread images: 23

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.