[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: 20
File: DPT.png (389 KB, 934x1000) Image search: [Google]
DPT.png
389 KB, 934x1000
Old thread: >>51880381

What are you working on /g/?
>>
First for Java
>>
First for Java
>>
second for my wife's son
>>
>>51882900
Please do not use an anime image next time, thanks.
>>
Rewriting the GNU operating system in Emacs lisp.
>>
>>51882985
during tough times, we must unite

i'm not even an anime fag, i just do the traditional OP as a somewhat neutral counter to the trap fag OP
>>
>Analyzing project.
>Generating header files.
>Generating archive files.
>Access denied.
>Access denied.
>Access denied.
oh fucking automation studio, looks like it's FUBAR
>>
Going to write a simulator game in C# because I'm a noob

That said, I have no idea how anything works so I don't really know what to simulate kek
>>
How do I write code into a post? Complete newfriend here, just started to learn Java. Seems pretty simple so far, I'm learning about inheritance now with code academy. Hopefully I can make my own vidya one day.
>>
>>51883207
S T I C K Y
T
I
C
K
Y
>>
>>51883207
see >>39894014

also see https://docs.oracle.com/javase/tutorial/

godspeed based java anon
>>
>>51883207
>>39894014
>>
>>51883263
>>51883268
>>51883304
;_; /g/ pls forgiv mi.
>>
ask ya <3 programming literate anything.
>>
I need a free (preferably simple) C editor. For windows. What do?
>>
>>51883549
GVim if you want to get good.
Notepad++, TextAdept, Atom otherwise.
>>
>>51883549
notepad.exe
>>
>>51883577
>>51883567
I'm a retard. I also need to compile and stuff. I guess that would make my requirement an IDE, not an editor.
What then?
>>
>>51883618
visual studio
>>
>>51883618

You don't need an IDE to compile stuff.

Look up mingw.
>>
>>51883618
I'd recommend learning how to use makefiles and compiling directly from Gvim.
I also believe that there are plugins for Notepad++ and Atom that let you compile things directly from the editor.
If you really don't want to give those a try, you could try CodeBlocks, but I remember it being a pain in the ass when I began coding.
>>
Why is she always upside down? It triggers my autism.
>>
>>51883618
Code::Blocks, MinGW+anything
>>
File: fag.png (28 KB, 643x597) Image search: [Google]
fag.png
28 KB, 643x597
Got bored, Made this.
>>
Working on a general English language parser for an AI project.
>>
Been trying to get lubuntu installed for 12 hours...
>National Public Embarrassment
>>
>>51883618
for c++ you might try here:
https://isocpp.org/get-started
>>
How many of you use clang-format?

>>51883662
high speed sports photography anon. she's performing the sicp high-jump.
>>
>>51883810
>>>/wrongthread/

/flt/
>>
This is probably my last place to turn to. Black Ops 3 crashes after pressing 'enter' on the title screen due to '0xC0000005' - it's what I found in the dump file. Any ideas?
>>
>>51883671
heh, nice one fggot
>>
>>51883671
lol fgt

>>51883951
driver issue? reinstall? use a different card?
>>
>>51883951
https://steamcommunity.com/discussions/forum/1/496880503074853074/

possibly some driver or hardware issue it seems
>>
>>51884072
Seen that post.
I tried one RAM stick at a time - same problem persisted. I re-installed my Nvidia drivers, but that hasn't done anything. There aren't any other drivers I can think of.

>>51884040
Re-installed GPU drivers, already tried re-installing and verifying the game cache. I don't have a different card at my disposal. This was completely fine before - it happened unexpectedly and seemingly without any reason
>>
>>51884072
good spot anon. same exception code.
>>
>>51884110
>This was completely fine before - it happened unexpectedly and seemingly without any reason
sounds like a hardware fault
>>
Don't know shit about simulating it but I'm going to write a baseball game simulator
>>
>>51884183
could you just start out by creating a huge list of pairs?
>if condition : do this
>>
>>51884183
>Don't know shit about simulating
If you're gonna write a video game about baseball you don't know shit about anything.
>>
>>51884205
I'm trying to figure out how to do it numerically. Determining if a player got a hit or not and what kind of hit it was is kinda hard
>>
>>51884217
I don't know anything about simulating baseball. I wrote for school a few numerical simulations for gas particles, but doing this more for fun.
>>
>>51884226
well, you could create a function that takes 3 items into account:
>the skill of the pitcher
>the skill of the batter
>a random value
>>
>>51884260
Yeah I'm working with just the batting average of the batter and the average of batters faced of the pitcher and using odds ratio for now, going to try to expand it over time. Probably better to start small and expand it over time.
>>
>>51884249
>baseball
>fun
>>
>>51884153
But my friends all have the same problem - it just varies with each one.

I'm not sure about hardware - I tested my RAM for errors, and I used 1 stick at a time individually; still the same problem. I don't have another PSU I can test with, but I don't see how that can be a problem.
>>
>>51884287
It's the best sport for people with autism
>>
>>51884295
it might just be that the game was poorly programmed
>>
>>51884249
today, you would do a gas/fluid simulation on the GPU most likely anon.
https://www.youtube.com/watch?v=CHObtN0DR1U
http://docs.nvidia.com/cuda/samples/5_Simulations/particles/doc/particles.pdf

>>51884281
>Probably better to start small and expand it over time
Exactly right anon. That's a good principle to follow in both engineering and science.
>>
File: file.png (58 KB, 1273x598) Image search: [Google]
file.png
58 KB, 1273x598
>>51883671
way ahead of you m8
>>
>>51884305
HAH never thought of that. Probably true ehh.
>>
>>51884317
Yeah I just did some basic stuff in MATLAB in terms of the gas stuff

I'm using this baseball thing as a way to learn C#
>>
File: file.png (42 KB, 709x282) Image search: [Google]
file.png
42 KB, 709x282
>>51884318
example usage
>>
What is a 'reduce by key'?

// sparse histogram using reduce_by_key
template <typename Vector1, typename Vector2, typename Vector3>
void sparse_histogram(const Vector1& input, Vector2& histogram_values,
Vector3& histogram_counts) {
typedef typename Vector1::value_type ValueType; // input value type
typedef typename Vector3::value_type IndexType; // histogram index type

// copy input data (could be skipped if input is allowed to be modified)
thrust::device_vector<ValueType> data(input);

// print the initial data
print_vector("initial data", data);

// sort data to bring equal elements together
thrust::sort(data.begin(), data.end());

// print the sorted data
print_vector("sorted data", data);

// number of histogram bins is equal to number of unique values (assumes
// data.size() > 0)
IndexType num_bins = thrust::inner_product(
data.begin(), data.end() - 1, data.begin() + 1, IndexType(1),
thrust::plus<IndexType>(), thrust::not_equal_to<ValueType>());

// resize histogram storage
histogram_values.resize(num_bins);
histogram_counts.resize(num_bins);

// compact find the end of each bin of values
thrust::reduce_by_key(data.begin(), data.end(),
thrust::constant_iterator<IndexType>(1),
histogram_values.begin(), histogram_counts.begin());

// print the sparse histogram
print_vector("histogram values", histogram_values);
print_vector("histogram counts", histogram_counts);
}
>>
File: file.png (6 KB, 230x114) Image search: [Google]
file.png
6 KB, 230x114
>>51884372
continued͏
>>
>>51884465
I think I figured out it's a map reduce operation using the histogram key.
>>
gonna sleep now so I can get into AoC day 16's top 100 leaderboard

wish me luck lads
>>
I was trained to use cout << / cin >> on C++.
How does that stack up with printf() instead?
Does it matter if it's in C?
>>
>>51885691
printf is significantly better in pretty much every way.
>>
>>51885740
Geeze, really? I need to git gud then. Does it require a library like cin/out or is it base?
And what's the printf equivalent of cin>>[variable]?
>>
>>51885848
>Geeze, really?
It's a lot faster (no virtual function shit) and is easier to internationalise.
>Does it require a library like cin/out or is it base?
printf is a part of the C standard library. Every (hosted) C program has access to all of those functions.
>And what's the printf equivalent of cin>>[variable]?
The scanf family of functions.
>>
>>51885896
Thank you much.
>>
>>51884281
>batting average
Averaging numbers is a hard problem that is better left to experts. /g/ can't do it either, at least not in C.
>>
>>51886537
we can average two numbers, just not two ints
>>
>>51885933
>>51885896
Followup; I'm useless and having trouble interpreting the http://www.cplusplus.com/reference/cstdio/scanf/ page.
How would I write
cin >> variablename;
with scanf? The template they give is kinda daunting.
>>
>>51886581
int a = 5

cout << a;
printf("%d", a);

cin >> a;
scanf("%d", &a);
>>
>>51886607
int a, b;

cin >> a >> b;
scanf("%d %d", &a, &b);

cout << a << b;
printf("%d %d", a, b);
>>
>>51886618
>>51886607
Jesus, it's that simple? Well, I already knew I was dumb. Thank you.
>>
>>51886638
%d is just for ints by the way
http://www.cplusplus.com/reference/cstdio/printf/
>>
Working on a chabot/assistant in c++. Just using CLI for now as I haven't learned GUI in c++ yet. Is it much different than in java?
>>
>>51886651
C++ has no standard gui, check out Qt
>>
>>51886656
What is QT exactly?
>>
>>51886618
>>51886607
with scanf I can discard input by putting *, like
scanf("%d %*f %d", &a, &b); // 20 21.23 36 would be scanned to to ints

how do I discard like that with cin?
>>
>>51886671
Qt is primarily a C++ GUI library that looks native on GNU, Mac and Windows desktops
It's well documented and supported.
Qtcreator is its own little IDE. I recommend using that.
>>
Can anyone help me with my regex? I hate it and don't understand it.

I just want to match the image URLs in my string, but my expression is matching the whole string. I think it's something with the whitespace, idk.

see: http://rubular.com/r/vWB7Ldt6PW

pls
>>
>>51886702
Is it free? I am using vs 2015 now. Can I add the libraries to VS instead?
>>
>>51886721
Yes it's free
>>
>>51886715
http://rubular.com/r/bqN8miTIWG
>>
>>51886755
Then I am sold. Still pretty new to programing so for now I will continue with vs until I better understand the language. I am in my second year of college for programming but I am switching to a video game design course in September so any programming I have to learn on my own from now on.
>>
>>51886768
how can it work with tabs too?

http://rubular.com/r/sfRnfyd0yQ
>>
File: images3TVU17QJ.jpg (12 KB, 259x194) Image search: [Google]
images3TVU17QJ.jpg
12 KB, 259x194
>>
>>51886671
>check out Qt
>What is QT exactly?
jesus
>>
>>51886828
http://rubular.com/r/sfRnfyd0yQ
https?:\/\/.*?\.jpg


.* is greedy matching
.*? is not greedy

Example with test string "aabbaabb"
a.*b matches the whole string
a.*?b matches only "aab"
>>
>>51886828
nvm got it

http([\s\S]*?).jpg
>>
>>51886852
I am looking at it right now. But having a quick summary is always nice. Plus it keeps the conversation going. Kindly fuck off.
>>
More C
struct Table(float orient){
float Mercury=orient*.38
float Venus=orient*.904
float Mars=orient*.376
float Jupiter=orient*2.538
float Saturn=orient*1.065
float Uranus=orient*.886
float Neptune=orient*1.14
float Pluto=orient*.063
float Haumea=orient*.064

};

//below...
struct Table(orient) Planet;

The goal is to be able to call for the numbers by having a line such as
printf("You would weigh %d %d\n", Planet.Mercury, str1); //str1 is the units.

But I'm pretty sure I am declaring the structure wrong. Or some other equally elementary problem.
>>
>>51886919
>%d %d\n"
%d %s\n"
>>
>>51886919
>%d
>float
use %f, like
printf("You would weigh %f %s\n", Planet.Mercury, str1); //str1 is the units.
>>
>>51887032
jajaja, I caught the belatedly. Still, there seems to be some problem with declaring and instantiating the structure.
I assume it has to do with me trying to pass in a value (orient) to the structure, but what's the deal? How would I do that differently?
>>
Any cute haskell using traps today?
>>
>>51886919
there are no constructors in C
read
a
fucking
book
instead of just fucking around and doing everything wrong
>>
I'm developing this application in C# using Windows Forms but one of my friends recommended Qt w/ C++ so I'm thinking I might transition over

My one qualm is that my program needs to query the internet for some data and I know that that isn't very simple in C++; is there a way to somehow add a script into my C++ code that will do that for me and if so is there a scripting language you recommend? Thank you
>>
>>51887184
m-me

approxTimes = 16

apply :: Int -> a -> (a -> a) -> a
apply 0 z f = z
apply n z f = apply (n - 1) (f z) f

sqrtInt :: Int -> Double
sqrtInt n =
apply
(n - 1)
1.0
(\a ->
let x = apply approxTimes
(a * 2)
(\x -> a * 2 + 1 / x)
in
x - a)


>>
Any way to use Qt on Windows without installing QtCreator? I'm perfectly happy with my set up and don't want to use an IDE.
>>
I'm trying to become self-taught in CS, at least until I can get into a decent school. Learning languages is easy, but I'd like to get more theory. Would something like an AP Comp Sci AB/BC book be alright? I know it's not quite at a college level, but I figured it would be more of an overview, and in the meantime I could find books that cover topics more in depth (TAOCP, CLRS, etc)

Or should I just go straight for CLRS?

Also, anyone have any recommended books on data structures?
>>
>>51888109
there might be a minimal installer/package on the qt website with just the "barebones" tools. i'm pretty sure all you need is qmake and a compiler
>>
>>51888201
CLRS is much beyond AP CS.
>>
making a text adventure in python because am nub
>>
>>51888326
About what level would you say it is?
>>
I know C++ and Java. I want to start developing for Android.

What are the esential prerequisites for coding for Android?
Apart from java for the application itself.

What frameworks should I learn?
>>
>>51888705
APCS is pointless bullshit Java shit like inheritance and encapsulation and basic logic and recursion, and you have to memorize some sorting algorithms and binary search.

CLRS is actual algorithms, understanding them and understand the math running time (O notation etc). I only read the first few chapters and it was already much above the entire APCS curriculum I took a while back. Besides, the AP teaches a language (Java, which is shit btw) and CLRS teaches algorithms through pseudocode
>>
>>51890208
android SDK
>>
>>51890281
>A[1] is the first element in the array A
trash
It's a great book but this trips me up
>>
>>51890208
If all you want to do is Android, just learn Java

At the end of the day you can go from Java to C++ no problem
>>
>>51890364
It's psuedocode, it doesn't matter. And it's not modelling real computer memory (which is the primary reason for 0 index!)
>>
>>51890390
I just can't get my merge sort working :(
I should just try doing it from scratch without looking at the psuedocode
>>
>>51890411
What language?
Try writing it in Lua, hehe
>>
File: 0fa.jpg (8 KB, 184x220) Image search: [Google]
0fa.jpg
8 KB, 184x220
https://src.chromium.org/viewvc/blink/trunk/Source/wtf/WTF.cpp

>WTF.cpp
>ArrayBufferContents::setAdjustAmoutOfExternalAllocatedMemoryFunction(adjustAmountOfExternalAllocatedMemoryFunction);

>ISHYGDDT
>>
>>51890533
C, nah
>>
>>51890384
>>51890349

And for interfaces? Xml ? Javascript?
>>
>>51890622
Android Studio
>>
>>51890390
>0-based index
>not mathematically beautiful

uneducated fool
>>
>>51890767
how is a 0 based index any more or less mathematically beautiful than any other index?
>>
>>51890668

Explain.

Built in GUI tools?
>>
>>51890923
google you fucking toddler
>>
Let's say I contributed to an emulator project. Would it be stupid to put this on my resume, since it's kind of in a grey area legally speaking?
>>
>>51892073
nah it'll be fine. when was the last time you heard of someone getting in trouble for an emulator, and the employer cares more about your skills and his own affairs than busting you for some small-time offences.
>>
>>51886919
Mate you have no idea what you're doing. Read the classic C book by Kernighan and Ritchie. It will literally take less than a day if you're diligent
>>
File: advent tree.jpg (116 KB, 703x649) Image search: [Google]
advent tree.jpg
116 KB, 703x649
Woke up late, but still finished it in 24 minutes, 6 minutes too late for leaderboards
>>
>>51886919
WHY ARE YOU TRYING TO SHOVE OOP INTO C
>>
>>51892178
>structs are OOP
Kill yourself.
>>
>>51892178
that's not even OOP, that's just an attempt at a constructor
>>
>>51883671
What language is this?
>>
>>51892105
>when was the last time you heard of someone getting in trouble for an emulator

Bleem, PS3 scene

But yeah, he got nothing to worry about. Especially if you don't live in the US police state. Fags have released full NDA'd n64 shit and nobody got fucked yet as far as I know

Nobody can fuck you for simply writing an emulator for some hardware m8
>>
>>51892313
python
>>
>>51892243
>Constructors aren't OOP
No, kill yourself
>>
>>51892334
>Constructors are OOP
No, kill yourself.
>>
>>51884318
>>51892331

Is this also Python?
>>
File: ji.jpg (87 KB, 736x748) Image search: [Google]
ji.jpg
87 KB, 736x748
Using JQuery feels like cheating tbqh.
>>
>Constructors
Kill yourselves
>>
>>51892348
Yep
>>
>>51892338
>Constructors exist outside of OOP
No, kill yourself
>>51892350
Same to you
>>
>>51892366
>Having a function that sets up a struct for you is OOP
Are you delusional?
>>
>>51892364
Looks pretty damn elegant.
>>
check it out guys
import httplib2 as http
import json

url = 'http://services.runescape.com/m=itemdb_rs/bestiary/beastData.json?beastid='

def main():
h = http.Http('.cache')
beastid = input('Enter beast id: ')

response, content = h.request(url + beastid)

beast = json.loads(content.decode('utf-8'))

output = 'name: {0}\nlevel: {1}\nweakness: {2}'.format(beast['name'], \
beast['level'], beast['weakness'])

print(output)

if __name__ == '__main__':
main()


and:
$ python runescapebeast.py
Enter beast id: 49
name: Hellhound
level: 92
weakness: Slashing

If only I still played that shitty game I might make an actual usable program out of this.

>>51892348
yes
>>
>>51892375
The only thing I see like that is the other guy's shitty attempt to force constructors where they aren't even possible
>>
I'm trying to learn programing now, just started on Python.

How much do programmers make?

It's mainly an intrest for making cool little things and as a back up in case I ever get kicked off the NEET bux ride.
>>
>>51892439
>How much do programmers make?
If you're doing it for the money, switch.
>>
>>51892391
-module(threadcheck).
-export([threadcheck/1]).

-define(URL, "https://a.4cdn.org/g/thread/").
-spec threadcheck(list()) -> ok.
threadcheck(Thread) ->
{ok, "200", _Headers, Body} =
ibrowse:send_req(?URL ++ Thread ++ ".json", [], get),
BinBody = list_to_binary(Body),
{Start, Len} = binary:match(BinBody, <<"bumplimit">>),
Bump = binary:part(BinBody, Start + Len + 2, 1),
case Bump of
<<"0">> ->
timer:sleep(1000),
threadcheck();
<<"1">> ->
io:fwrite("/dpt/ is awaiting a new trap thread~n"),
ok
end.

>>
>>51892454
I don't WANT to do it for the money, I just thought it good as a real life skill of anything goes tits up in my life.

... what is Switch?
>>
>>51892475
1) what does this do
2) what language is this
3) that language is disgusting
>>
>>51892487
switch into a different industry
>>
>>51892487
It's a good skill if you're into computers. Otherwise you're better off learning to weld.
>>
http://strawpoll.me/6281268

