[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: 25
File: ko.png (389 KB, 934x1000) Image search: [Google]
ko.png
389 KB, 934x1000
What are you working on, /g/?

Old thread: >>52076772
>>
>>52080391
u losed
>>
fuck you for using an anime picture
>>
memes are a meme
>>
requesting 3d trannies for better thread
common, mods are dead and janitors are sleeping
>>
Friendly reminder that mods like to delete the newest thread when there's a duplicate, no matter how many posts it has.

Go post in the other one. >>52080378
>>
File: consider:.jpg (31 KB, 500x375) Image search: [Google]
consider:.jpg
31 KB, 500x375
What should be the compile target of my new programming language? Javascript? Webassembly? The JVM? C source code? x86? I want it to be able to mooch off of another language's libraries quite easily.

define (sumArguments x y z)
if ((x equals y) and (y equals z))
+ x y z
elseif ((y / 2) equals z)
(x + y) - z
32

sumArguments 2 4 8

sumArguments
1234
Math.factorial 32
Math.round
divide 123 456 789

define (imperativeFunction num1 num2)
imperative
let num3 (num1 / num2)
if (num3 < 5) (return num1)
return (Math.power num1 num3)

It's sort of a lisp++, using indentation as an alternative to the endless parentheses. The primary goals are expressiveness/ flexibility, simplicity/ readability, and good performance. I'm going to get rid of punctuation wherever possible so that the code will be clear and understandable, and typing is done by inference up the AST. I want functional, OO, and imperative styles to all be equally valid, and for it to be very easy to switch between them as appropriate, and there's going to be macros for infix functions too. Also I'm going to use a constraint-based system to perform compile-time evaluation and simplification of code in the AST. That's in addition to a very stack and register-friendly language design.
>>
>>52080514
python
>>
>>52080554
its more like bernie
>>
>>52080632
>5AM
no shit
>>
File: kivymd logo.png (41 KB, 512x512) Image search: [Google]
kivymd logo.png
41 KB, 512x512
>>52080391
I'm developing Material Design widgets for Kivy, a Python framework to make Android/iOS/desktop apps.

Here's the repo: https://github.com/kivymd/kivymd

What do you think /g/? Material Design haters plz no bully.
>>
>>52080522
delete yourself of the internet, filthy weaboo
>>
>>52080647
Well we don't live on fucking Tea Street in god damn Crumpet City, do we, faggot?
>>
>>52080632
Just woke up, anon-kun.

I'm working on a django application today. Something simple to manage my shitposting images. I don't normally do web stuff, but it's been fun so far.
>>
File: 1450827530398.png (201 KB, 322x395) Image search: [Google]
1450827530398.png
201 KB, 322x395
>>52080653
No bully, please
>>
>>52080637
7:36PM here dweeb.
>>
>>52080514
>>52080526
Does anybody else have some more serious input?
>>
>>52080694
>living in pacific country area
lol
>>
>>52080711
I'd go for nim myself
>>
>>52080711
dude, python has a million libraries, I chose that one for you
also, I imagine ur language will need to be syntactically similar with similar features, so choose the one you like th emost , aka, for me it'd have to be haskell since curry funcs
>>
Updated memesnake to gradually drop to updating the image from once every 120 ticks to once every 30 ticks, decrementing the count by 1 every time it eats something.
>>
>>52080702
I'm not, but it looks interesting. How's your experience been so far?
>>
>>52080724
>write source code
>compile to Nim
>recompile to C
>re-recompile to asm
>>
Which is real thread?

>>52080391
>>52080378
>>
I've got a data class called "UserSettings".

I'm not sure how I'd set "DefaultSettings".

For some reason my brain can't understand how I'd go about doing that. I'm being retarded I know, but I really can't seem to think of the best way to create a version of that class that stores default values that I can call if the user hasn't got stored local settings.
>>
File: svgui.png (111 KB, 1280x974) Image search: [Google]
svgui.png
111 KB, 1280x974
I would like to learn how to create simple SVG graphical user interface for PLC programs with SVGUI. But the problem is that Beremiz & SVGUI do not have any documentation at all. How should I get started with it?
>>
>>52080828
I'm going to say this one, since it has more replies in a shorter post lifetime.
>>
>>52080828
this one, more replies, no tranny, etc
>>
>>52080841
Which ones, anon? Post pictures and I'm sure we can help you.
>>
File: awoo~.png (762 KB, 1000x1000) Image search: [Google]
awoo~.png
762 KB, 1000x1000
>>52080841
>literally stealing my posts from the other thread
this is literally spam
>>
File: file.png (8 KB, 147x49) Image search: [Google]
file.png
8 KB, 147x49
>>52080863
>>52080841
lol
>>
File: CHAIKA! MAKE BIG!.png (469 KB, 984x923) Image search: [Google]
CHAIKA! MAKE BIG!.png
469 KB, 984x923
Friendly reminder that the OP of this thread lost by posting his thread a full 2 minutes after the first one.
And in order to pretend that his thread is legitimate he is copy pasting posts from the other thread into this one.

You're talking to a literal samefag.
>>
>>52080843
you can use glade for graphical user interfaces
>>
>>52080887
Wow, rude.
>>
>>52080913
>everything must be the SAME
nah
>>
designated shitting thread
>>
>>52080922
you've posted this image 4 times in the the last 24 hours and it's always accompanied by an insincere political opinion, you BSD sympathizer cuck.
>>
>>52080916
>wanting a trap op image
get out liberal faggot, I bet you'll vote for hillary because muh vagina
>>
>>52080968
OP stop copy pasting my posts.

You're a fucking loser, you know that?
>>
File: 1444159018240.png (779 KB, 1000x1000) Image search: [Google]
1444159018240.png
779 KB, 1000x1000
>>52080994
>he's copy pasting other people's posts to make his thread more popular on a weeaboo imageboard at 6am in the morning

where did your life go so wrong?
why is is this so important to you?
>>
>>52081037
>he thinks i'm the OP of the other thread
wow, you really are a loser
this is literally the only thing you're thinking about, so much so in fact that you didn't even consider the idea that you might not even be talking to the OP of the other thread.

also, you can't delete threads over 25 minutes old, so abloo bloo bloo sucks to you
>>
>Added usersettings to my applications
>On startup it loads settings if they exist, if not it generates a new file from default
>Now my applications enters break mode immediately after finishing it's loading duties
>No idea what the problem is other than the fact it breaks

Fan fucking tastic.
>>
Can we just start over in the other thread?
there's literally nothing of value here, just 2 weebs fighting and samefagging.
>>
>>52081083
I'm not angry, I'm trying to make you see the error of your ways.
Your habits are unhealthy.
>>
>>52081077
>"Additional information: The calling thread cannot access this object because a different thread owns it."

Literally the only information I get. I've tried commenting out various things and it's still not playing ball.

I have absolutely no information with which to fix this.
>>
>>52081133
I made a meme-triangle yesterday and posted it, but nobody cared.
Now I'm rewriting it to be more impressive in hopes that somebody cares.
>>
File: 2015-12-27-0627-08.webm (514 KB, 640x346) Image search: [Google]
2015-12-27-0627-08.webm
514 KB, 640x346
>>52081155
Nah, it seemed too easy and boring.

Here's my meme triangle.
>>
>>52081133
Yes
>>
>>52081163
How do I draw animations in the terminal like that?
I assume this is, C, right?
>>
>>52081203
Well, I wrote a miniature graphics library that treats characters like pixels and updates the screen as I apply transforms to the triangle.

Right now I'm writing an API that would let me easily change rotation angle, speed, scale, position and add multiple triangles.

And no, it's written in Pascal :^)
>>52081207
Thank you. Your (You) is kindly appreciated.
>>
File: drag and drop programming.jpg (122 KB, 992x559) Image search: [Google]
drag and drop programming.jpg
122 KB, 992x559
How does it feel knowing that programming will be dumbed down to be easier for millennials born after the year 2000?
>>
File: nativeshell.png (11 KB, 640x480) Image search: [Google]
nativeshell.png
11 KB, 640x480
>>52081163
>>52081256
Will it work in Native Shell? I want pure memeing.
>>
>>52081256
I figured as much, but how do you draw to the terminal without doing something hacky like calling system("cls") for every frame?
>>
>>52081271
That might be possible, I'd have to enable some compatibility flags, but I haven't delved into that yet.
I'll look into it when it's a bit more finished.

>>52081273
Well, it's still hacky. I wrote a function that defines a bounding box for the triangle (that's the "background" you see there) and the screen is updated only inside it.

