[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: 29
File: godsofprogramming.jpg (100 KB, 600x600) Image search: [Google]
godsofprogramming.jpg
100 KB, 600x600
Daily Programming Thread

What are you working on, anonymous ?

# New & Revised /dpt/ Code of Conduct #
We want to ensure that the /dpt/ community, while large and diverse, remains
welcoming and respectful to all participants. To that end, we have a few
ground rules that we ask people to adhere to.

- *Be friendly and patient.*

- *Be welcoming.* We strive to be a community that welcomes and supports
people of all backgrounds and identities. This includes, but is not limited
to members of any race, ethnicity, culture, national origin, colour,
immigration status, social and economic class, educational level, sex,
sexual orientation, gender identity and expression, age, size, family
status, political belief, religion, and mental and physical ability.

- *Be respectful.* Not all of us will agree all the time, but disagreement
is no excuse for poor behavior and poor manners. We might all experience
some frustration now and then, but we cannot allow that frustration to turn
into a personal attack. It’s important to remember that a community where
people feel uncomfortable or threatened is not a productive one. Members of
the /dpt/ community should be respectful when dealing with other members as
well as with people outside the /dpt/ community.

- *When we disagree, try to understand why.* Disagreements, both social and
technical, happen all the time and /dpt/ is no exception. It is important
that we resolve disagreements and differing views constructively. Remember
that we’re different. The strength of /dpt/ comes from its varied community,
people from a wide range of backgrounds. Different people have different
perspectives on issues. Being unable to understand why someone holds a
viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to
err and blaming each other doesn’t get us anywhere. Instead, focus on
helping to resolve issues and learning from mistakes.
>>
Whos the faggot in the back
>>
>>54310142
What the fuck is this shit
>>
Reposting from last thread:
I've been avoiding rust because of the CoC bullshit, but I took a glance at it today.
Holy shit, it looks fantastic!
>it's a functional programming language
>it doesn't need a GC or refcounting except in the case of structures that might have circular refs
>fast as shit
>ML constructs everywhere
>C-like syntax so the babyducks don't flee before trying
>uniqueness types for safe memory management
>side-effects as an option, disabled by default
>supported by mozilla, which is still a large company
>some serious people are starting to write good-quality libraries for it

What's the catch? There's always a catch, like lisp's lack of libraries, ocaml's disgusting build system, or haskell's laziness and 0/10-quality libraries. What's rust's?

ALSO: Human biological immortality SOON, get hyped faggot!
>>
>>54310149
your mom
>>
>>54310159
made by webshitters
>>
>>54310159
>lisp's lack of libraries,
Common lisp has every libraries that you ever wanted.
>>
>>54310159
Mozilla will be kill soon.
>>
>>54310185
And yet it seems (again at a glance) that it would actually be viable for legitimate systems development.

>>54310191
Fuck no it doesn't. Point me to a single even remotely usable GPU compute library. You can't, they're all ridiculously limited or unusably slow. And it's not exactly a small niche application, it is niche but just barely.

>>54310211
Community will fix it (r-right?)
>>
Code of Conduct or Traps, which are more cancerous?
>>
>>54310233
Code of Traps and Traps of Conduct.
>>
>>54310233
I would take trap posting over SJW crap any day of the week.
>>
>>54310225
>Point me to a single even remotely usable GPU compute library.
cl-cuda
>>
File: metabolism.jpg (97 KB, 620x413) Image search: [Google]
metabolism.jpg
97 KB, 620x413
REPOST:

>>54309393
Full immortality is too large for a first milestone, but there is a lot of biological evidence that human life extension is possible.

Many organisms live much shorter lives than humans, but some live 3-10x longer than us (For example Arctica Islandica clamshell lives >400 years, Bowhead Whales and Koi fish live ~200 years, Pinus longaeva trees live up to 5000 years). Many smaller animals live longer lives if we control by their size, the champion here is naked mole rat.

Now, we have all the prerequisite technologies to start a massive anti-aging research effort:
* >1000 of species have their genomes sequenced. Some of these species live remarkably long for their size (for example http://www.naked-mole-rat.org/about/ ). These genomes are freely available ftp://ftp.ncbi.nlm.nih.gov/genomes/ with annotations and all supporting data.
* Thousands of individual human genomes are already sequenced and available as well.
* The software to analyze these genomes is already here, for free: https://github.com/search?utf8=%E2%9C%93&q=bioinformatics .
* There is a database of known relationship between genes and aging: http://genomics.senescence.info/
* Computing power to analyze this data is available.
* All scientific papers (including genetics, molecular biology, bioinformatics) are available for free at http://sci-hub.io/ http://libgen.io/
* Almost all technical literature including biology (for example Alberts' Molecular Biology of The Cell), bioinf. and CS textbooks are available at http://libgen.io/

Anybody with a PC and internet connection can use these resources. Sadly, society largely chosen not to engage in massive ant-aging effort and invests much more in entertainment, real estate and similar dead-end stuff.

Sadly even programmers, the people who could directly help this research spend their time doing stupid stuff like arguing about language #100 vs language #101 and writing Yet Another Window Manager.
>>
>>54310348
This picked my interest. How would I even be able to help?
>>
File: gene-therapy-process-960.jpg (158 KB, 960x751) Image search: [Google]
gene-therapy-process-960.jpg
158 KB, 960x751
>>54309497
Here is her first hand experience https://www.reddit.com/r/Futurology/comments/3ocsbi/ama_my_name_is_liz_parrish_ceo_of_bioviva_the/
She is very brave to do it on herself, but sadly 1 person is nowhere near enough for a good study. We need much more research in that direction, also this research could be done on mice, cats, apes, and only then on humans.

Telomeres are only the beginning, they are mostly an evolved failsafe mechanism against cancer. If you learn how to lengthen them you'll have to deal with the consequences and that's the hard part.
>>
Whats the meaning of # in C programming?
I first assumed its comment
but now seeing more of code I kinda doubt it

also it is rather hard to google it out
>>
>>54310458
Preprocessor macros.
>>
>>54310484
finally thats a term I can google out...
thnx
>>
>>54310458
C# (C Sharp)
Definition - What does C# (C Sharp) mean?

C# is a general object-oriented programming (OOP) language for networking and Web development. C# is specified as a common language infrastructure (CLI) language.

In January 1999, Dutch software engineer Anders Hejlsberg formed a team to develop C# as a complement to Microsoft’s NET framework. Initially, C# was developed as C-Like Object Oriented Language (Cool). The actual name was changed to avert potential trademark issues. In January 2000, NET was released as C#. Its NET framework promotes multiple Web technologies.

The term is sometimes spelled as C Sharp or C-Sharp.
Techopedia explains C# (C Sharp)

The term’s # character derives its name from the musical sharp key, which denotes a one semitone pitch increase. C# is pronounced "see sharp."

C# improved and updated many C and C++ features, including the following:
C# has a strict Boolean data variable type, such as bool, whereas C++ bool variable types may be returned as integers or pointers to avoid common programming errors.
C# automatically manages inaccessible object memory using a garbage collector, which eliminates developer concerns and memory leaks.
C# type is safer than C++ and has safe default conversions only (for example, integer widening), which are implemented during compile or runtime.
No implicit conversions between Booleans, enumeration members and integers (other than 0) may be converted to an enumerated type. User-defined conversions must be specified as explicit or implicit, versus the C++ default implicit conversion operators and copy constructors.
>literally 10 seconds on google
>>
>>54310312
cl-cuda only does cuda ffi bindings so far. cl-gpu would have been a better post but it's slow as balls. The fact is there's no magma, no arrayfire, no neon, no theano for CL. Hell, not even a spoc as far as I know and spoc is another example of a slow-as-fuck (but hey, at least it exists) version of that kind of package.
>>
How can i easly put every index of an array into 1 variable?

lets say i got int array[3] with
array[0]=1
array[1]=9
array[2]=2

how can i put all those numbers in a single int variable to get 192?
>>
>>54310512
Not sure if retarded or just pretending.jpg
>>
File: mbcell.jpg (35 KB, 500x635) Image search: [Google]
mbcell.jpg
35 KB, 500x635
>>54310403
>How would I even be able to help?
There are various ways to contribute, anon:
1) Choose bioinformatics or molbio for a college degree, then find a relevant job. Or maybe even start a company.
2) Work as a programmer in some biotech corp or uni
3) Contribute to some bioinf. projects, there are many of them
4) Contribute to some cool computational biology projects, for example OpenWorm is really cool.
5) Earn yourself lots of $ working as a programmer, invest in stocks/bonds then retire early and become a self-funded biohacker.
6) Contribute to open hardware/software for biohackers (for example to http://openpcr.org/ )
7) Advocate for more bioinformatics research and life extension, make a website or blog about this.
8) Make some related web services, for example a life-extension-themed diet calculator for web or mobile.
>>
What benefit does functional programming give me? Why would I abandon OOP in favour of functional programming?
>>
>>54310561
3x less code that does the same things
no more class hierarchies that don't fit on a whiteboard
>>
>>54310233
traps because coc fags are just joking while traps are unironically fags

