/dpt/ - Daily Programming Thread

Previous Thread; What are you working on, Cred Forums?

Other urls found in this thread:

http://caml.inria.fr/distrib/books/llc.pdf
drive.google.com/open?id=0BxAwHtIXlHoGRU1ZTk5Fc0tPYnc
msdn.microsoft.com/en-us/library/4ks26t93.aspx
github.com/enfiskutensykkel
msdn.microsoft.com/en-us/library/windows/desktop/aa366898(v=vs.85).aspx
boards.Cred
github.com/Cred
stackoverflow.com/questions/9138790/cant-use-modulus-on-doubles
twitter.com/AnonBabble

at the beach and also on dpt

haskell is bad and you should FEEL bad!

We will witness soon

>tfw using WinAPI for a personal project

I always forget how terrible this is.
Why does every function need 20 parameters, and why are there so many typedefs?

Well how else is one supposed to pass a long pointer?

anime is the best...

Procrastinating with BGI.

>not using ARM logo for thread
I'm disappointed in you, new OP.

Dynamic typing is shit

>What are you working on, Cred Forums?

Still doing this: GPUDirect RDMA benchmarking utility for InfiniBand and some proprietary PCIe-based interconnect.

And not making pancakes, as the other user thought.

Working on my blogging platform but i am not inspired at all because Im not going to blog.

Start small, start tweeting.

Monetize it and get other people to start blogging

at least post cute traps in the op

sharing dick pics with cute bubble butt bi boys on kik

I'm on-call for about another 6 more hours.

Is there a good resource for learning more about machine learning?

Is the Stanford Mooc on coursera good?

wrong thread bucko

hi do u lik my reverse
void
reverse(char *s)
{
size_t p = strlen(s);
char c;

while (p > strlen(s)) {
char c = s[strlen(s) - p];
s[strlen(s) - p] = s[p];
s[p] = c;
--p;
}
}

size_t
strlen(const char *s)
{
size_t i = 0;
while (s[++i]);
return i - 1;
}

>implementing your own strlen
why?

I wanted 1 less than the standard strlen returns
?
obviously
?

.........................

how's your aspergers going?

strlen(s)-1 ??????

fuck off with java code retard

Fuck off with you're cursing. Cred Forums is a Christian board

>cussing

strlen("");

sorry mom

0

Why is it that potty-mouths almost never get their grammar right?

mein Gott, c is so fucking ugly.

>""[1]

Nice variable names bruh.

Im rewriting my toy c++ game engine, so reading lua config file for window settings fps etc, get window and rendering flags. I cast them to bool (sdl takes uint32 xD) and lo and behold it changes my screen resolution and had to kill it manually xD took me a while to catch it..
Funny thing is it works in original version.

>abstractCharacterArrayFactory

>xD
>unironically

first of all i dont have aspergers i just have autism

sorry lol :P

It's okay, we respect everyone in our autism aware community :-)

What trivial functions do I implement with single letter variable names next?
Also, jokes aside, I implemented strlen for fun.
I'm trying to reverse any pajeet-effects caused by extensive exposure to high level languages.

Perl or python for a scripting language, and why?

Python, more people use it

perl if you want to be a cool hacker

Get for D

Ruby, because it's simply less retarded.

...

Best way to learn ocaml? Anyone know any good books?

I find c not exactly beautiful but quite pleasing to the eye.

http://caml.inria.fr/distrib/books/llc.pdf

v0.0.2
void
reverse(char *s)
{
size_t p = strlen(s) - 1;
size_t q = p;
char c;

while (p > q / 2) {
char c = s[q - p];
s[q - p] = s[p];
s[p] = c;
--p;
}
}

pls respond

>http://caml.inria.fr/distrib/books/llc.pdf
english please

I made an Electron app that scrapes Putlocker for mp4 streams and lets you play, download, or get a link to them.

You don't like VO?

Looking over dead projects to revive them, including my own MVC framework, made to get a better understanding of how MVC works.

...

>go to /dpt/
>nothing but unused meme languages, toy code for school assignments, and retarded NEETs with no actual contact with the industry
Anyone knows some place where actual programmers discuss things? /r/java is an example of a good place, but I need more.

Can someone please give me a project idea that isn't a meme.

What are your interests?

a meme hosting site with facebook integration

from PIL import Image
import math
import random
from functools import partial

R, G, B, A = 0, 1, 2, 3
img_width = 1920
img_height = 1080
img = Image.new('RGB', (img_width, img_height))
img.convert('RGB')
half_width = img_width / 2
half_height = img_height / 2

def dist(vec1, vec2):
return math.sqrt((vec2[0]-vec1[0])**2 + (vec2[1]-vec1[1])**2)

def perpix_img_transform(img, transform_fn):
img_copy = img.copy()
for i in range(0, img.size[0]):
for j in range(0, img.size[1]):
pix = img.getpixel((i, j))
output = (transform_fn(pix[R], i, j, R), transform_fn(pix[G], i, j, G), transform_fn(pix[B], i, j, B))
img_copy.putpixel((i, j), output)
return img_copy

def sunset(i, x, y, RGB, orb_sz=1, point=(img_width/2, img_height), grad_rgb=(5, 1, 0.5), ray_period=80, use_noise=False):
if use_noise:
noise = 5*random.random()
else:
noise = 1

