[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: 50
old thread >>54310142

what are you working on /dpt/?
>>
>>54314128
her femanon penis looks weird
i just don't understand japanime
>>
heelo i liek to tyep code do u liek 2 tyep code
>>
>>54314128
oh hey just started that show

not working on shit right now but i pushed like 7 commits to various projects already today and i dont feel like writing any more code for a few hours
>>
>>54314151
I'm sorry the trapfag has bended your mind
>>
/dpt/ I spend my work days doing mindless web garbage - AngularJS / Javascript, bullshit like that - I want to make something / have a personal project. My issue is i can't think of anything at all to work on. Does anyone else have or had this issue? what do?
>>
>>54314158
Definitely my favorite anime, even Roberta's blood trail. I wish I could rewatch it for a first time again. Have fun!
>>
>>54314151
femanons don't exist
there's only anons
>>
From previous thread:

f2c :: Float -> Float
f2c f = (f-32) * (5/9)
>>
>>54314200
I must not be real then if femanons don't exist
>>
>>54314246
Post some code and I can tell if it's written by a girl
>>
>>54314246
you're not real, anon.
>>
>>54314246
L O N D O N
O
N
D
O
N
>>
>>54314274
I'm tired of this, traps aren't girls, they are men in skirts, fucking deal with it.
>>
>>54314246
Tits or GTFO
>>
>>54314246
None of this is real.
>>
java Q:
can hashmaps have more than one value?
i know you gotta have a 'key' and a 'value'
but can you set it up like k, v, v2, v3... ?
phonebook, for example:
key = last name
value 1 = first name
value 2 = last name
value 3 = phone number
value 4 = address
value 5 = email addy
>>
File: 1435447811590.jpg (687 KB, 1920x1080) Image search: [Google]
1435447811590.jpg
687 KB, 1920x1080
>>54314246
>>
>>54314300
A hashmap can have an object as a value, so you can have an array as a value or even another hashmap as a value.
>>
>>54314289
That's why I inquired anon
>>
>>54314300
that's not how a hashmap works

but the value could be an index into an array of phonebook entries
>>
>>54314314
there's a deeper meing with this but i'm to tired to wri
>>
>>54314327
>>54314322
thanks guise
>>
>>54314329
the only thing deep is jaden's mouth and anus
>>
Why is the rust main community so fucking disgusting? Rust is such a nice language, too.
Alternative compiler W H E N?
>>
pypy or cpython for python3?

Which do you use, and why?
>>
>>54314182
Make a g a m e
http://www.playfuljs.com/a-first-person-engine-in-265-lines/
>>
i have a question about asserts in C
Code A:
//example
void check_node(node *new_node)
{
if (new_node == NULL)
return;
else
printf("All OK");
}


Code B:
void check_node(node *new_node)
{
assert(new_node);

printf("All OK");
}



are code A and B equal?
>>
>>54314508
fuck it why not, atleast waste a saturday night
>>
>>54314508
>raycasting
Another innovation to thank our god, Carmack, for daily
>>
File: cpp.jpg (42 KB, 408x500) Image search: [Google]
cpp.jpg
42 KB, 408x500
SICP or pic related?
>>
>>54314565
You can't compare the two books

Read both
>>
>>54314565
dude ducks almao
>>
>>54314246
L    NODNOL
O O
N D
D N
O O
NODNOLONDON
O O
N D
D N
O O
LONDON L
>>
>>54314565
C++ makes you somewhat employable. It's better that you know how to write in pure C as well, but C++ is a good language. A lot of people hate it, and they have valid reasons, but C++ is a powerful language, the main issue with C++ is that it almost has too many features.

Learn C / C++, functional programming is a meme, by the time you're qualified for any jobs that require functional programming, you won't be taking your advice from /g/
>>
>>54314576
>>54314587
well, I have no idea what both books are for...
I'm a college dropout. I know how to program (10+ years, know some java, C, Go, python, ASM, ...), but I want to deepen my knowledge (in particular, when it comes to systems programming and CS stuff). thing is, I don't know how. should I read both books, then?
>>
>>54314344
It's called a multimap or a bag. Guava has an implementation.
>>
>>54314531
No assert() calls exit() on assertion failure. First just exits the function.
>>
>>54314622
>read both books
<read
kel just fin problems online nd do emm
>>
>>54314613
>It's better that you know how to write in pure C as well
MY SIDES!
Next thing you'll say is that the skill in highest demand is programming in binary.
>>
>>54314622
You want to learn system programming and ask between SICP and Programming in C++... What?
>>
>>54314663
I said I want to learn two things...
also, afaiu, Lisp is not only functional. and it could give me a new perspective on programming. I've seen awesome stuff done in Lisp, which is the reason it interests me.
>>
File: MandelBox01.png (145 KB, 1008x1034) Image search: [Google]
MandelBox01.png
145 KB, 1008x1034
I made a MandelBox demo.
>>
>>54314693
oh, my eyes
>>
>>54314693
cool, what is it?
>>
>>54314691
SICP is a beginners book. You aren't a beginner.

If you want to learn LISP, learn LISP. If you want to learn CS stuff pick up an Algorithms book. If you want to learn system programming pick up a Unix programming book. Learning new languages doesn't teach you the material.
>>
>>54314736
Mandlebrot. It says it right there
>>
>>54314757
No it doesn't
>>
>>54314622
>systems programming and CS stuff
In that case, neither of the two books will help you.

To get some more knowledge of algorithms, look into "Algorithms" by Dasgupta.
>>
>>54314751
ok m8, thanks. the C++ book, then, right? I barely know anything about C++.
btw, by CS I meant advanced stuff, like language processing, AI and so on. I *think* I know the basic stuff, but I might have forgotten already...
>>
File: MandelBox05.png (255 KB, 1008x1034) Image search: [Google]
MandelBox05.png
255 KB, 1008x1034
>>54314736
>>54314718
It is a MandelBox. A fractal that is computed by iterating a certain nonlinear transform function over a vector, until it either goes off to infinity (well, in practice to a large number) or to 0.
>>
>>54314772
retard
>>
>>54314782
No... If you want to do systems programming you already know C.
>>
File: 1462061977449.png (51 KB, 1008x1034) Image search: [Google]
1462061977449.png
51 KB, 1008x1034
>>54314693
your png is now optimized
>>
>>54314808
>>54314776
ah, thanks. guess I should be more confident in my knowledge, then. perhaps I just need to give it a refresh or something.
>>
>>54314782
AI is a very large topic, but now it is mostly machine learning. Machine learning borrows very little from computer science, it is mostly applied probability and algorithms built around it (these algorithms can do wonderful stuff though).
>>
>>54314794
infinty is not zero
>>
>>54314186
Lemonlaplace?
>>
File: mandlenotch.jpg (661 KB, 1279x720) Image search: [Google]
mandlenotch.jpg
661 KB, 1279x720
You guys should look at Notch's 3D Mandlebox, it's amazingly trippy.
http://doodle.notch.net/unmandelboxing/
>>
File: MandelBox06.png (766 KB, 1008x1034) Image search: [Google]
MandelBox06.png
766 KB, 1008x1034
>>54314894
I didn't say that..
>>
>>54314930
that looks like utter garbage
>>
>>54314970
this
>>
>>54314930
yup, I want to code a 3d one as well.
>>
>>54314970
>>54314981
It's low-res (I think it may be a voxelization of the fractal using ray-marching, with fairly large voxel size??), but quite cool if you actually watch it.
>>
>>54314751
SICP isn't strictly a beginner's book. It has an introduction for beginners, but I guarantee that any programmer could get something out of it.
>>
>>54315007
it's not really that cool you're just easily impressed

this looks a gorillion times better

https://www.youtube.com/watch?v=XB1m1TZ6WiQ

https://www.youtube.com/watch?v=bO9ugnn8DbE

https://www.youtube.com/watch?v=P4RVm0fnKX8

https://www.youtube.com/watch?v=8zsGfmMsdeU

https://www.youtube.com/watch?v=TP_2Zxr3CQM

i know they're not real time but still
>>
>>54315081
Those offline rendered ones are pretty mind-blowing. There's something really engaging about the feeling of exploring some abstract alien space.
>>
>>54315142
if it exites you so much why not do math yoiurself
gn
>>
>>54314128
Why hasn't /g/ made an open source 4chan app? I only know basic HTML, JavaScript, and CSS. We should make one open source ad free app that can run on every platform.
>>
>>54315081
>https://www.youtube.com/watch?v=8zsGfmMsdeU
>13:30
when that kush hits you
>>
>>54315280
1: /g/ and /dpt/ is incapable of collaborating on anything
2: Nobody cares enough to bother
3: Mobile is shit
>>
How do I get started with gui's.

I need a basic text editor. But one that can see colors. I basically want to make http://accelareader.com/
but one that supported colored text.
Whats the best way to get started with this. I know python java c++ racket but Ive never made a gui before so I dont really know how to progress from here.
>>
>>54315279
Not him, but how do I into fractal math?
>>
Didn't realize there was a new thread.

I posted a question here >>54313941
and here >>54315195

I'm trying to understand javafx for my class and I just don't get it. I just need to put text that a user can type onto a blank window. The text and background needs to be different colors and the text needs to wrap. My problem is I don't know why the text doesn't appear. It seems like it should be an easy solution and I feel stupid, but I really don't know what I'm supposed to do.
>>
File: mbox.gif (1 MB, 512x512) Image search: [Google]
mbox.gif
1 MB, 512x512
I made GIF. That required me to make a adapt some BMP encoder from github, which required me to make a shim for node.js Buffer in my JS environment. And then I did
convert `ls -v *.bmp` mbox.gif
>>
>>54314128

The update utility our company uses is a piece of crap written in C++ over a decade ago, and is barely functional. They won't update it because it can't update itself and they are worried about 'compatibility'.

So, I'm writing a way more robust one in python. It's fully functional currently, just need to figure out how to use tkinter right - i.e., I'm writing my own abstraction layer.
>>
What are the class of programs with ostensibly simple design yet unknown whether or not they ever end called? I thought they were "busy bodies" but I can't get anything googling that.

Found it by googling a synonym, busy beaver. Where their computational complexity is undecidable yet their design is dead simple.
>>
>>54315280
>what is clover
>>
>>54314300
look up guava's multimap
>>
>>54315330
wondering this too

would be neat with real time 3d fractals using opengl

https://www.youtube.com/watch?v=XIzScwydxOE
>>
>>54315454
It's Android only.
>>
>>54315504
>/g/
>using anything but android
you could port it to iOS if it's open source
>>
>>54315534
It would be easier just to start from scratch because it uses Java.
>>
>>54315504
all the cross platform frameworks suck
>>
>>54315584
Isn't Xamarin okay, especially for something like this.
>>
>>54315534
m8 https://github.com/Floens/Clover
>>
yo does c sharp have the same syntax as c++
>>
>>54315610
I would rather get cancer than navigate a java project

pic related
>>
>>54315644
take a wild fucking guess
>>
>>54314658
C is not binary.
>>
>>54315644
No

yes

sometimes
>>
>>54314658
>programming in binary
You're a fucking retard. Binary is just a fucking number base.
I think you mean, "programming in machine code".
>>
>>54315606
probably the best one but it's still far from optimal IMO
>>54315649
le enterprise maymay
but yeah I think that shit often overcomplicates reading code and increases the barrier of entry to a project. at the same time, probably nicer than a big flat directory hierarchy with all the files in it lacking any organization that everyone does in C
>>
>>54315680
>the point
>your head
>>
>>54315752
>the point
>your head
>>
>>54315767
>your stomach
>your head
>your anus
>>
>>54315722
Honestly if I can get a directory with all the source files, as long as they have the name of what they do it's infinitely more readable. The files in that database folder all have "Database" in the name, so it just makes it frustrating to navigate.
>>
www.jobs.bg/f3176751

Should I go for that, or is Ubisoft shit?
>>
File: 1437478403344.gif (8 KB, 645x773) Image search: [Google]
1437478403344.gif
8 KB, 645x773
>go to Uni open house
>CS department is full of Chads and 2cool4u fags
>immediately switch into Comp Eng
I just started tconsidering firmware development anyway so hopefully it works out.
>>
https://www.youtube.com/watch?v=BsCeNCVb-d8

Pretty cringy
>>
>>54315652
>>54315659
so no?
>>
>>54315900
there are some things different and some things the same y'know. It's like if Java was more true to C++.
>>
File: image.jpg (505 KB, 3840x2160) Image search: [Google]
image.jpg
505 KB, 3840x2160
Making my own image library, just to learn the image formats but also practice designing a flexible architecture to my software

Image attached is what my input is
>>
>>54315985
feel when no rei gf
>>
File: why i should not be doing this.jpg (4 MB, 3840x2160) Image search: [Google]
why i should not be doing this.jpg
4 MB, 3840x2160
>>54315985
this is what i got back
>>
>>54316032
what is the expected output?
>>
>>54316088
i am just trying to have it come back without getting garbled. If you look at the PNG spec, it has filtering per scanline.

atm it is getting garbled when it hits one of the filters
>>
File: job.png (653 KB, 979x1772) Image search: [Google]
job.png
653 KB, 979x1772
>>54315837
alright here it is in .png

do I take the job?
>>
>>54316112
Why would we care what job you take
>>
Comparing arrays in javascript ignores the order right?
var arrayOne = ['a','b','c'];
var arrayTwo = ['b','c','a'];

arryaOne == arrayTwo; //would yield true

This would be true because javascript array comparison only looks at the content, disregarding index, right?
>>
Some dude literally called cashman is trying to hire me. Do I take the job? Keep in mind that this guy's name is cashman.
>>
>>54316133
He must've changed his name from Jewman
>>
File: 1445833983632.png (367 KB, 467x720) Image search: [Google]
1445833983632.png
367 KB, 467x720
indexing all shit anime posted between 2009 and 2013 on usenet.
going to take for fucking ever
>>
>>54316133
only if it is the right guyhttps://www.youtube.com/watch?v=ON-7v4qnHP8
>>
>>54316128
They're arrays, not sets.
>>
>>54316124
because it's either get this job doing shitty games, or get a job in a small company making shiity mobile apps
>>
>>54316128
test it out ffs
>>
>>54316159
>>54316155
He works for google staffing and is offering me a software engineering position. Also, this was a cold email.
>>
>>54316176
I tested, i just don't know why yet. Can't find anything about "array comparisons in javascript" specifically.
>>
>>54316188
Are you sure he's not a rapper?
>>
>>54316201
In c++ you would call it an overloaded operator. dunno if that's what they call it in javascript
>>
>>54316216
Nah, it turns out it's actually a qt3.14 grill.
>>
>>54316188
Google his name and see if he has a linkdin or whatever
>>
>>54316032
>>54315985
just got it working now
helps if you use the correct variables in the right places
>>
>>54316414
Yup that'll do it haha
>>
File: image.jpg (531 KB, 3840x2160) Image search: [Google]
image.jpg
531 KB, 3840x2160
>>54316536
just a little proof of it doing some work already
a nice and simple banding test - no clue if it is useful, but it looks funny

will prob put 1 or two more images up as i like them
>>
File: image.jpg (571 KB, 3840x2160) Image search: [Google]
image.jpg
571 KB, 3840x2160
>>54316577
here is one with much more sublt stripping and going in the opposite direction

just fyi
i only have png decoding done in the library
i do the decoding and alterations in the c++ code of mine
i then write to a text file all the pixel values
then python (very slowly) puts into an image for me to upload

i can compile and run my c++ twice in the time it takes the python script to run once
>>
Any idea why grep gives me argument list too long?

I'm trying to fix the names of some files but grep just errors.

Library is the file I wanna search
files is the directory

Bash script:
#!/bin/bash

library=$(<~/libraryfile)
files=$(find /location/ -type f)

while read line
do

if [ ! -z $(grep "$line" "$library" ) ]
then
echo "$line" >> brokenfiles
fi

done <<< "$files"
>>
File: image.jpg (717 KB, 3840x2160) Image search: [Google]
image.jpg
717 KB, 3840x2160
>>54316659
could it be simply that you have too many files in libraryfile?

im not too sure what
read line
does though, take input on stdin?

>pic is simple color shift r->g g->b b->r
>>
File: android java.png (257 KB, 1928x1048) Image search: [Google]
android java.png
257 KB, 1928x1048
Just started trying to learn Java yesterday, not getting very far. Coming from a python/VBA background.

How do I made button work?
>>
My array is out of the scope of my other two methods. How can I get them to use my array? Here's some pseudo code.

public class testscope{
public static void main(String[] args){
ArrayList<Integer> list = new ArrayList<Integer>();

stuff here....
do{
print stuff
i = userinput
switch(i){
case 1:
lfirstMethod(x);
break;
case 2:
secondMethod(x);
break;
case 3:
quit
default:
System.out.println("Unknown Operation");
}
}
while(i !=3);


}

public static int firstMethod(int x){
stuff that uses list array...
list.get(2);

public static int secondMethod(int y){
stuff that uses list array...
list.get(1);
}
}
}
>>
>>54316761
why can't you just pass it as an argument?
>>
>>54316760
>tfw this apparently should make the button do something
>tfw it doesnt

Is there some way in the interface to click on the button and start entering code for when it gets clicked?

    @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

addListenerOnButton();
}