Vote for great good
>>
>>51892509
>>51892528
Oh jeez, what's wrong with the industry?

And I do like computers, when I get a job I want it to be with computers.
>>
>>51892549
Programming is good then, keep learning python, although it would be best to learn C first but who cares
Make sure you're learning from a reputable source, i.e. NOT learnpythonthehardway by zed "the moron" shaw, codecademy, etc
>>
>>51892391
procrastinating for physics exam tomorrow, have a Ruby translation:
require 'open-uri'
require 'json'

url = 'http://services.runescape.com/m=itemdb_rs/bestiary/beastData.json?beastid=' + ARGV[0]

thingy = JSON.parse(open(url).read)

puts "name: #{thingy['name']}"
puts "level: #{thingy['level']}"
puts "weakness: #{thingy['weakness']}"
>>
>>51892439
you're better off with java or C++ m8
>>
>>51892535
The fuck is wrong with you people?

Big data is the meme
>>
>>51892594
"Full stack" is a meme. These webfags would faint if they saw the source of Apache, so they aren't even close to being fucking "full stack".
>>
>>51892592
Don't listen to this guy. You can pick up python quickly and any company with a website would appreciate python+(django, flask, web2py), etc and that shit pays quickly compared to the time it takes to learn it
>>
>>51892608
>you need to see the source of absolutely everything in full stack to make full use of it
full retard
>>
>>51892594
this
>>
>>51892626
If you don't even fucking know C, you aren't a "full stack" developer. Christ, you aren't even a real programmer.