from_point = max(dist((x, y), point), 1.0)
inv_from_point = min(orb_sz * (half_height / from_point), 1)

theta = math.acos((point[0]-x) / from_point)

#sun
i += grad_rgb[RGB] * inv_from_point * 10
i += inv_from_point * math.sin(theta*ray_period + noise) * 5

return int(i)


for i in range(10):
orb_sz = random.random()
point = (random.randrange(1, img_width), random.randrange(1, img_height))
grad_rgb = (5*random.random(), 5*random.random(), 5*random.random())
ray_period = random.random()*80
img = perpix_img_transform(img, partial(sunset, orb_sz=orb_sz, point=point, grad_rgb=grad_rgb, ray_period=ray_period, use_noise=True))

img.show()

When I lol I lol real hard...

Perhaps it is a direct result of the vigorous onanism that they use as a substitute for fisting?

why is it so difficult for me to make a fucking TODO list to start a new project?
it sometimes takes me YEARS to even start taking stuff I want to do seriously.
should I be more organized? what should I read to stop procrastinating and being so lazy

Implying there's nothing between f and abstractCharacterArrayFactory

Gow a pair and start doing things.

An AI that ASKS QUESTIONS....

Only S.I.M.I.A.N. but it will suffice.
It depends how correlated to the task the inputs are and how dense the neurons... but it seems to be presenting quite well at the moment.

We're promised more training sets by tomorrow.

Have fun...

Just settled down to read K&R to brush up on my C.

Is there plenty of examples and tasks to practice what I learn in the book, or is there a supplement list of things that I can make sure I can achieve before considering myself finished?

Programming noob here: if I wanted to search for the frequency of an integer inside of an ArrayList, would the time complexity of the algorithm be affected by sorting the list? The book I'm reading compares sorting and searching to looking inside of a phonebook, and searching a phonebook is easier because its sorted. But wouldn't a frequency search still require each element of the arraylist to be visited? Shouldn't the time complexity be roughly the same?

...

every number is the same, now tell me whats the big o for that

>a journey of a thousand miles begins with a single step

I assume green means easy, yellow is medium and red is hard?

Constant? It knows that every value is the same, thus it does one operation? But if every number is the same, then sorting is useless since the frequency counter does the same thing. Bear in mind, I only just started studying time complexity, so I'm not very good at it yet.

1. Don't call an O(n) function in a loop if its value is not expected to change, or if it is expected to change in a predictable way.

2. Don't implement your own strlen function, and if you do, don't call it strlen, or give it static linking. You may just cause linking conflicts with the C standard library.

Take some drugs. Uppers, preferably. It's what all of the successful people do.

array = [0,2,4,6,8,10,12,14,16,18,20]
For loop to find 12 would take 7 iterations.

array = [20,6,12,16,18,0,4,14,2,8,14]
For loop for finding 12 would take 3 iterations.

So in this scenario, the unsorted array would be quicker when left unsorted, however to sort and then find the int would take a lot more iterations to complete.

What do?

learn2algorithms

A-Am I a programmer now?

> if I wanted to search for the frequency of an integer inside of an ArrayList, would the time complexity of the algorithm be affected by sorting the list?

No. Although one would be able to stop searching as soon as one encounters a number larger than that particular integer, the fact of the matter is, one could end up searching as much as the entire list without being able to make further assumptions. It's O(n) regardless.

yea

Yes, now you don't have to learn anything else

Alright, thank you senpai.

No. Do the same in C with zero bugs and you'll be a coder.

how would it know thats the same number or anything thats inside of it without going through it once.
or take this other example, every value is different but the value its at the very end of the array in the worst case.

well said

slow as fuck.

good job though

I'm the guy who asked the question first: there are many searching algorithms that take advantage of sorted arrays and know how to search a particular value without visiting all the values. As an example, the binary search uses a sorted array and starts near the middle of the array and sees weather the value is larger or smaller than the searched value. In your scenario, it starts by checking 10 (the middle of the array), then the largest value nearest 10, which is 12. Thus it checks 2 values, as opposed to checking the 3 values in your unsorted array.

So in other words, no matter what happens, every element has to be checked once, thus we get O(n) no matter what.

Is there a suggested language?

Some of these require graphics, so I'm guessing a language that supports graphics, or just import your own library as seen fit?

depends on what u put inside. just use whats best for the situation

Suppose I need to declare two arrays with the same number of slots

Would this be a good way to go for it? Language is java btw:

int a = 25;
String[] n = new String[a];
int[] r = new Int[a];

So if I'm putting inside random numbers, I get the scenario I described?

I want to learn code. just to know better how computers work and maybe do simple things.
what do?

C->C++->python
C->Python
C++->Python
Just one of the three

>>>/sqt/

How do you declare an array with a desired size?
How do you get the size of an array?

Yes, this is an ok way if you're allowed to create both arrays. If you can only create one of the arrays, see

looking through an unsorted array with all different real numbers, won't be the same as looking through one that can have duplicates.

there's all kind of sorting algorithms, just gotta use them suitably

Learn C and/or Python

C is obviously way better if you want to learn how things work. Python does a lot of things for you and lets you focus more on the concept of your program which is why I think it's a great hobby language. I think C++ isn't good for beginners since it's bloated as fuck

Real programmers don't have time for image boards, they have real programming to do.

>/r/java
>Reddit
>Java