What's funny is that the refresh rate of the image is bottlenecked by the speed of the cursor position and print commands, so I'll probably have to narrow it down even further by checking only for pixels that actually changed.
>>
>>52081221
It's a sorting algorithm using the GPU.
I don't know if it's going to get a great performance yet, but it's fun and challenging to code.
>>
>>52081133

I wrote a few hundred lines of C++ today...

>>52081203

If you want to interact with the console outside of simple stdout/stdin, there are a few ways to do it. One is to use the ncurses library, which is fairly multiplatform. Just update screen every animation frame and such. If you don't want to rely on ncurses or similar libraries, you can always interact with your console from scratch. On Windows, this is done with the Win32 Console system calls, and on most Unix systems, this is done with ANSI VT100 escape codes. Neither method is particularly ideal, because it involves writing more code, and it won't work on the other platform. On some interpreted languages (Python and Ruby I think), ANSI VT100 escape codes may be translated to Windows system calls on Windows platforms.
>>
You guys probably get asked this a lot and I apologize for asking again.

But I wonder which language or area of programming I could earn the most from while working long distance (as a freelance worker or something similar)? I'm not a neet, just someone who wants to be able to travel a lot.
>>
>>52081262
These are great news, because those who can still program the old fashioned way will be gods compared to the millennials in the programming world.
>>
>>52081262
>that big else-do
they're never gonna make it, anon
>>
>>52081133
Still working on my own dependency injection container (Java)
wrote a bunch of different classpath scanners to make it all a little bit more flexible and customizable