public void addListenerOnButton() {

button = (Button) findViewById(R.id.button1);

button.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {

openDialog();

}

});
>>
>>54316732
Libraryfile is like 500 lines long.

read line goes through "$files" line by line
>>
>>54316659
>>54316821
can't you use "read ... < ~/libraryfile" to read, and grep, each file at a time?

I agree with >>54316732, libraryfile must have too many lines, probably
>>
>>54316782
It doesn't work. I'm still learning so maybe I'm just confused. Do you mean like this?

public static int firstMethod(int x, ArrayList<Integer> list)
>>
>>54316872
No you have to do it in a while loop.

The library file is 500 lines.
>>
File: matlab%20graphic%20.jpg (30 KB, 300x379) Image search: [Google]
matlab%20graphic%20.jpg
30 KB, 300x379
Do you guys of CE, CSE or similar use Matlab?

If so, what do you use it for?
>>
>>54316915
err, sorry, I'm sleepy...
yeah, that's what I mean, use another while loop to read libraryfile
>>
File: temp.jpg (309 KB, 3840x2160) Image search: [Google]
temp.jpg
309 KB, 3840x2160
>>54316732
a little random band shifting and it looks great
>>
>>54314300
you dont use a hashmap for this, you create an entire new class with these information
>>
Max you're gay.
>>
>>54310320
>wanting to live even longer
why
living is pretty shit
>>
>>54316988
what happens if you try to shift it by a fixed multiple of sin() or cos() to get a "wavy" effect?
>>
File: temp.jpg (342 KB, 3840x2160) Image search: [Google]
temp.jpg
342 KB, 3840x2160
>>54317083
been playing with random for the last few mins - but i love the suggestion
>>
>>54316943
Yes.