To expand upon python lets you practice your algorithms skills better, C makes you learn memory management and other more complicated concepts since C doesn't hold your hand at all. In Java, the compiler tries to not let you shoot yourself in the foot. C lets you shoot your dick off , even unwittingly.

kid confirmed

>anime

Anime website

...

Most of the programming subreddits are pretty good.

Heh. I've done that, but with a Sierpinski triangle.

>Cred Forums was the first board
>anime is posted everywhere
>404 girl
>anime banners

>"not an anime website"

Assuming that those arrays will hold different characteristics of the same "objects" (not Java Objects!, e.g. name and age of a person) you might want to consider just using one array of Objects instead.
I haven't used Java in forever - is there something like (String, Int) in Java?

code monkey detected

Does CPU pipelining only help in hardware implementations? or could it speed up VM implementations too?

>just to know better how computers work
C. No substitutes.

roll

Cred Forums was the first board, but it was anime/random.

roll

i ain't here for durations i'm just taking vacations

up to you, just make it happen

C and OpenGL 1.0

I've built an annoyatron, for Windows.

drive.google.com/open?id=0BxAwHtIXlHoGRU1ZTk5Fc0tPYnc

Traceback (most recent call last):
File "dogsnatcher.py", line 2, in
from bs4 import BeautifulSoul as bs
ImportError: cannot import name BeautifulSoul

sudo pip install beautifulsoup4

>lostboy.exe

Look again. It was a typo, not a missing module

>BeautifulSoul

holy kek didn't saw that

>windows

>greentext

>not making your applications portable

lol

Maybe in the future.
On that note: How do you make sound on Linux?

very carefully

how did you learn modern c++? is there a good book for it?

...

I have it, I just want to know if others use it or if they have advice for learning more

Trying to create queries on multiple tables without INNER JOIN. Im stumped im new i hate sql

So... while I haven't seen the source code to any large scale VMs, I would assume no. Pipelining the way a CPU does it implies that fetching instructions, decoding instructions, and executing instructions occurs both in parallel and in lockstep. Modern parallelism on computers, however, doesn't allow this easily. To force threads to work in lockstep requires the use of mutexes, which will slow down the computer, rather than speeding it up.

Moreover, it is worth noting that for VMs that emulate a foreign ISA, it is common to use dynamic recompilation, rather than interpreting instructions. In this scenario, all of the "pipelining" is left to the host CPU, since it is native code that ends up getting run.

what qualifications do you have? college degree?

How is that relevant?

i see this guy "Ruby" on here all the time, and he seems to know his shit, so i was wondering what qualifications did he have.

New to programming. What should I work on next after I've gotten sick of the for loop lesson that is Project Euler?

He only trusts highly qualified Anons

Can anyone give me a hint? Also im using access 2016.

Maybe you should try actually reading the pdfs after completing a task and educating your dumb ass.

>degree = qualifications
Even as someone currently pursuing a PhD, I find that pretty demeaning and offensive.

>Project Euler
>for loop

you're doing it wrong

Project euler is not about looping, it's about being smart beforehand and doing as little looping as possible.

>the pdfs

Which ones?

Write a program that given two strings A and B, determines if A is a substring of B. Optimize for speed and space.

why don't we ever have programming competitions?

Project Euler is more maths than programming

>Even as someone currently pursuing a PhD
PhD in what?
> I find that pretty demeaning and offensive.
people with college degrees or any certification are more trustworthy than people who don't have any way to show that they know something

Because TDPT contains people with skill levels ranging from implementing fizzbuzz for the first time to

Exactly, I want more projects to program and get practice with that are more programming-based and not number-theory based. Any ideas?

>PhD in what?
High-performance computing (computer science)

>people with college degrees or any certification are more trustworthy than people who don't have any way to show that they know something
Are you actually saying that the content of somehow would be less or more "correct" depending on whether or not the poster has a degree or a certification?

>would be less or more "correct" depending on whether or not the poster has a degree or a certification?
Yes. That's obvious.

That depends on the languages you want to use, how much experience you have in different areas, what you are interested in etc.
You can always use something like this for ideas.

what algorithm was used here to generate those sun rays?

anyone knows?

I have a Bachelor's degree in Computer Science, and am currently studying for my Master's degree.

When you finish your masters will you outgrow the ruby babysitting language?

Using Python right now. Familiar with C++. Want to eventually use Swift.

Programmed enough to get me through a BS in mathematics. Working in a completely unrelated field but want to be able to program enough to get a decent job in the technology field.

So if user had a degree from Jesus Rules Texas University College, that would somehow make his statements more "correct" than if he, for example, has 20 years of work experience in a relevant industry?

Facts are facts, and errors are errors, no matter who says them or makes them. If I say something wrong, it's not "less wrong" just because I almost have a PhD.

If you base your line of reasoning on argument from authority and/or think that a piece of paper matters when it comes to knowledge, you have a pretty narrow world view.

Anyone here know a good GPU for under 300 dollars for vga passthrough using xen on linux and opencl and stuff?
[spoiler]yeah i know this is off-topic[/spoiler]

>that would somehow make his statements more "correct" than if he, for example, has 20 years of work experience in a relevant industry?
Implying in industry you learn valuable thing. In industry we just learn dirty trick.

Then you work in the wrong industry, my friend.

Source: I'm doing an industry PhD.

Are you doing a master's degree?