gonna start thinking about some kind of sorting algorithm that guarantees that the classes get instantiated/injected in the proper order, much like Spring Boot seems to do it
>>
>>52081262
My two cents is that the source-code/syntax paradigm is archaic.

I'd rather have a system where functionality is not dependent on syntax. Let the IDE generate source code and define the syntax, separately.
The source file would contain syntax-independent commands for functions, objects, blocks, etc, and when you open it in an IDE, the IDE translates it to text based on your syntax preferences.
Everybody wins.
>>
>>52081364
Does something like JAX-RS not have an option for dependency injection?
>>
>>52081349
Isn't that market too over saturated? It sounds like fun though
>>
>>52081389
I don't think so, JAX-RS is just for REST web services

Java does have @Inject and other stuff like that, but I want to write my own thing
>>
>>52081406

It has the most demand, hence why tons of people get into it. If you want to get into a less saturated market, you're going to have to learn more than just a language. Personally, I'm trying to get into niche markets, namely security and system software.
>>
Why do people recommend that you separate the rendering from the update/tick function?
My CPU usage went from 100% to 30% when I started only rendering surfaces when I needed to.
>>
Ugh, I hate it when libraries use unsigned ints for no reason.
>>
>>52081482
i use unsigned ints for no reason

fight me
>>
>>52081496
abs(t2 - t1)
t = unsigned int
Have fun debugging.
>>
>>52081482
>Java doesn't have unsigned ints
haha suck my dick faggots
>>
>>52081502
abs them separately, then subtract, you dumb shit
>>
>>52081502
why would you absolute value something which you know is positive already?
>>
>>52081532
Distance between 2 positions for instance.
>>
>>52081541
just add them to an int and then abs that
>>
>>52081554
overflow.
>>
>>52081389
>>52081429
From the javax.inject documentation

"This package provides dependency injection annotations that enable portable classes, but it leaves external dependency configuration up to the injector implementation. "

Injector implementation is exactly what I'm trying to do

Whether I'll actually use the javax.inject annotations is something that I'll decide in the future
>>
>>52081482

Why? There's absolutely nothing wrong with using unsigned integers. They can be easier to optimize around in some instances, and unless one needs a value to be negative, there's no reason to use a normal int... unless one wants to make the line length shorter or something.

>>52081502

max(t1, t2) - min(t1, t2)
>>
>>52081735
 t1 > t2 ? t1 - t2 : t2 - t1

would this be simpler
>>
>>52081803

