old thread: What are you working on, Sup Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
en.m.wikipedia.org
twitter.com
Is there any reason to write POSIX shell compliant shell scripts instead of bash scripts?
If you need to run on environments that may only have a simple POSIX shell and not bash, sure.
Otherwise no
ok then
How do i create index-accessible arrays in a posix shell script?
You are tasked with mapping gender as viewed by tumblr into native Java OOP with correct polymorphism and inheritance.
They need this as part of data gathering on tumblr demographics.
What do you do?
Damn it, Jim, I'm a programmer not an anthropologist!
these threads are more and more retarded
enum gender { MALE, OTHER };
reminder that women and queers can't program for shit
foo[0]="bar"
echo ${foo[0]}
Java is deprecated.
Except the only people lobbying for their expulsion are those who make even less of a contribution to the thread. Basically, you're everything you accuse the ``SJWs" of being - you don't write any code, you perform no useful work, all you do is persecute those more productive than yourself for not having ideologically acceptable beliefs.
delete OP's webm
What even is your purpose here? You know this is off topic, and will result in the best case being ignored, and in the worst case being banned. So what do you expect to gain?
you're a fag who sucks at programming. you probably don't even program at all you're just here to force your fag shit.
No, I actually do program, I have posted code in the past and commented on other people's code. What have you done?
Dumb question user, why would you write scrips in bash and the like? Are you deploying to places where you can't guarantee some newfangled interpreter?
I'm a code monkey :^)
well, gender is a spectrum so poly/inheritance arent applicable patters for this problem
so we really only need a 'person' object containing two unsigned integers that represent the amount of male and/or female the 'person' has
the methods in the 'person' object have different behavior based on those spectrum integers
Actual right answer
use BigDecimal nigger
>newfangled interpeter
like?
Anyone know how to get rid of the if statement below in python without resorting to multiplication by -1?
x = 10**1000
toggle_sign = True
total = 0
while x > 0:
y = floor(x * (sqrt(2)-1))
if toggle_sign:
total += ((x+y)*(x+y+1)/2 - y*(y+1))
else:
total -= ((x+y)*(x+y+1)/2 - y*(y+1))
x, toggle_sign = y, not toggle_sign
>without resorting to multiplication by -1?
But that's literally how you invert a number you tard.
How do I parse this data from my webcam stream?
--ipcamera
Content-Type: image/jpeg
Content-Length: 22124
ÿOÿà
The guys at work keep harping on about how easy their life is after rewriting arcane shell scripts in python. That's not my area, so I'm none the wiser.
multiplication by -1 is much faster than a branch you retard
I dunno, how do you read jpeg images.
Do you just want the content length number?
why not just scale with ints. It would be much better than using decimals. Representing gender is an abstract concept anyways, so it decimal precision wont even matter.
Your code needs inspection.
xor the sign bit
just flip the most significant bit of the number for fastest inversion.
>xor the sign bit
not true. I'm dealing with very large numbers and python allows arbitrarily large integers
>well, gender is a spectrum
:^)
kill yourself
That's the same speed as multiplying by -1 but less clear
You are actually retarded
Why is C++ so shit?
trap.cpp:8:32: error: invalid conversion from ‘void*’ to ‘Girl*’ [-fpermissive]
struct Girl *trap = crossdress(sizeof(struct Boy));
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
wtf is your problem? don't just assume things.
don't listen to these retards. keep the branch. you can turn the expression into a function to reduce code repetition.
I dunno, I tried writing all this to a jpg file sans the headers but it doesn't werk.
python hides that and allows arbitrarily large integers
Because C++ aims to be "typesafe" by 1980s standards rather than 1970s standards.
Use a Kronecker delta, like 2(kronecker - 1/2). I suggest you use the Fourier representation of it so that you won't need to use any if statements.
int kronecker(int x,int y)
{
double sum = 0.0;
int nmax = 1000;
std::comp i = {0.0,1.0};
for(int n=0;n
how do you receive this data? TCP stream?
im the one with the original solution and i just realized the scale thing is wrong
each 'person' object needs to accept a string submitted by the associated user in their 'gender' field
then we need to feed the entirety of all tumblr content into a deep-learning neural net
then the gender strings are passed through the neural net and abstractly interpreted into numeric values that can be used in calculations within a 'person' object's methods
I don't really understand the advanced math stuff, but a for loop is a kind of if statement, so it doesn't really work for what they're talking about.
that's the worst code i've ever seen. you should be shot.
>Anyone know how to get rid of the if statement
>proceeds to add 11 lines of code
looks interesting though desu
What exactly is your basis for the notion that the universe of gender can be mapped to a 1-dimensional space?
y = floor(x * (sqrt(2)-1))
OverflowError: long int too large to convert to float
trolled hard
That's the joke.
>I was only pretending XDD!
my actual function uses integers instead of floats. Try 10**100
this is psuedo code
even if you don't understand the math it's pretty obvious that it's an impractical solution
>my actual function uses integers instead of floats
What? sqrt(2) will always be a float, and multiplying it by an int will cause a float conversion
Unless you swapped out half your code for no reason, it's still going to break
you are absolutely correct. we need a powerful graphics rendering network so we can perform the calculations necessary in a multidimensional simulation
Management here, it still needs to be done with Java. If you want to do neural network with native Java then go ahead. Oh and your budget is $2m.
Get to work you fucking code monkeys.
>what is the Hilbert curve
R^2 is surjective to R, meaning they have the same cardinality.
You build an int out of as many digits of sqrt(2) -1 you want
414213562373095048801688724209698078
5696718753769480731766797379907324784621
0703885038753432764157273501384623091229
7024924836055850737212644121497099935831
4132226659275055927557999505011527820605
7147010955997160597027453459686201472851
7418640889198609552329230484308714321450
8397626036279952514079896872533965463318
0882964062061525835239505474575028775996
1729835575220337531857011354374603408498
8471603868999706990048150305440277903164
Then you multiple your number by then then do a floor divide on the result and you get the same value as if you would have done the psuedo code I gave you... you can use integers instead of floats
Thanks to Backpack, Haskell will now support:
applicative functors
Applicative functors
Applicative Functors
applicative Functor functors
applicative Applicative Functor functors
No idea
class IntDecimal {
int Value;
int DecimalPointLocation;
}
Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); she's super duper cute and easy to prototype in; she has contempt for false flags; and she's a blast to write in! Did I mention how cute she is? Say something nice about her, /dpt/!
nigger how do you expect use to help you if you don't even know how you get your data?
D
Go
Rust
Haskell
Common Lisp
Are these even relevant outside of Sup Forums?
Does stripping my binaries make my codes faster?
Congratulations, you just reinvented floating point.
x = 10**1000
sign = 1
total = 0
while x > 0:
y = floor(x * sqrt(2)-1)
total += sign*((x+y)*(x+y+1)/2 - y*(y+1))
x, sign = y, -sign
Testing shows a 9% speed increase with this code
Who cares?
that's not how floating point works.
No. It only makes them smaller
I just confirmed its TCP.
class intString {
String myString;
int letterLocation;
}
What are the reasons for wanting that?
Smaller binaries means better cache locality, meaning faster execution.
thats pretty cool. How do you test speed and get a percentage back? Is there some kind of library
>What is math
I ran them both a few thousand times, timed the total time taken for each one, then used basic math
Average python coder.
>how do I import basic math?
B-be gentle please!
void print_love() {
puts("
i know how to do it by hand. I was wondering if there was an inbuilt tool. Thanks for your contribution
>print_love
>not printLove
...
dumb frogposter
You might be in an embedded environment where space is at a premium, or you might be shipping very large binaries and want all the slimming you can get
symbols are stored in their own section of the binary, not interleaved in the code/data sections. They don't affect cache locality
i have never used python. But nice try anyways
...
Not programming related.
> >>>/
yoyà kinda looks like the jpeg signature:
en.m.wikipedia.org
Define "doesn't work", does the image viewing program not recognise the file?
>printLove
>not print_love
jesus christ user just use floats or high precision decimals
Lets say I have a normalized vector like [0.702,0.701] Associated with some pixel at [5,3] for example.
How can I get the next pixel that this pixel is "pointing" to with the least amount of error?
I have figured out a simple way to loop a user input until it's within my defined numbers that doesn't involve until answer1 == '1' or answer1 == '2' or....for a hundred ors
and now I'm sure someone will tell me an even faster way I should be doing it....
>ribbit.png
>rabbit.jpg
I don't want reddit stink nearby. Piss off.
you should be able to figure this out on your own
Clearly I am not.
It's been like a year or two and I still want to fix the typo where I made it say "hug memory" instead of "hog memory"
loser