It's good for hacking out or proving a technical idea on a wide variety of topics QUICKLY. Want to use a numerical solver, matrix multiplication, plotting point clouds, do image processing in C++? There's a bit of a timesink in compiling and linking all the different libraries you need to accomplish these things, not to mention walking through tutorials and getting an understanding of the library. And THEN worrying about how you make all the data types play nicely with one another.

With MATLAB you could have all these features readily available at a moment's notice and flesh out whatever you're working on before worrying about optimizing for speed. There's also the nice advantage of manipulating and plotting data while debugging. At my lab we use it as a prototyping tool before porting to C++
>>
File: temp.jpg (1 MB, 3840x2160) Image search: [Google]
temp.jpg
1 MB, 3840x2160
>>54317083
not exactly what you were wanting i guess...
>>
File: temp.jpg (410 KB, 3840x2160) Image search: [Google]
temp.jpg
410 KB, 3840x2160
>>54317216
better???
>>
>>54317216
I think right now, you are putting in the row's index as the input to sin(), right?

Try something like this:
for each row i in array:
double d = sin( (double)i / 10);
shift row i by int(10*d) pixels


That will "slow down" the oscillating.
>>
>>54316658
>i then write to a text file all the pixel values
>then python (very slowly) puts into an image for me to upload
Why on earth do you do it this way? Can't you use libpng or some other c++ png library?
>>
>>54317241
>>54317216
Neat
>>
>>54314165
Bended
>>
File: small_waves.jpg (344 KB, 3840x2160) Image search: [Google]
small_waves.jpg
344 KB, 3840x2160
not enough so fuzzy??
>>
>>54314128