Webcucks are the worst.
>>
>>51892642
>thinks full stack is a meme
>mentions C
jesus christ lads
>>
>>51892654
Again, if you don't know C, you can't call yourself "full stack" unless you're a grade A memester. If you can't understand the code that runs the entire networking stack, then fuck off with your shitty meme label.
>>
>>51892549
Programming is highly undervalued.
>>
>>51892494
It polls the 4chan API until a thread hits the bump limit and warns you appropriately. It's Erlang.
>>
>>51892642
>Ctard at it again
you don't know what the term "full stack developer" means. and top keke at you being smug about knowing C when you can't even grasp the basic concepts of OOP.
>>
>>51892654
On a scale of 0-9 how butthurt are you that C is the greatest programming language of all time?
>>
File: datnig.webm (688 KB, 426x426) Image search: [Google]
datnig.webm
688 KB, 426x426
Ask your beloved programming literate anything,
>>
>>51892672
get back to work linus
>>
>>51892654
Talk shit on C all you want but most of the programs in the stack of a "Full Stack" are written in C. If you claim to be a Full Stack developer and don't know C you're full of shit.
>>
>>51892672
>C
>greatest
Didn't think it was meme hour already. You can't even perform basic operations involving summing up a set of numbers and then dividing that sum by the number of numbers
>>
>>51892582
nice