even umaru + reddit + coc is like not even one tenth as bad as traps
>>
>>54310522
>cl-cuda only does cuda ffi bindings so far.
lel what ? cl-cuda implements a complete dsl to write kernels in a lispy language.
>>
>>54310548
>3) Contribute to some bioinf. projects, there are many of them
By that I mean some of these https://github.com/search?utf8=%E2%9C%93&q=bioinformatics .
>>
>>54310348
You know most people don't like living forever, right?
>>
>>54310529

int digitCounter = 1;
int output = 0;
for (int i = arr.length -1; i >= 0; i--) {
output += arr[i] * digitCounter;
digitCounter *= 10;
}
>>
>>54310576
More like code that requires 3x more time to write and figure out and for somebody else to understand. FP is a meme.
>>
File: trap_programmers.jpg (18 KB, 237x213) Image search: [Google]
trap_programmers.jpg
18 KB, 237x213
>>54310584
traps are a qt you meanie!
>>
>>54310604
most people don't like dying. if you were biologically immortal you could choose when to die (or society could have some regulations for how long you're allowed to live) and you could off yourself as painlessly as possible.
>>
>>54310185
no it wasn't, stop talking out of your ass
The whole thing was started by Graydon (https://github.com/graydon) who primarily developed in C/C++ at Mozilla (they didn't use to write much javascript at all). and it's not even based on any "web languages" at all.
>>54310211
the project is large enough to be maintained by the community and it's well past 1.0. but as we've seen with Mozilla before, they have a tendency to come back from the dead
>>54310609
it's true that you have to think more for each line of code for FP but the shorter code offsets that problem. functional programming increases code density so obviously it takes a bit more effort to write a line, because a line isn't just doing some tiny operation
>>
>>54310652
>rust
>not being worked on by literal sjw fags and webshitters
kek keep telling yourself that
>>
>Rust is FP!

Bloody good one, m8.

t. Rust tinkerer
>>
>>54310587
It doesn't support any higher level constructs on top of cuda. defkernel only allows writing straight cuda with sexp. It doesn't permit anything more, inherently. Thus, it is effectively just a cuda ffi binding (even though what it really does is compile the kernels to cuda and then compile the cuda to gpu code, then call the compiled kernel as needed, the level of abstraction, power and performance is the same). Again, it doesn't do shit compared to cl-gpu, magma, arrayfire, neon, theano, spoc, clmath, cumath, etc.
>>
>>54310668
he's right.
>>
>>54310561
It provides the same level of abstraction as OOP but scales (in terms of sloc and concepts) sub-linearly, whereas OOP has a weird curve (high entry, almost linear scaling in the med-end, super-linear in larger projects).
>>
File: 1471-2091-11-39-s1.png (282 KB, 1266x1170) Image search: [Google]
1471-2091-11-39-s1.png
282 KB, 1266x1170
>>54310604
I think people are just too scared of their imminent death, so they became very good at coping with that fact. http://pastebin.com/71kw7VQS

>>54310647
Yup, I'd rather wouldn't have children (or had only one) and became eligible for life-extension than breed and die. It's quite said that people in the developing world are breeding like rabbits, they devalue human life by doing that.

Only people from the rich countries have some hope at developing life extension because almost all the science, talent and wealth is concentrated there.
>>
>>54310668
How isn't it FP?
-Only pure operations permitted by default
-ML constructs like match, type-class-based typing instead of standard OOP
-Higher-order functions, lambdas, side-effect-free primitives
-Native support for several side-effect-free types
-Functional record updates
>>
File: qtpie.jpg (46 KB, 603x494) Image search: [Google]
qtpie.jpg
46 KB, 603x494
/java & android/

I have DownloadService class responsible for downloading files.

I have downloadHelper class that has all methods for downloading, deleting and checking file etc.

Is there any reason to not make all methods in downloadHelper class as static?
>>
>>54310764
>java
h e l l o
p a j e e t
>>
>>54310604
I'll never understand this. I'm pretty sure the greatest part of people's woes come from the fact they're mortal. Of course, some people probably really don't want to be immortal, but that means cripples and the mentally deficient, not healthy, normal humans. I will never understand why every piece of literature ever tries to paint immortality as a curse. It just doesn't make sense to me. I've thought about this very, very thoroughly so I'm pretty certain my idea is at least 1000 times more accurate than any author's.
>>
>>54310755
>How isn't it FP?

Because it's procedural.

>>54310698

No he isn't. It's multi-paradigm at best.
>>
>>54310794
see
>>54310142
>- *Be friendly and patient.*

I forgot that the only proper way to program is C, next time I will write C android code with ndk-build and jni wrapper

lel
>>
>>54310764
If you have an entire class where every method is static, but it only called from one other particular class, really all of those methods should just be in the other class.

The only reason to separate things is if your helper class is used in multiple places, otherwise you're just arbitrarily splitting files because you're scared to go beyond 500 lines or something.
>>
>>54310666
there are a few SJWs who are major contributors to it (Steve Klabnik) but that doesn't detract from the language at all. if you're not using a language because SJWs helped write the compilers you're as bad as the SJWs who won't use a language written by a white dude
>>54310668
it's a weird mix of paradigms. it's probably most similar to Lisp since it mixes OOP/imperative/fp. people like calling it FP because it's inspired by ML and Haskell in terms of the type system and pattern matching, but it's definitely way more imperative than either of those. that said, mixing paradigms is awesome when you get it right (which i believe Rust did)
>>54310755
first-class syntax for loops (for loops, infinite loops, etc.), mutable state (even has assignment/arithmetic operators like +=, -=, etc.), etc. the way it deals with data (type system, immutable by default) is very much inspired by functional programming but it's not meant to be used in that way 100% of the time
also, what do you mean by only pure operations being permitted by default? you can write code with side effects in any procedure and there's no semantic distinction between procedures and functions
>>
>>54310854
dude the language has a freaking code of conduct

the language has a code of conduct

dude
>>
>>54310854
>by only pure operations being permitted by default?
You have to add mut modifiers to indicate side-effects are permitted. The default behavior (i.e. no mut) prevents any side-effects.
>it's not meant to be used in that way 100% of the time
It is completely viable to use it like that 100% of the time. What you mean to say is that it's not required to do so, and the reason for that is that rust is a multi-paradigm functional programming language in the same sense as lisp, but much less all-encompassing.
>there's no semantic distinction between procedures and functions
Whether the references passed as arguments are mut or not.
>>
Why would anyone use a language with a literal code of conduct?
>>
>>54310908
Because the code of conduct only affect you if you participate in compiler develpoment, the community can "hijack" the project if the coc causes too many problems, and ultimately, the language is so good that even the massive malus of it having a coc attached is acceptable.
>>
File: Go-brown-side.sh.png (65 KB, 600x600) Image search: [Google]
Go-brown-side.sh.png
65 KB, 600x600
I wish this lang wasn't a meme.
>>
>>54310883
does that stop me from being able to write code with it? or even contribute to official projects under a github profile that's not personally associated with me?
>>54310904
there's more to impure functions than just modifying the values of arguments. i can use IO calls to perform side effects that affect the state of the program globally
>>
File: mr0130005008.jpg (31 KB, 422x424) Image search: [Google]
mr0130005008.jpg
31 KB, 422x424
>>54310803
>I will never understand why every piece of literature ever tries to paint immortality as a curse
I understand this quite well, but I do not accept this at all. Our culture tries to make people comfortable with their objectively short and miserable existence, culture thrives on obedient people that don't worry about the big scheme of things too much. That's the same reason we have so quick and standard process of dealing with the dead - put them into a beautiful box, put some flowers, weep a little, done! Life continues.

Our generation is one of the first ones (*) that actually has all the necessary data and computing equipment to do some progress on life extension (see >>54310348 ). It's hard to change thousand years old habits though.

* probably the first one was around in 70s-80s when semi-decent computing and basic DNA sequencing became available
>>
>>54310960
>being a literal cuck
>>
>>54310908
I like qt trappiness so I don't mind adopting a manifesto that will make their lives more comfy :3
>>
>>54310940
the Code of Conduct is attached to the language, along with all projects developed with it.

Nobody will want anything to do with it.
>>
>>54310990
>the Code of Conduct is attached to the language
No, it's attached to that one rust compiler.
>along with all projects developed with it.
[citation needed]
>>
>>54311006
>requiring citations
what r u a CVCK?
>>
>>54310854
>mixing paradigms is awesome when you get it right (which i believe Rust did)

The problem with Rust is the extremely intense ownership system. Makes it hard to work with.

At least the error messages are really good.
>>
File: file.png (80 KB, 955x937) Image search: [Google]
file.png
80 KB, 955x937
>>54310142
I'm making a web-based coffee timer/alarm (mostly for longer brews) while "learning" Ramdajs which is really fantastic for functional Javascript, has most of the functions I miss from Haskell and some clever workarounds.
>>
>>54310831
I created separate class because its called by two class DownloadService and DownloadIntent, it depends on user setting choice and its easier to maintain it this way.
>>
>>54310983
trannies are not traps, you disgusting tranny chaser
>>
I want to practice my Rust but idk what to program in it.
Y'all know any good ideas for a project?
>>
>>54311024
>>>/g/wdg
>>
>>54311019
yeah. like type inference, you have to give up on some pieces of code that, while technically correct, cannot be inferred by the compiler. so in a lot of cases I've written a piece of code that would be perfectly safe but i have to redesign it in a way that works for Rust's ownership model. i hope that in a few years they overhaul this part of the compiler after some more research so that it will be a bit more relaxed yet still ensure the same safety (definitely a possibility since linear type systems are still very cutting edge)
>>
>>54311063
Make a new texteditor that's like vim, except without vim's obvious issues (hjkl should instead be jkil, window commands need to be fixed, mouse actions need to be less broken near the edges, buffer list should always be visible by default without needing an additional plugin, plugins should be concurrent with the editor, etc.)
>>
>>54311043
I pity them, they clearly want to look qt, but often their biology + our current medtech just aren't enough for achieving this..
>>
>>54311089
>you have to give up on some pieces of code that, while technically correct, cannot be inferred by the compiler. so in a lot of cases I've written a piece of code that would be perfectly safe but i have to redesign it in a way that works for Rust's ownership model.
Examples?
And are you aware of box types?
>>
>>54311095
Text editor is a great idea, thanks
Now somebody help me design a logo
>>
>>54311063
A simple doom-like shooter http://www.playfuljs.com/a-first-person-engine-in-265-lines/
can you write it shorter than this guy? (^:
>>
I recently finished an Android application while learning some Clojure. If anyone's willing to test the APK on their phone, I'd like to know if there are any issues. I don't have a physical android device to test on unfortunately. Otherwise, enjoy!

Recording: https://a.pomf.cat/qptfcq.mkv
Source: https://a.pomf.cat/suyrvh.zip
APK (Targets API 23): https://a.pomf.cat/rhzsqe.apk
>>
I never really understood function calls in python all that well. When do I put things in the parenthesis next to a function? If I make an input inside a function, how do I retain the input when I bring that variable to another function? If I have dozens of variables that need to be remembered between different functions, can I make a list and put that in the parenthesis so all of the variables in that list are carried over, instead of having to rewrite all the variables I need in the function every time I call it?
>>
building mobile app
it will req a server, so i'll have to build that functionality too and then simultaneously work on both to get them to play nice
>question:
what is the most economical way to have a server presence to host files and applications while still being fully functional and scalable?

example: if i had a dating site to hold profile and let people log in to find matches

not a dating site, but kinda want that structure

rasp pi on my home internet?
rent server space from rackspace or something like that?
>>
>>54311144
>what is the most economical way to have a server presence to host files and applications while still being fully functional and scalable?
OVH VPS, 3.5$/mo
>>
>>54311113
Box types are no catch all. Fucking with Rc<RefCell<Box<Cell<>>>>>> is annoying as hell, makes your types more verbose than C++...

>>54311116
He does it in JS and HTML5, where they give you a canvas API that allows you to make a gameloop in like 10 LOC.
Doing the same in Rust would mean using some SDL interface, maybe OpenGL, I can only imagine the boilerplate
>>
>>54311163
>Doing the same in Rust would mean using some SDL interface, maybe OpenGL, I can only imagine the boilerplate
SDL2 is very easy, you can init it in 10-20 lines. See http://pastebin.com/AcmcNzMX
>>
File: 1439903195165.png (536 KB, 776x840) Image search: [Google]
1439903195165.png
536 KB, 776x840
>>54311127
>I don't have a physical android device
>>
>>54311116
>265
not impressed
>>
>>54311212
Impress us then, anon!
>>
>>54311127
>being this poor
>>
>>54311163
>Box types are no catch all.
They literally are. That's literally the whole point of their existence.
>Fucking with Rc<RefCell<Box<Cell<>>>>>>
Potentially better than rewriting everything. Beside, you still haven't answered the important question.
>>
>>54311127
>botnet ALERT!!!
i don't have a phone lmao, right
test it on yours (so i can steal your data)
>>
Friendly reminder that TypeScript is the best language available.
>>
>>54311328
i hope i didn't get cancer from the mkv, other than the weeb cancer
>>
>>54310647
>or society could have some regulations for how long you're allowed to live)
Jesus Christ could you imagine SJWs having a say in something like that? Fucking white males aren't allowed life extension but retarded niggers can have indefinite extension and billions of kids each cause privilege or some shit.

What horrid world that would be.
>>
>>54311161
just read thru the site, thanks for this.
Q: what's the catch though? how are they just a fraction of the cost of most other hosting platforms? i'm i giving them access to my code in the EULA? do they lock me in so i can't migrate later?
>>
File: DusHapx.jpg (1 MB, 1280x1915) Image search: [Google]
DusHapx.jpg
1 MB, 1280x1915
>HTML
>Java
>Python
>Visual.basic
>C#
>C++

All languages I have learned to some degree throughout my life before completely forgetting everything as soon as I don't use them for more than a month or two

Is there really any point in learning to code if you don't plan to make a career of it?
>>
>>54311468
sure, build a million dollar app like uber or angry birds. retire
>>
>>54311253
>poor
I would prefer to be called financially destitute instead. Please respect the /dpt/ CoC.

>>54311253
The future will be here one day.

>>54311328
You can build the source yourself if you grab a copy of leiningen and check the readme. Though you can trust me because I wouldn't lie, especially not to anons on /dpt/.
>>
>>54311522
>>54311210
Shit, misquote.
>>
>>54311468
>Is there really any point in learning to code if you don't plan to make a career of it?
not really, except if you enjoy it as a hobby perhaps, but you don't seem to
>>
>>54311115
u could call it REKT Rust Extensible Keyboard oriented Text editor kek
>>
>>54311454
There is no catch. The servers are in europe, you'll have some ~60-100ms ping to it. They are cheap because Europe has cheaper labor.
>i'm i giving them access to my code in the EULA? do they lock me in so i can't migrate later?
They have it just like everyone else has it in AWS GCP and Azure, you just run your virtual unix server there.
>>
File: 1458552727028.png (351 KB, 639x480) Image search: [Google]
1458552727028.png
351 KB, 639x480
In C++, if I add a prototype in the header, does this force a class to implement the virtual method even though it was already defined in the inherited class?
>>
>>54311468
>Is there really any point in learning to code if you don't plan to make a career of it?

Write cool software, for example games or desktop/web apps you need for yourself. Languages are just memes, it's the algorithms and applications that matter.
>>
>>54311537
b..but aren't androids inherently oppressive ?
>>
>>54311095
>hjkl should instead be jkil
triggered
>>
>>54310159
The catch is that you don't actually need strong memory safety all that much.
>>
>>54311441
>he still identifies as a male in 2016
its like you dont even know what year it is.
http://facebook.us/refinery29/videos/10154096117412922
>>
>>54311606
You do, though, absolutely. Memory safety is 99% of the reason for bugs in C programs, and such bugs are absolutely everywhere.
>>
>>54311468
learning syntax doesn't mean you learn a language.
>>
>>54311553
Brilliant
>>
>>54311618
Who's writing in C other than kernel devs, embedded devs, legacy maintainers and /g/ hipsters?
>>
>>54311636
where's her dick?
>>
>>54311038
In that case, separate class is the best way, like you said it's easier to maintain.

Java doesn't have a clean way to make a "static" class, other than doing exactly what you have suggested already, making all methods static.
You could also make the helper class final, and its constructor private: http://stackoverflow.com/questions/7486012/static-classes-in-java
>>
>>54310159
did they finally do a stable release yet?
>>
>>54311553
I'd say called it Rust Expandable Kludge style Text editor
>>
>>54311616
>nonbinary pajeet
>what have I seen
>>
>>54311579
Only if you anger them, so be careful.
>>
>>54311648
The thing is, there are only two options: manual memory management with C, or GC. GC means no memory safety issues, but it's slow as fuck and somewhat non-deterministic. Rust solves this about GC in almost all cases, and ridiculously strongly amortizes the cost of GC the rest of the time (because almost nothing lives in GC space so a sweep is virtually free). C means you have to manually manage memory and deal with the bugs this causes, and again, rust fixes that by rejecting programs with memory-related bugs.
>>
>>54311676
Yeah, forever ago. It's already on 1.8 stable.
>>
>>54311709
C++ and D do fine with a mixture of options not necessarily backed by the type system.
>>
>>54311730
doesn't each "stable" release change a shitload of things? the releases aren't really stable...
>>
File: safari-crash.png (6 KB, 575x133) Image search: [Google]
safari-crash.png
6 KB, 575x133
>>54311606
HEART BLEED
CVE
SEVERITY HIGH
SEVERiTY CRITICAL
BUFFER OVERFLOW
STACK OVERLOW
SEGMENATION FAULT
YOUR FAULT
YOUR FAULT
YOUR FAULT
YOUR FAULT
>>
Why isn't there a standardized list of terms that programming languages have to follow? Every language calls the same shit different things and it's retarded
>>
>>54311709
https://en.wikipedia.org/wiki/Boehm_garbage_collector
>>
>>54311793
https://xkcd.com/927/
>>
>>54311793
Because programmers profit from their job being complex, just like the lawyers profit from the legalese.
>>
>>54311808
shit
>>
>>54311793
>Why isn't there a standardized list of terms that programming languages have to follow?
there is
>>
>>54311793
even worse, every language calls different shit the same things
like "functor" has a meaning in math as well as a meaning in linguistics, but it's also a term used by Haskell, OCaml/SML, C++, Prolog, and other languages to mean different things in each one
or "monad" has a meaning in functional programming but also means something in philosophy and math, plus it means something entirely different in APL-like languages
>>
what does `auto' do? seems to only be useful for embedded chips from 1980s
>>
>>54311785

The things you are describing are 99% of the time the fault of C users. Other languages aren't nearly as bad.
>>
>>54311883
>The things you are describing are 99% of the time the fault of C users. Other languages aren't nearly as bad.

>a good 90% of software running on my desktop is written in C or in C++ which is very similar memory-wise.

MEMORY CAN'T BE "READ"
>>
>>54311912
you god damn retard that's programmer error
>>
ASSIGNMENT TIME:
1. google Fahrenheit to Celsius formula
2. write a simple converter in your program of choice
3. share code here, but don't post language
4. see if others can guess the language you used
>>
>>54310274
"sjw" is a meaningless right-wing buzzword. It has no more meaning than "cuck" does.
>>
>>54312016
>"sjw" is a meaningless right-wing buzzword. It has no more meaning than "cuck" does.
so says the SJW cuck
>>
>>54311994
main = print (f_to_c 32) 

f_to_c f = (f - 32) * 5.0 / 9
>>
>>54312045
python?
>>
>>54311994
auto fahrenheit2celsius(T)(T x) {
return (x - 32.0) * 5.0/9.0;
}
>>
>>54312034
>we should be above name-calling
>shaddup yew sjw cuck
I guess it is pretty close to summer.
>>
How do i start with Artificial Intelligence?
>>
>>54312058
ruby?
>>
float fahrenheit2celsius(float x) {
return (x - 32.0) * 5.0/9.0;
}
>>
>>54312072
No
>>
>>54312073
java?
>>
>>54312053
no, sorry
>>
>>54312084
it could be java, C, or C++

That's why this is retarded
>>
File: 1459453914188.jpg (633 KB, 690x2121) Image search: [Google]
1459453914188.jpg
633 KB, 690x2121
>>54312016
SJW is basically radfem with some tumblr alt-left thrown in. It is a well defined, sexist ideology.
>>
>>54311853
>like "functor" has a meaning in math as well as a meaning in linguistics, but it's also a term used by Haskell, OCaml/SML, C++, Prolog

Surely they all follow the mathematical properties?
>>
>>54312096
depends, did you public static void main?
>>
when shit like
https://github.com/rust-lang/rust-www/pull/274
(scroll down a bit)
actually happen, I really have a hard time justifying wanting to try rust.
>>
>>54312062
AI is 80% ML these days.
To learn some ML, do:

1) Read /r/MachineLearning everyday, also read older posts there is a lot of great stuff

2) Try to implement simple stuff, a linear classifier, naive bayes, multilayer perceptron.

Read wikipedia and tutorials, some decent ones are http://karpathy.github.io/neuralnets/ http://scikit-learn.org/stable/tutorial/basic/tutorial.html https://www.toptal.com/machine-learning/machine-learning-theory-an-introductory-primer

You shouldn't have problems with ordinary programming, shouldn't fear highschool math. ML builds on these skills. Also note that using ML is way simpler than coming up with semi-original or even full custom algorithms (an example of semi-custom one: http://benanne.github.io/2014/04/05/galaxy-zoo.html )
>>
File: 47784511_p0.png (669 KB, 1100x1300) Image search: [Google]
47784511_p0.png
669 KB, 1100x1300
>>54312045
>>
>>54312103
not really, they all mean wildly different things
the Haskell meaning is closest to the one in type theory but it really doesnt match up perfectly
>>
>>54311767
C++ is just C, D is GC. If you don't know what you're saying, don't comment.
>>54311799
Not only is boehm a fucking joke (it fails to mark most stuff, it doesn't sweep with the right timing, it's slow as fuck), but it doesn't address anything. By this logic, you could say that programming in lisp is actually programming in C, thus C has hygienic macros, because it's possible to write a lisp interpreter in C.
>>
Where do you people upload your code?
I finally started making things that aren't total crap and kind of what to share them.
Do people really not use github because SJW stuff?
>>
>>54312102
funny how none of the want any LABOR jobs in the bottom right of that list.
>>
>>54312103
C++ -> an object with the () operator overloaded.
OCaml -> a function that operates on module objects.
>>
>>54312102
Except it's not. I'm a political moderate and I've been called one. "sjw" is just a useless right-wing buzzword. The neo-reactionary equivalent of "shitlord".
>>
>>54310142

>race, ethnicity, culture, national origin, colour,
immigration status, social and economic class, educational level, sex,
sexual orientation, gender identity and expression, age, size, family
status, political belief, religion, and mental and physical ability.

the sjw cancer must be stopped
>>
>>54312138
github, gitlab
>>
>>54310233
traps improve the working environment
>>
>>54312116
>>54312122
Haskell is a puzzle-oriented programming language that attracts attention of autistic-but-not-bright users that happen to like to solve puzzles while programming.
>>
>>54312113
90% of the shit on /r/MachineLearning is bullshit by people who don't have a clue. The only things worth reading are the ama by meaningful people like hinton, bengio, lecun, etc.
If you actually want to learn ML, do the Andrew Ng coursera and read papers.
>>
>>54312168
nice bro
>>
>>54312153
Fuck off, SJW scum.
>>>/tumblr/
>>
>>54312141
Feminists have established all kinds of trade schools for things like carpentry and plumbing. Don't repeat things you read on 4chan.
>>
>>54312122
Well that's awful. Also what's the difference between the mathematical functor and Haskell's?
>>
>>54311772
Each 1.X release generally only adds to language and the standard library, so code written for 1.6 should work for the 1.8 compiler.
They are very conservative in what they change, which is why stuff like HKTs still haven't made it into the language, but are being discussed.
>>
>>54312153
>a word means nothing because I've been called it
I think /dpt/ calls me retarded nearly daily but that word still has meaning.
>>54312183
oh, can it.
>>
>Hasklel
>high performance
>can perform high level optimizatios other languages cannot

explain this shit right here

import System.Environment

f = (+5)

get = f 1

g = get

s :: Int -> Int -> Int
s 0 _ = 0
s n x = x + s (n-1) x

main = do
a <- getArgs
putStrLn $ show $ s (read $ a!!0) g


$ perf stat ./x 10000000
60000000

Performance counter stats for './x 10000000':

1373,821351 task-clock (msec) # 0,993 CPUs utilized
204 context-switches # 0,148 K/sec
1 cpu-migrations # 0,001 K/sec
162.011 page-faults # 0,118 M/sec
4.125.376.175 cycles # 3,003 GHz
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
11.064.090.306 instructions # 2,68 insns per cycle
2.414.141.974 branches # 1757,246 M/sec
2.008.346 branch-misses # 0,08% of all branches

1,383238720 seconds time elapsed


It should only perform a single multiplication.
Even C++ does better.
>>
File: fuckoff.jpg (136 KB, 542x700) Image search: [Google]
fuckoff.jpg
136 KB, 542x700
>>54312183
You go. He wasn't even being inflammatory.
>>
>>54312111
>* We are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, disability, ethnicity, religion, or similar personal characteristic.
How much of a bitch are you to get triggered by this?
>>
File: occupational_deaths.jpg (34 KB, 600x537) Image search: [Google]
occupational_deaths.jpg
34 KB, 600x537
>>54312141
it's quite horrible actually. male:female death on job ratio is very high, males are forced into doing hard dangerous jobs. Of course sjws deny these facts, that's why, ironically, they are sexist.
>>
>>54312124
No, you don't know what you're saying.
>>
>>54312173
>read papers.
decent papers pop up on r/MachineLearning every week. I don't have time to read 10 papers per day.
>>
>>54312208
>I think /dpt/ calls me retarded nearly daily but that word still has meaning.
So you're retarded then?
>>
>>54312187
>Don't repeat things you read on 4chan.
in light of this, could you point out some of the female plumbing trade schools? A quick googling finds nothing.
>>
>>54312187
see they tried and failed.
even after their efforts, <2% of the LABOR force
>>
>>54311652
>int udda(int x)
>udda
>>
>>54312216
Don't be so shocked. This is /g/. Half of /dpt/ is unemployed autistic neets who pee in bottles and get triggered over the idea that the real world requires manners.
>>
>>54312168
https://unqualifiedreservations.wordpress.com/2007/08/02/whats-wrong-with-cs-research/
>>
>>54312264
what does peeing in bottles have to do with this?
we bottle pissers are an oppressed class
we are bullied by other 4channers and most of society too
we need special rights and protections
stahp your micro aggressions against us
>>
>>54312209
>not tail-recursive
Lrn2program faggot.
>>
>>54312192
in math, a functor is from a category to a category but in Haskell there's only the Hask category so functors are constrained to working inside the Hask category
i'm not really well versed in category theory so i cant explain it super well so I suggest http://stackoverflow.com/questions/14820139/how-are-functors-in-haskell-related-to-functors-in-category-theory
>>54312209
it shouldn't perform any multiplications because you didnt write it as multiplication
>>
In Java, if I'm storing a bunch of dates (that I store in a text file), would I parse each date and put the data into a new GregorianCalendar instance for each new date?

I know there are some external libraries that may be simpler, but I want to use the Java standard library to get some experience with it for employment and what not.
>>
>>54312216
>I wrote about what I felt about this experience. I believe this is the right place to put this for transparency, and I don't want to send it to anyone directly as everyone should have a chance to read and discuss this. I'd like to thank anyone who has been involved in this discussion so far, for taking the time to do so.

>It's a long one, so I suggest looking at some pictures of cute puppies for energy.

>When I say "you" or "you've'" I refer to no person in particular, I am not upset by any one person. You == Rust. Anyone could have been involved in this.
[etc.]

>literally "how dare you discuss my PR that adds two words, "gender identity", to the CoC instead of accepting it blindly, SHITLORDS!
>acceptable in any way, shape or form
>>>/tumblr/
>>
>>54312294
second, this sounds interesting
>>
>>54312283
Peeing in bottles is something you can change. Sexual orientation or skin color isn't.
>>
>>54312240
No. Only shit papers ever show up on r/ML
>>
AFAIU, "internet sjw" is supposed to be a pejorative term against people that cry all day long about their supposedly "unprivileged" status in internet forums, when, in reality, they are more privileged than many, many people in their own countries.

for example, you won't ever see these internet feminists talk about poverty, workers rights and so on. they only talk about themselves.
>>
>>54312316
equating a dick lust with melanin count
>>
>>54312209
>write a purposefully bad algorithm
>its slow
no shit
>>
>>54311063
Conway's game of life
>>
>>54312242
HOW DARE YOU QUESTION ME, SHITLORD? LISTEN AND BELIEVE! Fucking rapist! Cis scum! Are you kidding me? You're a fucking white male!
>>
>>54312338
>for example, you won't ever see these internet feminists talk about poverty, workers rights and so on. they only talk about themselves.
Not true. Most feminism is intersectional nowadays.
>>
>>54312363
This kind of shitposting is getting really old.
>>
>>54312393
You say that as if that's not literally, unironically what's happening in the world right now, including to programming languages like rust.
>>
>>54312386
>>54312338
you're both making dumb generalizations, please stop
>>
>>54312278
Mencious Moldbug is cool, he developed Urbit.

...

Since Earth code is fifty years old, and Martian code is fifty million years old, Martian code has been evolving into a big ball of mud for a million times longer than Earth software. (And two million times longer than Windows.) …

Therefore, at some point in Martian history, some abject fsck of a Martian code-monkey must have said: fsck this entire fscking ball of mud. For lo, its defects cannot be summarized; for they exceed the global supply of bullet points; for numerous as the fishes in the sea, like the fishes in the sea they fsck, making more little fscking fishes. For lo, it is fscked, and a big ball of mud. And there is only one thing to do with it: obliterate the trunk, fire the developers, and hire a whole new fscking army of Martian code-monkeys to rewrite the entire fscking thing.

… This is the crucial inference we can draw about Mars: since the Martians had 50 million years to try, in the end they must have succeeded. The result: Martian code, as we know it today. Not enormous and horrible – tiny and diamond-perfect. Moreover, because it is tiny and diamond-perfect, it is perfectly stable and never changes or decays. It neither is a big ball of mud, nor tends to become one. It has achieved its final, permanent and excellent state.
>>
>>54312313
Thanks, it's really not interesting though its annoying.

I'm fairly certain you just use GregorianCalendar objects to store dates, but its mostly the name that's throwing me off. Why would each date be called a calendar it sounds stupid.
>>
>>54312393
Id prefer that you give an example of a female plumbing trade school that are apparently popular these days
>>
hey, SJW. let me have your money and let be be liberal with it.

whatever morals you hold to, let me rewrite them liberally.

give me the liberty to do whatever i want no matter what.

liberalism is toxic, cancerous, and stupid.

period.

hope you wake up someday.
>>
What's the best comfiest way to get into webdev with no dynamically typed languages, static typing only?
>>
>>54311616
lmao
>>
>>54312316
>Sexual orientation
Some people can change it, don't devalue their experience. Also it is quite possible that with right conditions (and maybe with some special drugs) everyone can.

>skin color isn't.
There is a combination of plastic surgery and cosmetics that allows one to achieve this in limited form. With good enough tech it will be possible.
>>
>>54312445
wait a few years until languages start targeting webassembly
>>
>>54312333
This one was very cool https://www.reddit.com/r/MachineLearning/comments/4ggdnj/160406778_benchmarking_deep_reinforcement/

if you don't like this than maybe you are not into modern ML, or you are into stat ML..
>>
>>54312435
i dont get how he can stand there and call Haskell too complicated for the average programmer and then make Urbit, though. the Urbit learning curve is at the very least similar to that of Haskell, if not more difficult.
>>
>>54312436
>Why would each date be called a calendar it sounds stupid
i'm just learning java/programming myself, but i think it would be prudent to have an object (multidimensional array) to hold each date in an index location.
>>
>>54312290
Ah!
Why can it only optimize tail recursion though?
Shouldn't the compiler be able to transform this type of function into an equivalent tail recursive version?
Also it's still not a multiplication, which is what g++ optimizes it to.
>>
>>54312483
I was about to get angry and then I remembered this wasn't /g/ - technology but rather neo-/g/ - consumerism. Keep at it, anon-chan, maybe you'll develop an actual interest in technology one day!
>>
>>54312469
>autism the post
>>
Is it possible for a C++ GUI program to use two different GUI libraries at the same time? For example, could I write a program that uses GTK3's scroll bars, while using QT's textboxes at the same time?
>>
>>54312500
>Why can it only optimize tail recursion though?
Because doing otherwise is undecidable with regard to termination.
>>
>>54312491
Urbit is less complex than haskell. Haskell has hundreds of language extensions its a literally meme puzzle language for people that like to read whitepapers and solve puzzles while programming.

Urbit solves another set of problems than haskell, it aims to be a practical persistent distributed computing foundation. It's like a universal bitcode.

Also I recommend https://ngnghm.github.io/blog/2015/08/02/chapter-1-the-way-houyhnhnms-compute/
>>
>>54312523
No.
>>
Where do I go for help with malicious code?
Every place I know gets butthurt if anything looks even a little suspicious.
>>
eclipse says alert your scanner system in never closes
google leads to stackoverflow which says ignore it, java will auto close it, eclipse is just being stupid
is stackoverflow right or how do i "close" the scanner?
tried umpteen variations, but none work
>>
>>54312525
It is undecidable in general, however you can always do it for a finite set or a certain class of function.
Proving program equivalence is undecidable too - allowing tail-call optimization is an example of where a program can be transformed into a different one by an algorithm, even though in the general case it is undecidable.
>>
>>54312520
I dislike how modern elites use divide and conquer tactics to rule the population, while the sjw activists gleefully follow along instead of seeking /tech/ remedies to biological inequalities.
>>
>>54312547
kys hack3r
>>
>>54312574
Tail call optimization does not transform a program into an equivalent program and its domain of application is severely restricted anyway.
>>
>>54312568
It's good practice
Why can't you close it? Can you post your code?
>>
>>54312596
no u
>>
>>54312579
Yeah why don't gay people just get brain surgery or take drugs, and everyone else bleach their skin and get transplants.
>autism the post
>>
>>54312574
You can always do an infinite set of program transformations to terminating programs and still have it terminate (^:

Halting problem is a meme IMHO, for very large class of commonly useful functions it can be proven that they halt. Who cares about obscure general case?
>>
>>54312499
>have an object (multidimensional array) to hold each date in an index location
So you mean one object to store all the dates?

If I understand you correctly, that may work for just dates, but the information I want to store also have times and I feel that would get contrived with that method.

I'd rather just use the Date class for each instance and store it in an ArrayList, but the date class is depreciated.
>>
>>54312440
Hey, neo-reactionary. Please shut the fuck up and go to /pol/. This is /dpt/ and no one cares. Hope you wake up someday.
>>
>>54312602
package numbercruncher;
import java.util.Scanner;
public class ncsamples {
public static void main(String[] args) {
System.out.println ("please enter then name you most commonly answer to");
Scanner scanstr = new Scanner(System.in);
String cn = scanstr.next();
System.out.println("Thank you, " + cn + ", now what is your first name?");
String fn = scanstr.next();
System.out.println("Please enter all middle names.");
String mn = scanstr.next();
System.out.println(fn + ", thank you, now what is your last name?");
String ln = scanstr.next();
System.out.println("In what year were you born? (4 digits)");
Scanner scanint = new Scanner(System.in);
int by = scanint.nextInt();
System.out.println("In what month of " + by + " were you born? (2 digits)");
int bm = scanint.nextInt();
System.out.println("On which day of the month were you born? (2 digits)");
int bd = scanint.nextInt();
System.out.println("Got it! " + fn + " " + mn + " " + ln + " goes by " + cn + " and was born on " + bm + "/" + bd + "/" + by + ". If this is correct, SUBMIT to get your numbers!");



>line 6: "resource leak: 'scanstr' is never closed"
and
>15: "resource leak: 'scanint' is never closed"
>>
>>54312597
From what I understand tail-call optimization transforms a program from
1. new stack frame
2. perform calculations
3. goto 1

into
1. new stack frame
2. perform calculations
3. goto 2


>its domain of application is severely restricted anyway
which is why it is decidable
>>
>>54312547

Anon, if you want to write malware, you have to learn everything yourself. That's just how things work.
>>
>>54312667
You're retarded.
function transform f args ... = f args ...; while true do ; done
>>
>>54312659
I didn't meant this that way, actually I meant straight->bi/gay to alleviate overpopulation or have a better partner (girls are meh partners desu)..
Also I think that freedom to change one's body is a very important thing. And if, once the tech becomes available, lots of black people become white then why not? It's their choice.

But of course normies prefer to stay crippled and seek handouts for their inborn biological variations...

I guess my frame of reference is too alien for you..
>>
>>54312691
It should just be scanstr.close()
Also you don't need two separate scanners for strings and ints, you can just use the one
>>
>>54312714
I didn't say malware, senpai.
I can already into botnets.
I mean for general questions, I'm not even interested in all of that /actually damaging/ stuff, just fun.
>>
>>54312695
If you don't see how program 1 is not the same as program 2, you're retarded. Not that you had a clue what you were saying to begin with, though.
>>
>>54312294
If you can control the format of the input file store the timestamp and just read and store as longs for simplicity. Otherwise, either Date of Calendar objects will do. Date is simpler but neither are perfect.
>>
>>54312733
No, I'm not. I mean take a simple halting function, add some nonsense A = A - 1 + 1 to it and voila! you have a new halting function. Repeat countably infinite times. Now you have a countably infinite set of halting functions. Of course there is still countably infinite set of non-halting functions, but it just shows that the Halting problem is blown our of proportion by theoreticians.
>>
>>54312744
scanstr.close();

thanks, senpai!
package numbercruncher;
import java.util.Scanner;
public class ncsamples {
public static void main(String[] args) {
System.out.println ("please enter then name you most commonly answer to");
Scanner scanstr = new Scanner(System.in);
String cn = scanstr.next();
System.out.println("Thank you, " + cn + ", now what is your first name?");
String fn = scanstr.next();
System.out.println("Please enter all middle names.");
String mn = scanstr.next();
System.out.println(fn + ", thank you, now what is your last name?");
String ln = scanstr.next();
System.out.println("In what year were you born? (4 digits)");
scanstr.close();
Scanner scanint = new Scanner(System.in);
int by = scanint.nextInt();
System.out.println("In what month of " + by + " were you born? (2 digits)");
int bm = scanint.nextInt();
System.out.println("On which day of the month were you born? (2 digits)");
int bd = scanint.nextInt();
System.out.println("Got it! " + fn + " " + mn + " " + ln + " goes by " + cn + " and was born on " + bm + "/" + bd + "/" + by + ". If this is correct, SUBMIT to get your numbers!");
scanint.close();

no more flags! :D
>>
>>54312791
I literally proved you were retarded and you still believe that you're not. This must be a new low even for neo-/g/.
>>
>>54312445
typescript is nice if you want ES6 compatibility, but Elm is a really nice language that has shit like type inference, etc. it's based somewhat on Haskell but specifically meant to be simple to learn and cuts out most of the complex Haskell features
https://www.youtube.com/watch?v=oYk8CKH7OhE
https://www.youtube.com/watch?v=Agu6jipKfYw
>>54312536
you can constrain yourself to the base language in Haskell. Yarvin claims that Haskell is bad because it's not designed with the learner in mind but the syntax of Urbit clearly is not meant to be something very simple to learn. even if it takes less work than Haskell to learn, it's not nearly as simple as Scheme or Forth to learn and just ends up recreating the problems of APL/J/K that caused them to never be adopted
>>
>>54312746

You said you wanted help with "malicious code", the exact definition of malware. And I will stand by my point -- this isn't something you ask people for help on. This is something you do entirely on your own.
>>
I did it the hard way on purpose.. I could have just gotten the link to the ip:port but this is more fun.
Is this good or just spaghetti code?
How would you improve it?

import requests
import lxml.html
from lxml.cssselect import CSSSelector
counter=0
master_list = []
while counter < 30:
counter+=1
print('Page',counter)
lolcount = str(counter).zfill(2)
theurl = "http://www.samair.ru/proxy/ip-address-{0}.htm".format(lolcount)
print(theurl)
r = requests.get(theurl)
for x, line in enumerate(r.iter_lines()):
if x == 5:
print(line)
derp = str(line)
desu = derp.split('"')
print(desu[3])
css = "http://www.samair.ru"+desu[3]
break
got_css = requests.get(css)
l = {}
C = []
CSS2 = got_css.text[:-1]
for K, f in enumerate(CSS2.split('\n')):
f = f.replace(":after {content:",",").replace(
"}","").replace('"','').replace(
"\n", '').replace("'", '').replace('b', '')

x,y = f.split(',')
l[K] = x
K = str(K)+'A'
l[K] = y
C.append('')
tree = lxml.html.fromstring(r.text)
for x, f in enumerate(C):
sel = CSSSelector('span'+l[x])
results = sel(tree)
x2 = str(x)+'A'
data = [result.text +l[x2] for result in results if result != []]
master_list.extend(data)
if data != []:
print(data)
print(len(master_list), ' proxies saved.')
for proxy in master_list:
with open("working.txt", "a") as myfile:
myfile.write("{0}\n".format(proxy))
>>
>>54312889
>samair.ru

Oh man, blast from the past

So many hours spent as a kid looking for SOCKS4 proxies to get around rapidshare and megaupload download limits
>>
File: smile_with_a_carat_nose.gif (2 MB, 500x500) Image search: [Google]
smile_with_a_carat_nose.gif
2 MB, 500x500
>>54312820
I don't see how I am wrong. I'm just saying there is infinite set of halting functions and infinite set of non-halting functions. In general case deciding right class for your function is not possible, but for many (+ inifnitely many) practical functions it is possible. Also there are ways to write programs that always halt, and this practice is encouraged in mission-critical systems (see NASA guidelines).

Also argument number 2:
All computers are finite state machines so we can wait a finite (lol) time and see if this finite automaton comes to one state it has already been in, then we can certainly say that it is executing non-halting function and we don't need forever. Either that or it halts.

How's that, mr smart?
>>
>>54312889
Oh, I forgot to just divide master_list by two instead of counting C..
Oh well.
>>
>>54312759
 diff x y
3c3
< 3. goto 1
---
> 3. goto 2
>>
File: gameoflife.png (5 KB, 459x239) Image search: [Google]
gameoflife.png
5 KB, 459x239
I've had this idea for a while about creating artificial "life".
Like an infinitely expanding digital ant farm, if you will.

It wasn't until recently I found that I'm not the first to have this idea (pic and filename related), but I thought I could expand it significantly.

>start off with ASCII terrain generated from satellite images of Earth / etc
>populate the terrain with single entities called humans
>enable these entities to form collective entities called towns / cities / countries
>introduce chaos via random RL data like Twitter dumps
>host the whole thing on an open website

What do you guys think?
>>
>>54312938
ALL PHYSICAL COMPUTERS
ARE
FINITE STATE MACHINES

TURING MACHINE IS A MEME
NON-HALTING PROGRAMS ARE A MEME

THERE ARE ONLY FSMs THAT REACH A HALTING STATE ONCE
AND FSMs THAT REACH THE STATE THEY HAVE ALREADY REACHED

AND NOTHING ELSE

COME, ARGUE WITH THIS
>>
>>54313050
When you type in all caps psychology tells us you know your argument is wrong :^)
>>
File: photons02.png (50 KB, 640x480) Image search: [Google]
photons02.png
50 KB, 640x480
>>54313035
Actually I'm trying this myself (picrel)
But I think you aim too high

>start off with ASCII terrain generated from satellite images of Earth / etc
Initial conditions shaped like earth won't help

>populate the terrain with single entities called humans
but they will behave much simpler than them

>introduce chaos via random RL data like Twitter dumps
I don't see how it works

otherwise AI is a patrician-tier hobby, I APPROVE.
>>
i'm writing a simple recursive json parser/deserializer for reasons

the value parser asks for the expected type to avoid unnecessary boxing and type conversion

it's going ok, but this feels wrong
object ParseValue(Type type)
{
if(type == typeof(string))
return ParseString();
else if(type == typeof(char))
return ParseChar();
else if(type == typeof(byte))
return ParseByte();
else if(type == typeof(short))
return ParseShort();
else if(type == typeof(int))
return ParseInt();
else if(type == typeof(long))
return ParseLong();
else if(type == typeof(float))
return ParseFloat();
else if(type == typeof(double))
return ParseDouble();
else
return ParseObject(type);
}


i could generate a lookup table on construction, but then isn't that just doing the same go-down-the-list thing?
>>
>>54313065
But please, tell me how I am wrong.
Also I typed this in caps because it's a pretty terrible truth.
>>
>>54313107
the halting problem is not about physical computers though.
>>
>>54311095
https://github.com/neovim/neovim
https://github.com/google/xi-editor
>>
>>54313095
>Initial conditions shaped like earth won't help
But they will affect where cities form.

>but they will behave much simpler than them
Very very much so. I was thinking limiting the behavior to work/move/have money/sleep/procreate/grow old/die. Basically they'd be on the par with ants IQ-wise, but still it'd be a fun experiment to get running.

Things like war and economy would be town/city's properties.

>I don't see how it works
Think economy affected by tweet geographics/demos. You could use stock market data as well.
>>
>>54313229
I agree, but my point is that there is a finite physical world and the world of mathematical ideas where infinite sets are possible. If we are interested in real computers and problems they solve, we should remember this distinction.
>>
>>54313095
>>54313251
I'm trying to figure out the picture, what is it that you're doing exactly?
>>
>>54313251
That's actually interesting, good luck to you. Read about World III model http://bit-player.org/2012/world3-the-public-beta it tried to do this quite rigorously, with parameters fitted to real data.
>>
>>54313255
okay. I don't see how this devalues the halting problem in anyway.
Thread replies: 255
Thread images: 29

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.