I'm just calculating the angle created by the vector from the center to the pixel, and the horizontal, then using it as the argument for sine to get the increasing and decreasing intensity as you go around.

Did you even read my post? I just said that I'm doing a PhD....

I already have a master's degree.

No PhD and you think you're opinion is valuable?

>opinion
Which opinion are you referring to, exactly?

no shit sherlock. you already said you have a PhD in this thread 4 times.

what does industry phd mean

a company is paying you to do your phd?

Then why are you asking me if I'm doing a master's degree? Jesus...

[this is post requires a PhD to be seen]

Yours. You have no PhD, stop arguing.

Anyone know sql? Id like to learn about programming in a programming thread

That's the most common form, yes. In my case, however, I'm merely working in collaboration with a company and my funding comes from a government grant.

Probably the ugliest piece of shit I have ever written

__declspec(noinline) static int NewMain(int argc, int *argv[]) {
return 123;
}

__declspec(noinline) static void NewMainEnd() {

return;
}


Then
size_t pointer_NewMain = (size_t)NewMain;
size_t pointer_NewMainEnd = (size_t)NewMainEnd;
function_buffer = new char[pointer_NewMainEnd - pointer_NewMain];
memcpy(function_buffer, reinterpret_cast(&NewMain), pointer_NewMainEnd - pointer_NewMain);


What it does: Copies a function into a char buffer.

just use subqueries bro

>Microsoft code

daily reminder that the reason Windows is closed source is because their code is horrible, and they don't want people to see

>fun1()
>fun2()
>fun2 - fun1
not reliable

That's pretty slick, mind sharing the industry? I do some amateur research outside of the day job but don't want to give up my salary to do it full time in academia.

>Copies a function into a char buffer.
Something deep inside me just died

Thanks famalam

>and they don't want people to see
Like all closed source code.

>That's pretty slick, mind sharing the industry?
I work together with a company that develops PCIe-based interconnects (think InfiniBand, but PCIe all the way instead, so extremely low latency combined with high throughput), and the field ranges from rugged environment to high-performance computer clusters. The guys that discovered "gravity waves" used our technology to run their calculation software, which is pretty neat.

>I do some amateur research outside of the day job but don't want to give up my salary to do it full time in academia.
I get that. I used to work as an embedded developer while I was doing my master's and for a year after I completed my master's before I went back, and I make considerably less money now than before, and it really takes a toll.

However, I feel that I'm compensated in the amount of travels and personal freedom and autonomy I enjoy, so it's not entirely wasted.

