/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1537982848765.gif (500x281, 71K)

Other urls found in this thread:

docs.python.org/3.7/library/exceptions.html#StopIteration
tiblar.com/
jobs.braveclojure.com/
github.com/0xF6
instagram.com/re.gate/
stackoverflow.com/jobs?q=cloujure
twitter.com/SFWRedditVideos

fuck opengl

Rust

Python is garbage.
Change my mind.

It's pretty comfy, what are your issues with it (except muh whitespace)?

docs.python.org/3.7/library/exceptions.html#StopIteration

> Multiple versions
> Quirks everywhere
> poor multicore support
> Not statically typed (For huge projects, it's a must)
> slow

computerlet here what is the point of exceptions and exceptionhandling? What are they even? Is it like a faulty wire or other hardware flaw? memory decay?

something goes wrong that the computer doesnt know what to do with, you want to have ways of managing it if it happens instead of everything just crashing

Anone... you can't be serious. I thought you already knew JavaScript well enough for this...

Attached: df89bee7135ca2093f82dbba319a3292.jpg (600x900, 41K)

im a moron. meant

I fucking suck at deducing what a block of assembly code is supposed to do after learning x86 for a few months. I'm trying to learn MIPS (and maybe 68000) for the purpose of romhacking/RE. What is a good resource to use? Should I just memorize as many opcode descriptions from the manual pdf unitl something clicks or follow some tutorial?

Attached: 65269684_385492285282256_3310280369761692754_n.jpg (640x550, 52K)

exceptions can mean different things depending on what layer you're working at

a cpu has exceptions which trigger when something goes wrong, e.g. when trying to execute an undefined instruction or accessing memory it does not have permissions to use. a handler is called which knows what to do with this situation.

high level programming languages may also have exceptions which work in an analogous way. something goes wrong and a handler is found and then called to deal with the situation non-locally

They represent any kind of error condition (oftentimes just unexpected program input) in a way that is more explicit (and often reserved for more "severe" cases) than stuffing an error indicator into a return value or status register (which, unless you're using languages such as Golang, can be conveniently ignored or misunderstood if you don't expect anything to fail).

I'm working on a social media site.
here's the production version: tiblar.com/
any input on design/functionality/etc would be appreciated

Attached: Screenshot_2019-07-09_19-17-49.png (1919x1049, 307K)

Feeling down because my school's library is donating all its old programming and computer science books and there's nothing I can do about it. But I guess thats what happens when the CS program transitions into a software engineering program.

I guess what I'm working on is trying to find a silver lining somewhere and maybe see if I can beg the librarians to let me borrow some of the old assembly manuals.

i remember you from /wdg/

Attached: 1562598530014.png (10000x10000, 2.6M)

>create account
>username: g
>email: g
>password: g

>it registers
really?

Where do I send my money to get a doll like her?

I'm using BeautifulSoup to fetch some specific links from a page. I am able to get print the links I want using this:

for link in soup.find_all('div', class_='r'):
print(link.a['href'])


But, I want to save those results in a text file. I tried converting the link variable to a string and save it but it saves just the last result.

Any ideas?

You're just printing into the file instead?
with open('somefile.txt', 'wt') as f:
# ...
for link in soup.find_all('div', class_='r'):
print(link.a['href'], file=f)

with open("log.txt","w") as log:
for link in soup.find_all('div', class_='r'):
log.write(link.a['href'])

i think you're overwriting it every time. try append mode. 'a' or 'wa' or something

res = ""
for link in soup.find_all('div', class_='r'):
res += str(link.a['href']) + "\n"

with open("log.txt","w") as log:
log.write(res)

>Unlike C/C++ where we can use sizeof() method to get an object size in bytes, there’s no true equivalent of such method in Java.

Why is Java such a shit language?

That's not the issue, if you open a file for writing it will be truncated and every write advances the file position by the amount of data written.
The actual issue is the lack of new lines, compared to this just concatenates all the URLs.

is it worth to learn C before I learn C#?

Yes, because C comes before the #

it is worth to learn it before everything
when you learn to make stack, queues, lists and trees with C, you can learn every other language in less than a month

OP here, the thing is that I have several "keywords" that I'm looking for in the page, and each of them has several links. With this I get just the last results, for that specific keyword, but I'm looking to write all the results in one single file. Is it possible?

Example:

keyword_1
url1
url2
url3

keyword_2
url1
url2

And so on...

both very equally convincing points, thank you very much!

Attached: 1518054166869.jpg (500x500, 44K)

And what would you need that for? Instances of both C++ and Java classes are opaque, you can't even poke around their innards reliably using offsetof() like you can in C structs.
As you can see in the article you've quoted, you can nevertheless acquire this information through JVM instrumentation the same way you can invoke low-level magic that hasn't been exposed through standard API functionality using sun.misc.Unsafe.

I changed my profile picture but it didn't update until I closed the guide. reloading the page didn't do it. just a note, maybe it was intentional but just making sure

C++ classes can be reliably manipulated by casting to unsigned char*.

You have to invoke find_all once more as link.a['href'] gives only the first child of every tag.
for keyword in soup.find_all('div', class_='r'):
for link in keyword.find_all('a'):
print(link['href']) # or write to file, whatever

well, I need to move to a specifc position in a file and I always use the fseek in C, I just want something that tell me bits of a class so I can move.
yes, I know that I was a bit exaggerated and lazy with my post

why not? account security is on you. If you care about your account just use a password manager with two factor.

Had a good laugh at this one.

are you retarded?

>web developer
user...

I just set up ccache so it works with my operating system builds. My 50 second build just shrank down to 5. Feels GOOD man.

Attached: almost.png (125x38, 5K)

Why are signed operands converted to unsigned in C when theres a comparison? Why dont they have it be the other way around?

Has anyone used live++ on a project? Is there inconveniences? I just don't get how certain things it claims to do could work in the code reloading unless you're programming under some sort of restriction.

I'm guessing it's because literals are signed by default (I don't remember the exact rules)
that way x > 100 will do what you expect

congrats

I follow a lot of generals across several boards. I’m considering making a program that scrapes my boards of interest for given regular expressions (e.g “/dpt”/, “/wdg/“ for Jow Forums, “/ohm/“ and “/hbg/“ for /diy/, etc) and displays them as a new local webpage in firefox that looks like a Jow Forums board.

I dont wanna do this if it already exist. Thoughts?

Lisp is the most powerful programming language.

It's quite the same thing but in Jow Forums X if you use filters with "highlight" it will move all the threads the top of the catalog. That + thread watcher and you should be fine.

/dpt/i;boards:g;highlight

why

keyboardinterrupt, not being able to kill threads, no multiline lambdas are shit too

>keyboardinterrupt, not being able to kill threads
thread1.daemon = True

that very light purple color in the background is really nice
what stack are you using to build it?

do you actually want a regex? this seems like a simple text search

Because negative numbers are just very big positive numbers, hence
-7 < 8 is false

C's type system is pretty retarded about signed/unsigned but basically the type conversion happens into whichever type has a larger maximum, and unsigned int is considered to be larger than int since UINT_MAX. the comparison with > uses the same conversion rules as any other operator including + or * or - or whatever

the non-retarded way to do it would be to cast them both into the smallest type that can hold the full values, i.e. long int in this case, but the standard does not specify that so you'd have to do it manually

No, I agree.

*since UINT_MAX is twice as large as INT_MAX

Are there good job opportunities in Clojure? Worried for my future desu

jobs.braveclojure.com/

>be me
>randomly browsing github
>stumble upon profile with cute girl picture
>repos aren't web design or javascript
>immediately get suspicious because we all know girls don't actually code
>do some research and sure enough my friends...
ITS A FUCKING TRAP
github.com/0xF6
instagram.com/re.gate/

thankfully everything is right in the world, I can go on my day

What about europe

the website i linked has a "Remote?" button

is there future in bash scripting ? i am using linux for 5 years exclusively
is it possible to work on it professionally? for example webdev stuff at least?
since i assume it is required to have windows or mac if you write programs for those specific platforms

also how come that python is so much used in linux systems? why was python chosen?

write a neural network to detect traps

>is it possible to work on it professionally?
devops maybe?

so webdev not? backend seems more serious and interesting to me than frontend, i hate javascript basically

I don't know if I wanna go for a remote option though, I'd love travelling in Europe which is why I was asking.

> Multiple versions
Only two, and one of them is end of life this year

> Quirks everywhere
No actually examples so not a valid argument

> poor multicore support
Multiprocessing module and concurrent futures modules both make this easy

> Not statically typed (For huge projects, it's a must)
I guess? No one who actually uses it has this problem though

> slow
Compared to what? It’s often fast enough

Not bad user, I give you a 4/5

Attached: F27D9077-57CE-4EEE-941F-08B5A3B240B2.jpg (500x611, 64K)

Bash isn't really used for backend or frontend. It's more of an admin thing, which is why I suggested devops - that's the profession that uses bash the most afaik.

i was thinking to learn Clojure. what i am in for? whats thappening in that world?
what is clojure used for generally today?

what about

stackoverflow.com/jobs?q=cloujure

oh i know that,seems i wasnt clear enough
i wanted to learn bash scripting more deeply because i love that kind of stuff,
what other stuff is required to become system/linux administrator ?

does this language have a future?

Attached: perl6.png (261x243, 56K)

it's called perl 7

Not many results.

This isn't reassuring.

I know this is going to make Jow Forums reeee but I'm using MySQL, PHP, and jQuery. I'm about to put out a recommendation update that uses Neo4j. If it grows then I'll move to something that allows it scale more efficiently.

Attached: 16ca66cb6af0c2f3.png (786x1014, 62K)

i am with you
php is simply the best technology for what it was created for

I've got a CSV with a "Names" column in Python, how would I CSV to show all the names starting with the letter S first?

holy shit

sysadmin here. Imo the most important thing is to have a broad understanding of the fundamentals of computing, rather than detailed knowledge of specific tools (that comes once you're in a role). Primarily, you are a troubleshooter - if you don't understand why and how things work, you will never be effective at fixing problems when they arise.

so you mean to tell me that i can land a job without much professional experience?
although i've been using linux for years now i even forgot how windows looks like

What's the time complexity on string comparisons in Python? Eg if I'm looking for a pattern in a string does comparing slices of the text run in the same time as a linear search or does it have to match each individual character? code example:
text = 'asdtgafasdgasdfuckgdjsfhk'
pattern = 'fuck'
for i in range(0, len(text)):
if(text[i:i+len(pattern)] == pattern):
print("found")


What's going on behind the scenes here? Does the slice and string comparison view the whole string at once for the comparison or does it have to loop through and compare each character in each string?

It depends on where you are in the world and how little you are willing to work for. I started out as an apprentice (17 years old, obviously no experience) working for an MSP. The best way to start your career in system administration is to work for a small to medium business with one or two other IT guys who are senior to you. They will teach you everything you need to know, and all the responsibility when things go wrong is on them. If you like the company, you can stay and replace them when they move on.

You need to have a deep understanding of Windows. It's just inevitable I'm afraid.

What does Jow Forums think of the first program I did my myself??

#include
#include
#include
#include

char* psswd = "abcdefghijklmnopqrstuvw12346890ABCDEGH=!$%^&*()_+-";

void getRandom(size_t length) {
// return 4;
int randNum;

for (int i = 0; i < length; i++) {
int num = (rand() % (strlen(psswd) + 1));
if (i == length-1) {
printf("%c\n", psswd[num]);
} else {
printf("%c", psswd[num]);
}
}
}


int main(int argc, char** argv) {
char *p;
long lengthi = strtol(argv[1], &p, 10);
srand(time(0));
getRandom(lengthi);
}

text = 'asdtgafasdgasdfuckgdjsfhk'
pattern = 'fuck'

if pattern in text:
print ("Found")

Congratulations on writing your first program! Here's to many more. Good job user.

thanks friend

#include
#include
#include
#include

void getRandom(const char *psswd, size_t length)
{
int i;
int num;
int randNum;
for (i = 0; i < length; i++) {
num = (rand() % (strlen(psswd) + 1));
printf("%c", psswd[num]);
if (i == length-1) {
puts("");
}
}
}


int main(int argc, char** argv)
{
const char* psswd = "abcdefghijklmnopqrstuv"
"w12346890ABCDEGH=!$%^&*()_+-";
char *p;
long lengthi = strtol(argv[1], &p, 10);
srand(time(0));
getRandom(psswd,lengthi);

return 0;
}

>You need to have a deep understanding of Windows
awww really? oh shit man this is a hard punch, damn it

please use the official Jow Forumsdpt password generation algorithm.

doesn't answer the question and doesn't work in the case i'm interested in

Redpill me on A*.

So basically A* is:
1) Find recursivelly in each new step the closest open nodes.
2) Find later and pick among the open nodes the one with least value.
3) Add said open node to the closest ones.
4) Iterate until you reach the target.
5) Do a reverse path looking trhough the closest ones.

Is this correct?

Attached: 1554565632560.png (769x612, 167K)

>time complexity on string comparisons in Python
It works in the example you provided and it's the best way to find a sub string in a string.

String comparisons typically do a linear scan of the characters, returning false at the first index where characters do not match. The time complexity is O(N) and the actual time taken depends on how many characters need to be scanned before differences statistically emerge.

There's nothing that quite makes me want to kill myself like doing Android development
Whole thing should be nuked from orbit and started again from scratch

You may well be able to find yourself a Linux-only shop, but it's a lot rarer, and they tend to look for greybeards. As a junior you don't have much to offer, so you can't afford to give up your flexibility. You need to be a jack of all trades. You can specialize later. Knowledge of Windows is a must. But that's just one man's opinion, and it might not be the right advice for you. Check your local job market and see for yourself.

you have an open list and a closed list, closed list exists to make sure you dont test the same node twice
and its iterative not recursive

just use rnative brah

>that if inside the for loop
Why don’t you just print the new line after the loop finishes?

It has been, and it's called Fuchsia.

thanks. I also had to remove the + 1 from rand() % (..) because it was sometimes printing the \0 as well sometimes and messing up the output