Can someone explain when and why to use the keyword super in C++? Is it a standard feature of C++14?
>>
>>54317241
that's a good one!
>>
File: temp.jpg (312 KB, 3840x2160) Image search: [Google]
temp.jpg
312 KB, 3840x2160
>>54317253
yes, if i was sane
>>
>>54317158
I see, that's interesting, I asked because I'm from EE and is the must have program for us, but we use it mostly for control and power systems designs, hence why I was interested in seeing what approach you guys from CSE gave to it.
>>
>>54314930
I couldn't help but think of this.
http://js1k.com/2016-elemental/demo/2552
>>
File: 1446962972638.gif (479 KB, 320x240) Image search: [Google]
1446962972638.gif
479 KB, 320x240
>Zero flag is equal to one when the result of an operation is zero and is equal to zero when the result of an operation is a nonzero
That's gonna be confusing
>>
>>54314128
https://www.youtube.com/watch?v=oj9V8VAmwOc
>>
>>54317467

Well, it does make sense.
>>
File: temp.jpg (436 KB, 3840x2160) Image search: [Google]
temp.jpg
436 KB, 3840x2160
>>54317288
i think i have hit the limit for how much noise can be added to an image

night /g/
>>
I am probably ask the wrong people but how do you guys stay motivated to work on your programming outside of school/work life? Right now I thought I was in a good place, I knew I needed some work. I am currently finished the last project(more like partner is, another story) but I am worried after finals end that I will lose my motivation. Its very draining and all but I want to learn the necessary things to get a job .
>>
File: Screenshot_2016-05-01-14-14-52.png (108 KB, 1080x1920) Image search: [Google]
Screenshot_2016-05-01-14-14-52.png
108 KB, 1080x1920
Ayyy, finally got this to work.
>>
>>54317558
Shouldn't your motivation for programming go up after finals because you don't have anymore classes to get in your way?
>>
>>54314128
So I need to make a program that reads data from a file, sorts it, and the writes it back on the file. I have already written the code to sort the array and write the data in the array to the file. That code works perfectly. However, I cannot figure out how to read data from the file and break it up into words so that I can store each string in a different element of the 2D array.

