[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 32
File: index.jpg (11 KB, 300x300) Image search: [Google]
index.jpg
11 KB, 300x300
old thread: >>52682123
whatcha working on?
>>
>>52693132
Programming
>>
TRAPS AND TRANNIES ARE ABSOLUTELY DISGUSTING
>>
>>52693166
What about cis females?
>>
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a 16 year old

You are a programmer, not a coder

Software Alchemist is GOAT
Developer is okay
Magician is okay
Software Magus is okay
Software Engineer is okay
Software Architect is okay
Code Guru is okay


Archmage is reserved for only the most senior of programmers

Writing in HTML and CSS is not programming, therefore it should be referred to as designing
>>
>>52693188
some of them are ok
>>
File: catalog.webm (2 MB, 1366x768) Image search: [Google]
catalog.webm
2 MB, 1366x768
I'm making a 4chan app for the desktop, using the API and Xlib calls. So far all I have is the catalog, caching of thumbnails and images/webm, opening images/webms in feh/mpv respectively, thread subjects && comments, and scrolling with the mouse wheel. It's my first project without using a toolkit, and coincidentally without using git.
>>
File: Denise_Milani_Wallpaper.jpg (118 KB, 1600x1200) Image search: [Google]
Denise_Milani_Wallpaper.jpg
118 KB, 1600x1200
>>52693212
Denise Milani spotted
>>
>>52693233
damn i had forgotten about her

TFW NO GF
>>
What's the fucking deal with MSVC?
If I use their project system with /Wall, even /W4, they shove down my throat WinSDK issues.
Meanwhile if I compile from command line with the same switches it just werkz(and it's faster too).
>>
File: tumblr_o0xnon9AR41umayn6o1_1280.jpg (110 KB, 1092x960) Image search: [Google]
tumblr_o0xnon9AR41umayn6o1_1280.jpg
110 KB, 1092x960
>>52693233
and for those who were saying i have a foot fetish... this denise milani pic is a great pic, the feet are just one small part of it, everything else is extremely nice unlike on pic related as i don't find those grills particularly interesting
>>
>>52693212
Why Xlib over xcb?
>>
File: Denise Milani sanddunes13.jpg (975 KB, 4000x2678) Image search: [Google]
Denise Milani sanddunes13.jpg
975 KB, 4000x2678
>>52693233
i thought i'm the only one who has a thing for her :^)
>>
>>52693339
I didn't get too hung up over which one I used. I saw Xlib and xcb both, and decided to go with what I saw first, which happened to be Xlib. I just want to make a 4chan app so that I don't need to keep an icecat instance open so often, and perhaps fill part of my screen for desktop threads so I can be cool like /g/
>>
>>52693212
You are literally the reason wayrandu isn't coming...
>>
File: file.png (6 KB, 200x200) Image search: [Google]
file.png
6 KB, 200x200
Operating Systems
Systems Programming
Object-Oriented Programming/Design
Artificial Intelligence

boring subjects (except AI), shit profs, but i gotta admit i have zero motivation and dont know what i want to do with my degree/education. cant even get free internships, but desu i wouldnt hire me
>>
>>52693443
I was just wondering since Xlib is so old to the point modern implementations are written in xcb since it's such an improvement.
>>
>>52693569
Those look like fun classes desu, my only IT class this semester is a boring-ass project management class right.
At least I'll be starting on InfoSec next semester
>>
>>52693132
Writing a heap allocator for my toy OS. Physical page allocation is done, next I need a way to keep track of those pages mapped to consecutive virtual addresses within the bounds of a heap. I'm thinking a simple bitmap will work for now. After that, I can get started on malloc and free.
>>
>>52693576
It seems to just werk for me, despite the spaghetti code I've thrown at it at the wee hours of the night. I don't even discriminate between thumbnails on the screen and thumbnails off the screen; they all get downloaded the same (unless they're already in the cache, off)
>>
>>52693633
How do you get started with a toy OS
>>
Asked this in the web dev thread but no response.

How would I go about replacing an asp.net system with JavaScript/node/Json? I know I'm being pretty vague but I know a company who's using really old technology for their MVC and want to catch up to modern stuff.
>>
GCC 6 when?
>>
>>52693891
This summer.
>>
>>52693876

You rewrite everything from scratch
>>
Is there anything more fun in programming than pointers?
>>
>>52694253
dependent types
>>
>>52693212
WHEN WILL THIS BE AVAILABLE FOR US?
>>
>>52694354
After I clean up the spaghetti and make it more RAM efficient; right now it sits at 130ish megabytes, but that can be easily chopped down by not loading every single thumbnail for the entire duration of the program's run.
It also has no real feedback for when things are downloading (it downloads all the thumbs in separate pthreads before the window is created, which doesn't happen until after the thumbnails finish downloading so the program appears to hang if there's a lot more thumbnails since last time it was run)
It also doesn't display much info about the threads yet, just the thumbnail, subject && comment. It doesn't even handle the HTML tags yet.
Finally, it doesn't even allow you to enter threads yet, just view the OP images. Once I get all these issues at least somewhat dealt with, I'll throw it up somewhere if /g/ wants it.
>>
>>52694253
Lazy evaluation.
Lazy I/O, lazy references, cyclic everything.
>>
>>52693208
What about computer as a term for a person? If I only program to compute things, wouldn't that make me a computer? Like computers before electronic computers.
>>
>>52693208
>don't call it coding
>Code Guru is okay
>>
What's the most idiomatic way to check for unsigned integer overflows in C? Casting to unsigned?
>>
>>52694447
>Finally, it doesn't even allow you to enter threads yet, just view the OP images. Once I get all these issues at least somewhat dealt with, I'll throw it up somewhere if /g/ wants it.
THROW IT UP NOW, so we have a resource to bookmark and find it when it's done.
>>
So I want to make a autohotkey script so that when I press a button based on what section of my monitors the window that I am hovering over it resizes to a specific size and moves to a specific location.

However I'm having some issues with even beginning this and figuring out what areas I need to designate by pixel because this script keeps giving different numbers each time.
#Persistent
SetTimer, WatchCursor, 100
return

WatchCursor:
MouseGetPos, xpos, ypos
ToolTip, X%xpos% Y%ypos%
return

First it says that the left most part of my left most monitor is X-1276, now it says its X-1

What the fuck is happening?
>>
>>52693762
Have intimate knowledge of C, assembly and the architecture you're writing for. You can learn a lot of the more advanced theory as you go, but you'll still need to be able to know at any given time exactly how the hardware and software are interacting.
>>
>>52694613
Addition or multiplication? Either way, make a macro UINT32_ADD_WILL_OVERFLOW(x, y) or whatever.

Best is to use types large enough for any value your program will use. If you need to use libgmp.
>>
>>52693208
STFU
>>
>>52694622
I have no place to put it at the moment. I don't have a github or anything such as that, and I'd want to put it on my own server anyway, which is currently not web-facing.
>>
>>52694691
Multiplication. Specifically multiplying by 2. Is it enough to check the highest bit is 0 for no overflow?
>>
>>52694792
Yes, *2 is just <<1
>>
>>52694792
no
>>
>>52694845
Why not?
>>
>>52694876
ho shit I forgot that higher bit if for negative
maybe you're right
>>
>>52694253
API web references.
>>
>>52694613
Inline assembly or compiler intrinsics.
>>
>>52694613
> What's the most idiomatic way to check for unsigned integer overflows in C?
Unsigned integers don't "overflow". Overflow is when you get a carry *into* the top-most bit (i.e. from bit 30 to bit 31 for a 32-bit value).
>>
>>52695154
What do you call it when an operation would overflow had the type enough bits?
>>
>>52695154
So what do you call it when it wraps back to 0?
>>
>trying to write multithreaded code
>running the same input through it over and over
>it works perfectly about 30% of the time
>the rest of the time it gives me total nonsense
HELLO DARKNESS MY OLD FRIEND
>>
http://zachholman.com/posts/startup-interviewing-is-fucked/

>I’m a product engineer. I don’t have a formal CS background, but I build things for the web, and I’m really good at it.
>Not every company has insisted upon using programming riddles as a hiring technique, but the ones that do almost exclusively focus on weird algorithmic approaches to problems that don’t exist in the real world

The number of JavaScript code monkeys complaining about interview processes is hilarious. Being able to write code and understanding why it's written that way is the difference between an assembly line worker and a product engineer.

These idiots actually complain that they shouldn't have to "memorize" algorithms for these interviews, completely failing to understand that an actual programmer would be able to reproduce those algorithms - not regurgitate them from memory like a trained monkey. A web developer who only knows how to copy and paste code, but not understand how or why it works, is not qualified for a "Director of Engineering" position. You aren't even an engineer.
>>
>>52695205
use based java

https://docs.oracle.com/javase/tutorial/essential/concurrency/
>>
>>52695205
Language?
>>
>>52695237
>zach
they should have just filtered him out based on his name
>>
>>52695154
>>52695188

Wrapping around back to 0 is still called overflow.

https://en.m.wikipedia.org/wiki/Integer_overflow

>In the C programming language, signed integer overflow causes undefined behavior, while unsigned integer overflow causes the number to be reduced modulo a power of two, meaning that unsigned integers "wrap around" on overflow
>>
>>52695312
>unsigned integer overflow causes the number to be reduced modulo a power of two

I thought it was undefined behaviour?
>>
>>52695289
D

I'm gonna go and ask on the forums desu
>>
>>52694931
unsigned ints can't be negative
>>
>>52693132
99% sure I passed my final round interview at Facebook!!!!!!

I celebrated by smoking a lot of weed
>>
>>52695346
not for unsigned integers
>>
>>52693208
Im 19. Is it ok if I come off like a 16y/o?
>>
>>52695378
good for you

>>>/g/wdg
>>
>>52695369
my cute little unsigned ints can't be this negative, desu yo ne
>>
>>52695346

Apparently not. Although it really shouldn't be undefined behavior anyways. There's multiple ways of expressing signed integers. On every platform I have seen, however, there is only one way to represent unsigned integers (not counting endianness).
>>
>>52695188
carry
>>
>>52695396
Thanks <3

But what does gwdg mean?
>>
File: GZ2EyK0.png (13 KB, 434x260) Image search: [Google]
GZ2EyK0.png
13 KB, 434x260
>>52695411
>>
>>52695383
>>52695399
So (x * y) < x would return true if it overflowed?
>>
>>52695425
Sorry I thought it was like telling me to leave /g/ or something
>>
>>52695439
Not if x is 0.
>>
>>52695439
not necessarily

do the math with a few examples
>>
>>52695472
Well, yes, but in that case the result is always going to be 0.
>>
>>52695472
Or y is 1.
>>
>>52695497
this isn't rocket science

for example if you have uint8_t
x = 2
y = 255
x * y = 510 mod 256 = 254
254 < 2 = false
>>
>>52695439

Not necessarily. Consider the following case:

int32_t x = 1000000000;
int32_t y = 6;
int32_t z = x * y;


6 billion modulo 4.2 billion and some is 1.7 billion and some, which is greater than 1 billion.

For multiplication, you check for overflow with division.
>>
>>52695237

This mindset is rampant in the web development community. Every self-taught dude who only knows JS calls themselves an engineer. The worst part isn't that they overestimate their knowledge and value, but that they are somehow indignant about companies not wanting to hire them because they can't solve simple algorithm questions.

The issue is that they know so little that they don't even know how much they don't know. They think algorithm questions are a bad way to choose candidates because they don't know enough about programming or software to even understand what those questions are testing for. They're just upset that they failed and, instead of improving their knowledge, they bask in their ignorance.
>>
Is there any way in autohotkey to check if theres a window in a section of the monitor even if its not active or in the front.
>>
>>52695574
Just like the Lispers before them.
>>
>>52695575
You cant check like that, sadly. You dont have access to the WM, only the events that interact with it (keystrokes, batch files, simulated mouse clicks, etc)
>>
>>52695610
and like the hasklelers and pythonistas after them
>>
>>52686102
>>
>>52695636
So basically what I want is impossible:

Basically I just made a script that changes a windows position and size based on what position the cursor is.

This basically means that now I have several boxes on my monitor where I move windows.

I wanna make a button so it shuffles through the windows on that location.

Is that impossible with AHK?
>>
>>52695668
Not in AHK. I suggest you learn C++ and start coding more directly to the OS. You'll be surprised by the power it has
>>
I'm interviewing a guy for a senior engineering role next week. What meme programing challenge should I ask him?
>>
>>52695737
tornado text
>>
>>52695188
carry out
>>
>>52695737
Implement a substring search in N time and K space (where n is the length of the string and k is the length of the substring)
>>
>>52695574

I love it when people bitch about failing at whiteboarding. "Waaaahhhh, other people have standards for programmers! Why can't I just be a piece of shit with no problem solving skills and who will likely contribute to a gigantic bug that will kill the company?"
>>
>>52695707
>Not in AHK. I suggest you learn C++ and start coding more directly to the OS. You'll be surprised by the power it has
I'll be honest I'm rather dumb when it comes to programming and this AHK script is about as good as I get.

I honestly wouldn't even know where to get started if I decided to do C++.

On a side topic, how would I combine the scripts, run something in the background when I hit the key that would link to that script, as the AHK run script opens up a cmd window obnoxiously.
>>
>>52695312
> Wrapping around back to 0 is still called overflow.
Not in the C standard. Or by anyone who knows what they're talking about.

It's normally referred to informally as wrapping or truncation. The actual language of the standard is:

> A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting unsigned integer type.
(6.2.5p9)
>>
>>52695737
you get an array of one day's share prices of a stock in chronological order
find the largest positive difference in share price you could have made by buying once and then selling once during the day
>>
>>52695737

Ask him how he would approach building a program to detect infinite loops in a program for given inputs. If it takes him more than 30 seconds to tell you it's impossible, don't hire.
>>
>>52695808
it is 100% possible if the program is well-defined
>>
>>52695439
> So (x * y) < x would return true if it overflowed?
No. For addition (x+y)<x && (x+y)<y if the calculation wraps. For subtraction, (x-y)>x if the calculation wraps.

You can't detect a wrapped multiplication; you just have to split the operands into high/low halves so that the parts can be multiplied without wrapping (but if you want 100% portability, bear in mind that nothing in the standard precludes the standard integer types from having an odd number of bits, so you may actually need to split into 3 parts).

Division can't wrap; the result is always smaller than the numerator.
>>
>>52695761
is this even possible? it seems like we at least need to keep the string in memory, taking N space. Are you imagining reading k chars at a time from stdin or something?
>>
>>52695888
you can use kC memory, C being some constant
>>
>>52694553
That's actually what it meant before modern computers were invented.
>>
>>52695825

Who says the program you're checking is necessarily well defined? There is no reason a program cannot invoke another program and check it's results to determine its behavior.
>>
>>52695888
Nope! You use what's called a rolling hash. Once you form the initial hash (which is take k time, which is less than or equal to n) you then so a linear search where with each iteration you divide your hash by the character you no longer need and multiply by the new character.

And I take that back, it's actually constant space. It's n + k time :) (but k is always less than or equal to n so really it's just n time)
>>
>>52695888
>>52695901
oh wait i see what you mean

i guess the k space is for your part of the algorithm, the parent string is irrelevant as it could be an array or a stream or something
>>
>>52695918
in a real-world situation if you want to do something like that you're likely to have everything self-contained with a well-defined program to analyze and you will also not be restricted to answering yes/no like in an aspergian meme riddle, you will be able to answer yes/no/indeterminate
>>
>>52695825
> it is 100% possible if the program is well-defined
Then ask how to determine if a program is well-defined.

Any language in which you can't create a loop whose termination is impossible to determine statically is of no use as a general-purpose programming language.
>>
>>52695805
This one's tricky. Anyone have a solution that's better than searching through all O(n^2) combinations?
>>
>>52695972
var minPrice = prices[0], maxDiff = 0

for(price in prices) {

if(price < minPrice) {
minPrice = price;
}
else if(price - minPrice > maxDiff) {
maxDiff = price - minPrice;
}
}

return maxDiff;
>>
File: 1406425994240.jpg (17 KB, 225x225) Image search: [Google]
1406425994240.jpg
17 KB, 225x225
>Software """"""""""Engineering""""""""""
>>
>>52696070
>maxDiff = 0
assuming you can buy and sell at the same price or avoid buying/selling altogether (otherwise the answer would be negative if the price went down all day)
>>
>>52696070
Well, now I feel like an idiot.
>>
>>52695921
Is this the Rabin-Karp algorithm?
>>
op i am currently working on this

https://codeshare.io/7OByS

i could use some advice please :D
>>
>>52695939
The real-world answer to whether a program is non-terminating is "who cares?".

There's no practical difference between a non-terminating program and a program which can be proven to terminate after 50 billion years. The only meaningful distinction is between "guaranteed to terminate in a short amount of time" and "we should consider implementing a timeout".

The ability to write non-terminating programs is a feature, not a bug. E.g. it's fairly common for the termination criterion to be "when a human decides that the program should terminate" (i.e selecting the File -> Exit menu option in a GUI application or sending SIGHUP to a daemon process). Of course, most theoretical models are limited to computation and don't even consider I/O.
>>
Where can I find inexperienced, impressionable, and naively passionate programmers who haven't lost the will to live yet to do free labor for me?

How do I gain the charisma needed to lead an open source project and gain the respect and dedication of hundreds of developers to do my bidding?

Failing that, where to meet other incompetent washed up fools like myself to talk all day about dreams which never came true.

Who /burnedout/?
>>
>>52696172
>Where can I find inexperienced, impressionable, and naively passionate programmers who haven't lost the will to live yet to do free labor for me?
undergrads
>How do I gain the charisma needed to lead an open source project and gain the respect and dedication of hundreds of developers to do my bidding?
torvalds-tier aesthetics & autism combo
>Failing that, where to meet other incompetent washed up fools like myself to talk all day about dreams which never came true.
right here, friendo
>>
File: front.jpg (398 KB, 1494x1000) Image search: [Google]
front.jpg
398 KB, 1494x1000
Help me build a time machine please.
>>
>>52696172
>Where can I find inexperienced, impressionable, and naively passionate programmers who haven't lost the will to live yet to do free labor for me?
Hi
>>
File: 1450847137968.jpg (56 KB, 432x323) Image search: [Google]
1450847137968.jpg
56 KB, 432x323
>>52696172
>free labor
nothings free son
>>
>>52696164
if i asked >>52695808 in an interview and got "it's impossible" straight away i wouldn't be impressed at all as it shows you're close-minded and parroting what other people have told you. if i asked you to find a strict yes/no answer to arbitrary programs then it would be an ok answer but not if the question doesn't specify those things.
>>
>>52696184
>>52696208
:3
>>
Can anyone give me the algorythms for manipulating space time?
>>
>>52696268
Python's probably got a library for it
>>
>>52696268
heavy objects manipulate spacetime, write alygorths that manipulate heavy objects and spacetime will be yours
>>
I need a time device. I seriously have to go back in time. I have somethings that I need to change.
>>
>>52696324
did you grope your sister or something? you can tell us anon
>>
Seriously if anyone knows or can time travel. Let me know.

~Odell
>>
>>52696324
what's with the hot dog?
>>
I have to prevent a few things that went on in recent years. Please help me out. Preventing a death of someone I love.
>>
>>52696356
yes your mad right your mad
>>
I'm not mad. I need them to know the truth and then they can go.
>>
>>52696368
http://sonic.wikia.com/wiki/Chili_dog

i didn't know that this was a thing (not a huge sonic fan). is this upsetting to sonic fans?
>>
>>52696383
>tfw I have a song for that exact feel
https://www.youtube.com/watch?v=Mw3IHox1ujE
>>
File: 129Magikarp_AG_anime.png (29 KB, 678x776) Image search: [Google]
129Magikarp_AG_anime.png
29 KB, 678x776
Learning Python.

What's the difference between Try/Except and If/Else?
>>
Hit me up. I have the device!
>>
>>52696411
>>52639500
>>
Odell I've traveled so far back that I signed the Ten Commandments. I invented skiing and fucked Cleopatra.
>>
>>52695205
So it turns out trying to write multithreaded code without a keen understanding of quantum superposition just isn't going to work

lasciate ogni speranza, voi che multithread-e
>>
>>52696411
It is used for exception handling rather than just conditional statements.
>>
is there a go to C library for basic data structures like growable arrays, linked lists and stacks?
>>
>>52695737
http://codeforces.com/problemset/problem/560/A
this
>>
File: jiraffe.gif (1018 KB, 500x700) Image search: [Google]
jiraffe.gif
1018 KB, 500x700
DAE choose Java for successful projects just to spite buttblasted /dpt/ autists?
>>
>>52696561
glib but you could instead use a superior language such as C++
>>
>>52696594
eww no thanks. I'll check out glib
>>
>>52695761
>senior engineering role
>asking a programming 101 question
>>
>>52696587
No because the buttblasted /dpt/ autists are actually right about java
>>
>>52696669
>senior engineering role
>ask a programming 101 question
>99.99% of applicants have no fucking idea how to answer it
>>
>>52696563
Parse the numbers then:
if (in[0] = 1) 
return -1;
return 1;
>>
>>52696587
java is actually really fucking good, it's just an epic meme and stupid normies get asspained for having to learn it in their crappy schools
>>
File: 1408427728239.png (179 KB, 600x328) Image search: [Google]
1408427728239.png
179 KB, 600x328
>>52696701
only thing worse than a memer is an anti-memer
>>
>>52696701
The JVM is a great piece of work, but the Java language has some flaws. It has a very shoddy generics system, and is often too verbose and lengthy.

IMO its main redeeming factor is the excellent documentation, but I would still try to avoid Java for a personal side project unless it was necessary for some reason.
>>
Why don't banks code their software in C or Assembly like /g/ computer science PhDs?
>>
>>52696736
because banks care about safety and correctness
>>
>>52696744
C and Assembly are the best languages according to /g/ experts tho
>>
>>52696749
you got meme'd on
>>
>>52696736
Assembly would be a major pain and as much as I like C, I wouldn't use it for anything security related
>>
>>52696686
I really don't buy this at all. I've been asked way harder questions at every internship I applied for, and it was still hard as fuck to land a job because of all the competition. You're going to let a senior dev get by with answering easier questions than fucking interns do?
>>
>>52696794
you start with easy questions and then do some tougher ones if they aren't straight up retarded
>>
Making a chat website because I got tired of writing C++
>>
>>52696736
legacy code that wasn't C or assembly maybe
>>
>>52696901
Yes that must be it :^)
>>
is there a C to Java transpiler?
>>
>>52696736

Because performance is less important for them. What's more important is that the software never fails under any circumstances. Furthermore, it has to work with old code, because they are banks and do not wish to fix what already works.

So they do everything in COBOL.
>>
Rate my python senpaitachi.
import os as o
import time as t
import random as r
a=[" ____\n / \\\n / \\",
" \\ / ___\n \\ ___/---------/ \\",
" / \\\n \\ /\n \\____/",
" / \\---------\\___/"," \\ __/-----------/ \\",
" ___\n / \\\n / \\\n \\ / ___",
" / \\\n \\ /\n \\___/",
" / \\-----------\\___/"]
k,l,m,n=r.randint,54,[],0
w,x,y,z=["\n".join(i) for i in [a[:2],a[3:1:-1],a[5:3:-1],a[7:5:-1]]]
class B:
def __init__(s,p,v,a):s.p,s.v,s.a=p,v,a
while n+1:
o.system("lc"[::-1]+"s"if o.name=="nt"else"raelc".reverse())
n={0:lambda:0 if k(0,5) else 1,1:lambda:1 if k(0,3) else 0}[n]()
s=[" "for i in range(l)]
for i in m:
if int(i.p)<l:s[int(i.p)]="X"
i.p,i.v=i.p+i.v+i.a,i.v+i.a
if n==0:
print("\n".join((w," |___ | {}"+"".join(s),x)))
else:
print("\n".join((y," |__ | {X}"+"".join(s)[1:],z)))
m.append(B(0,.5*r.random()+2.5,-.005))
m=list(filter(lambda i:i.p<l,m))
t.sleep(.05)
>>
hey guys encryption nub here. In an implementation of SHA-2 there's this table

var K = [
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 ];


What's going on here?
>>
>>52697265
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z/10
>>
>>52697278
Square roots of primes
>>
Am I retarded? I'm learning to use regular expressions in python. Shouldn't this print a list of strings of characters?

inputString = input()
regexString = re.findall(r"\w*", inputString)
print(regexString)


If I input "hello test python" it will output

['hello', '', 'test', '', 'python', '']

instead of
['hello', 'test', 'python']


Any idea what I'm doing wrong?
>>
>>52696736
>implying cobol isn't secret master race
>>
>>52697364

Not quite. Primes, by definition, do not have integer square roots. According to Wikipedia, these are the "first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311".

https://en.wikipedia.org/wiki/SHA-2#Pseudocode
>>
>>52697495
why would this be useful for encryption? did essentially pick this methodology to arrive at these numbers at random?
>>
>>52697571

SHA-2 is not encryption; it is hashing.

Anyways, primes are useful in cryptography in general because, well, they just kind of make algebraic attacks unfeasible.
>>
>>52697393
RTFM
>Empty matches are included in the result unless they touch the beginning of another match.
That \w* is matching the empty positions after the word matches. Why don't you use \w+ instead?
>>
>>52697393
Try:
regexString = re.findall(r"\w+", inputString)


* matches 0 or more, you want + which matches one or more character
>>
I have been devoting my full time and energy towards debugging a memory corruption issue for the last 30 hours. The issue was pointers to memory that gets realloc'd. That shit's difficult to find in a game.
>>
File: vaccine.small.webm (1 MB, 1200x800) Image search: [Google]
vaccine.small.webm
1 MB, 1200x800
>>52693212
cool
This is my GTK one, Xlib sounds annoying
>>
>>52698145
you ran valgrind right
>>
>>52698194
Windows only program because of library requirements. I tried to get Dr. Memory working but it shits itself on Windows 10 with VS2015. The next closest thing I had was this https://msdn.microsoft.com/en-us/library/x98tx3cf.aspx
>>
>>52698222
Which is basically only leak detection, which didn't help.
>>
Is H.264 decoding deterministic?

That is, does an input stream X always result in image Y across all valid decoders?
>>
>>52698176
massive waste in screen space after date/time & before post n.

make it show a grid (no lines) of reply numbers
>>
>>52697278
Those are all the encrypted values.

Make good use of them because you can only use each one once.

(If you find more of them you could be rich)
>>
Can someone give me a brief explanation of why El Chapo and other Mexican drug lords are extradited (or tried to be) to the US? Does the US have that authority over Mexico?
>>
>>52698657
Good walls are built from two sides
>>
>>52696230
> it shows you're close-minded and parroting what other people have told you
Um, no. It shows that you're aware that a general solution is impossible. If you wanted to know whether they were "parroting" a fact or actually understood why it's impossible, you'd need to ask them for an outline proof.

There are all kinds of possible approaches for detecting specific cases, but it wouldn't hurt to start by mentioning the fact that it's impossible in the general case, rather than waste half an hour outlining various (necessarily incomplete) approaches before it becomes clear that "it's impossible" is the answer they were actually looking for.

Even if they're looking for "partial" solutions, it would be wise to determine what sort of cases they expect it to deal with. That's something that's actually important in practice.
>>
Is programming gay?
>>
>>52698792
no it's transgender

check ur priveledge
>>
>>52697278
Those are the round constants. Effectively-random numbers which are used to make the function different for each round.

>>52697364
Cube roots of primes.

The point is that they're "nothing up my sleeve" numbers. Effectively random, but being generated by a simple algorithm eliminates the possibility that they were specifically chosen in such a way as to provide a back-door. The digits of pi are a common source of such numbers.

That was the problem with Dual EC DRBG: certain "random" constants P and Q were given without explanation, although the algorithm itself can be broken if you can find x such that x*P=Q (mod m). That's a hard problem to solve, but not if you're the NSA and you specifically generated Q from a value x which you already know.
>>
>>52698792
only if ur a faget
>>
What's the gaming language?

I have a gaming headset, a gaming mouse and keyboard, and of course a gaming pc.
But now i decided to learn a programming language. But it has to be gaming.
So what's the gaming programming language?
>>
>>52699039
Gamers are too stupid to be programmers.
>>
>>52699039
C# + Unity
>>
>>52699039
Actionscript
>>
Does anyone have any experience with Neovim yet?
Is it worth using it over standard Vim yet?
>>
>>52699130
>hipster among hipsters
>>
>>52696411
Everything
>>
Does anyone know anything about WPF?

I want to create a listbox type thing, one long list of containers within which I can insert data, but I don't want any of the highlighting stuff, or be able to touch it in any way. I want to achieve the same effect but without it being an actual listbox I guess.

I can't seem to find any way to achieve it.
>>
>>52699349
Table?
>>
>>52699367
Eh, I think listbox will do the trick, I just have to figure out how to virtualise the stuff I put in it, because drawing each one individually is a fucking brickfest, completely locks the thing up badly.
>>
>>52695707
Not him, but what's the starting point if you want to do that stuff in C++? On windows would you need to know the WinAPI? And on linux?
>>
so fucking quiet
>>
javafx8, vaadin or something?
Has to be made with java.
>>
Signed up for some programming competition or something. It's in two hours. It's apparently in VB.NET and WF, using "basic graphical input/output functions and mathematical compuations".

I barely know any VB, but I do know a lot of C# and WPF. How screwed am I?
>>
>>52699349
Just make a listbox and then disable it. It'll still be visual, but it'll be "read only" in a sense (the user can't manipulate it in any way and it'll appear slightly greyed out).
>>
Is there a way to style GUIs for C programs in CSS?
>>
>>52699984
Yes, but it's extremely retarded. Basically you need to do the 'visual' aspect of your program in HTML and then bind that HTML to your program's actual functions using some medium language, which is usually JSON.

Github Atom is a text editor that's "styled" in CSS. Note that Atom is bloated and dumb.
>>
is making a function for every instruction a bad idea in a gameboy emulator
>>
>>52700158
Using a computed goto would probably be a lot better.
>>
>>52700224
Yeah gotos are usually the most efficient ways to do something.
>>
>>52700158
depend on the programming language and the implementation of that programming language but it's probably the best option if you have procedure inlining.
>>
>>52700258
Computed gotos are pretty much an efficient switch statement. If you're using C or C++, computed gotos are a GNU extension. I don't know about the support for it in other languages.
>>
>You will likely also find files ending in .pyc. These are compiled Python files and can be safely ignored. However, if you find them as distracting as I do, you can use the following shell command to remove them: find . -name '*.pyc'-delete. Python will re-create them the next time your run your site.
Should I drop this book right now?
>>
File: release.png (5 KB, 325x96) Image search: [Google]
release.png
5 KB, 325x96
Is there any point to releasing resources at the end of the application since the system throws it all away anyway?
>>
>>52700373
Letting the OS handle it is fine
>>
>>52700373
People will think you're a stupid faggot and completely untrustworthy as a programmer if you can't even manage your resources properly.
>>
>>52700373
No, it's also annoying as fuck if you do and it's a large application since it takes forever to close
>>
>>52700398
I'm talking about end of program cleanup
e.g. for an opengl context wrapper, have a static flag for initialization - force only one instance, hence no need of lifetime mgmt during runtime

>>52700416
>>52700384
all right
>>
>>52700455
>I'm talking about end of program cleanup
So am I. If you can't even put a free for every malloc, you've completely failed as a programmer.
>>
>>52700471
you're retarded
go away
>>
File: 1452403462016.png (79 KB, 307x400) Image search: [Google]
1452403462016.png
79 KB, 307x400
>>52700482
>Can't even manage memory properly
>Tries to call somebody else retarded
>>
What's the point of private member funcs that don't have implicit counterparts(e.g. constructors)?
>>
https://github.com/Microsoft/Pyjion

A JIT for Python based upon CoreCLR by Microsoft
>>
>>52700471
You have obviously never written a single line of production quality code.
>>
>>52694690
>>52693762
Look up james m osdev tutorial or the ones by Mike on brokenthorn. It's not too hard to get into, but it takes a while.
>>
>>52700769
So every "production quality" program must leak every piece of memory it acquires?
>>
>>52700819
It's counterproductive to have your application take an hour to shut down. You don't need to free resources when your application exits because the OS does it for you.
>>
>>52693311
SMACK LIPS PROFOUSELY
>>
>>52700842
>because the OS does it for you
It's not portable to assume this.
>>
>>52700880
Most applications are developed with a specific set of target platforms in mind.
>>
>>52700819
Doesn't the OS give each process some virtual address space that is thrown away at exit - hence "leaking" doesn't mean anything here?
>>
>>52700892
>>52700896
Even if you want to rely on OS-specific behaviour for your program, it makes your program much harder to extend or incorporate into a long running program.
"Let the OS handle it" is a horrible mindset and leads to memory leaks in daemons and other long-running programs.
>>
>>52700924
"Let the OS handle it" is perfectly valid in this case. Good memory management while your program is running is important, but you literally do not ever need to manually free resources when you close your program, all it does is make it take a long time to shut down when you could just let the OS do it (Which it will do anyway, even after you waste time freeing resources). The only exception is if maybe you're not using an OS from the last 20 years.
>>
File: linker.png (14 KB, 1451x57) Image search: [Google]
linker.png
14 KB, 1451x57
What's the deal here?
I'm linking both user32.lib and opengl32.lib
>>
>>52700960
It's just a fucking horrible mindset to have. If you're constantly being a lazy fuck who won't even walk a few data structures to free them at program exit, you're probably going to carry that cancer to the rest of your program.
>This function returns a malloc()ed string to be printed. It's only leaks a few dozen bytes every time it's called, who cares if it leaks? It'll be freed when the program exits anyway.
>>
>>52701013
meant gdi32.lib not user32.lib
>>
>>52701013
It's probably some bullshit related to C++ and name mangling.
Is the program compiled with the same compiler as the libraries were?
>>
>>52701017
You argue like a moron
Think before you start parroting and acting like you're superior

>>52701046
I'm not using any other libraries than WinAPI and the Opengl 1.1 lib Windows gives you
>>
>>52701083
>I'm not using any other libraries than WinAPI and the Opengl 1.1 lib Windows gives you
That doesn't answer my question at all. You need to learn about the absolute fuckfest that is C++ linking.

>Think before you start parroting and acting like you're superior
Good rebuttal, fucktard. The entire thing is opinion based though, as it's a matter of style.
>>
>>52701121
>Is the program compiled with the same compiler as the libraries were?
This was your question
Am I supposed to build fucking user32.lib? Am I going to fly to Redmond and break into MS and build the fucking libs myself?

>Good rebuttal, fucktard. The entire thing is opinion based though, as it's a matter of style.
The initial problem was very scenario specific and you started parroting and assuming.
>>
Help me /dpt/ why does Love2D crashes my system?
>>
Stupid C question inbound!

I want to do > operand to int and const int, what do?

while(i < a + n)


i is int and a is const int array
>>
What are you guys using for writing Python?
>>
>>52701550
spyder + ipython
>>
>>52701823
is it free and open source?
>>
>>52701872
yes
>>
print(re.match(r'\[(\d+)\/(\d+)\]', '[CBM]_Evangelion_3.33_You_Can_(not)_Redo_(Dual_Audio)_[BDRip_1080p_AC3]_[C5D9D91E] [110/132]'))


Why the fuck does this print "None"?
Am I retarded? Every online parser I've used said it should capture 110 and 132, but it doesn't
>>
>>52702209
Ok, apparently I had to use .search instead of .match
>>
>open ide at uni

>see this

public class wtf{
public static void main(string [] args) {
string x = " yo why tf isnt this working?";
system.out.println)(x);
}
}


just thought id share a kek
>>
>How would you like your language sir?
>Just fuck my shit up
And thus Bash was born.
>>
#include <stdio.h>
#include <string.h>
size_t index;
int main(void) { return 0; }

>This doesn't compile
>>
>>52703843
Of course.
>>
>>52699963
lol I won
thanks for nothing /dpt/
>>
>>52703843
If you're using gcc, use e.g. -ansi or -std=c89. Otherwise, <string.h> will declare a function named "index".
>>
>>52703650
>bash
>language
>>>/tr(b)ash/
>>
>>52698620
good idea
>>
Anyone save that v2.0 ideas picture?
I only have v1.0 and v1.1.
>>
does anyone have any python IRC bots I can take inspiration from?

I don't plan on using any irc libraries I don't think
>>
>>52704141
>Python
Wrong thread, I think you're looking for reddit.
>>
Why is it literally impossible to split a string into substrings in C++ without using Boost or platform exclusive features?
>>
why is Haskell so comfy?
Thread replies: 255
Thread images: 32

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.