Well it's certainly going to execute faster. As for simpler... it's less high level, but honestly who gives a shit?
>>
In C# is there any way to set an async Task<T> to null? I don't want to have to return a string I have absolutely no use for, rather just use "return;"
>>
>>52081995
Why not async void?
>>
>>52081956
We can't all be smart.
>>
>>52082031
I thought it had to be a task to run, shows you how stupid I am huh.

In an ideal world I'd know how to read the return string somehow and use that to set my status text, but I am not very smart and don't seem to understand how it works.
>>
>>52082051
It slowly builds up.
Give it a shot.
>>
>>52082069
>>52082031

No it does need to be a task to use "await" and there has to be a return type.

Oh well I'll just return an empty string.
>>
File: 2015-12-27-082910_576x940_scrot.png (774 KB, 576x940) Image search: [Google]
2015-12-27-082910_576x940_scrot.png
774 KB, 576x940
haskellers, halp!

code compiles but doesn't work, why?
basically, I want to replace underscores with spaces in a multitude of files, and so I've coded pic related, which does this
>check a dir from sys args
>set it as current dir, and do the same for every subdir and if its a file, then replace "_" with " "
>use space to do everything and d is used as a state keeper
>meme function is for extracting parent dir
pls halp, i don't know what makes the program get stuck
>>
>>52082273
that doesn't look like haskell. it's readable.

try adding more monads
>>
>>52082343
no, their pseudo code is shit
srs, couldn't understand anything, i'd rather an algorithms book for a specific language
>>
>>52080514
C. But that could make your FFI problematic to implement.
>>
>>52080391
Rewriting a Node.js imageboard in Go. Web server is mostly done and I should be able to start on the client-side and related database write functions soon.
>>
>>52082444
it comes from google, probably it is
>>
>>52080391
I'm tired of this fucking picture. The girl looks retarded
>>
>>52082444
No. There are some cancers but the Code of Conduct was going to implement SJW bullshit and the community very clearly stated they didn't want that shit and Andrew Gerrand from the Go team backed down and wrote a sensible version (just common sense stuff) instead.

The SJW influence is everywhere, but Go has been able to resist its cancer relatively well. If you want better than that, you'll probably have to hang out only with the RISC V assembly community :^)
>>
>>52082421
then read it
>>
>>52082414
Share the code senpai.
>>
>>52080514
LLVM IR. It allows you to share the bytecode among any machine with an LLVM compiler, and it's faster than compiling to other pseudo-portable targets like C or javascript because you don't have to work around their own constructs to implement your own efficiently.

For example, match can be implemented as a single jump instead of linearly checking each condition until a match occurs, which can be much faster than a series of if, this way. The basic idea is that very high-level constructs may have optimizations that are extremely efficient for them, but the same construct expressed as a composition of lower-level constructs might be too ambiguous to optimize this way.

Moreover, by targetting LLVM IR, you can interop with C extremely easily in several ways. First, you can simply defined external symbols and link with the corresponding C library and it will work just fine. Second, you can use clang to compile C files as-needed on-the-fly to generate an interface for your language.

Since you're making a functional language, using the JVM is not appropriate.No free alternative to .Net is mature enough to be targetted so far, but when one becomes mature enough, it would also become a good target.
>>
>>52082594
OCaml doesn't have this issue. Use OCaml today!
>>
What's your favorite algorithms textbook?

I like Algorithm Design Manual and CLRS
>>
>>52082608
wikipedia
>>
>>52082616
Wikipedia is more of a reference
>>
>>52082444
No. Lower level languages generally have less of that shit, because there are less incompetent drama queens capable of using it.
>>
>>52082541
https://github.com/bakape/meguca/tree/version2
>>
>>52082601
Thats only because OCaml doesnt have anything resembling a community.
>>
>>52082444
Absolutely. Worse even.
>>
>>52082637
>Thats only because OCaml doesnt have anything resembling a community.
OCaml has a very large community actually.
>>
>>52082645
This means that it's not e.g. F* which is completely controlled and used only by microsoft (which would be a non-diverse (MS-only) non-worldwide (US-only) community).
>>
>>52082273