I could trim down the python extensibly, but it's far less elegant than that lol
>>
>>51892691
wat
>>
>>51892688
talk shit on webdev all you want but you're fucking clueless fucking Ctard
>>
>>51892700
you know what I'm talking about
>>
>>51892680
Can onset detection be used for beat tracking?
>>
>>51892691
It's almost like C is a very small language leaves stupid shit like that out of the standard library because you can literally make a function for it in 10 minutes.
>>
>/dpt/
>anons defending 'full stack web dev'
what's going on
>>
>>51892704
no i don't, educate me please
>>
>>51892700
calculate the truncated int average of n ints in C
>>
>>51892575
... Shit, I've been trying to learn from Code Academy. Is that bad? It seemed really, I don't know, vague maybe? Just like I was going from task to task without really learning anything.

I did get Think Python though, is that better?
>>
>>51892688
and to what level does your fedora go? May as well understand machine language
>>
>>51892713
i even despise the typical webcuck but the Ctard is fucking clueless. you don't have to know C to be a full stack developer.
>>
>>51892720
That is much better, yes, use that.
>>
>>51892724
>he isn't at least passingly familiar with assembly
Really? Keep digging this hole of yours, webtard.
>>
>>51892716
I'm talking about averaging 2 ints in C. Trying to do more is even more of a task
>>
>>51892720
>Just like I was going from task to task without really learning anything.
python in a nutshell
>>
>>51892736
Average 2 ints in Java then. Or Rust. :^)
>>
>>51892742
codecademy in a nutshell*
>>
>>51892735
>now being told I need to have passing familiarity with machine language in order to be a proficient full stack dev
lmaoing at your life
>>
>>51892705
yes
>>
>>51892747
int average(int a, int b) {
return (int) (((long) a + b) / 2);
}
>>
>>51892736
boost has statistic librarys, besides, what's wrong with (a+b) / 2 (or 2.0 if you want a float)
>>
>>51892747
>using java or rust
jesus christ lads
>>
>>51892749
python really isn't ideal as your first language. simply the fact that it hides types from the user is much as possible is absolutely horrifying.
>>
>>51892724
>understanding assembly
>hard
lol
>>
>>51892751
If you can't at least look at assembly and vaguely understand what's going on, you're a shitty programmer. Full stack or whatever is irrelevant.

