/dpt/ - Daily Programming Thread

Ayden Evans
Ayden Evans

What are you working on, Cred Forums?

Previous thread: credforums.com/thread/64786774/technology

Other urls found in this thread:

crypto.stackexchange.com/questions/1025/can-one-generalize-the-diffie-hellman-key-exchange-to-three-or-more-parties
tornadofx.io/
pastebin.com/QxikmuGm
golang.org/doc/faq#generics
success.outsystems.com/Evaluation/Getting_Started_With_OutSystems/05_Does_OutSystems_help_customers_build_applications/40_Expert_Services
github.com/puddly/android-otp-extractor
github.com/qdot/deldo
credforums.com/thread/64787480/technology
youtube.com/watch?v=FQRW0RM4V0k
stallman.org/articles/on-hacking.html

James Carter
James Carter

java

Jason Nelson
Jason Nelson

web
assembly

Adrian Bennett
Adrian Bennett

pls no

Jackson Stewart
Jackson Stewart

Im currently trying to build open scene graph. or should I say I built it except like 4 or 5 plugins.

I made the project with cmake and all dependencies are provided and basically everything works. except I get those problems when I compile it.

I already fixed a bunch if other problems by compiling the dependencies in question myself. but there seems to be a deeper problem that it doesnt work out of the box as it should. anyone some ideas?

Henry Cook
Henry Cook

first for nim!

Joseph Ward
Joseph Ward

last for crystal

Gabriel Scott
Gabriel Scott

Second for nim. Currently porting my game engine from Rust.

Brayden Wood
Brayden Wood

If you used C you would have been first

Chase Miller
Chase Miller

but I did use C, in the long run at least, after compiling

Brody Bell
Brody Bell

Not if you include development time

Ian Nguyen
Ian Nguyen

If you used C you would have been first
in highest bug count? Definitely
/samefag

Wyatt Jones
Wyatt Jones

I'm working on a java app. Why a java app in 2018 you may ask? Because our group of 7 people is too uncoordinated to be able to setup a database and a PHP server so we're just hardcoding the data in

Jacob Ortiz
Jacob Ortiz

My latest act of artistic genius, a la Fortran:

C Uses Newton's Method to find the square root

PROGRAM SQRT
REAL NUM
REAL NEWTON ! Not including this caused a type mismatch error.
REAL X
WRITE(UNIT=*,FMT=*) "Enter a number: "
READ(UNIT=*,FMT=*) NUM
X = NEWTON( NUM )
IF( MOD( X, 1.0 ) .LT. 0.01 ) THEN
WRITE(UNIT=*,FMT='(1X,I9)') INT( X )
ELSE
WRITE(UNIT=*,FMT='(1X,F13.9)') X
ENDIF
END

FUNCTION NEWTON( NUM )
REAL NUM
REAL NEWTON ! Guess
REAL DIV ! Relative reciprocal of guess
NEWTON = 1.0
50 DIV = NUM / NEWTON
NEWTON = (NEWTON + DIV) / 2
IF( ABS( NUM - (NEWTON * NEWTON) ) .GT. 0.001 ) THEN
GOTO 50
ENDIF
END

Nathaniel Collins
Nathaniel Collins

No.

C Uses Newtons Method to find the square root

PROGRAM SQRT
REAL NUM
REAL NEWTON ! Not including this caused a type mismatch error.
REAL X
WRITE(UNIT=*,FMT=*) "Enter a number: "
READ(UNIT=*,FMT=*) NUM
X = NEWTON( NUM )
IF( MOD( X, 1.0 ) .LT. 0.01 ) THEN
WRITE(UNIT=*,FMT='(1X,I9)') INT( X )
ELSE
WRITE(UNIT=*,FMT='(1X,F13.9)') X
ENDIF
END

FUNCTION NEWTON( NUM )
REAL NUM
REAL NEWTON ! Guess
REAL DIV ! Relative reciprocal of guess
NEWTON = 1.0
50 DIV = NUM / NEWTON
NEWTON = (NEWTON + DIV) / 2
IF( ABS( NUM - (NEWTON * NEWTON) ) .GT. 0.001 ) THEN
GOTO 50
ENDIF
END

Isaac Hill
Isaac Hill

C on suicide watch

Eli Butler
Eli Butler

Re-learn javascript
Learn NoSQL DB

Ethan Ross
Ethan Ross

implying any amount of money can compensate for the hours of your life lost being a webmonkey

Jason Ramirez
Jason Ramirez

What do you guys think about round-robin DH using RSA private keys as the DH private exponent? If I use that system, I could also use the private key to verify identities, killing two birds with one stone.

Jaxon Lopez
Jaxon Lopez

RoR
Obj-C

Wrong.

Jacob Flores
Jacob Flores

Speak English, doc

Henry Gutierrez
Henry Gutierrez

Isn't that how it's done already? I did an implementation a while back but can't remember exact details

Wyatt Thomas
Wyatt Thomas

crypto.stackexchange.com/questions/1025/can-one-generalize-the-diffie-hellman-key-exchange-to-three-or-more-parties

Hunter Long
Hunter Long

Ah fuck you're right, SSL uses asymmetric keys.
I need to think before I post.

Jaxon Jackson
Jaxon Jackson

