/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

pastebin.com/q8see1Ss
youtube.com/watch?v=Y0S4oSkRtOU
dlang.org/library/std/container/binaryheap/binary_heap.html
youtube.com/watch?v=1Bix44C1EzY
twitter.com/NSFWRedditGif

First for anime picture

I'm working on a

Hey guys, I wrote a keylogger in go. Can you guys r8?

pastebin.com/q8see1Ss

> import (
> "github.com/jordan-wright/email"
>)
You can't make this shit up.

c++ won't let me invent new primitive data types

gayest shit ever

Welcome to trash

go seems great for writing malware

top kek

that shit might fly for internal stuff at google but even then it's sketchy

I don't get it

enum byte : unsigned char {}; // byte is a new integer type
byte b { 42 }; // OK as of C++17 (direct-list-initialization)
byte c = { 42 }; // error
byte d = byte{ 42 }; // OK as of C++17; same value as b
byte e { -1 }; // error

>pastebin.com/q8see1Ss
It is really nice, but it is still in its infancy for malware. Hard to find good code for it.

did you hear about that japanese machine that uses botnet code to color in line art

He imports a library directly form master branch of a github repository. For some reason this is an accepted practice with Go.

I don't think you guys realize how go works. You aren't actually getting it from the site.

Lol, you don't know how go works.

>He imports a library directly form master branch of a github repository
and what's bad about that

>JSR-310/java.time use the word "Local" to mean "without timezone information", so actually not local
I've seen some stupid shit in my time, but jesus
I imagine the local bit was added at the end when someone noticed the specification was actually too reasonable by Java standards to be included in the core

...

hey guys how do i get an internship at blizzard? gimme tips and i suck yo dik

Go, more like JEW.

explain

learn sepples

Well I know Go caches repositories, but that's not the point.
There is not required version, so the next time author of the repository pushes a broking change or delete the repository clean deployment will fail. This is left-pad shit all over again.

youtube.com/watch?v=Y0S4oSkRtOU

No you fucking retard. you can use "go get" the same way you use "pip install", so if there is and update to a repository, you would have to update it on your computer. You are not directly importing from github. The name of the module is just the same as the github site.

So were do you specify the version of a package you need? Because whatever the source, without versioning the system is broken.
>so if there is and update to a repository, you would have to update it on your computer
Yeah, but what if I do a clean build on a new machine? I will have no other choice but to download the recent version from master, isn't it?

What does Sup Forums think of F#?

I want to do FP but I also want a job. Is this the best language to do that?

Scala and Erlang / Elixir are more popular for that

next tip please

Very well paid, works with .NET, not nearly as trashy as Scala.

Nobody uses Elixir.
Scala is dying

learn hardcore game/graphics programming with directx/opengl/vulkan. start by making simple games and tech demos. unless you want to be an artfag

Directx is dead.

I'm taking a c++ class right now. I'll look into what you said.

any ideas for projects that would look good on my resume?

it's called directx 12 because only 12 programs actually need it

Touch your monitor. It is warm, like flesh.
But itis not flesh.
Not yet.

How long did it take you guys to get competent in your chosen language? What was your first language?
Learning JavaScript through Codecademy and I'm not sure if it's working and if I'm learning it properly or not.

another tip pls

Sooooooooooooooooooooooo anything?

while (true) {
try {
System.out.print("Enter prefix size: ");
prefixSize = in.nextInt();
break;
} catch (InputMismatchException e) {
System.out.println("Invalid input. Must be an integer.");
}
}

This prints "Invalid Input. Must be an integer." literally forever if a user inputs an incorrect answer.
Is System.in actually reading System.out? What the fuck?

Daily reminder to #include

eh, gonna implement Djisktras in D lang because I'm bored and because I'm about to learn network layer routing in my networks class

question would something like -
dlang.org/library/std/container/binaryheap/binary_heap.html
be used as a priority queue?

Learning operators in c# and unity

Next lesson will be on Equality operators.

Trying to get a good solid base in c# coding in unity so I can design my own games.

Wheres the rest of the code? Have you considered using Integer.parseInt() instead of chucking an exception?

>windows only
no thanks

next one please

ParseInt also throws a ParseException if the input is not valid.

So why isn't the input valid?

Because I'm trying to round the corners off of this program before I send it to a normie and I don't want it crashing if it gets given an incorrect input

Remember to change your underwear daily.

Looking at it, it's a Max Heap. Will probably want to use the 'negative' of distances then. Also note almost no libraries support decreaseKey op's, so you continually add the same node with 'lower' priorities instead (and keep track of 'visited' nodes in a set or something).

Never pet a burning dog.

Are diapers considered underwear?

Example of some csharp I had to write for one of their game tutorials. Now that I know more of the c# coding I understand exactly what the hell I was typing and doing. This is a player crontroller script basically effecting the player character object in said game. From pick ups to the movement controller etc.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class PlayerController : MonoBehaviour {

public float speed;
public Text countText;
public Text winText;

private Rigidbody2D rb2d;
private int count;

private void Start()
{
rb2d = GetComponent();
count = 0;
winText.text = "";
SetCountText();
}

private void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector2 movement = new Vector2(moveHorizontal, moveVertical);
rb2d.AddForce(movement * speed);

}

void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.CompareTag("PickUp"))
{
other.gameObject.SetActive(false);
count = count + 1;
SetCountText();
}
}

void SetCountText()