Alternative was to use inline assembly and do a bunch of __emits but oh wait... x64 :(

"Inline assembly is not supported on the ARM and x64 processors."
msdn.microsoft.com/en-us/library/4ks26t93.aspx

Fuck.

not him but do you a github?

Ruby is a tool, and I'm not going to give up using it for the tasks it is useful for (i.e. everything Python is useful for). Nor am I going to give up C and C++ programming.

How do you execute it?
Windows has no mprotect to mark the page as executable and "call" it.

I do, but I don't have a lot of interesting stuff on it, sadly. Just some personal projects from ages ago when I had time to have personal projects.

github.com/enfiskutensykkel

holy shit i think i saw your github not so long ago.
you used to post here months ago?

awesome

>you used to post here months ago?
Yeah, I'm a long time lurker. Been lurking since late 2007 / early 2008 and just stuck around.

You probably saw the Brainfuck compiler thing, I did that the first week of my summer vacation because I had nothing to do and no where to go (which is kinda sad actually).

I don't. I save the function in a new executable section within a different file (PE). I change the entry point of the PE to the copied function.

How do you guys feel about libraries and using other people's code? with permission ofcourse.

Thanks man, your field sounds pretty metal. Sounds like I should stick to the day job until I can find someone to sponsor my research, heh. Besides the hit to salary, everything I've read about post-doc life sound miserable.

Shit is still interesting though, so I guess I'll stick to the amateur bit for a while and see what pans out.

Got this shit coming in Tuesday

keep on keeping on.

Also, Norway is probably filled with a lot of qt3.14 girls

nothing wrong with that.

they made those libraries to be used by people.

why not this?

idk

>Sounds like I should stick to the day job until I can find someone to sponsor my research, heh.
Well, as I said, despite the drastic cut in salary, I still make enough to make payments on my mortgage and afford food on the table (at least for the better part of the month), so it's not too bad. But it's not directly comfortable either, I'll give you that.

>Besides the hit to salary, everything I've read about post-doc life sound miserable.
Yeah, I have no intentions of doing a post-doc. It's pretty miserable and it's a constant struggle to fund your own job by applying to a bunch of projects all the time.

>Shit is still interesting though, so I guess I'll stick to the amateur bit for a while and see what pans out.
Well, best of luck to you then. I mean, you can look around for someone willing to sponsor you for an industry PhD, I guess that would be an ideal situation salary-wise.

What do you do for a living, if I may ask btw?

void
triangles(const int width)
{
int height = width / 2 + 1;
size_t sz = (width + 1) * height + 1;
char *data = malloc(sz * sizeof(char));

for (int i = 0; i < height; ++i) {
int line_start = i * (width + 1);
int cnt = 0;
int lim_spaces = (width - i * 2) / 2;
int lim_sym = lim_spaces + (2 * i) + 1;

for (; cnt < lim_spaces; ++cnt) {
data[line_start + cnt] = ' ';
}
for (; cnt < lim_sym; ++cnt) {
data[line_start + cnt] = '#';
}
for (; cnt < width; ++cnt) {
data[line_start + cnt] = ' ';
}
data[line_start + width] = '\n';
}
data[sz - 1] = '\0';
printf(data);
free(data);
}

>this took me literally in 1 hour
Kiru me, I did it in JS in 3 minutes.

>keep on keeping on.
Cheers.

>Also, Norway is probably filled with a lot of qt3.14 girls
They're too bad to be honest, but too bad I'm an overweight 2/10 turning 30 this year myself. So not exactly the ideal bf for said girls.

In java, how can I use a PrintWriter object inside a method to write in a loop in another class? The .close() doesn't let me continue writing.

If it's any comfort, I like your clean code formatting although sizeof(char) really tickles my autism.

What method should be used instead of sizeof()? I don't know much C at the moment.

>They're too bad
Oops. I meant that they're not too bad.

> What do you do for a living, if I may ask btw?

Pretty comfy gig implementing backend infrastructure services for a fortune 100. Pretty standard Java/enterprise shop.

My stuff on the side, however, centers on the Curry-Howard correspondence. Spending a lot of time climbing the abstraction ladder from untyped lambda calculus to the calculus of constructions so I can start doing some original research.

Oh wait, a char is 1 byte right?

No, sizeof is fine (although it's not a method, it's a keyword).

It's just that according to the C standard, sizeof(char) is always 1, so you're basically doing sz * 1.

>overweight
what about lifting and some exercise? you probably have a strong jaw hidden behind all that fat in your face

you can't go wrong with lifting, imo

Yes, so it's pretty redundant.
If you want to keep it there is also the sizeof(*data) option, which is the most sensible.

>Pretty comfy gig implementing backend infrastructure services for a fortune 100. Pretty standard Java/enterprise shop.

As a college student, could you describe what a typical day looks like in your job? i'm learning to be a backend developer so i could use some tips.

if you don't mind of course.

I used to be fit when I was younger (did MMA, kickboxing and taekwondo until ~22, even have a 2nd dan black belt in taekwondo). But I just got insanely sick of exercising. It's just insanely tedious, to be honest.

I guess I should just man up and do it from a health perspective though, since there's a heart condition running in the family.

get a room faggots

>Pretty comfy gig implementing backend infrastructure services for a fortune 100.
Well, I used to do some back-end before I did the embedded stuff, it was fun in its own way and if the PhD thing didn't turn out I would have no problem falling back on that.

>My stuff on the side, however, centers on the Curry-Howard correspondence. Spending a lot of time climbing the abstraction ladder from untyped lambda calculus to the calculus of constructions so I can start doing some original research.
This is way beyond my level, I have about zero knowledge of lambda calculus and I only know the fundamentals of functional programming, which is quite embarrassing seeing how I'm actually doing a PhD in computer science which was born out of that stuff.

doesn't it make you feel like the program is less yours? ownership wise?

Not the guy you're responding to, but no. But then again, I don't really feel that a program is "mine" to begin with. There's a reason why I always use a free license for my programs, and that is that I feel deep down that it really belongs to the public.

depends. if you're using a lot of methods from that library, yes.

if you are using something like, stb_image (a public domain JPEG/PNG reader ) just to load images, its fine

VirtualProtect
msdn.microsoft.com/en-us/library/windows/desktop/aa366898(v=vs.85).aspx

I'm trying to use the following Java method
public void printToFile(Object o) throws FileNotFoundException{
File outFile = new File("out.txt");
PrintWriter out = new PrintWriter(outFile);
out.print(o);
out.close();
}
How can I place the out.close() outside this method so I can use it inside a loop? Already tried instantiating the method, but I don't know where to place the out.close().

declare PrintWriter out globally

make a PrintWriterFactory

can't translate this into python3 for the love of hiroyukichan
strings_to_query = [
"/how_to/build/your/own/gems.rb",
"How to build your google.rb own custom source control",
"Public methods are your grub public API and be",
"this text should be at the end"
]

query = 'grb'
query_reg = /#{query.split('').join('.*?')}/

sorted = []
strings_to_query.each do |string|
match = query_reg.match string
sorted

> could you describe what a typical day looks like in your job?

You will inevitably encounter a flawed implementation of agile/scrum, which is when your platonic ideal of software engineering will be shattered. It'll be a constant source of frustration as management tries to bastardize the agile process to suit their business needs of the day.

On average a third of the day is dedicated to meetings with management and the rest of the day dedicated to achieving poorly defined "sprint goals".

My best advice would be to get _really_ comfortable with ambiguity, because management will rarely give you enough detail/direction to satisfy you. Set goals for yourself. Always learn something new. Ignore the crusty/bitter engineers because they're part of the problem too.

> Well, I used to do some back-end before I did the embedded stuff, it was fun in its own way and if the PhD thing didn't turn out I would have no problem falling back on that.

Yeah, all things considered it's not a bad gig.

> This is way beyond my level, I have about zero knowledge of lambda calculus and I only know the fundamentals of functional programming, which is quite embarrassing seeing how I'm actually doing a PhD in computer science which was born out of that stuff.

Untyped lambda calculus is actually pretty easy to pick up, and imho changes the way you think about how you describe programs. I wouldn't be embarrassed about not knowing enough about the theoretical side of CS. There's plenty about physics I don't understand, despite it being pretty fundamental to how the circuits in your pc work.

you're kinding

>kinding
Did you mean kidding? Because I'm not. Why do you think free as in freedom software licenses exist?

can you repair my car too?

That sounds like internalized communism.

I don't work for free (or for others) even though I give a way code for free. Those are different things.

You mean as a public instance variable?

Sounds like you are working for free.

sudo have sex with me

sudo: sex: command not found

...

Username not in sudoers file. This incident will be reported.

Are you actually claiming that effort and product of that effort are the same thing? Are you saying that spending two years designing a chair is the same thing as the physical, mass-produced chair?

What mental gymnastics and logical fallacies did you do to come to this conclusion?

>suggest lifting
>sully your suggestion with meme-tier bodyweight

Don't do this program. Either lift, or do "real" bodyweight (i.e. pullup bar and pushup variation intensive). Or just go to /fit/ and make things easier.

Also, how about that technology, eh?

you do work and you give it out for free

Or another example: A composer spending years writing a song is the same thing as the thousandth cover band playing that song.

>This incident will be reported.

I don't do the work for free, I give the product of the work for free.

Not the same thing. How do you think open source developers make money exactly? I can assure you that Linus Torvalds and the top 50 kernel developers do not work for free and are paid a lot of money for doing what they do.

Reminder that if your language is garbage collected but cannot implement traverse_ then it is useless.

i could care less

Neither of these are arguments.

shart in mart

>mfw proprietary cucks are unable to grasp that free software developers don't work for free

How cucked by communism are you if you think freedom means that nobody gets paid? Capitalism aka economic and individual freedom works. You'd have to be a communist to not understand this.

That's because you based your own arguments on fallacious logic and I'm trying to point that out to you using simple examples, you fucking imbecile.

Communists don't work for free. Are you dumb?

How do they get paid?

communism has never been implemented

>How do they get paid?
Well, many of them are employed by Google and other companies that invest heavily in free software. These companies sees the benefit of the free software as a business model so they pay developers to work on free software projects.

It's simple really.

They don't. They threat their families if they don't work for free

can anyone tell me why this script isn't getting the thread names?
#!/usr/bin/env python3.4
import requests, re, time
from bs4 import BeautifulSoup

base_url = 'boards.Cred Forums.org/b/catalog'
with requests.Session() as c:
source_code = c.get(base_url)
plain_text = source_code.text
soup = BeautifulSoup(plain_text, "html.parser")
for i in soup.findAll('div', {'class': 'teaser'}):
print(i)

>Communists don't work for free.
Of course, because communism is the opposite of freedom.

>muh real communism has neven been tried
That's the go to argument for every communist teenaged edge lord.

Because you're a retard for not using the API

Didn't work, does exactly the same as having the out.close() inside the method

>html.parser
Use the JSON API, you idiot.

Dont want to use the api
Im new to this, can you explain a little bit?

github.com/Cred Forums/4chan-API

I don't want to use the Cred Forums api

Why the hell not? Do you really think scraping HTML is a better idea than reading JSON?
You can't even argue that it's for learning purposes, because you're using a
import solution
solution.run()
program

>14. The use of scrapers, bots, or other automated posting or downloading scripts is prohibited.

>I don't want to not be retarded.

use the api or gtfo, please.

>ruby is a tool
Yeah he is

You could've just said he's using a python program

They work for stolen money, though. :)