For one of my classes we're doing an engineering project and my group wants to make a mockup of the app. I got stuck with that part. How would i even go about learning this? I have four weeks and i took a java class. It doesn't have to do anything. I just want to make it look good and have some clickable buttons. And maybe a loading screen when the app opens up.

Hudson Martin
Hudson Martin

You could be a nonce and embed a webpage in the app, rendered with JavaFX.

Carson Cox
Carson Cox

Powerpoint. Not even joking.

Evan Gonzalez
Evan Gonzalez

Kotlin + TornadoFX
tornadofx.io/
- boilerplate-free (picrel)
- screencasts
- well-supported (Google!) language by the makers of the most used JVM IDE
/shill

Dominic Rodriguez
Dominic Rodriguez

Visual Basic
Hahahahah fucking why

Adrian Brooks
Adrian Brooks

any questions?

Benjamin Reed
Benjamin Reed

does anyone here have a simple C/C++ example of libxml getting data out of xml document with the said document attached?
i only found tutorials (in jargon) that work on god knows what and in the end i have no idea what's going on

Jose Perry
Jose Perry

One of our clients has a Pajeet-made VB.NET project that we've been ordained by the gods of cruelty to rescue. It's been two years, and we're still working on it.
I fucking hate VB.

Brody Jenkins
Brody Jenkins

Nice job, Pig Fucker.

Elijah Jackson
Elijah Jackson

I know even less web development than i know java
I was thinking of uploading it to the play store so my class could download it. We have to present this thing so i wanted to ham it up

Benjamin Turner
Benjamin Turner

You have to do it for Android? That won't be bad, there are plenty of ways to mockup apps.

James King
James King

You Can Write FORTRAN in any Language

Camden Cook
Camden Cook

What exactly uses x86 still? How are these platforms still relevant? And do i need to care if i'm building for newer software/hardware?

Jace Ross
Jace Ross

That's how Microsoft does it after all.

Ryder Smith
Ryder Smith

"Legacy" hardware. Until everyone stops using shitty compuers, you'll have to support it.

Colton Gonzalez
Colton Gonzalez

Ok some of the hard problems should be super hard

Eli Turner
Eli Turner

Taking this challenge now that stomach is full, going for at least 3 of the 5 gets.

Alexander Thomas
Alexander Thomas

well shit

Logan Ramirez
Logan Ramirez

Euler's in C++.

Samuel Davis
Samuel Davis

I know. That's why I like the direction of WebAssembly and things like that. The less build targets you as a developer have to hit, the easier it is to maintain.

Christian Anderson
Christian Anderson

Aren't modern API's designed to support both versions in one source code?

Tyler Howard
Tyler Howard

You still have to compile your code twice

Dominic Jackson
Dominic Jackson

sataniaposting
/bant/
Cancer, begone.

Dominic Mitchell
Dominic Mitchell

If you compile to x86, depending on the language, it is supported in 64-bit as well. Just depends. But like said, you still have to compile it twice.

Andrew Martinez
Andrew Martinez

still supporting x86 when, even some of the major distros stopped supporting it
sasuga, /dpt/

Ryan King
Ryan King

I don't have to but i'm pretty sure you have to have a developer by to create apple apps, right? And i wouldn't be able to test it on my own phone

Jonathan Reed
Jonathan Reed

I remember jokes being made about how dilapidated VB was in the fucking 90's, the fact that anyone could still be using it 10 years after the plug was pulled makes me believe those same users enjoy fucking corpses

Hudson Ortiz
Hudson Ortiz

If you turn on USB debugging on your phone (developer mode setting), and allow to install apps from untrusted sources, you can certainly test it on your own phone.
But you do need to have a developer license to publish to the Play Store.

Brody Wilson
Brody Wilson

That project makes me want to convert to Islam, nuke the entire planet, and rape every person that I find in Heaven. VB.NET WinForms + DataSets + SQL Server, its like a glitch in the fucking Matrix.

Hudson Butler
Hudson Butler

(÷∘2÷+⊢)⍣=

Connor Ross
Connor Ross

Sure, I will leave but only if you can make something better than what I make.

currency converter
venford's law
graphic analog clock
draw a spinning 3d cube
tcp chat program with basic encryption
create a hsv color representation

I'll be making at least 3 of these.

John Taylor
John Taylor

tcp chat program with basic encryption
not making a WebRTC DataChannel voice + video + chat app with RSA-4096 encryption
You really do belong in /bant/

Jonathan Bailey
Jonathan Bailey

That was what the challenge said, literally.
implying I'm not making the encryption algorithm as well.

James Martin
James Martin

Now that I think about it, what does the "create" in
create a hsv color representation
even mean? And wouldn't CIELAB or CIELUV (or to keep the hue component, CIELCh) be more interesting anyway?

John Young
John Young

WS1S will save systems programming.

Jackson Cox
Jackson Cox

post screenshots of your code

Carson Wilson
Carson Wilson

if you can make something better than what I make.
better than what i make
Anything is better than nothing.

Adrian Nelson
Adrian Nelson

i use vsc too, it's pretty comfy

Jeremiah King
Jeremiah King

Nothing interesting yet.

Charles Davis
Charles Davis

anyone here ever used java swing? How does a nigga go from one form to another?

William Jackson
William Jackson

Perl
le currant jahr
shiggy

Kayden Cruz
Kayden Cruz