{
countText.text = "Count: " + count.ToString();
if (count >= 12)
{
winText.text = "You Win!";
}
}
}

pleays use code tags or a pastebin

Oh sorry new to Sup Forums so I didnt know about that, they in the sticky at the top?

how is that going to get me an internship at blizzard?

Think about it: if you pet a burning dog, chances are that you'll burn too and die, thus making it impossible for you to get an internship at blizzard.

of course they are you fucking retard

Salty oldfag

Yep went and checked it before you got extremely uncool for a small thing.

not sure how to explain it, but I guarantee it's some weird fuckery with the newlines and the way Scanner is reading them in from stdin.

try using
Integer.parseInt( in.nextLine() )

instead

The Open Watcom version works on Linux and DOS too.

Does it ever output "Enter prefix size"?

rude

Enter prefix size: asdf
Invalid input. Must be an integer.
Enter prefix size: asdf
Invalid input. Must be an integer.
Enter prefix size: 4
1
11
21
31
41
51
61
71
81
91
101
Got it!
works on my machine.

This did it. Thanks user!
while (true) {
try {
System.out.print("Enter prefix size: ");
//prefixSize = in.nextInt();
prefixSize = Integer.parseInt( in.nextLine() );
break;
} catch (NumberFormatException e) {
System.out.println("Invalid input. Must be an integer.");
}
}


Might be a speed thing, then.

well that's a pain in the ass. thanks for the advice btw!

How hard is it to learn R?

not that harRRrd

If the goal is to key log someone, this would get caught by any antivirus. No obfuscation, no av evasion, no persistence etc. Otherwise, if an exercise, it's a good start.

If you're up for it, maybe have a go at dynamically loading and resolving dlls (like what malware does) so it doesn't reveal much information when the binary is checked with a tool like peid etc

Hook the keyboard functions (not sure if you have to have callbacks from C code to do this in go?). Maybe see if you can detect what hooks your antivirus installs and unhook them(most av will detect this without replacing the hooks or messing with av internals.

Yay, I created bignum.c!
#include
#include
#include

#define ASCII_OFFSET 48
#define GET_VALUE(x) (x - ASCII_OFFSET)

#define DECIMAL_POINT 10
#define FILLER 11
#define NEGATIVE_VALUE 14
#define POSITIVE_VALUE 15

typedef struct bcd {
unsigned char h : 4;
unsigned char l : 4;
} bcd;

void* bignum_new(const char* bignum) {
int length, i, buf;
void* bignum_buf;

length = strlen(bignum) / 2 + 1;
bignum_buf = calloc(length, sizeof(char));
if (bignum_buf == NULL) return NULL;

i = 0;
buf = -1;
if (*bignum == '-') i = 1;
for (; *(bignum + i); i++) {
buf *= -1;
if (*(bignum + i) != '.' &&
(*(bignum + i) < '0' || *(bignum + i) > '9')) {
return NULL;
}
else {
if (buf > 0) {
((bcd*)(buffer+i/2))->h = (*(bignum + i) == '.' ?
DECIMAL_POINT :
GET_VALUE(*(bignum + i)));
} else {
((bcd*)(buffer+i/2))->l = (*(bignum + i) == '.' ?
DECIMAL_POINT :
GET_VALUE(*(bignum + i)));
}
}
}
if (buf > 0) {
((bcd*)(buffer+i/2))->h = FILLER;
goto rest;
} else {
rest:
((bcd*)(buffer+i/2)->l = (*(bignum) == '-' ?
NEGATIVE_VALUE :
POSITIVE_VALUE);
}
return buffer;
}

Congratulation anime memer!
Here's your reward.
youtube.com/watch?v=1Bix44C1EzY

tfw when I just finished doing the huffman coding in C and there isn't a single problem with my code.

yes there is

typedef struct bcd {
unsigned char h : 4;
unsigned char l : 4;
} bcd;

What does that colon do?

no you little faggot

Bitfields

What's wrong with this while loop?

while (counter < numOfStudents) {
cout

>*(bignum + i)
Just use bignum[i].
>(bcd*)
Stop breaking the strict aliasing rule.
Use a union instead.

It's a bitfield.
h and l take 4 bits each.

It's not written in rust

Here's the rest of the code

#include "stdafx.h"
#include

using namespace std;

int main()
{
int numOfStudents, arrayOfStudents[25], counter = 0;

do {
cout > numOfStudents;
} while (numOfStudents < 1 || numOfStudents > 25);

while (counter < numOfStudents) {
cout

Why is python so unpopular?

>Use a union instead.
Elaborate?

because it's productive

Try using cin.ignore() look it up, it's probably because it's eating a new line on every loop

This happens with C++ when you use cin in loops

>there isn't a single problem
if by that you mean there are literally dozens of problems

arrayOfStudents is an array of 25 integers, not strings.

i dunno why you wouldn't just use a wector instead of an array

Oh duh. Thanks, man. I actually noticed that right before I updated this thread.

I was going to rewrite your code to do it correctly, but I see you haven't even declared "buffer" anywhere.
Is that supposed to be "bignum_buf"?
If it is, why the hell are you using void pointers? Why not just make it a bcd pointer?

>wector
Hi Chekov

What about if you run Linux with no antivirus?

> blog posting
> avatar fagging
> no code tags
> "learning operators in unity"
> can't code for shit

we got an 8 year old here

but that doesn't answer my question?

Whats a good method of listing names from an array in an alphabetical manner?

sort

explain

Using a sorting library is a good method

any in particular?