the file is called student_record, no extension:
72 James
56 Mark
87 John
30 Phillip
44 Andrew


This is the array I want to put the data into:
    static String[][] student_record_array = new String[5][2];


This is the read method that I need to modify:
void readMyFile() {
DataInputStream dis = null;
String record = null;
int recCount = 0;
try {
File f = new File("student_record");
if (!f.exists()) {
System.out.println(f.getName() + " does not exist");
return;
}
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
while ((record = dis.readLine()) != null) {
recCount++;
System.out.println(recCount + ": " + record);
}
} catch (IOException e) {
System.out.println("Uh oh, got an IOException error!" + e.getMessage());
} finally {
// if the file opened okay, make sure we close it
if (dis != null) {
try {
dis.close();
} catch (IOException ioe) {
}
}
}
}


Is there some way I can get dis.readLine() to stop when there is a space between words?
>>
File: temp.png (1 MB, 6899x8134) Image search: [Google]
temp.png
1 MB, 6899x8134
>>54317572
no, it will go down, because you won't have school work to avoid by doing personal projects
>>
>>54317572
I usually have two weeks and I am so drained from studying that I get tired and do nothing for like a week.

I am a person who kind of needs a mission to stay focused.(hence why I fell for the college degree trap) I think this is going to be different because I had fun programming two assignments but thats still in the back of the mind the usual post semester slugishness
>>
>>54317558
I never program outside of class work honestly. I have no motivation. I'm still just starting out with my cs courses, but I have a class where I am allowed to turn in all my work at the end of the semester (which is in one more week) and I literally just started yesterday. I'm lazy as fuck.
>>
>>54317695
Motivate yourself not to be a lazy fuck
>>
>>54317467
So just think of it as an isZero boolean, which is true if the result is 0.
>>
This haskell code runs in .13 seconds.
s :: Int -> Int -> Int
s n x = sum (take n (repeat x))

main = print (s 100000000 6)

This equivalent c++ code runs in .14 seconds:
#include <iostream>

int main()
{
int s = 0;
for (int i = 0; i < 100000000; i++) {
s += 6;
}
printf("%d", s);
}

why arent you using the fastest language on the planet, /dpt/?
>>
>>54317966
Now write in in assembly and tell us the profile results
>>
>>54318006
I dont know assembly. If you write the code and tell me how to compile it, I'll tell you how long it took to run.
>>
>>54317966
With what version of what compiler and with what cflags?
>>
>>54318067
g++ 4.9.3
-Wall -std=c++14 -O3
>>
>>54318053
>He doesn't even know assembly
What next? Are you going to tell us that you don't know how to calculate machine code addresses? You probably haven't even memorized your x86 opcodes.
>>
>>54318074
that just turns the code into
printf("%d", 600000000);
>>
>>54318099
ah so we've measured how long it takes to print to stdout. How useless.
>>
>posting unoptimized pngs

this thread is cancer
>>
>>54318084
watch he doesnt even know how to use the registers

also assembly fucking sucks
>>
>>54317966
>not using the optimizer

Nice b8
>>
>>54318134
I like programming directly in machine code. It's more effective that way.
>>
>>54317966
That C++ doesn't even compile here, because you basically wrote C.

incpp.cc: In function ‘int main()’:
incpp.cc:9:19: error: ‘printf’ was not declared in this scope
printf("%d", s);


If I change the includes to hack around that that... only differences below are gcc vs g++


[user@linodeplz shitposting]$ time ./incpp
600000000
real 0m0.306s
user 0m0.290s
sys 0m0.000s
[user@linodeplz shitposting]$ time ./inc
600000000
real 0m0.001s
user 0m0.000s
sys 0m0.000s

>>
>>54316658
This reminds me of something I did in python a while ago. It essentially was a form of stenography, where I hid the information of one picture in the date of another picture. It worked by converting the RGB values of each pixel of an injection image to binary. It would then go through and offset the base image's pixel's RGBA value depending on the injection string. The human eye can't really tell the difference between (120, 200, 200, 255) and (121, 199, 200, 255) so the output would look identical to the base, but if you differ the the base and the output, you can reconstruct the original image.
>>
which book should I read to learn about algorithms?
the mit recommended one?
>>
>>54318240
dont they use the same compiler? also isnt it I/O bound? see >>54318099
>>
>>54318281
desu I have no idea. I just thought "he wrote C, and then included a C++ header and called it C++". So I tried to "fix" it in two different ways and this was the result.
>>
anyone have any clue as to why line 202 is breaking my program? the getName function in galaxy is just
    string getName() { return m_name ;}