Installing the latest botnet 10 and its taking ages

mine got stuck in an infinite loop and never even did install the update so i deleted windows 10 on my desktop entirely

I just bought the XFX Disappointing3D. Oh well.

why is it so much harder to write a 200 line paper than it is to write a 2 thousand line program

With a program, those 2 thousand lines come naturally as the program expands. With a paper, the professor screams at you to write a 40 paragraph essay and gives you a topic that's only worth a few lines.

make a calculator in 2 thousand lines, you won't

make one that shows proofs

Roll for this

roll

sure i will, i'll just make it text based

I a dumb
How can I have it so that in a CodeBlocks project, the include, lib, src folders are in the project folder?

Also I still can't figure out how to get glad.c to be able to find glad.h.

Because in programming being verbose is generally easier, and usually produces the shittier end result, so it's actually to your benefit to write something smaller.

With a paper, bloat is considered a good thing.

I tried using the sdl2, but it was much slower than the sfml2.
I get around 60fps with sfml2, while sdl was around 25fps.

Has anyone got the most recent challenge roller?

I'm restless and I can't sleep, need something to do.

make the next facebook.

I'm neither a kike nor a thief.

That and social media is literally crowd-sourced spying.

using a GUI lib would add more lines you dip

is it possible to make a dictionary mapped to functions in python?

ex
{"test1": test(arg1,arg2), "test2": test2(arg1,arg2)}


where I can iterate and check if get an instance of test1 I can run test() with my specified parameters?

or something similar to what I'm trying to accomplish?

Trying to build Godot from source. On paper it's straight forward, but I think I've found an edge case.

anyone else considering suicide

Trying to go through 2 chapters of exercises in 3 hours.

I keep getting this error on this one. I don't know how to fix it.

everyday

Can't you read the error message?
stackoverflow.com/questions/9138790/cant-use-modulus-on-doubles