Understanding how the CPU works is essential to being a good programmer.
>>
>>51892755
>overflow
>>
>>51892772
do you REALLY need ints bigger than 32(or 64) bit?
>>
>>51892766
what this function does ?
        cmp     edi, 10
jg .L5
lea ecx, [0+rdi*8]
mov edx, 1717986919
sub ecx, edi
mov eax, ecx
sar ecx, 31
imul edx
mov eax, edx
sar eax
sub eax, ecx
ret
.L5:
sal esi, 2
mov edx, -1840700269
mov eax, esi
imul edx
lea eax, [rdx+rsi]
sar esi, 31
sar eax, 3
sub eax, esi
ret
>>
>>51892535
https://www.youtube.com/watch?v=E8SEVsxV070
>muh machine learning
>muh data mining
>these rocket surgeons in charge of "cutting edge" research
>>
>>51892781
yes and you can easily need them you fucking python babby.
>>
>>51892765
why I said it would be best to learn C first but oh well
>>
>>51892795
C is in the other extreme of simple. choose the sensible middle ground with java, C# or C++.
>>
>>51892765
anon, types are not fundamental to programming. python is now the most favored programming language for teaching due to its simplicity, multi paradigm, and pseudo code syntax.
>>
>>51892810
>choose the sensible middle ground with java, C# or C++
Kill yourself.
>>
>>51892838
>https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Algorithm_and_variants
>an integer
>an array of Boolean values, indexed by integers
>>
>>51892838
Personally, I tried to learn Python first, but I hated every moment of it. Then I was taught Java in my first couple of programming classes and nearly quit.