>>
I'm leaving /dpt/ for a while

Make sure the trapfag always gets BTFO pls

thanks,
anon
>>
>>54318336
just realised 2 variables have the same name haha what am i like
>>
>>54318250
you can watch the MIT lectures

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-design-and-analysis-of-algorithms-spring-2015/index.htm

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-854j-advanced-algorithms-fall-2008/
>>
QT or C#
Leaning towards qt since I can make android apps
>>
>>54317580
I finished this with no help from you fags. Goodnight.
>>
>>54318531
well done~
>>
Where do I start if I want to learn programming but have no background knowledge in coding, computers, or technology? I'm sorry if this gets asked a lot, just wanted some additional opinions before I get started.
>>
>>54318513
>Leaning towards qt since I can make android apps
Yeah C# sucks. You can only write Windows, Linux, Mac, Android, and iOS apps (with mono/Xamarin)
>>
>>54318513
They are not even the same thing. Also you can make Android apps with C# just fine.
>>
>>54318579
http://www.w3schools.com/
>>
>>54318579
https://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_3
>>
>>54318605
Cool. To be clear, I don't know anything at all about computers or webpages. This is still appropriate for me or is there something even one step lower for true babies?
>>
>>54318712
I'll put it this way. If you struggle with w3schools and web stuff(you won't because it's very easy), then you should be contemplating a career in prostitution.
>>
>>54318460
I think I'd probably like a book better, but I will give watching them a go.
>>
Is there a safe way to get around the borrow checker here?
struct Rope<T> {
data: Vec<T>,
next: Option<Box<Rope<T>>>,
}

impl<T> Rope<T> {
fn len (self) -> usize {
let mut n = 0;
let mut temp = Some(self);
while let Some(ref rope) = temp.take() {
n += rope.data.len();
temp = rope.next.map(|x| &*x);
}
n
}
}


I'm trying to do it intentionally without recursion but might have to resort to that if it's actually impossible to do with lifetimes
>>
I've been trying to proceed in a serialized way, so I don't build a patchwork, but I'm a broken mess that just can't handle it.

Quick question about C++ syntax. What does "->" denote? Pointer is *. What is this thing? It will frequently occur with the "this" keyword.
>>
How do I get a list/dict of all the params passed through a class so that I can store them in a text file?

Python
>>
>>54318894
x->y
is _exactly equivalent to_ (*x).y

a note:
People always say that C++ and C are compatible and supersets and what not, but internally C++ actually handles pointers very differently from C.
Let's say we have the following code:
int x = 3;
int* p = &x;
int y = *p;


In C, it's straightforward. &x gives a reference to the variable, is of type `int*` and gets assigned to p. *p does dereferencing and assigns the result to y.
In C++, the end result is the same, but the semantics are different.
After x is declared, the expression "x" is of type `int&`, the "reference type". The & operator converts `int&` into `int*`.
Then when we dereference p, we get a value of type `int&` again, which gets implicitly casted to type `int` because y is of type int, which is where the actual dereferencing happens.
>>
File: 682d5925e8[1].png (159 KB, 1794x845) Image search: [Google]
682d5925e8[1].png
159 KB, 1794x845
char rawInsert[strlen(arg[2])];


Why does this work? arg and arg[2] are both allocated dynamically.
>>
File: mainmenuapp.webm (3 MB, 1366x768) Image search: [Google]
mainmenuapp.webm
3 MB, 1366x768
Learning Java and libGDX to make shitty mobile games, learning Scene2D to do the menus in. Just finished a start screen (webm related)
>>
>>54318972
https://en.wikipedia.org/wiki/Variable-length_array
>>
>>54318991
thanks. I had no idea.
>>
Alternative ways to loop in Ruby:

1 .send :upto, 10 do |i|
i .send :display
"\n" .send :display
end
>>
Can't decide if I should get into web backend or mobile dev, got to decide shit for my masters this year. Help me /dpt/, which one feels best to code in and is more profitable
>>
File: nB1vw1a.png (5 KB, 128x128) Image search: [Google]
nB1vw1a.png
5 KB, 128x128
My code always looks like shit. I feel like a failure. I never use OOP principles, I just mash a bunch of functions together and write a big main to make it do what I want. I do nothing but make webapps and I fear I'll never do anything important.

How do I stop being a pajeet, /g/?

Pic related, I drew it on my webapp
>>
>>54319045
>How do I stop being a pajeet, /g/?
design your programs before you write them

>>54319042
>feels best to code in
>web dev
easy answer
>>
>>54319045
Work on other people's (good) code over github, etc. It did wonders for me back then, it forces you to understand design patterns and use oop
>>
>>54319051
Are there decent mobile dev jobs anyways? Maybe I'm just not seeing the big picture.
>>
>>54318934
Thanks for the detailed explanation.

I'm having a lot of trouble learning just about everything and anything, and all that's really in the way is myself. I understand everything I read, but something deep in my mind rejects everything and won't integrate it. I can't tell if I feel frustrated or apathetic.