What are good projects to put on a CV/project site? Primary languages are C/C++ so can't put up a website/Android or iPhone apps, etc.

not really these days but i had a "phase" where i seriously contemplated suicide. i guess i've learned to cope with my existence and in most ways i'm not actually as pathetic (compared to most other people) as i'd like to think sometimes. if i get "tfw no gf" i might just need a fap and then i can focus on programming or something.

>so can't put up a website
Why not?
Also, anything that does CRUD.

I'm getting a segmentation fault but I'm not sure why.

Here's a snippet of the code:

void addQueen() {

for (int m = 0; m < arraySize; m++) { // Fill array with queens
queenArray[m] = Queen();
}

queenStack.push(queenArray[0]); // Put the inital Queen in
for (int i = 1; i < arraySize; i++) {
queenStack.push(queenArray[i]); // Push the next queen onto the stack
currentQueen = queenStack.top(); // Make the top queen the current one
validQueens = 0; // Reset the number of valid queens
elementNum = 0;
compareQueens(currentQueen);
} // end for

}

void compareQueens(Queen comparedQueen) {

while (!queenStack.empty()) {
elementNum++;
queenStack.pop(); // Pop the current queen of the stack
previousQueen = queenStack.top(); // Make the top queen the previous one
tempArray[elementNum] = previousQueen; // Queens are temporarily saved in an array after they are popped
if (comparedQueen.getXPos() != previousQueen.getXPos() && comparedQueen.getXPos() - 1 - elementNum != previousQueen.getXPos() && comparedQueen.getXPos() + 1 + elementNum != previousQueen.getXPos()){ // If the current queen isn't directly, or to the immediate left or right above the previous one...
validQueens++; // Add one to the counter of queens that are valid
} // end if
} // end for


The part that is fucking up is the previousQueen = queenStack.top() part of the compareQueens method. I would imagine that this is because the stack is empty but as you can see in the code I push 2 items in the stack and pop one, so there should still be one left. Any ideas?

is it normal for new programmers to use a lot of if statements

I am working through exercises in a C++ book and while I eventually figure out the exercises, I often up with a shitload of complicated if statements all over the place

I feel like I might be missing the point of some of the exercises, there must be a less tedious way to do this stuff. but I'm not sure if maybe everybody does this in the beginning and later stops relying on it so much

>Why not?
Because I haven't done any Front End shit, and want to specifically get gigs related to C/C++
>CRUD
Have messed around with Sqlite through C, nothing amazing though.

please r8 my first program (be gentle)

#!/usr/bin/env python
import os.path
import datetime

date = datetime.date.today();

##This function writes input data to a text file with today's date as a filename and header
def diary_write():
diary_entry = open(str(date), "w");
diary_entry.write(str(date) + "\n");
dream = input("What did you dream?: \n");
diary_entry.write(dream + "\n");
diary_entry.close();

##This function reads text file contents and prints it for the user to read. It can only read files with
##the correct format (yyyy-mm-yy). Example: 2016-09-18
def diary_read():
read_entry = input("\nWould you like to read diary entries? ")
while read_entry[0].lower() == 'y':
read_entry_yes = input("\nWhat is the date of the entry? (yyyy-mm-yy) If you want to stop reading, type stop: ");
if read_entry_yes == "stop":
print("\nHave a nice day\n");
break
elif os.path.lexists(read_entry_yes) == False:
print("\nYou either did not dream that day or you entered an invalid format");
continue
else:
diary_read = open(read_entry_yes, "r");
print("\n");
print(diary_read.read());
diary_read.close();
else:
print("\nHave a nice day\n");

##Asks the user if they dreamt. If yes, then it won't let them write an entry if they already wrote one.
##If no, or an entry already exists, it will ask if they want to read an entry.
##If no, then the program closes.
answer = input("Did you dream last night? ")
if answer[0].lower() == 'y':
if os.path.lexists(str(date)) == True:
print("\nYou already wrote an entry for today!")
diary_read();
else:
diary_write();
diary_read();
else:
diary_read();

It's an electronic dream journal

so I'm a retard and I'm learning C at the moment

say I have a function that takes in two arrays, is it possible to use an array for the first function argument, then modify the SAME array using another function and use the modified array for the second argument?

so it'd be like

arguments = (array a, modified array a)

Learn LISP instead.

You are thinking of a 1list of 2tuples.

1 is your key word and data structure. When using OOP, think of 1listobject.append() and 1''.del()
Then you can access each piece of the list like you would a regular list object. So at the individual list child objects, you can now look at them as tuples.
I ended up with a data structure like this the other day in WingIDE when debugging in my watch.
I am trying to explain the functionality of the thinking rather than code for you, as you need to understand rather than ask.From what I explained above, you can then google your python x-version list/dict append, del, merge, raw print.

You should be popping after getting the top element. Here, you pop off the last element of the stack and then try to get the top element, which causes a segfault.

th-thanks

% isn't divide, / is

Noticed a typo in one of my comments
Where it says (yyyy-mm-yy) it should be (yyyy-mm-dd)

I guess I'll have to go with CreateDIBSection

I mean, you need some kind of front-end knowledge if you're going to make a full project that you can show people. You can make UI pretty easily using QT; all the real program logic is in C++.

u r a faget

It's easy to manipulate lists in LISP. It's exactly what you want to do.

I have to do this in C

10 PRINT "Hello World!"
20 GOTO 10

It's simply not possible. You can't even reliably average 2 integers in C.

You could have the other function return the modified array and pass it in as the second argument.

someFunction(a, otherFunction(a));

great stuff man. Start with intermediate stuff that challenges you and go from there.

I would like to challenge you to try writing to SQLite, MySQL, and using a tkinter GUI basic example to map your functions to the GUI calls.
Lastly if you are in windows, try a >10 step distutils compile to EXE so you can port it around.

Maybe its too out there. But give it a go and bite the whale a small bite at a time. You'll be impressed with your own product by the end and get familiar with data structures at the same time.

Sorry, i meant front end in terms of websites and shit. Building a GUI for something, no worries, just don't know what are a good example projects, maybe a Music Visualizer/real-time FTT display? I can code, just don't know what to make to impress employers.

I thought functions in C can't return arrays

You would need to make a copy of the array before you modified it. Or create a new array in that function and return the result. (You would have to be careful about memory leaks with that method though.)

is more relevant than you might think. In Lisp, you could do something like (myFunction myArray (modify myArray))

Not him but you can't return nor pass arrays to functions. You can pass pointers to arrays to workaround that.

If only C had never been invented. There would be no C-likes, we'd all be using LISP-likes.

Yeah, sorry, I don't know about that. I've thought about the same thing myself.

The most recent thing I've made is a desktop app that scrapes putlocker for video streams and provides a much nicer/simpler interface than their website. The problem is it's illegal, or at least in the gray area, so it's not exactly something to highlight to prospective employers. I really only made it for personal use and for some of my friends.

I might add, why don't you try some logging?
Heres some logging I've done if you want to borrow to get you rolling.
import time
import logging
import os
import sys

logdate = time.strftime("Date %m-%d-%y"+"time-H:%H-M:%M" )
str(logdate)
filename = 'dream_journal' + logdate + '.txt'
log = open('C:dream_journal_'+logdate +'.txt', 'w')
logging.basicConfig(level=logging.INFO, filename='email_pylog' + logdate + '.log')
#Im a big fan of emailing logs
logging.info('Starting Program')
logging.info('Use this function to write to your log..')
try:
#there must be a try and except to use the error function
somecode/functionhere()
except ValueError as E_con:
logging.error(E_con + 'some reason the code failed here to append to log')
#If you like my code go ahead and throw a credits comment in your code for the logging:)

No, it would be worse.
We would all be using Pascal-like languages.

Pascal was better than C, though, and it led to safe languages like Ada.

wtf is this and how do i fix

>Ada
Have fun with your masturbatory "safe" languages.

>is it possible to use an array for the first function argument, then modify the SAME array using another function and use the modified array for the second argument?

I am not sure what you are trying to accomplish here, but you will need to allocate memory for both arrays if you want them to exist in memory at the same time. But yes, it is possible to make a function with two array arguments, and it is possible to use a function to produce a mutated version of an existing array, either by returning a pointer to a buffer containing the new array, or taking a buffer as an argument and outputting to that buffer. Something like this might be an example:

#include

typedef int (*intfunc)(int);

void map_ints(const int* input, int* output, size_t n, intfunc f)
{
for (size_t i = 0; i < n; ++i)
output[i] = f(input[i]);
}

int add_two(int n)
{
return n + 2;
}

int main(void)
{
int foo[5] = { 1, 2, 3, 4, 5 };
int bar[5];

map_ints(foo, bar, 5, add_two);
for (size_t i = 0; i < 5; ++i)
printf("%d\n", bar[i]);
return 0;
}

Functions in C can return pointers. You can malloc memory for an array, and return a pointer to the buffer. That said, you should make sure that the buffer you allocated gets freed before it leaves scope.

i'd say it's normal, but maybe they're trying to teach you OOP or something, if you post an example we might be able to help

>Java
You can't fix it rajeesh, also you can't divide a string and an int.

how do fix

What advantages would I get from having logging? I'm not entirely familiar with logging, just a little bit of research about it. My program is so simple that I don't see any errors happening, but I might be missing the point

Not overly familiar with java- but you need to calm down first before looking at the code. Be Spock- if you get emotionally compromised/startled then the mission is jeopardized.

You can't divide a string (grade4) by an integer(number, in this case grade 4). Try turning all grades into numbers before dividing.
Also your compiler is always honest with you. Change the color from red to something less threatening:-)

you need to parse the string into a number

eat poop.

pic is the beginning of a set of several drills (which continue to make further checks such as if the integers are equal and so on, and ultimately ends up being a program that converts a bunch of types of measurements into each other)

how I did the first two parts was:

int main()
{
coutpeanut>>shell)
if(peanut>shell){cout

When something goes wrong with an end user, you can quickly discover how far they got. If journals get deleted, you know when you wrote them. Many details you might not think to include in the journal itself are then chronicled.

It also helps for early termination and catches errors that you might otherwise miss by using try/except. This becomes a critical junction in a professional environment when you are held accountable for your work (if you so choose that path).

Mew thred :3

that's absolutely fine, that's how you'd normally do it (an if statement to do something different based on a comparison)

Just wrote a program that will read in a list of movies with their budget and box office earnings, and will remove and commas and dollar signs, convert the numbers to integers (or floating point) and then will sort them by title and percent profit. Just finished.

nigga you gotta turn that grade + grade + etc into a string