Years later, I "discovered" C and fell in love immediately with the control it offered me. It felt like I really understood every step of the process. I picked up assembly not much later.

Now I've been programming in C for 7 years. Still can't stomach Python.
>>
>>51892853
says the tard that can't even understand OOP
>>
>>51892867
??? what post(s) are you associating me with to get to that conclusion anon
>>
>>51892879
the C guy from yesterday, might not be you
>>
>>51892770
>is irrelevant
You what? That is the main topic of discussion you retard
>>
How do I detect when a thread has been updated in JavaScript, /dpt/?
>>
>>51892927
Store the previous thread. Get new thread. Compare to previous thread. If different, it updated.
>>
>>51892770
>Understanding how the CPU works is essential to being a good programmer.
lel
>>
>>51892927
you mean like a 4chan thread? there should be something in the API for that
>>
>>51892949
It is though. If you have no understanding of the hardware you're working on, you're worse than a code monkey.

To you, the computer is something you type magical spells into, and magic comes out. To someone who understands the CPU, it's a marvel of human engineering.
>>
What's the easiest way to send email via python?
>>
>>51892965
all you really need is a rough idea of how expensive a given computation is and how variables get fetched (very slowly) in batches from memory
>>
>>51892965
programming is not about machines in first place.
>>
>>51892784
i could translate it to C, but i can't tell you what it's meant to do, but that has nothing to do with the language