This helps.
>>
>>54319273
not the guy you quoted, but the best way to learn is to practise, and by practising, to make mistakes, and then learn from those mistakes
>>
>>54319347
I don't really know what's wrong with me. I feel like my head is full of walls and selective limiters that are only seldom loosened. It's not just programming, I can't do anything. I can't connect anything. It's as though this is something I have done to myself.

I'm sick of it all. I need to become able to just let go.
>>
in laymans terms, what does this error message mean?

error: passing 'const classA' as 'this' argument of 'virtual const string classA::getName()' discards qualifiers [-fpermissive]
m_name = obj.getName();
^
>>
>>54319461
You have a problem learning anything? I kind of understand. I don't know what to say except that taking a short break and then delving back into the material might help. If it gets worse, consider speaking to a doctor or mental health expert.
>>
>>54319461
Wondering about it will not help you at all, but practising will. If I'm wrong, then you get your shekels back.
>>
I just finished writing a python implementation of Nondeterministic Finite Automata in python. It was pretty fun to learn about all of the bullshit you can add to python classes.
>>
>>54318579
I know your type. You'll never start and you'll ask this question forever. Enjoy
>>
File: pUb5Jg6.jpg (131 KB, 467x535) Image search: [Google]
pUb5Jg6.jpg
131 KB, 467x535
>>54314280
what is the meaning of "LONDON"?
help a newfag out
>>
>>54319532
It's probably psychological, for the most part. A lot of started when I became stuck on tracing every observed phenomena down to the absolute lowest level possible. Anxiety and years of chronic pain set the stage for the rest.

It's very split minded. I remember practically everything. I can pull it apart, put individual elements into a framework. Iterate and compare it to the rest of what I know. But I can't -use- any of it. Every mental avenue is cluttered and ends in a wall, things fizzle out before I can connect anything. I feel artificially limited, as though I was crippled and just dumped off into my life and may not really know quite know where I am or what I'm actually doing. Someone drove by me the other day and stopped, asking for directions to some place a few towns over. I couldn't remember, and I've lived here for 15 years. Yet the next day I could reconstruct a path just fine. I have no faith in myself whatsoever, and whether I like it or not, it's clear that's an accurate disposition. I have the most base form of incompetence.

Some part of me knows I could learn, and do, anything I want. I've done it before, I could do it again. And I remember how, I can feel it. But there's something wrong. I've managed this for years, if it doesn't clear then I'd say it's probably about time for it all to be over.
>>
Hello i have a problem.
For a project i had to build a program wich does some shit, during run time the program makes some temporary files and then deletes them.
Here's the problem: the path of those temporary files is hardcoded in and it's a relative path, but the user might launch the program from a superior directory ./directory1/dir2/myprogam fucking up the relative pathing.
What do?
>>
>>54319461
ADHD? it's pretty popular these days
If you are americunt you can get some adderall and then try programming.
make sure you sleep enough and not eat shit.
>>
>>54319695
>is hardcoded
>it's a relative path
>What do?
Consider never programming anything ever again.
>>
>>54319638
A /fit/ meme that started when a well known tripfag (RIP) rather pathetically commented "please be in london" when he saw a girl's ass. The location is commonly varied to the true location of the poster. Welcome to 4chan, friend. Have a good time.
>>
>>54319708
>girl's
>>
>>54319695
Number of design problems m8

1. don't use hardcoded paths, make them relative
2. If you make files and then delete them before your program is finished running, then you shouldn't make them :^) Every time your program runs it needs to write to the hard drive and thats very silly
>>
>>54319695
Oh, and theres probably a facility in the language you're using to reference the file path of the script that you are running, so that would fix your problem.
>>
>>54319526
in
virtual const string getName()
, const applies to the string object the method returns. What you want is
virtual string getName() const 
, so that const applies to "this", "this" being the way the classA object you invoked the method on, gets passed to the method. You can use this as a value inside methods, it will be a
classA*
value, basically. So the message is basically pointing out this constness mismatch to you.
>>
>>54314128
Black lagoon is so disgusting I had to drop it on episode 3 because it was that bad.
>>
I actually want to get into writing kernel level/mode cheats for games but I have no idea where to start.

Googling this leads me around and to a few sources but for now I just want to write a kenel level program the overlays a black circle on chrome or something but I can't even find where to do that.

I'm a programmer just with a completely different skill set i just lack experience and where to look, anyone have any ideas?
>>
>>54319706
>>54319736
The project requires me to do this shit, i am well aware that access to disk is costly.
What i mean is that my program has the usual folder with a makefile etc, i have 1 folder wich is there to contain those temp files, into my program i hardcoded the relative path "../folderWithTempFiles/myTempfile", all is good if you run the program from a certain folder, but from other folder it fucks up due to pathing.
I don't know how to be able to run the program from any location and have those temp files aswell.
>>
File: bueno_mmmmmmmm.png (741 KB, 650x578) Image search: [Google]
bueno_mmmmmmmm.png
741 KB, 650x578
>>54319708
oh okay, I'm not new to 4chan I just need to lurk moar I guess. Thank you for being polite.
>>
>>54319761
you will probably want to learn C and reverse engineering since you mentioned cheats for games.
>>
>>54316112
Why are they hinting that they are employing audiophile neckbeards?
>>
>>54319828
I know C, but I'm trying to do an out of process cheat that just reads the process memory and then has another program overlay a hud/input artificial mouse inputs.

I don't want to do code injecting if I can avoid it.