Just because a program compiles doesn't mean it's correct. Clearly the logic of the program is wrong. If you say it's getting stuck, then you likely have an infinite loop. I don't understand Haskell syntax at all, but could it be that change function?
>>
>>52082721
Why would you be against a diverse community?
>>
>>52082671
Yea sure. Thats what everybody who uses OCaml tells me. But when I mention OCaml to literally anybody they just look at me wondering what the fuck thats supposed to be.
>>
>>52082773
That's because you're asking normies what they think about programming, instead of asking programmers.
>>
>>52082834
>not wanting to pair program with qts
>>
>>52082834
>Best person for the job turns out to be a minority

>They fucking chose them because they're a minority!!! A minority would never be the best person for this job!!!

>>>/pol/
>>
>>52082820
Im talking about CS Students and collegues at work.
>>
>>52082883
Awww, isn't it cute everyone? Timmy is playing make-believe!
>>
>>52082857
He did say choose the best person for the job, so I don't think he'd mind your scenario. Cool your jets man.
>>
>>52080645
I use it for my apps and it's great.
>>
>>52082857
>this is what SJWs actually believe
>>
>>52082921
The point is that these red pill spergs will never accept that a minority could be the best for the job. It's just racism in disguise.
>>
>>52082966
He never said that. At least here you are fighting straw men.
>>
>>52082980
>He

Just say "I"
>>
>>52082966
I'm glad you can read their minds
>>
>>52082987
Not him, the other guy that responded to you is him prolly.
>>
Let's have a strawpoll to see how diverse /dpt/ is.

http://strawpoll.me/6374789
http://strawpoll.me/6374789
http://strawpoll.me/6374789
http://strawpoll.me/6374789
>>
>>52083039
>Racism is such a silly word

Here we go
>>
>>52080968
are you 5 ?
>>
>>52083039
>Racism is such a silly word, it's like if gingers called the act of insulting gingers for being ginger, "gingerism".

So other races are literally inferior and people are just calling a spade a spade? Interesting logic kiddo. I remember when I was 15.
>>
>>52083039
"Racism is prejudice, discrimination, or antagonism directed against someone of a different race based on the belief that one's own race is superior."
>>
>>52083016
I'd say /dpt/ is pretty diverse besides the one probably joke answer, looking at you minority non-straight non-binary.
>>
>>52083091
You've compared "racism" to "gingerism", which means calling someone a ginger.

"Racism" isn't calling someone by their race, it's >>52083068
>>
Anyone here use Mahapps?

I'm trying to access the current theme brush (NOT the current accent) I can't find anything online or having scanned through the files.
>>
>>52083189
We grew up.
>>
>>52082709
it just just my meme function, the change one is fail-safe
>>
>/dpt/ doesn't like diversity
Non-white male here.
S-should I leave?
>>
>>52083319
s-sure
>>
>>52083166
I just wish black people would stop thinking they're a human.
>>
>>52083195
grew down, more like.
>>
>>52083416
It's pathetic. Without fairly assessing each population's potentials and differences, how can any society work efficiently?
>>
>>52083434
>being a socialist
Go live in russia, fag.
>>
https://challenge.synacor.com/

You can't call yourself a programmer if you can't do simple virtual machine programming /dpt/. You can put anything in e-mail address, it's only for logging in
>>
>>52083643
>eyerape neontext
>>>/trash/
>>
>>52083724
Those colours show that it really is some serious hackers shit
>>
>>52083880
>>52083724
wow you faggots will do anything to not program and just shitpost
>>
>>52083988
I code my own ideas, besides I don't have the time to shitpost AND do some dumb challenge.
>>
>>52084002
>dumb challenge
you seem intimidated
>>
>>52084016
Well then you're very bad at judging the emotions of others
>>
>>52084052
you seem even more intimidated
>>
File: PLC5_Program.jpg (143 KB, 1224x743) Image search: [Google]
PLC5_Program.jpg
143 KB, 1224x743
>>52081262
PLC programming has been like that for the last 20 years or so
>>
>>52084095
>tfw the royal dutch navy using something similar for radar equipment
>>
>>52084127
How do you know
>>
>>52084139
Got a tour an knew a few that did an internship.
Just kidding, I'm a terrorist.
>>
File: 01.jpg (237 KB, 1024x768) Image search: [Google]
01.jpg
237 KB, 1024x768
>>52084127
>>52084139
These devices are everywhere especially in the manufacturing industry. They are all programmed in drag&drop fashion.
>>
>>52084230
It's not PLC programming. The tool spits out C++ code.
>>
>>52084230
Honestly, I can barely understand the things that are on that image at >>52084095
>>
and SDR guys in here