but understanding the syntax etc. and being able to write simple stuff in assembly really isn't that hard if you're proficient in 1 programming language already
>>
>>51892794
wat
wat does that have to do with python?
>>
>>51893025
the implication is that most python users only work with very simple programs/scripts so that they never use big numbers
>>
>>51893013
Code monkey detected.
>>
>>51893085
yeah dude, i am a code monkey, tony hoar is a code monkey, dijkstra is a code monkey, leslie lamport is a code monkey, anyone who have risen himself above the irrelevant machine details is a code monkey.
>>
>>51893155
It's too bad the world doesn't run on theories, it runs on engineering. Computer science without a focus on hardware is useless.
>>
>>51893155
luckily we still have knuth
>>
>>51893201
the guy who made is own virtual disgusting architecture ? (MMIX)
>>
>>51893220
Kek, I bet you're one of those guys who graduates a CS program without ever writing a line of code. But you know algorithms and data structures and what a turing machine is, so the code is irrelevant, right?
>>
>>51893236
>turing machine
>machine
disgusting. i prefer lambda calculus, it's more pure.
>>
>>51893220
yeah
because guess what, it's not about writing assembly programs
its about understanding how things work deep down
>>
>>51893255
>virtual architecture
>how things work deep down
so he sould start with assembly or even jaba byte code, amiright ?
>>
File: 2015-12-16_11-21-12.png (19 KB, 1681x263) Image search: [Google]
2015-12-16_11-21-12.png
19 KB, 1681x263
>>51893246
agreed, gotta love myself some lambdas
http://www.blue.sky.or.jp/grass/
>>
>>51893268
it's close enough to real world architecture(or was at the time, anyway)
>>
>>51893268
The entire point was that there was quite a variety of popular computer architectures at the time, so he combined the various featuresets and designed a languag which could easily be translated into any of them.
>>
>>51893305
you are confusing programming with computer engineering.
>>
>>51893397
You are confusing programming with ivory tower wankery.
>>
>>51892667
Really? How much do programmers make?
>>
>>51893429
20-30$/hour
>>
>Two exams tomorrow that I didnt study for.
How fucked am I.
>>
/* 
* Average two ints (pro grade code)
* Compile with:
* gcc -o avg avg.c -lgmp -lm
*/
#include <stdio.h>
#include <gmp.h>
#include <assert.h>
#include <math.h>

int average(int a, int b)
{
mpz_t a_, b_, two, x, y;
mpz_init(a_);
mpz_init(b_);
mpz_init(x);
mpz_init(y);
mpz_init_set_si(two, 2);
mpz_set_si(a_, a);
mpz_set_si(b_, b);
mpz_add(x, a_, b_);
mpz_tdiv_q(y, x, two);
return (int) mpz_get_si(y);
}