I imagine they meant something like this.

Jackson Lopez
Jackson Lopez

Can a kind soul explain to me what are "generics" and it is a problem that Golang doesn't have them?
[/NotAProgrammer]

Aaron Peterson
Aaron Peterson

I had to write a script to deploy the database project for this project, since I can't use VS2017 in Debian. Ignore the spaghetti code.

Wyatt Lewis
Wyatt Lewis

() => console.log(...)

instead of a simple

console.log(...)

why

Aiden Perez
Aiden Perez

It's a chain of promises that resolves sequentially.

Zachary Reyes
Zachary Reyes

I could've easily just put them inside the next block, but this was at about four thirty last night, so I wasn't at my best. I'm just happy it deploys!

Joshua Allen
Joshua Allen

What would be the problem if you didn't use

 async 
keyword?

Hudson Thompson
Hudson Thompson

I'm someone else, but he couldn't have used await, I think?

Jonathan Morales
Jonathan Morales

The mssql package isn't synchronous, so I'd have to either do async/await or a bunch of callbacks.

Matthew Long
Matthew Long

java

Is exercise 8.7 expecting me to use the sieve method I made in 8.5?
Cos I'm trying to write a method that doesn't call other methods and I can't get it to work.

Logan Parker
Logan Parker

There are different kinds of numbers, like whole numbers and fractions.
Say you want some code that adds up all the numbers in a list.
With generics you can write a single add function that applies to a list of whole numbers, a list of fractions, a list of real numbers or whatever.
Without them you must either copypaste your code into multiple functions, or lose type safety (i.e. the knowledge of what kind of number is being added) in order to do this.

Josiah Butler
Josiah Butler

But what's nice is since I am doing things asynchronously, this is all I have to do to run things sequentially: pastebin.com/QxikmuGm

Cameron Cox
Cameron Cox

my man. How's it going? have you found any problems to be particularly interesting?

Aaron Moore
Aaron Moore

Ok thanks, I see it.

And is these a good reason why Golang doesn't add this?

Wyatt Nelson
Wyatt Nelson

and the one in 8.6 i assume. that's one line of code though

Nicholas Morales
Nicholas Morales

Not same person, but see golang.org/doc/faq#generics

Justin Rodriguez
Justin Rodriguez

Adjust your autism.
8.5,6,7 are clearly laid out in such a progression that they blatantly invite you to reuse the code written in the previous exercise.
This is called reading between the lines. Useful for interacting with actual human beings too.
/shitpost
Srsly tho, do it via the expected approach -
reusing the code. Only then, if you're in the mood, do your own shit as an alternative implementation alongside the expected one.

Nicholas Morales
Nicholas Morales

What is a OutSystems Expert?

Kayden Kelly
Kayden Kelly

I just want to make it look good and have some clickable buttons.
matlab gui
look good
lower your expectations on that point though

Adam Kelly
Adam Kelly

Cuz go is Google's tard-proof language, meant to be simple enough that it minimizes fuckups by its pajeets and SJW koders.

Sebastian Wilson
Sebastian Wilson

OutSystems Expert
success.outsystems.com/Evaluation/Getting_Started_With_OutSystems/05_Does_OutSystems_help_customers_build_applications/40_Expert_Services

Colton Torres
Colton Torres

fuck off, shill

Brayden Ross
Brayden Ross

?

Caleb Watson
Caleb Watson

Thanks

Owen Barnes
Owen Barnes

What are you talking about? I did a Google search, I didn't even read the link.

Jose Butler
Jose Butler

Made some contributions to a python script that extracts 2fa codes from your android, still waiting for google to receive my PR.

Jason Nguyen
Jason Nguyen

post link

Justin Allen
Justin Allen

Thanks. I've been away from general learning for some time now.

Matthew Richardson
Matthew Richardson

github.com/puddly/android-otp-extractor
My "real" PR hasn't been accepted but hopefully will be soon, I guess he just merged the second one and that broke the first.

Angel Fisher
Angel Fisher

#include<vector>
using std::vector;
vector<bool> sieve(int n){
if(n<1) return {};
if(n==1) return {0};
vector<bool> res(n);
res(n).flip();
res[0]=0;
res[1]=0;
for(int i=2; i<n; i++){
if(res[i]){
for(int j = i*i; j<n; j+= i){
res[j]=0;
}
}
}
return res;
}

bool areFactors(int n, const vector<int>& factors){
for(const auto& v : factors){
if((v==0) || (n%v != 0)) return false;
}
return true;
}

bool arePrimeFactors(int n, const vector<int>& primefactors){
auto primes = sieve(n);
int product = 1;
for(const auto& v : primefactors){
if((v==0) || (n%v != 0) || !primes[v]) return false;
product *= v;
}
if(n != product) return false;
return true;
}

Bentley Martin
Bentley Martin

res[0] = res[1] = 0;

Cooper Flores
Cooper Flores

for(int j = i*i; ...)

Huh?

Cooper Sanchez
Cooper Sanchez

I'm trying to write a method that doesn't call other methods
Why?

Luke Jones
Luke Jones

I thought that's what they wanted. Anyway I've done it using the sieve method from the previous question.

Jason Torres
Jason Torres

Set the multiples of the prime to false. Obviously you don't start at the prime.

Asher Cox
Asher Cox

153 screenshots