what's a good receiver to get started with
>>
I have a struct in C++. It has two pointers to another struct and an unsigned int. sizeof says it uses 24 bytes. I want to reduce that.
I tried changing unsigned int to be char, double, short int, everything -- sizeof still returns 24. Only adding/removing items from the struct changes anything.
Am I not understanding something? Why doesn't the data type of the integer influence the size of the struct?
>>
>>52084095
wew datsa lotta lads
>>
>>52084350
Protip: the compiler adds extra padding to your struct, so the size is likely more. Stop doing useless optimizations.
>>
>>52084315
As far as I know those are basically just instructions for comparison (GEQ,LEQ), logical operators, assignment and time delay (TON).
>>
>>52084377
They're not useless, I don't have enough RAM for all the structs, so I want to reduce their size.
Any way to do that?
>>
>>52084406
The fuck are you doing if you don't have enough RAM to hold what seems to be a binary tree?
>>
>>52084350
https://en.wikipedia.org/wiki/Data_structure_alignment#Data_structure_padding
>>
>>52084406
with gcc

struct Foo
{
int a;
char b;
} __attribute((packed));
>>
>>52084406
#pragma pack
>>
>>52084441
a real big binary tree.

>>52084444
Dem quads, thanks for the link.

>>52084463
That worked, thanks! I'm not sure whether that causes anything catastrophic, but oh well.
>>
Reminder to not create a new thread and just move to the other one when this one is autosaging.
>>
>Ocaml has classes, but classes and inheritance exist for
code reuse purposes, rather than to induce subtyping relationships.
Based.
>>
>>52084499
> That worked, thanks! I'm not sure whether that causes anything catastrophic
On x86/x86-64, there's a performance penalty due to non-alignment.

On other platforms, any pointers to structure fields would be invalid as they don't satisfy the alignment requirements; attempting to access a field through such a pointer will typically either terminate the program with SIGBUS or return garbage.
>>
>>52084675
>performance penalty
Of what kind? I need really fast access, so I wouldn't like any slow downs on that front.
Considering I only save about 1GB from all this, I don't think it's really worth it.
>>
>>52084389
I mostly understand that, but I don't see that in the diagram.
>>
>>52084795
You're beyond retarded. Take a lead to the head.
>>
>>52084837
But this is a friendly website, anon. You can't bully anyone here. At least without any arguments to back up your edginess.
>>
Can anybody give me some links/literature about multithreading preferably with some exercises? I know how to make a very simple producer consumer application, but i would really like to understand the fundamental concepts properly.
>>
ok faggots, another site where you work with a virtual machine. It's essentially a game where you have to guess the password per level by seeing how the opcodes affect memory and how it reacts to the password you entered into its memory

https://microcorruption.com/
>>
>>52084095
How do I get into PLC programming.
>>
>>52084924
Can I use cheat engine.
>>
>>52085006
If you truly suck at programming, I don't see why not
>>
>>52084979
math and stuff
>>
>>52084979
>>>/reddit/
>>
Working on learning simple Python, doing the Euler Challenges. Doing something wrong, but I can't figure out what...

File "<ipython-input-2-0a96a1415bfd>", line 16
done = True
^
SyntaxError: invalid syntax
>>
>>52083016
>all these neckbeards pretending to be a girl
>>
>>52085052
Post previous lines.
>>
>>52085052
>SyntaxError: invalid syntax
Another reason not to use python.
>>
>>52085052
>Doing something wrong, but I can't figure out what
>Python
There's your problem.
>>
>>52082273
I can't read haskell but you're recursively calling meme with the same argument each time?
>>
>>52085058
number = 600851475143
print("Number is: " + str(number))
done = False

import math

x = (math.ceil(math.sqrt(number)))**2