The game I want to hack is protected by EAC which is a kernel(ring0) level cheat that does a lot of invasive ass shit. Scans open handles to see programs are doing, blocks hooking, blocks unknown drivers, takes screenshots of the game to send to them, literally copies and sends them a copy of a program so that they can try and figure out what it does to see if it's a hack, etc.

I need to disable patchguard, then stop eac/vac from knowing it's disabled, then I can run my hack from kernel or something like that. I'm surprised I haven't been able to find anyone anywhere that knows anything about this
>>
>>54319792
Use absolute path then.
>>
im not sure if this is a simple or question or not but how do i, in cpp, copy one object from one place in memory to another? for example i tried doing this

                    classA* a = Object.returnObject();
classA* b = *a->clone(a);


where clone is
        template <class T>
T *clone(const T& orig)
{
T *copy = new T();
*copy = orig;
return copy;
}


but all it did was return to me a point to the same place in memory. now, before you tell me to just not use a pointer to classA i have to use one since it's a pure abstract class
>>
File: Bqn0Ynv.webm (806 KB, 640x360) Image search: [Google]
Bqn0Ynv.webm
806 KB, 640x360
Ask your much beloved programming literate anything (IAMA).

>>54314930
Thanks for sharing. Notch is my hero.

>>54318579
https://code.org/ then http://programarcadegames.com/

>>54317966
GHC is considered to be one (if not the most) of the most advanced compilers, it doesn't even use a call stack on x86. It's a true piece of art of engineering.

C++ clang++:                    5.518077517 seconds time elapsed
C++ G++: 4.659448453 seconds time elapsed
Haskell GHC: 0.454930841 seconds time elapsed


>>54317467
How would you test if a 4 bits register is zero or not with logic gates ?

>>54316943
Matlab is a top quality tool but is neither free as in free beer nor free as in freedom.

>>54314565
SICP

>>54314408
Pypy is a lot faster than cpython but lacks the latest language features. Have a look at nuitka.
>>
>>54320034
any chance you could help me with >>54320016?
>>
>>54320034
>ShamefurDispray.webm
>>
>>54320007

Why use a kernel module? Just use ReadProcessMemory and WriteProcessMemory.
>>
>>54319761
it's a long path. You should start by familiarizing yourself with general r/e, check out beginners.re
>>54320007
> I'm surprised I haven't been able to find anyone anywhere that knows anything about this
You're surprised there aren't a bunch of people who can crack professional anti-cheat software + VAC AND patchguard just hanging out on /dpt/? All of these are updated constantly to disable known hacks.

For patchguard check out https://github.com/tandasat/PgResarch
For VAC research just download and reverse engineer cheats I suppose.

>>54320184
>The game I want to hack is protected by EAC which is a kernel(ring0) level cheat that does a lot of invasive ass shit
>Just use WriteProcessMemory
solid advice right there
>>
>>54320231
>ou're surprised there aren't a bunch of people who can crack professional anti-cheat software + VAC AND patchguard just hanging out on /dpt/?

Nah, I've looked else where and while I've found cheats that have done it the only things I've seen for patch guard were old sites from 2011 and russian tech talks, and kernel mode hacks seem sold but not discussed about execution.

Thanks tho I'll look into those resources
>>
>>54316032
V A P O R W A V E
>>
Alright /g/, I've been working on this assignment all night for a program to convert infix notation to postfix. I'm having trouble calling another function from my main function. The program hangs and gdb hasn't helped me.
My main function is this
int main(void)
{
char infix[80]; /*infix array*/
char postfix[80]; /*postfix*/

printf("Enter the infix expression: \n");
scanf("%s", infix);
printf("The Original infix expression is: \n");
printf("%s\n", infix);
convertToPostfix(infix, postfix);

printf("\nthe postfix expression is %s\n", &postfix);
return 0;
}

>>
>>54320693
and this is the function that I'm having trouble calling.
void convertToPostfix(char infix[], char postfix[])
{
char *i = &infix[0];
char *p = &postfix[0];
StackNodePtr head = NULL;
push(&head, '(');
infix[0]='o';
printf("hhh");
strcat(infix,")");

while (isEmpty(head)!=0){ /*while the stack isn't empty*/
if(isOperator(*i)==1){ /*if i is an integer*/
*p = *i; /*add to postfix array*/
i++; /*move to next elements*/
p++;
}
if(*i=='('){ /*if i is a left parenthesis*/
push(&head, *i); /*push it to stack*/
i++; /*increment i*/
}
if(isOperator(*i)){ /*if i is an operator*/
while(isOperator(stackTop(head))){ /*and while there are operators at the top of the stack*/
if(precedence(stackTop(head), *i)>=0){ /*if it has equal or higher precedence than the one in infix*/
*p = pop(&head); /*pop head*/
push(&head,*i); /*push value from infix to stack*/
i++; /*increment pointers*/
p++;
}

}
}
if(*i==')'){ /*if infix i is a right parenthesis*/
while(stackTop(head)!='('){ /*until top of stack is a left parenthesis....*/
*p=pop(&head); /*pop operators from stack and insert them in postfix*/
p++;
}

if(stackTop(head)=='('){ /*pop and discard left parenthesis*/
pop(&head);
}
}

}
printStack(head);

}
>>
>>54320705
IsEmpty never returns 0, find out why
>>
>>54314565
C++ is the most harmful fucking shit ever

AVOID
AVOID
AVOID
>>
>>54320736
Also add more debug prints or use a debugger to see what happens, there's another while loop that might be the cause
Thread replies: 255
Thread images: 50

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.