you're writing a rust compiler in python?

is that right?

Ryan Torres
Ryan Torres

i want to learn programming. What`s the best?i heard java

Jeremiah Turner
Jeremiah Turner

i heard java

weak bait is weak

Jonathan Morgan
Jonathan Morgan

java is where you start if you want to be a code monkey

Angel Johnson
Angel Johnson

Python is the best for getting started and actually getting things done with it.

Kayden Perez
Kayden Perez

Java
code monkey
$90K jobs

?

Joshua Diaz
Joshua Diaz

not bait. I really am just starting i just don`t know which computer language is the best one to find jobs for. Lots of places say java and second is php

Austin Scott
Austin Scott

Compiler for a c like lang. Compiler is written in python and I'm writing a backend that targets a VM that's written in rust.

Lucas Mitchell
Lucas Mitchell

targets a VM that's written in rust.

so you write in a C like language that generates rust assembly code?

William Bell
William Bell

I thought that's what they wanted.
But... why?

Chase Murphy
Chase Murphy

I'm doing it. No idea if it's going to land me anything though. I do have a maths degree (from 7 years ago, it's a lower second and I've been working in a supermarket for 4 years and I'm old.)

I kind of struggling to maintain momentum though, porn and vidya are literally beside me.

Jayden Reyes
Jayden Reyes

every code gets translated into assembler which then into machine code
go kys now!

Ian Scott
Ian Scott

compiler in python
enjoy your compile times

John Peterson
John Peterson

Literally why?
Are you a masochist for tedium?

Jayden Garcia
Jayden Garcia

It's a requirement from my Rust bootcamp

James Cruz
James Cruz

I wanted to reinstall mingw and msys since my version is too old amd deprecated but I forgot that sourceforge became bloatware now. The installer of this mingw release wants a registration code:
After clicking Next, please do the following:
1.- Enter a genuine organisation name in the second field
2.- Take a screenshot
3.- Email the screenshot to the email address below
These details are required in order to notify you of updates and new versions as they become available. You can also request new features and/or technical support

I'm trying to bypass this crap with immunity debugger but I can't find anything, I tried using a randomly generated string as registration code to find it easily but no results show up.
Can anyone give me some directions, for example some guide with a similar example if possible. I wanted to learn assembly some time ago but never found the motivation to get serious, this looks like a good chance.

The reason why I want to install this program even though I could use any other mingw release out there is that I hate having to register to install free software, I'm on very low speed internet and it kinda pissed me off because the installer is over 150MB, this is the main reason, the other reason is that I want to learn how to fiddle with interfaces like this so I can do the same for other software.

John Allen
John Allen

It's a requirement from my Rust bootcamp
[x] doubt

Angel Mitchell
Angel Mitchell

I'm overthinking things, I thought it was too obvious.

Liam Bell
Liam Bell

I dont plan on adding many features, currently most of the time is spent parsing and the IR generation is lightweight, but that might change if I get around to adding generics.

Jose Green
Jose Green

Utils

val primes: Stream[Int] = 2 #:: Stream.from(3) .filter {n => primes .takeWhile{_ <= math.sqrt(n)} .forall{n%_ !=0} }

def isPrime(n: Int) = primes .dropWhile{_<n} .head == n


8.5
def sieve(n: Int) = (0 until n) map isPrime

8.6
def areFactors(n: Int, xs: Seq[Int]) = xs forall {n%_ == 0}

8.7
def arePrimeFactors(n: Int, xs: Seq[Int]) = xs.product == n && xs.forall(isPrime)

Jose Jackson
Jose Jackson

i*2 has already been covered when 2 was scanned. Same with i*3, i*4=2i*2, i*5, ...., i*(i-1).

Daniel Morales
Daniel Morales

Just learn C++.

Logan Green
Logan Green

def sieve(n: Int) = (0 until n) map isPrime

Brainlet.

Ryan Miller
Ryan Miller

github.com/qdot/deldo

Isaiah Sanchez
Isaiah Sanchez

Mobile apps are the future.
That means you should learn Java and Swift.

I'm surpised I don't see more adverts for Swift developers.

Jason Gomez
Jason Gomez

I'm half way through the java book, wouldn't it be better to finish it? I know a couple of people who claim they can get me something as long as I get some certs.

Camden Robinson
Camden Robinson

It's useless when you have a prime stream that's calculated basically in the same manner. But hey, might as well satisfy the problem statement for completeness' sake.
Not focused on utmost efficiency, obviously, but the approach ain't too bad at toy example scales.
We're optimizing for semi-smug one-liners after all.

Wyatt Cooper
Wyatt Cooper

Swift
need to have apple hardware
100 dollars a year

Angel Walker
Angel Walker

I've read the book but haven't finished the exercises of the first chapter yet.

Josiah Gonzalez
Josiah Gonzalez

tfw unironic triangle appears

Evan Brooks
Evan Brooks

Are you making a game?
see you in 10 years

Nathan Barnes
Nathan Barnes

True. But the people need their iPhone apps.

Julian Rogers
Julian Rogers

Grats.

Jayden Young
Jayden Young

couldn't care less that people need apps

Cooper Scott
Cooper Scott

boogie

Benjamin Butler
Benjamin Butler

󠇦 󠇦 ▲
▲▲

Oliver Jones
Oliver Jones

Why does no one submit pull requests for depression?

Jaxson Carter
Jaxson Carter

see you in 10 years
implying
It goes much faster once you make the fucking triangle appear. Been through this a couple of times already.

Easton Adams
Easton Adams

but i want a AAA game so get to work.

Landon Rodriguez
Landon Rodriguez

but i want a AAA game
Getting there. (pic related)

Joseph Walker
Joseph Walker

How do i make myself look competent at the interneship/job fair, when the only coding ive done is for coursework.
I'm a senior.
Should I just kill myself now?

Nathaniel Davis
Nathaniel Davis

not writing your own vulkan wrapper

Jacob Torres
Jacob Torres

Lol before you kill yourself please consider that there are self-taught people here who can't go to university at all.

Jaxson Jackson
Jaxson Jackson

Remember, make eye contact, give a firm handshake.

Hudson Mitchell
Hudson Mitchell

gamma-corrected?

Adam Flores
Adam Flores

Corollary: avoid female company representatives

Luke Clark
Luke Clark

On the contrary, don't throw away your (obvious) stud suaveness, but go directly for the broads that can be more easily manipulated.
Honeytrapping works both ways, after all.

Andrew Perez
Andrew Perez

So user, what makes you unique? What are some of your interests?

Lucas Butler
Lucas Butler

Because the source code is not freely available.

Adrian Edwards
Adrian Edwards

Just don't be yourself.

Jose Murphy
Jose Murphy

Programming socks. Dragon dildos.

Nathan Martinez
Nathan Martinez

How do i make myself look competent
Ask dressing recommendations to /fa/
Can't go wrong.

Colton Baker
Colton Baker

Guessing this is you, but just in case, see the replies on credforums.com/thread/64787480/technology

Lucas Hernandez
Lucas Hernandez

/fa/ would probably tell him to dress like some hipster dork

Jaxson Barnes
Jaxson Barnes

Tried this earlier but everyone was busy screeching at each other

I'm doing some JS for WebGL and am kind of lost as to how to structure larger projects like simple 3d engines. I come from C++ and C#, so I have no idea what to separate on other files, whether it is preferred to stick to OOP or a more functional approach, etc

Just don't want to end up with a huge bowl of spaghetti a couple months from now

Mason Carter
Mason Carter

full rick

Dominic King
Dominic King

hello friends! i convinced my gf to learn python and code with me for funsies (its something shes always wanted to do, she says) do you guys have any cool ideas for projects? or should we just go through the challenges or something

Nathan Lee
Nathan Lee

Why does my C pointers get fucked up...
I start with
ptr: 0xddf688
then i add (size_t) 4
and it becomes.
ptr: 0xddf77000000000

Josiah Myers
Josiah Myers

Programming challenge: Draw a strange attractor

Andrew Gutierrez
Andrew Gutierrez

Purdy

Brandon Allen
Brandon Allen

Oblig
I've got a python for yo girl right here!

Christopher Long
Christopher Long

I understand monads, now what

Jordan Brooks
Jordan Brooks

I was thinking about getting into Swift, kinda hard when I don't own any apple products though. So many people have an iPhone, most people I know use them just for the camera, but I can see how getting involved in app development on their platform would be beneficial, looked up the license and it is 100 dollars a year. Do you have experience with it? Do you really think it's worth it? Should I stick to java?

Carson Martinez
Carson Martinez

Now you act superior and look down on everyone else.

Carson Sullivan
Carson Sullivan

rolling

Nathan Kelly
Nathan Kelly

Do you have experience with it?
Honestly, not more than one school lab and I hated it.
But I really do think app development is the future, and no-one's going to take an app seriously if it's not on at least the two big platforms.

Sebastian Sanders
Sebastian Sanders

void reverse(char * s){
char line[MAXLINE]

Ew. Either use dynamic memory or do it in place or use c++.

#include <string>
#include <string.h> // for strlen
#include <iterator>
#include <algorithm>
using std::string;

//option too poor for C++17
void ReverseString(char * str){
int n = strlen(str); // = std::char_traits<char>::length(str);
for(int i = 0, j=n; i<j; ++i, --j){
char t=str[i];
str[i]=str[j];
str[j]=t;
}
}

//option 1
string ReverseString(string str){
for(int i = 0, j=str.lenght(); i<j; ++i, --j){
std::swap(str[i], str[j]);
}
return str;
}

//option 2
string ReverseString(const string& str) {
string result;
for (auto it : str){
result=it + result;
}
return result;
}

//option 3
string ReverseString(const string& str) {
string result;
for (auto rit = str.rbegin(); rit != str.rend(); rit++){
result.push_back(*rit);
}
return result;
}

//option 4
string ReverseString(const string& str) {
string result;
std::reverse_copy(std::begin(str), std::end(str), std::begin(result));
return result;
}

//option 5
string ReverseString(const string& str) {
string result;
result.assign(str.rbegin(), str.rend());
return result;
}

//option 6
string ReverseString(const string& str) {
return string(str.rbegin(), str.rend());
}

//option 7
string ReverseString(string str) {
std::reverse(std::begin(str), std::end(str));
return str;
}

Evan Watson
Evan Watson

needing 8 different ways to reverse a string

Blake Ramirez
Blake Ramirez

C++ general

Ayden Adams
Ayden Adams

Trying to learn about hillclimbers & want to ask about the Knapsack problem. Basically I'm confused about how you would solve this by using a population of hillclimbers to try solve it in parallel when you have a Knapsack of about a capacity of 20 cubic inches & n=10 items of various sizes. The result is meant to be the Knapsack only the items that will provide the greatest total benefit within the knapsacks capacity. I'm trying to do this in Matlab.

How would use this by implementing it by doing it by:
1. An individual encoding the information solutions to the task
2. A genotype to phenotype mapping. How should the genotype be interpreted as
encoding a solution to our problem?
3. A fitness function. Basically a way to evaluate how good each phenotype is as a
potential solution to the card-sorting problem.
4. A method for mutation. Is it necessary to allow random changes in the offspring
produced by reproduction in order to maintain variability.

Also what's everyone's opinion on Julia? Is it worth learning?

Carter Morgan
Carter Morgan

If you can't find your own registration code, how about trying to find "Invalid Registration Code"?

Your debugger should have a "find all strings" or "find all references" button. If it doesn't, you might have to search every modules .rdata or memory manually. At some point the program will have to grab the "Invalid Registration Code" string. If you know the exact location in memory where that string is, you can set a hardware breakpoint to trigger when the program tries to access it. That access will almost definitely be when you've entered an invalid registration code.

If that works then great. You'll either find yourself in the middle of ntdll.dll or somewhere silly like that or in the middle of a function in the program. You can use the call stack or your own intuition to find out what functions and what branches were taken to lead you to that point. What you're looking for at this point is a function or branch that is only executed when you press the button that causes the registration code to be checked. Once you find that, you can start poking around in there and see if you can find the exact moment where your registration code is checked. You can sort of do that by littering it with breakpoints before and after function calls to see which get called and which do not, until you can work your way back to the exact moment the code gets checked.

Lucas Reed
Lucas Reed

lmao fuck

Josiah White
Josiah White

Once you find that, I would suggest determining if the check is entirely local or if it needs to connect to the internet to do it. (You can do that by running it in Sandboxie with internet access denied or turning your internet off and seeing if it complains about needing the internet) If it's connecting to the internet, you need to find out where it does and intervene yourself. Pull a Jedi mind trick and trick the program into thinking it connected to the server and the sever said everything was all OK. If it's local, you have the option of trying to reverse engineer the checking algorithm and creating your own registration code (ranges from easy to nightmare depending on how they've implemented it) or seeing if there's an easy point where it checks a single boolean value (output of the check function?) and flip it. It's also possible that it's both.

Putting your own registration code in is a good idea, but it's hard to track it down without a rough idea of when it might appear. If you get desperate you can see if your debugger has a trace function and set it to breakpoint when part of your registration code is loaded into one of the registers, but that would take a while to execute.

This would be what I would do in my first attempt. If that doesn't work there's also a few other ways you can try it - I can't pretend that I'm the most experience person myself. A lot of this might sound like nonsense, and I might not have explained it well, but if you persevere you will get there eventually.

David James
David James

NEXPTIME-complete

Julian Moore
Julian Moore

Also what's everyone's opinion on Julia? Is it worth learning?

It's in either the "too new, don't have your code broken by major changes" or "so old and yet has so little adoption, must be dead" camps.

Benjamin Sanders
Benjamin Sanders

roller

Mason Thompson
Mason Thompson

too new, don't have your code broken by major changes
why does this even matter? That's part of the fun of pre 1.0 langs. You get to watch it change and hopefully evolve with time.

Michael Allen
Michael Allen

how many layers of asymptotic complexity are you on right now?
you are like a little O(1)
watch this

Carter Jenkins
Carter Jenkins

def main():
graph = {
"a" : ["c"],
"b" : ["c", "e"],
"c" : ["a", "b", "d", "e"],
"d" : ["c"],
"e" : ["b", "c"],
"f" : []
}

print(generate_edges(graph))
print(list(graph.keys()))

def generate_edges(Graph):
edges = []

for node in Graph:
for neighbour in Graph[node]:
if (neighbour, node, 2) not in edges:
edges.append((node, neighbour, 2))
return edges

if __name__ == "__main__":
main()


Python noob and actual brainlet here.
How should I edit this block of code so my graph class can work with weighted links or edges? Thank you guys.

Kayden Torres
Kayden Torres

What the fuck is the point of doing any of this shit?
Literally why.
I mean no offense to any of you guys but this just makes me think as programmers as code monkeys. No mean to offend. Just tell me something to change my mind.

Landon Myers
Landon Myers

she doesn't do code katas
she doesn't have a diverse range of problem-solving skills
she is the real code monkey

Owen Harris
Owen Harris

The challenges?
They're just meant as a jumping off for people who need a project or want to gauge where they are. Thinking through the implementation in your head is a lot different than actually writing it.

Benjamin Lewis
Benjamin Lewis

What the fuck is the point of doing any of this shit?
Practice, and testing your skill.

Justin Cooper
Justin Cooper

Pic is what it's like to be an employed programmer.

David Gomez
David Gomez

- don't name your vars 'graph' and 'Graph'.
-- Graph looks like a class name
-- having them only differ by capitalization is a recipe for bugs
-- try e.g. 'graph' (as it's clear it's an adjacency list) and 'graphAdjList' - as given Python's duck typing, it's useful to hint at what format the function parameter is
How should I edit this block of code so my graph class can work with weighted links or edges?
- one way to do it would be to switch your neighbor lists from lists of nodes to lists of (weight, node)
(code was supposed to be here, but admins are incompetent)
Then you just adjust the inner for loop to handle that.
Although I'd personally consider switching to a (set of nodes, set of edges) representation if you don't have outside requirements.

Gavin Walker
Gavin Walker

she
keep dreaming

Justin Sanchez
Justin Sanchez

Fuck adjacency lists. Uses a matrix with weight values.

Connor Perry
Connor Perry

Proficiency in any trade is based on practice. But you can't throw your head against impossible tasks all the time so they have a bunch of simple ones on there.
I certainly don't find them all that useful but it's on the right path with some of the bigger projects. It can certainly be a useful experience to design a dungeons and dragons AI.

I'd rather see bigger 'handle generic user code' challenges though. Since most programmers will use libraries.
Might help thread quality too.

Dylan Fisher
Dylan Fisher

just dicking with homework. I just really like that line of code circled in red.

James Murphy
James Murphy

Thanks for replying. I'll see what I can do, like I said I'm pretty bad at this.

Xavier Morgan
Xavier Morgan

I share your appreciation of that code. It's both clear and concise.

Michael Rivera
Michael Rivera

Can we talk about reverse engineering?

Bentley Robinson
Bentley Robinson

No worries m8, you've got the right approach to this whole learning thing.
Just keep on doing it and ya'll get better with time and practice.

James Bailey
James Bailey

I like deconstructed tacos

Adam Collins
Adam Collins

I dislike having irrelevant side-effects in print statements. You'll get bitten by that habit soon enough.
(but it is cute)

Levi King
Levi King

What irrelevant side effect are you talking about here?

John Martin
John Martin

as long as it's programming related.

Hudson Watson
Hudson Watson

scanf
printf
disgusting.

odd = size%2;
use odd= size&1;

Jackson Peterson
Jackson Peterson

--foo isn't a side effect
really nigga?

Robert Williams
Robert Williams

Cmon he's obviously quite new.
I think the idea is that you don't want things to 'happen' in a program in print statements. It eases reading since you can now presume a print statement just outputs program state so it can be 'skipped' if you want to just understand what's going on.
Replacing '--tries' with 'tries' and decrementing before the print deals with that.

Connor Sullivan
Connor Sullivan

average
not median
to the trash it goes

Isaiah Brooks
Isaiah Brooks

what the shit is this

Josiah Nelson
Josiah Nelson

Python: $100,717
Considering that, even if there is a particularly high demand for Python programmers (which I doubt), the fact that pretty much any normie/brainlet/hipster who wants to learn programming almost always starts with Python means that there is a steady, even overflowing supply of new Python programmers available to meet that demand, I have a real hard time believing that Python is more lucrative than professional software engineering languages like C/C++ or even something like Javascript.

Also, why is Objective-C on that list and not Swift?

Julian Brown
Julian Brown

Reminder that if you want your application to last the minimum you should do is to model your data.

You don't even have to use a database, you just need to know how each entity relates with other entities.

"Normalize your data" -- Jordan Peterson

Daniel Jones
Daniel Jones

tldr use a FPL
thanks petey

Nathan Jackson
Nathan Jackson

I use smalltalk and I think it's neat

Grayson Wilson
Grayson Wilson

I've had a bit to drink

// Fucked.cpp : Defines how fucked you are.
//

#include "stdafx.h"
#include <iostream>
using namespace std;

bool isFucked = true;
int h = 0;

void fuck(bool isFucked) {
while (isFucked) {
if (h == 0) {
cout << "AHHHHHHHHHHHHHHHHHHHH";
h++;
} else
cout << "H";
}
}

int main() {
fuck(isFucked);
return 0;
}

How can I improve this?

Justin James
Justin James

What do you like about smalltalk, user? Show me something cool in it!

Sebastian Nelson
Sebastian Nelson

um...i like the live debugging. it's cool!

Lucas Rogers
Lucas Rogers

dumb question but
how do I do 1 in 16 chances using rand() in c?

Christian Gonzalez
Christian Gonzalez

Don't shadow globals with function parameters.
Avoid globals in cases like these.
An infinite loop is undefined behavior, this is very bad. Because if you don't have any input reliance you're at the good graces of your compiler. Probably won't matter in these cases but do keep it in mind.
Integer overflow is undefined behavior. What you wanted here is probably to extract the if statement with the AHHH
out of the while loop and just leave cout <<"H" ; in the loop.

Landon Gonzalez
Landon Gonzalez

!(rand() % 16)

Something like that, maybe?

Jayden Hughes
Jayden Hughes

rand() % 16
This gives you a random number between [0,15]
Its biased by 1/RAND_MAX towards 0 (both the random numbers 16 and 0 give you 0).
Which is probably fine for your use.
Now you can decide that you only do something when this gives you zero back with if(rand() % 16 == 0)

Carter Cook
Carter Cook

thanks guys

Adam Scott
Adam Scott

over representation
Hmm actually it's worse than that I think.
Since you'll probably not map all of RAND_MAX evenly to your range.

Anyway this only really matters in lotteries and security.

Isaiah Torres
Isaiah Torres

Say i recovered an encryption key from a software, and i made a repository containing that key. How big of a trouble would i have if the software manufacturer found my repo?

Chase Wright
Chase Wright

Dunno what the company will do, but I know malicious actors will find that shit real quick

Kayden Robinson
Kayden Robinson

They could definitely fuck you if they felt like it.

Parker Cooper
Parker Cooper

malicious actors
wat

Easton James
Easton James

Fancy term for hackers

John Walker
John Walker

AI that replaces Anime pictures with frogs

Joshua Thomas
Joshua Thomas

don't make me post rms's rant about that term

Aiden Ross
Aiden Ross

youtube.com/watch?v=FQRW0RM4V0k

Brayden Adams
Brayden Adams

stallman.org/articles/on-hacking.html

Nathan Ramirez
Nathan Ramirez

I went to lunch with some GNU fans, and was sitting down to eat some tteokbokki (*), when a waitress set down six chopsticks right in front of me. It occurred to me that perhaps these were meant for three people, but it was more amusing to imagine that I was supposed to use all six. I did not know any way to do that, so I realized that if I could come up with a way, it would be a hack. I started thinking. After a few seconds I had an idea.

First I used my left hand to put three chopsticks into my right hand. That was not so hard, though I had to figure out where to put them so that I could control them individually. Then I used my right hand to put the other three chopsticks into my left hand. That was hard, since I had to keep the three chopsticks already in my right hand from falling out. After a couple of tries I got it done.

Then I had to figure out how to use the six chopsticks. That was harder. I did not manage well with the left hand, but I succeeded in manipulating all three in the right hand. After a couple of minutes of practice and adjustment, I managed to pick up a piece of food using three sticks converging on it from three different directions, and put it in my mouth.

Autism knows no bounds

Elijah Wilson
Elijah Wilson

Lady Gaga's approach to clothing seems like hacking to me.
umm

Jacob Howard
Jacob Howard

How greedy is your algorithm, Cred Forums?

Luke Bennett
Luke Bennett

Done, finally. The attractor is the Lorentz attractors, with parameters P, R, B. Initial point is stored in X. The 3D points are then projected isometrically with a common matrix. Output is a PGM. Shrinks to fit largest dimension to D pixels. Outputs correct sRGB-encoded grayscale.

⎕IO ← 0

X ← .5 .5 .5
(P R B) ← 10 28 8r3
D ← 1000

M ← ⍬
:forlcl i :in ⍳1000
M ,← ⊂X
X +← .01 × (P × X[1] - X[0]) ((-X[1]) + X[0] × R - X[2]) ((X[0] × X[1]) - B × X[2])
:endforlcl

M ← (⊢-[0](⌊/)) ((⍉⊃M) +.×⍨ ÷ 2 3 ⍴ (√2) ∞ (-√2), √6 (3÷2) 6)
K ← 0 ⍴⍨ ((⌊.5∘+)⊢×(⌊/D∘÷)) ⌈/ M
K[⊂[0] ⌊ .5 + (D - 1) × ÷∘(⌈/,)⍨ M] +← 1

⍞ ← 'P2 ', (⌽⍴K), ' 255 '
⍞ ← ,⌊ .5 + 255 × (×∘(12.92∘×)∨(∼⊣)×⊢∘(-∘.055×∘1.055)∘(2.4∘√))⍨∘(≤∘0.0031308)⍨ K ÷ ⌈/,K

Jeremiah Thomas
Jeremiah Thomas

Oh, and I forgot. This is the output for 10000 points.

Joshua Turner
Joshua Turner

open source space engine W H E N?

Dylan Wright
Dylan Wright

Normally, I would count string size and malloc some temporary space (your first example would've been a much better solution; furthermore, I now realise I would've forgotten to free the allocated memory afterwards), but this is an exercise in the first chapter of K&R and dynamic memory isn't expected for this part.
But yeah, your first solution would've been ideal.

Camden Perry
Camden Perry

Now do an adaptive stepsize method.

Leo Howard
Leo Howard

Now you realize that computational processes aren't modeled well by categorical notions and go back to programming like a sane human being.

Gabriel Scott
Gabriel Scott

cs major
tfw 5 years into a 4-year degree

anyone know this feel

Daniel Davis
Daniel Davis

Its biased by 1/RAND_MAX towards 0 (both the random numbers 16 and 0 give you 0).

Fucking CS majors... It's biases the the numbers less than (RAND_MAX+1)%modulus by
the ratio [(RAND_MAX+1)/modulus + 1] : [(RAND_MAX+1)/modulus] by looping around incompletely.

If (RAND_MAX+1)%modulus == 0 then there is no bias. On most systems RAND_MAX will be 2^15-1, 2^31-1, or 2^63-1 so you're fine if you use a power of 2 less than 2^15.

Joshua Bell
Joshua Bell

Learning temporal logic and model checking.

Carson Green
Carson Green

Trying to make backpropagation work in an example.

Disable AdBlock to view this page

Disable AdBlock to view this page

Confirm your age

This website may contain content of an adult nature. If you are under the age of 18, if such content offends you or if it is illegal to view such content in your community, please EXIT.

Enter Exit

About Privacy

We use cookies to personalize content and ads, to provide social media features and to analyze our traffic. We also share information about your use of our site with our advertising and analytics partners.

Accept Exit