while not done:
z = x - number
z2 = math.sqrt(z)
if z2%1==0:
y = z2
print("Found y! y = " + str(y))
print("x = " + str(x)
done = True
else:
x += 1
>>
>>52085075
>>52085080
Will we ever get a memeless dpt?
>>
>>52085098
Can I post while keeping the spaces and such intact? It would make it easier to read for you.
>>
>>52082721
why do you care
>>
>>52085098
GOD DAMN THIS IS STUPID
1)
2) YOU DIDN'T CLOSE THE PARENTHESIS
>>
>>52085098
>print("x = " + str(x)
Easy mate, syntax errors at the beginning of a line means it was expecting something in the previous line
>>
>>52085122
*In shame*

Thanks.
>>
>>52085112
>>52085122
There's a empty code tag in the point #1, use that next time. Google it, cuz I clearly don't know how to post an empty code tag.
>>
>>52085057
I can believe there are some legbeards here.
>>
>>52085152
number = 600851475143
print("Number is: " + str(number))
done = False

import math

x = (math.ceil(math.sqrt(number)))

while not done:
z = (x**2) - number
z2 = math.sqrt(z)
if z2%1==0:
y = z2
print("Found y! y = " + str(y))
print("x = " + str(x))
done = True
else:
x += 1


Testing...
>>
File: 1440829767818.webm (3 MB, 640x360) Image search: [Google]
1440829767818.webm
3 MB, 640x360
In my Android application, I need to be able to save some text that the user entered, save it to a cloud somewhere (for anywhere from a fraction of a second, to indefinitely), then send it to another user's phone. Will Google Cloud Messaging handle all of that, or is there a better software I should use?
>>
>>52085199
the fuck is this?

>z2%1
nigga why?
>>
>>52085251
baka
>>
>>52085251
>2 DPT threads, only one of which is even close to the bump limit
>Still makes a new thread

You should kill yourself.
>>
>>52085244
To see if it's an integer? Care to share a better method?
>>
>>52085354
>replacing minimalistic approach with bloat.

wew lad top haslel
>>
>>52085331
Yeah, using a better algorithm, you're jumping hoops to find 2 perfect squares that add up to that number right?
>>
In C# does a fixed size list dump out when it hits the limit, or does it remove the value at 0 to accommodate?

I want to do some kind of track memory for when you want to go back when you're playing tracks in shuffle mode.
>>
>>52085406
Oh I mean to find 2 perfect squares such that the smaller one plus that number is equal to the bigger one
>>
>>52085424
What?
>>
>>52085354
>>52085380
It comes from a float, if you sqrt(float) you dont get an int, right?


>>52085406
Yes, trying to find all primes of a ridiculously (in the millions) large number.
>>
Daily reminder
a % 0 = a
in any decent programming language
>>
JANNY
>>
>>52083039
>I don't care is someone is black, white, or purple

>Lying on the internet.
>>
>>52085424
What kind of list are you using?
>>
>>52085465
What could you use this for?
>>
>>52085459
>trying to find all primes of a ridiculously (in the millions) large number.
I'd recommend doing that in a low level language. This isn't what Python is made for at all.
>>
>>52085484
Gives % an identity.
>>
>>52082721
If there are real manipulative shitters about then they are probably waiting for you to slip up and say something they can latch on to. Which is to say, they're trying to bait you.

I don't doubt that /g/ has some knowledgeable people. However, I also don't doubt many of them are anti-social as fuck, lack self-control, and will gobble up the bait at the worst time like the suckers they are.
>>
>>52085473
Whichever one will work in this instance.

If I do
"Object tempList = new List<Object>(30);"


When it hits 30, will it begin removing the value at index 0 to allow for a new Object to be added?
>>
What should the memest program ever made do?
>>
>>52085551
Install Gentoo.
>>
codata Monoid : Set -> Set where
E : Monoid a -> a
_*_ : Monoid a -> a -> a -> a

Assoc : (m : Monoid a) -> (x : a) -> (y : a) -> (z : a) -> open m {(x * y) * z == x * (y * z)}
LeftId : (m : Monoid a) -> (x : a) -> open m {E * x == x}
RightId : (m : Monoid a) -> (x : a) -> open m {x * E == x}


data Nat : Set where
Zero : Nat
Succ : Nat -> Nat

_+_ : Nat -> Nat -> Nat
Zero + n = n
Succ m + n = Succ (m + n)

natAdd : Monoid Nat
open natAdd
E = Zero
_*_ = _+_

Assoc Zero n p = Refl
Assoc (Succ m) n p = cong Succ (Assoc m n p)
LeftId _ = Refl
RightId Zero = Refl
RightId (Succ m) = cong Succ (RightId m)


Codata with an operation (open) to bring their fields into scope are perfect for type classes.
>>
>>52085559
What do you have against multithreading?
>>
>>52085528
It will automatically resize and keep all objects
>>
>>52085598
He uses OCaml.
>>
>>52085559
Technically this thread is spam, >>52080378 was first.
>>
>>52085610
Sucks, oh well unless you play several hundred thousand tracks in a single session I doubt it'd ever really matter.
>>
File: camel-up.jpg (216 KB, 1500x659) Image search: [Google]
camel-up.jpg
216 KB, 1500x659
I'm writing a probability analyzer for the board game Camel Up.
>>
>>52085528
"If Count is less than Capacity, this method is an O(1) operation.
If the capacity needs to be increased to accommodate the new element,
this method becomes an O(n) operation, where n is Count."
https://msdn.microsoft.com/en-us/library/3wcytfd1(v=vs.110).aspx

So no, it doesn't work like that.
>>
>>52085631
Well, you could just make a class that does what you want with a fixed-size array
>>
Wrote a program to reconvert exported audio files from my BWM.
These fuckers flip every bit on export to prevent you from stealing or something.
Once the magic number detection works you'd just give it a folder a receive your original files.
>>
File: anon.jpg (658 KB, 2048x1536) Image search: [Google]
anon.jpg
658 KB, 2048x1536
>>52082356
agreed -- I would have to scrutinize the pseudo code, THEN write it in my preferred language for it to make complete sense.
>>
>dumb weeb has made 3 threads nobody cares about

top kek m8
>>
>>52085639
I'm doing the same for a game in my country called tongits.

Shit's hard yo

What's the gist of camel up?
>>
>>52085681
Why do you buy slave's technology?
>>
>>52085681
s/BWM/BMW audio system
>>
File: 1447016210965.gif (2 MB, 400x242) Image search: [Google]
1447016210965.gif
2 MB, 400x242
>>52085207
Anyone?
>>
>>52085699
It's a camel races where you bet. So knowing the probability helps to bet.
>>
>>52085717
Did you even look up what GCM is?
>>
>>52085726
sounds really cool, and I'm guessing the cards affect the camels racing. Do you have people irl to play with?
>>
where milo at
I saw the github repo in the last thread
dude you are a monster
>>
>>52085793
post it lad
>>
>>52085755
There are few things that affect the race, the cards are just betting cards. I play with my wife and my son.
>>
File: post_it.png (17 KB, 955x519) Image search: [Google]
post_it.png
17 KB, 955x519
>>52085793
>>
Are you supposed to be constantly using iterables in python?
>>
>>52085919
You're not supposed to be using python at all
>>
>>52085925
btfo. What's important is the algorithms, not the language.
>>
>>52085925
Stop meming
>>
>>52085959
The one with 52 posts
>>
>>52085919
like a lot things in python, iters are largely a convenience. you can make do without them but it's harder and more complicated.
>>
>>52085959
Let's just create a new one to avoid confusion
>>
>>52085965
you should kill yourself faggot
>>
File: merryXmas.jpg (188 KB, 1366x768) Image search: [Google]
merryXmas.jpg
188 KB, 1366x768
>>52085877
these meme shapes are the future
>>
>>52085980
It's the legitimate thread, anyways.
>>
>>52085959
We make a /wpt/
>>
>>52086014
We wouldn't have this problem in the first place if you fucking trapfag would just have killed yourself.
>>
NEW!
>>52086042
>>
>>52082273
fuck haskell
>>
>>52080687
wikipedia says intel/amd processors no longer include a 'processor serial number', so what's the point of doing this? wouldn't there be only a few thousand variations of processors at max to try, making brute-forcing the 'encryption' trivial?
>>
File: P51227-135558.jpg (2 MB, 1224x1632) Image search: [Google]
P51227-135558.jpg
2 MB, 1224x1632
i started learning python today. how roundabout is my style? it took me a bit to figure out how to loop it but there must be a better way
>>
>>52086263
WTF is that code?
Thread replies: 255
Thread images: 25

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.