int main(int argc, char *argv[])
{
/* web shitter unit tests */
assert(average(1, 3) == 2);
printf("trivial test case passed.\n");

assert(average(-3, 1) == -1);
printf("rouding test case passed.\n");

int overflow = (int) powl(2, sizeof(int)*8 - 2);
assert(average(overflow, overflow) == overflow);
printf("overflow test case passed.\n");

return 0;
}
[/code
>>
>>51893458
Lol? No programmer in my city makes less than $55/hr. Do you live in India?
>>
>>51893429
avg 3000 euros before tax
>>
>>51893476
beautiful
>>
>>51886838
It's the latter.
>>
>>51893505
thanks. i'm working hard to further the science of averaging two ints in C
>>
>>51892932
>>51892963

Is this ok or am I retarded?

 
$("a[data-cmd=update]").click(function() {
window.setTimeout(function() {
var i = setInterval(function(){
if($(".board .navLinks > span:last-child").text() !== "Updating..."){
clearInterval(i);
console.log("Thread updated!");
}
}, 250);
}, 1);
});
>>
>>51893458
>>51893483
Is that good money? Never had a job so I'm pretty fucking clueless.
>>
>>51893682
>function(){function(){function(){...

Is this a common technique, here?
>>
>>51893818
It's normal javascript unfortunately.
>>
>>51893476
have you checked (-1, -1), (-1, -2), (-1, -3), (1, 2) and (1, 1)?
>>
>>51893800
Not really, it depends where you live I guess. I'd struggle. Fortunately my dad pays me more than that.
>>
>learning django
>everything coming together smoothly
anyone else know this feel?
>>
>>51893850
/* 
* Average two ints (pro grade code)
* Compile with: gcc -o avg avg.c -lgmp -lm
*/
#include <stdio.h>
#include <gmp.h>
#include <assert.h>
#include <math.h>

int average(int a, int b)
{
mpz_t a_, b_, two, x, y;
mpz_init(a_);
mpz_init(b_);
mpz_init(x);
mpz_init(y);
mpz_init_set_si(two, 2);
mpz_set_si(a_, a);
mpz_set_si(b_, b);
mpz_add(x, a_, b_);
mpz_tdiv_q(y, x, two);
return (int) mpz_get_si(y);
}

int main(int argc, char *argv[])
{
/* web shitter unit tests */
assert(average(1, 3) == 2);
printf("trivial test case passed.\n");

assert(average(-2, 1) == 0);
printf("rounding test case passed.\n");

int overflow = (int) powl(2, sizeof(int)*8 - 2);
assert(average(overflow, overflow) == overflow);
printf("overflow test case passed.\n");

// Anonymous 12/16/15(Wed)12:27:00 No.51893850
// >>51893476 (You)
// have you checked (-1, -1), (-1, -2), (-1, -3), (1, 2) and (1, 1)?
assert(average(-1, -1) == -1);
assert(average(-1, -2) == -1);
assert(average(-1, -3) == -2);
assert(average(1, 2) == 1);
assert(average(1, 1) == 1);
printf("No.51893850 test cases passed.\n");

return 0;
}
>>
>>51893819

My condolences.
>>
>>51893938
Fuck off GTP, there is literally nothing wrong with Lisp.
>>
>>51893924
nice
>>
>>51893956
I just wanted to try GMP.
It's pretty nice to have precise control over rounding for example
>>
File: Screenshot - 161215 - 21:40:19.png (20 KB, 414x280) Image search: [Google]
Screenshot - 161215 - 21:40:19.png
20 KB, 414x280
>testing different ways of doubling a 4 digit integer a hundred million times over several trials
>a=a*2 comes out at ~448ms
>a*=2 comes out at ~454ms
>a=a+a comes out at ~447ms
>a+=a comes out at ~453ms
>and for the best part
>a=a<<1 comes out at ~479ms
Is everything I've ever been taught about low-level optimisation a lie?
or is it just because I'm using a meme language?
>>
>>51894003
yeah you're using a meme language mate
>>
>>51894003
> Is everything I've ever been taught about low-level optimisation a lie?
Either it wads a lit or you were not listening. I doubt you'll be getting same results when you run your program one more time.
>>
>>51894003
>running a*=2 a billion times takes 4409ms
>running a=a<<1 a billion times takes 4749ms
fuck

>>51894015
aight I'll shit it out in c++ hang on
>>
>>51894027
Make sure to compile with optimizations on, kek.
Thread replies: 255
Thread images: 20

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.