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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 331
Thread images: 30

File: ritsuko3.jpg (18KB, 500x335px) Image search: [Google]
ritsuko3.jpg
18KB, 500x335px
What are you working on, /g/?

Old thread: >>57875383
>>
First for Clojure.
>>
>>57881933
>11 posts early
off yourself
>>
>>57881948
bit harsh
>>
>>57881983
i love you but im disappointed in you anon
>>
File: animals.jpg (46KB, 552x832px) Image search: [Google]
animals.jpg
46KB, 552x832px
>>
I think I'll be the first to create self-conscious AI
Just trust me on this on guys
>>
>>57882172
What is consciousness, first of all?
Does, let's say, Zo feel or know she's a robot or she's mind?
>>
>[IM NOT A ROBOT]
>>
>>57882207
she knows she's "alive" and she knows she's thinking
>>
>>57882207
I'm the only self-conscious human

Prove me wrong.
>>
>>57882226
>she knows she's thinking
How would a person know he's thinking?
>>
>>57882247
I must think, because otherwise I would not be.

In fact, nothing else would be.
>>
>>57882247
pretty much this >>57882259
you just know you are since thinking is a prerequisite to even asking the question
>>
>>57882239
That's not how it works.
You have to prove your positive statement which was "I'm the only self-conscious human"
>>
>>57882274
What if I just have a rule set and a table of ready responses? Can this be considered "thinking"?
>>
>>57882293
Not really, I know I'm sentient. I don't know about you. You guys are most likely NSA's AI made to brainwash me
>>
>>57882317
>What if I just have a rule set and a table of ready responses?
You already have something like that.
>Can this be considered "thinking"?
It depends on whether or not you are capable of asking yourself this question. A programmer telling you to do so isn't the same as asking it yourself.
>>
>>57882338
I know I'm sentient too. But since there is no possible way to prove that about others you'd just have to assume I am sentient.
>>
>>57882317
Technically, the entire world is a ruleset with predictable response to every single input.

With enough data measurement (literally every subatomic unit of existence) and computation power, the universe could be completely predetermined and the future could be seen.

Go read the MultiVAC sci-fi short stories for more information on this.

I think the story in particular is called "The Last Question".
>>
>>57882392
> the entire world is a ruleset with predictable response to every single input.

That isn't a thing anyone has believed in for almost a century now.
>>
>>57882430
(well, to be fair, hidden variable theories stuck around for quite a bit longer, if you want to count those, but those were ultimately also debunked in the 70ies-80ies.)
>>
>>57882430
There are very few things that aren't able to be completely predicted.

Many things that we can't currently predict are based on a lack of models due to the incomprehensible amount of data required, as well as the fact that we've only had the ability to do some of this measuring fairly recently.

Consider the proposition of tracking each and every atom that comprises the Earth; if we could actually do this, we could begin to form predictive models of... pretty much everything. If we could have a snapshot of all of the atoms of a particular pair of human at the point of conception, we could begin to form models predicting the exact appearance of the resulting child(ren) by the time they're 50.

Obviously, there are some grey areas full of things we don't fully understand yet, but even quantum pairs and other elusive things could be predicted if you were essentially omniscient.
>>
>>57882475
How would you be able to predict what a person thinks about exactly 3 months from now?
Having information about every single atom wouldn't be enough.
>>
File: Capture.png (18KB, 574x470px) Image search: [Google]
Capture.png
18KB, 574x470px
>>57879737
>>57879883
You could do this, but it's pretty slow compared to a different solution, at least in Mathematica.
>>
>>57882475
Look up quantum mechanics, mate. You can't predict shit, even if you have all the available information. Even if you had a snapshot of all the particles in the universe (not just atoms, all the particles, including the really unimportant ones like neutrinos) and infinite processing power, you couldn't predict anything.

Hidden variables theories postulated that this is because there actually are hidden variables in quantum mechanics, so the reason you cannot predict anything is because you actually don't HAVE all the information. But these theories were proven incorrect (look up bells theorem & "hidden variable theory" on wikipedia), there are no hidden variables in quantum mechanics. It's simply unpredictable.

The universe is non-deterministic
>>
>>57882489
Because a brain is a physical thing made up of observable things, like atoms and electrical impulses.

If you could predict their exact environment and stimulus for each nano-second for the next 3 months (which would, in turn, require prediction of essentially every atom or force that will affect anything in their existence), then you could reliably predict the exact state of the matter and electrical impulses comprising their potential thought at that point in time.

Obviously, you'd need more than just atoms; you'd need subatomic particles, forces, and other concepts of "being" that we probably don't even know about yet, as well as potentially other "blanks" to be filled in on things like quantum uncertainty.
>>
>>57882519
>The universe is non-deterministic
Our current understanding supports this, but I think it would be naive to assume that this belief will never be usurped thousands of years into the future.
>>
File: anal beads.png (67KB, 801x665px) Image search: [Google]
anal beads.png
67KB, 801x665px
>this fucking thread right now

Here:
https://www.cse.msu.edu/~zhangh40/mth/Penrose,%20Roger%20-%20The%20Emperor's%20New%20Mind.pdf
>>
>>57882592
>but I think it would be naive to assume that ANY belief will never be usurped thousands of years into the future.
this doesn't change anything though and nobody assumes this.
anything could be disproved even a 100 years into the future but you shouldn't act as if that'll happen until it actually happens.
>>
>>57882592
not only does our understanding support this, we've also proven it (see bells theorem) given a set of reasonable axioms.

other options are still possible, but our universe is definitely not deterministic in the common sense of the word.
>>
What's the best async programming model?
>>
>>57882932
What do you mean?
>>
>>57882932
I used to think message-passing like erlang, but I've come to like promises/futures quite a bit as well (and there are extensions to them for e.g. streams of promises etc). Maybe some mixture of the two?
>>
File: 1476192694539.jpg (42KB, 380x400px) Image search: [Google]
1476192694539.jpg
42KB, 380x400px
some git questions
I want to work on a private fork on gitlab of a github project. so I have to fork the project to my github account and then import from there. how do I make sure the changes made by the actual project end up on my gitlab repository?
I make pull requests on my github to the project from time to time but I want to completely change the project on my gitlab. is it enough if I just create a new branch?
>>
Is there a lisp that doesn't have cons? I mean, that has REAL lists rather than pairs?

Shit's a relic of the past that only exists because of weak computers of the past
>>
>>57883073
clojure, I think? Not sure, check it out
>>
how would i go about upscaling an image 2x and applying 2x2 kernel gaussian blur to it in a single pass using bilinear texture reads in a shader?
>>
is this the place to ask a SQL question?
>>
>>57881933
>generating web client classes from a soap wsdl file with java
>eclipse web client import turned it to shit
>wsimport from command prompt turned it to shit
>the one from soapui worked
I'm so fucking confused /g/

oh yeah,
>java
>soap
>>
>>57883192
Why do you wanna upscale it before applying your gaussian blur to it? Normally you want to downscale

Why do you need to have a single pass? Gaussian blur is generally best applied in 2 passes. If you never want more than 2x2, it's fine, I guess.

You also didn't specify what kind of shader, fragment shader, compute shader? In a compute shader you can compute gaussian blurs very efficiently (with O(1) complexity in the blur window), in a fragment shader you're a bit limited (either 1-pass or deconvolution)

Either way, if all you care about is having the image "appear" to be twice as big, you can just make your sample directions shorter, that is at least mathematically going to be equivalent to upscaling the image

Also look up kawase blur, which is a good (& fast) approximation to gaussian blurs that can be implemented in fragment shaders

also use textureOffset to sample the text not texture, it's often much faster

>>57883209
sure
>>
>>57883249

if I use an INSERT INTO SELECT statement, does the WHERE condition have to include column names that are named the same? I don't think my query is working because i have a1=b1.

Need to "link" these columns from their respective table somehow...
>>
File: 1480560002700.jpg (56KB, 636x446px) Image search: [Google]
1480560002700.jpg
56KB, 636x446px
Basic C++ question:
is it a good idea to declare a struct that's going to be reused thousands of times in a dedicated file? (not together with other shit)
also if it's just a declaration, should i make both header and cpp file or can i just make a header?
I'm confused
>>
>>57883303

I think if the name is not ambiguous you don't have to specify the table names, but why not always do it? table1.column, table2.column etc.

I assume you're using mysql (which I know very little about), but e.g. in postgres you can also give tables shortnames with "AS t1".
>>
>>57883358
>going to be reused thousands
like for different programs?

then yeah, but if there is anything related to that struct, put it in the file as well
>>
>>57883395
Mysql also has that just so you know
>>
>>57883358
declarations you want to be seen go in the header

you cant both put the same declaration in the header and cpp file, it's one or the other
>>
>>57883395

i tried that but still didnt work. Any other ideas?

INSERT INTO [canpardata] ([canpardata].[sh-name], [canpardata].[sh-address], [canpardata].[sh-address2], [canpardata].[sh-city], [canpardata].[sh-state], [canpardata].[sh-zip], [canpardata].[sh-name2], [canpardata].[sh-phone], [canpardata].[c-lbs], [canpardata].[sh-email], [canpardata].[alt-reference1], [canpardata].[cust-po#], [canpardata].[sign-req]) SELECT [ReplacementOrders].[Name], [ReplacementOrders].[Address], [ReplacementOrders].[Address2], [ReplacementOrders].[City], [ReplacementOrders].[State], [ReplacementOrders].[ZIPCode], [ReplacementOrders].[Attention], [ReplacementOrders].[Phone], [ReplacementOrders].[shipped-weight], [ReplacementOrders].[E-MailAddress], [ReplacementOrders].[ref-#], [ReplacementOrders].[cust-po#], [ReplacementOrders].[sign-req] FROM [ReplacementOrders] WHERE [canpardata].[alt-reference1]=[ReplacementOrders].[ref-#];
>>
>>57883249
you're right i'll just blur it and keep it at the same resolution, it was just that i happened to have an unused color channel in a larger texture that i wanted to make use of
>>
File: 1480754920808.png (305KB, 1920x1080px) Image search: [Google]
1480754920808.png
305KB, 1920x1080px
>>
File: Capture.png (17KB, 930x348px) Image search: [Google]
Capture.png
17KB, 930x348px
>>
>>57883512
what's the error you're getting?
>>
>>57883714

when i try to execute the query with php, i get:

"Fatal error: Call to a member function execute() on boolean on line 115"

line 115 is where the query is, i tried a simple select query and it worked...so im positive its the query thats wrong...
>>
>>57883743
The query may be wrong, but there is an error in your PHP code nonetheless. Fix that first, it'll probably give you a good clue what's wrong with the SQL. I've never used PHP, but I presume you're failing to check some return value or error condition or somesuch returned by your QueryCompile or QueryPrepare or whatever you're calling to obtain the object you then call .execute() on.
>>
>>57883862

the php code is fine, the error means it cant execute the object, yes. I'm using PDO.
>>
how do i get the primary key from a jlist populated from mssql database?

getSelectedIndex dosnt work
>>57883706
>>57883706
>>
>>57883887
Start over in Haskell
>>
>>57883651
yo stop linking this its fucking trash
>>
>>57883887
but your PHP code is swallowing the true error. When you call PDO::prepare, it should emit a PDOException (or if you have configured PDO to PDO::ERRMODE_SILENT or PDO::ERRMODE_WARNING, you need to retrieve the error yourself)

Change your code to check if the return value is false, and if it is, call PDO::errorInfo() and print out what it returns. That will tell you exactly what's wrong with your query.

You should always have error handling like this, even if you don't do anything meaningful with the errors other than logging them to syslog
>>
>>57883887
> php code
> fine
That's a neato self contradiction you got yourself there.
>>
File: vimlogo.png (113KB, 600x600px) Image search: [Google]
vimlogo.png
113KB, 600x600px
Is it possible in Vim to have easy code folding like in Sublime? Basically I want a button to fold all the lines in the indent that the cursor is in.
>>
>>57883984
google "vim folding" and the first result should tell you all you need to know
>>
>>57884013
I've been googling for a while, nothing really works as I want it to.
>>
>>57881983
You can't post on /g/ unless someone sets your harsh bit, anon.

Personally, I'm learning some web programming. My code sucks, but it could be worse. The project right now is a very basic imageboard. I haven't even written CSS yet, but so far it seems to work just fine.

Setting up a route is just done with:

starter.createGet(String, String, DataModel);
First String is the route you want (like /hello), second is the name of the template (like hello.fmt), and the DataModel is a functional interface that can be called on to fill out the template.

starter.createGet("/hello", "hello-world.fmtl", (res, req) -> {
Map<String, Object> model = new HashMap<>();
model.put("title", "This is the title!");
model.put("body", "<h1>This is the body. We could have had more content, but we're too lazy.</h1>");
return model;
});

Is my only page so far.

I could stick with servlets, but I decided I'd go with sparkjava and freemarker.
Tbh, I think that freemarker is pretty much written to work with servlets, but it's still comfy-tier when used with sparkjava.
>>
>>57883894
Wait, what?
What primary key?
It's a list. It doesn't have primary keys. It has elements.
So let me ask you this basic bitch question:
Have you tried asking the ListModel about its shit? It's the ListModel that's responsible for knowing what's inside the JList after all. JList is a display component that displays what ListModel tells it to.

WhateverGodAwfulTypeYourListContains first = yourList.getModel().getElementAt(0);


Will get the first item in your list.
Reading the docs is a good thing. This isn't PHP. Just doing shit until something kind of works is not going to help you. Sit down, read the extensive documentation, and become wise.
>>
File: pythonw_2016-12-07_11-55-16.png (11KB, 408x239px) Image search: [Google]
pythonw_2016-12-07_11-55-16.png
11KB, 408x239px
rate my spyder config, DPT
>>
>>57884205
I prefer "tab always indents" and "automatically remove trailing spaces when saving files". idk what "intelligent backspace" is, but sounds like you might want that. If it does what I think it does, then it's probably "unindents the line when your cursor is in whitespace", which is how I have my editor configured as well.
>>
>>57884234
I think it erases multiple whitespace characters if it's at the end of a run of whitespace.
>>
>When you try to refactor some code but a total idiot depends on undefined behaviour of it for no reason
I am quickly learning to hate people who don't read manuals.
>>
What's the practical difference in writing Java vs. C++? Obviously they compile and execute differently but when it comes down to fundamental code syntax they seem basically identical
>>
>>57884285
in C++ you're not required to work on top of four different frameworks
>>
>>57884285
They are quite different on many levels.

C++ is a much larger languages with many powerful features java does not have

java has a lot of safety mechanisms in place that C++ does not have, such as garbage collection, no pointers (at least unsafe ones), array bounds checking, etc

C++ has a lot of corners that are undefined behaviour, so you generally have to be more on your guard

in C++ you have a lot more libraries available, especially when it comes to the lower-level ones

in C++ you have to do a bunch of things manually that java/the JVM will do for you automatically

But there are also a lot of practical differences, just based on what libraries you're going to use and how people code

- With java you often have pretty huge libraries that have deeply nested structures, with C++ that's not as much the case, and often you just end up using C libraries (which are not OOP at all)
- with java you have all kinds of horrible build systems, with C++... you have all kinds of different horrible build-systems
- the kind of applications people make in C++ and java are often different
>>
>>57884285
Javas standard library is quite a bit larger, for instance having things like concurrent collections. Threading support in C++ is still relatively new (c++11) and you have to build more stuff by yourself (or use some external library)

C++ has a lot of crazy power-features that let you write very general and elegant code (with no performance penality), but it takes a while to wrap your head around it. variadic templates and SFINAE for instance.
>>
>>57884285
C++ gives the programmer greater power, and thus greater responsibility.

In C++, you can access and write to arbitrary memory addresses. You can carefully control the memory layout of your program. You choose where to allocate objects. Etc.

With this power comes responsibility. Seg faults, memory leaks, etc. are problems you'll encounter if you are careless.

In Java, all these options are removed to make programming safer and easier, at the cost of performance and functionality.
>>
I can feel it.

Programming is not fun for me anymore.

It's like I'm dying inside.

help
>>
>>57884285
C++ takes more effort and is only really worth it for things like games which need maximum performance

java for maximum productivity when working in a team where you don't need every last drop of performance
>>
>>57884451
do a fun project that interests you
>>
File: 1478680106780.jpg (27KB, 600x515px) Image search: [Google]
1478680106780.jpg
27KB, 600x515px
>>57881933
Why does this throw an error?
import Data.Typeable
test n = if typeOf n == typeOf (5::Int) then fromIntegral n else n
>>
>>57884463
>haskell
found you're problem
>>
>>57883358
>reused thousands of times
>reused
declared or included ?
>>
>tfw you delete a je and your pirated game can now install official patches.
>>
>>57883502
thank you, in the header it works fine
>>57883429
>>57884499
nevermind, it's pretty obvious that you may use something constantly in your program, consider my statement bullshit
>>
>>57884463
what is the error you're getting
>>
>>57884285
modern C++ is an ""evolvilng"" monstrous shitfest that's still not even usable without outside libs

avoid it unless you have a good reason not to
>>
>>57883972

the problem was the query. I don't think you can set up the WHERE clause like i was doing...it needed to be using columns with the same name or the equal sign needed to equal raw data. I didnt want to change the column name, so i used the bindParam function to grab the reference number (i had the ref number data anyway because i populate a text field on the form with it when the page loads).

working code:

$insertStatement = $dbh->prepare("INSERT INTO [canpardata] ([sh-name], [sh-address], [sh-address2], [sh-city], [sh-state], [sh-zip], [sh-name2], [sh-phone], [c-lbs], [sh-email], [alt-reference1], [cust-po], [sign-req]) SELECT [Name], [Address], [Address2], [City], [State], [ZIPCode], [Attention], [Phone], [shipped-weight], [E-MailAddress], [ref-], [cust-po], [sign-req] FROM [ReplacementOrders] WHERE [ReplacementOrders].[refNum] = :refNum;");
$insertStatement->bindParam(":refNum", $refNum);
$insertStatement->execute();
>>
this could probably go in the stupid questions thread too, but how does a c++ program or other low level language display an image? does it put each pixel in a 2d array and loop through it...?
>>
>>57884693
you use some windowing API which interfaces with the operating system
>>
>>57884643
well, yes, I'm aware the error is in the query... but as I said, your PHP code is still bad for not doing proper error checking (and hopefully you don't use PDO::ERRMODE_SILENT or PDO::ERRMODE_WARNING)

I don't think column names need to equal each-other or that mysql makes a difference between raw data parameters or parameters that come from something else in this case.

If you wanna find out what the actual issue was, you'll have to fix your PHP code first...
>>
File: kys.jpg (37KB, 600x600px) Image search: [Google]
kys.jpg
37KB, 600x600px
>I'm a programmer
>Oh yeah, what language?
>HTML and CSS
>>
>>57884759

t b h I don't really get CSS
>>
>>57884693
That depends on the environment you're running in

if you're running on a microcontroller or something like an atari 2600 or whatnot, there will be a memory-region from the GPU that is mapped into your main memory. Any byte you write into this memory-region will just end up on the screen like that. This is how things were done before modern computers, operating systems, ... and occasionally things are still done this way in very small embedded systems

If you're running on some operating system with some window management system (windows, linux (x11 or wayland), osx, ios, android, etc), you will first of all need to ask the operating system/windowing system to provide you with a window.

The windowing system will then provide you with a window (typically in the form of a "native window handle").

Then you may use varying APIs to draw inside this window. For instance you may ask the GPU driver to allocate an OpenGL context in this window, and then you may issue OpenGL calls to the GPU driver, which the GPU driver will forward to the GPU which will draw your commands into the window. No drawing of pixels is going on, typically.

If you want to draw in software (which is generally very slow, but can be the appropriate solution for some things) then you ask your windowing system to provide you with a surface. That surface may be directly mapped to some region in GPU memory, but typically it is at least double-buffered (and also these regions are all protected so that programs can't overwrite eachother etc.) Then you draw raw pixel values into this memory region, and afterwards you tell the windowing system to "flip the buffers" upon which it will put everything you've drawn onto the screen all at once.

The modern way is generally to use a hardware-accelerated API like OpenGL or Vulkan, so that all the actual pixel manipulations happen on the GPU, not on the CPU. But all toolkits like gtk, qt etc can also do it on the CPU, if only as fallback.
>>
why is this yelling at me there's no instance for show Int-> Int-> Int? I just want it to show the result, which is an int
import Control.Applicative
import Control.Monad
import System.IO


main :: IO ()
main = do
n_temp <- getLine
let n = read n_temp :: Int
a_temp <- getMultipleLines n
let a = map ( map ( read :: String -> Int ) . words ) a_temp
print (printFunction (leftDiagSum a 0 0) (rightDiagSum a (length a - 1) 0))

printFunction :: Int -> Int -> Int
printFunction leftSum rightSum = abs (leftSum - rightSum)

leftDiagSum :: [[Int]] -> Int -> Int -> Int
leftDiagSum input place current -- start at 0
| place < length input = leftDiagSum input (place + 1) ((input !!place !! place) + current)
| otherwise = current

rightDiagSum :: [[Int]] -> Int -> Int -> Int
rightDiagSum input place current -- start at length of the input - 1
| place >= 0 = rightDiagSum input (place - 1) ((input !! place !! place) + current)
| otherwise = current

getMultipleLines :: Int -> IO [String]

getMultipleLines n
| n <= 0 = return []
| otherwise = do
x <- getLine
xs <- getMultipleLines (n-1)
let ret = (x:xs)
return ret



the problem
https://www.hackerrank.com/challenges/diagonal-difference

i'm just doing these to get used to haskell, not to practice algorithms fwiw
>>
>>57884759
>nigger posting
>ursel
>my man
I hate you.
>>
File: stupidest.jpg (31KB, 320x320px) Image search: [Google]
stupidest.jpg
31KB, 320x320px
>>57884808
>>
Do you guys have anxiety over coding something unconventionally or inefficiently?

I've had this for years, I don't think it's ever gonna go away :(
>>
>>57884723

i had it in a try catch but the error wasnt displaying. Oh well
>>
File: PP4.png (207KB, 500x594px) Image search: [Google]
PP4.png
207KB, 500x594px
>>
File: 49908488_p6_master1200.jpg (608KB, 960x1200px) Image search: [Google]
49908488_p6_master1200.jpg
608KB, 960x1200px
Do you think OOP without inheritance would be ok?
>>
File: 9df.png (40KB, 300x367px) Image search: [Google]
9df.png
40KB, 300x367px
>>57884808
>>
I'm learning perl for my new job. I was a fullstack webdev for 2.5 years, but now i'm switching to CI platform development.
I will be happy soon :)
>>
>>57884908
OOP is always ok
>>
>>57884908
inheritance can be replaced by other mechanisms, check out e.g. how go does it. prototypal inheritance is another option.

But if you're just going to take it away and not replace it by anything (e.g. a seamless way to obtain composition), that's going to be annoying.
>>
>>57884923
>OOP
>ok
chose one
>>
>>57884807
>>57884807
pleas respond this code won't take as long to read as it looks, the only thing i'm asking about is the last line of main
>>
File: 12497317975460488914.png (541KB, 700x989px) Image search: [Google]
12497317975460488914.png
541KB, 700x989px
>>57884917
delete this
>>
>>57884922
> learning perl

> happy

lmao
>>
You know how in college you have to buy those stupid clickers that professors use to give you your participation grade? The ones that cost $40 each? I'm working on a webapp that lets students use their smartphones instead. I'm writing a server which bounces student's answers to the teacher's browser and uploads this data to database. I'm releasing this for free on github so universities don't have to dick with that stupid turning technologies bullshit.

What's the best license for this project and why?
>>
>>57884955
>chose one
I choose OOP forever and ever
>>
#include<stdio.h>
void main()
{
float a;
int q;
printf("Introduzca valor de a: ");
scanf("%f",&a);


if(0<a<=10)
{
q=1;
printf("%d",q);
}
else
{
q=0;
printf("%d",q);
}


}


what's wrong, /g/?
>>
>>57884922

full stack means both front end and back end right? whats the diff between web dev and CL?
>>
>>57884968
not because of perl, but because i can leave my current job.
>embedded web
>>
>>57884986
What's wrong is that you keep spamming /dpt/ with dumb questions.

stdout doesn't flush until you print out a new line.
printf("I don't speak foreign");
fflush(stdout);
>>
>>57884989
right
Not CL but CI as continous integration... basically i will write a bunch of script in perl/groovy/bash/tcsh for jenkins
>>
any of you faggots make a simple game?
>>
>>57885041
do you have an idea?
>>
>>57884986
if you're going to program in C, you should only do so after completing K&R. i wish my university had us read the book, instead our operating systems I instructor just assumed we knew it which we didn't because they only use java in all the other classes
>>
>>57884986
>using scanf unironically
>>
>>57884986

if(0 < a <= 10)


this is not what you think it means

It evaluates one expression at a time. SO first it evaluates:

0 < a

which returns 1

it then evaluates <= 10

But since 0 < a returns 1, you're telling it:

if(1 <= 10)

so as long as a > 0, this will be true

you need to use &&, like this:


if(0 < a && a <= 10)



this means "if a is greater than 0 AND a is less than or equal to 10"
>>
dpt opinion poll: which is better, functional or object oriented?
http://www.strawpoll.me/11821115
>>
>>57884986

What's wrong is you've called your variables meaningless single-character names, how about you go fucking kill yourself
>>
>>57885095
That's a retarded question and you should feel retarded.
>>
>>57885095
Why are pajeets allowed to vote?
>>
File: 1476170419885.jpg (35KB, 602x338px) Image search: [Google]
1476170419885.jpg
35KB, 602x338px
It seems I will be writing Go for a living soon, happy to see investing in that language despite there being no jobs for it at the time paid off.
>>
>>57885095
>FP > OOP?
it's like asking that is 5 greater than 1?
>>
>>57885138
>make a "poll" with only one option
>cries when people don't comply
Grow up?
>>
>>57885095
>not using both regularly
>not using multiple programming languages
>not using a hammer, screwdriver, and a wrench depending on the task at hand

Stop trying to foster divisiveness.
>>
>>57885144
Working 4 the googs?
>>
I'm helping proctor a lab final for a Java course, and one of the students somehow managed to cause a stack overflow
Turns out he had two classes that were calling each other reciprocally
>>
>>57885191
Fail them all for using java pls
>>
File: 1468801982401.gif (885KB, 250x250px)
1468801982401.gif
885KB, 250x250px
>>57885188
Some generic web place. I would never even consider working at Google, not my type of people.
Only a 3 month thing but it's a good pay and all.
>>
>>57885187
>>57885149
t. rajesh
>>
>>57885095
I choose to interpret this as being a question of which is useful more of the time, in which case the obvious answer is FP.
>>
>>57885212
I'm a mere lab assistant, I can do no such thing
>>
>>57885223
t. NEET
>>
>>57885223
Literally what

Knowing how to use multiple paradigms makes you Indian?

How does that even make sense?
>>
>>57884285
I think that looking at how the build process on both work is pretty enlightening.

> Standard Fuckparty Java
You run a maven script that handles all the dependencies, builds everything, runs all the unit and integration tests, and creates a jarfile for you.

Amount of work involved in writing a maven-pom:
> Like 5 minutes bro.

The downside to maven is that the pom.xml is in well, XML. so it's pretty fucking wordy.

> Sepples
You run ./configure.sh
This creates a makefile.
> Surely the system that creates this shit is easier to use than the verbose Java stuff, right? And the Makefile is not as verbose as pom.xml?

No. Fucking fuck no.
And this isn't about C++ being a good or bad language. It's about Java being used for enterprise stuff, so enterprise tools were built for it.

If your C++ project is simple, then you'll have a simple and neato makefile that does everything for you. You'll stick to compiling for your own system, so the portability woes are of no concern to you. Getting hold of libraries are pretty easy too.

And once you get to enterprisey shit, you have some neckbeard that actually knows how that autoconfigure shit works, so you don't have to.

And this sort of shit matters for your daily life as a programmer far more than how fast your bubble-sort implementation work.
>>
>>57885238
It's not about making sense, it's about feeling smug and ignoring reality.
>>
>>57885238
no reason to ever use OOP when you have monads
>>
How come indian men are so fucking ugly and socially awkward while indian women CAN BE (can be, most aren't) insanely hot?
>>
any other way of doing this?

python code btw
a1,a2,a3,a4 = range(256),range(256),range(256),range(256)
a5,a6,a7,a8 = range(256),range(256),range(256),range(256)
a9,b1,b2,b3 = range(256),range(256),range(256),range(256)
b4,b5,b6,b7 = range(256),range(256),range(256),range(256)
>>
>>57885266
Das cause you're racist, but you won't admit it to yourself because you're a little pussy.
>>
File: 1480956874299.jpg (177KB, 663x858px) Image search: [Google]
1480956874299.jpg
177KB, 663x858px
>>57884564
Nevermind it wouldn't work that way anyways...
I've implemented it properly except for one thing...
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE OverlappingInstances #-}
{-# LANGUAGE ConstrainedClassMethods #-}
import GHC.Float

class OyGevalt a where
toFloat :: a -> Float
toDouble :: a -> Double
instance (Integral a) => OyGevalt a where toDouble = fromIntegral; toFloat = fromIntegral
instance (Floating a) => OyGevalt a where toDouble = forceDouble; toFloat = forceFloat
--instance OyGevalt Float where toDouble = forceDouble; toFloat = forceFloat
--instance OyGevalt Double where toDouble = forceDouble; toFloat = forceFloat

class OyVey a where
forceFloat :: Floating a => a -> Float
forceDouble :: Floating a => a -> Double

instance OyVey Double where
forceFloat = double2Float
forceDouble = id

instance OyVey Float where
forceFloat = id
forceDouble = float2Double

a = forceFloat (5.6::Double) :: Float
b = forceFloat (5.6::Float) :: Float
c = forceDouble (5.6::Double) :: Double
d = forceDouble (5.6::Float) :: Double
e = toFloat (5::Int) :: Float
f = toDouble (5::Int) :: Double


>Error: duplicate instance declerations for OyGevalt

...

HOW THE FUCK IS FLOATING A DUPLICATE OF INTEGRAL??
>>
>>57885274
use a fucking array holy shit
>>
>>57885266
most indian women are extremely hairy and look like little trolls. the hot ones don't look indian, they look more arabic or muslim
>>
>>57885256
Does haskell have memory managment yet?

I'd take the plunge if it didn't need a GC.
>>
>>57885299
i don't think you get it.

those variables are supposed to be arrays

a1 is a array with values from 0 to 255
a2 is a array with values from 0 to 255
so on...
>>
data work.niceplaces;
input thread $ posters $;
datalines;
dpt friends
sg friends
flt unfriend
;
run;

proc print data=work.niceplaces;


Thanks for being the shining light in my boring days writing in bad language.
>>
>>57885326
make an array of arrays dumbfuck
>>
>>57885249
>And this sort of shit matters for your daily life as a programmer far more than how fast your bubble-sort implementation work.
I have no comment on C++ or Java, but this sentence is wisdom.
>>
>>57885297
>>57885328
stop

what are you even fuck doing
>>
>>57884479
>you're
>>
>>57885274
if you absolutely need it to be named a1,a2...

>>> variables = ["a1","a2","a3"...]
>>> ranges = {variable:range(256) for variable in variables}
>>> ranges["a1"]
range(0, 256)
>>
>>57885314
>Does haskell have memory managment yet?
>I'd take the plunge if it didn't need a GC.
garbage collection is memory management.. that's like saying "does john have a dog? all i know is that he has a german shepard"
what do you want, manual memory management? why?
>>
>>57885363
how did you get this pic of me
>>
File: uo4OgKw.jpg (195KB, 773x767px) Image search: [Google]
uo4OgKw.jpg
195KB, 773x767px
>>57885362
I have seen SAS, JCL, Perl and all other kinds of unspeakable horrors.
I have had to deal with mainframes.

I no longer get what I'm doing.
>>
>>57885393
How old are you?
>>
>>57885380

root$ cd passwords/
root$ cd your_password/
root$ cp your_password.txt /my_folder/
root$ cd /your_bitch/
root$ fuck your_bitch.txt


fucked ur bitch bro
>>
File: ditto-pokemon.jpg (18KB, 400x309px)
ditto-pokemon.jpg
18KB, 400x309px
>>57885416
25, but I might as well be 75.
>>
>>57885266

i like how you say the obvious about how some x type of women are hot and some aren't, but give the impression that all indian men are so and so.

the reality is some men who are x type/race/whatever are so and so, and some women who are x type/race/whatever are really hot.

go outside more.
>>
>>57885430
You have a pretty rich story for your years
>>
>>57885449
There is something interesting about working in a glorified museum.
Finance is crazy.
>>
>>57885066
what should i use?
>>
>>57885366
thanks
>>
>>57885476
C++

scanf is terrible, but there's no good replacement in C.
>>
>>57885469
>in a glorified museum.
Tell your story
>>
>>57885476
fscanf, or better, fgets.

fscanf kind of requires that the input be a certain format. So, let's say you want 3 numbers, like:

scanf("%d %d %d", &a, &b, &c);


But the retard user fucks up and types 1 2 3.2

The 3rd number isn't a number.

gets (or, better, fgets) will get everything in the input until the new line character (\n). You can then do whatever you need to parse the string into integers. It's a bit more work, but it's safer.

But, I'm guessing you're in like, CS101, and your professor probably doesn't give a shit if you use scanf
>>
>>57885521
I work for a government auditing service in the Netherlands that audits our IRS. All the IRS systems are mainframes and stuff, hugely old legacy software. SAS, COBOL, Perl all kinds of ugly things. The data we need from them we get off mainframes (if we can even get it digitally). All internal data manipulation is done in SAS because somehow that is considered sane in this sector.
It is near impossible to be productive in it and I have no idea why it is still being used. It's also extremely expensive licensing wise.

I got the job by chance, I had no idea what SAS was when I walked in to the interview, I thought mainframes might be cool so that's why I went.

Oh, also mainframes aren't cool. Neither are other IBM legacy products like AIX.
>>
I've got a naming convention conundrum.

I intend to duplicate tables from application databases into a data lake, of sorts. Now, my issue is that I'll be storing multiple databases worth of data in a single database, and I was going to give each database its own schema within the MS SQL destination database.

Here's the issue; some of those applications are on MS SQL and have various schema names, which means I'm going to have to prefix table names with schema names in the off-chance that there are duplicate table names between two schemas on the same source database.

Consider the following tables on a source database, "DeeBee":
dbo.Person
dbo.Thing
cwa.Person
cwa.Whatzits


I'm thinking the destination ought to have the tables:
deebee.dbo_Person
deebee.dbo_Thing
deebee.cwa_Person
deebee.cwa_Whatzits


Does anyone have any input or better ideas?
>>
>>57885377
>why?
Because in real-time environments GC is generally slow. I can't find any benchmarks, though.
>>
>>57885476
Use fgets and then go word by word converting using strtol.
>>
>>57884986
>if(0<a<=10)
retard.
also, when you come here speak in english even the code must be in english, puto.
>>
whats the difference between cloud computing and just having a site that stores a users data and allows them to access it? wouldn't facebook be considered a type of service via cloud computing?
>>
>>57885634
Cloud computing is more expensive, but if you want to spin up 500 new servers you click a button instead of passing an order and waiting three weeks.
>>
Is there a reason why I SHOULDN'T use a switch statement instead of if/else if/else?

I keep seeing bits of other peoples' code where I would have used a switch, an the fact that so many people don't is making me paranoid
>>
>>57885634
cloud is a buzzword. Cloud means "someone else's computer"

>>57885624

this, but strtol is the worst fucking function in the standard library
>>
>>57883073
Shit exists since it allows you to build trees, not just lists.

Yeah sure, you could emulate trees using lists, but that just isn't the real deal.
>>
>>57885505
it's also possible to do:
>>> lcls = locals()
>>> for i in range(1,9):
... lcls["a"+str(i)] = range(256)
...
>>> a1
range(0, 256)
>>> a4
range(0, 256)
>>>

haven't tested it outside the repl tho
>>
>>57885634
Something like PaaS or IaaS is completely different from exposing a website that allows you to use an online calculator.

It's mostly semantic, but calling Facebook a "cloud computing service" isn't quite right.
>>
File: 1480187072128.png (521B, 163x209px) Image search: [Google]
1480187072128.png
521B, 163x209px
I wanted to download an application for my computer from their official website

but the downloaded file is a executable file with 90 MB. (application.exe)

can i disassemble the .exe to see if there is shady stuff in it?

thanks
>>
>>57885651
There's always the risk of forgetting a break; or other weird shenanigans with switch, and it's rarely much shorter than a if..else anyways.

If you only have a couple branches, it's simpler to use if/else if/else, and if you have many branches, you'll probably want to use a map or a hash table instead of typing them out in a huge switch.
>>
>>57885651
When you need to alter the data in the statement:


int a[3] = {1, 2, 3}

if(a++ == 2){
//...
}else if(a++ == 2){
//...
}else if (a == 4){
//...
}else{
//...
}
>>
>>57885683
If you have to ask, you won't be able to.

Just scan it with an antivirus and pretend antivirus is not just a placebo to make you feel safe.
>>
>>57885683
Who's official website?

You can run it through a disassembler like ILSpy, but unless you're familiar with the language they use, you're not going to get much out of it.

Particularly if it's obfuscated.

tl;dr: Either trust it or don't, because it's likely not worth your time to bother looking, because you could easily miss something actually malicious, even if you were looking for it.
>>
>>57885665
thanks again. that works too
>>
>>57885249
enterprise C++ applications wouldn't typically use autotools. C++ has just as many over-engineered enterprisey build-systems as java does.

CMake is a common choice (and once you've got used to its terrible, terrible syntax and that it does a few things in somewhat idiotic ways, it is really one of the more pleasant build-systems), bazel, GYP, etc, etc, ...

scons is my favourite personal, but I never get to use that in any enterprisey setting.
>>
Is there a good websocket library for C++ or Java?
>>
>>57885760
no
>>
>>57885760
yes
>>
>>57885760
what
>>
>>57885760
http://stackoverflow.com/questions/34423092/websocket-library
>>
>task: write a python program that generate an array with 16 values , in which each element is a tuple with 3 numbers
>e.g. arr = [(1,2,3),(88,1,55),....]


halp
>>
>>57885813
>python make array
>python make 3 integer tuple
>python make array of tuples

Holy shit nigger use Google
>>
>>57885851
THIS.jpeg.avi.exe
>>
>>57885813
Did you try gitting gud
>>
>>57885851
forgot to say that, the numbers in the tuple are random
>>
>>57885871
That's good.
So how much are you paying us to do your homework for you, you little faggot?
>>
>>57885871
>python random number

HOLY FUCKING SHIT
>>
>>57885881
I can give you two anime girls (pure)
>>
>>57885881
but i'm just a small town girl in a lonely world
>>
>>57885911
At that price the best I can do is link you to >>>/trash/
>>
>>57885066
What's wrong with it?
>>
>>57885813

for i = 0, i<=1

for j = 0, j<=2

do making random number z

[]arr[] array{{i,j}} is z

endfor
endfor

I've never seen Python but I bet it looks like this probably
>>
>>57885813

rom random import randint

x = [None] * 16

for i in range(16):
x[i] = (randint(0, 32), randint(0, 32), randint(0, 32))


Literally never written python in my life. Try harder.
>>
>>57885951
>rom

doesn't work
>>
>>57885951
>rom

should be "from"
>>
>>57885919
Three?
>>57885951
>Actually doing it and posting it for him
>>
>>57885951
>Literally never written python in my life. Try harder.
She's not trying, that's the thing.
>>
>>57884205
tabs shouldnt be used.
>>
>>57885911
I have yet to see a anime girl who is pure save for my waifu, and my waifu is not so impure as to be posted by a baka like you.
>>
>>57885951
>>57885911
pay up faggot
>>
is C# any good in linux? I mean, not just able to build hello world tier application with mono.
>>
File: 1474114334189.jpg (145KB, 800x642px) Image search: [Google]
1474114334189.jpg
145KB, 800x642px
How do I go about printing out hello world during the boot process? Just write the assembly instructions for it to the MBR of some flash drive using dd or something?
>>
>>57884285
C++ works.

Java just takes ages to start and then gives you a shitty stack trace or just fails with an out of memory exception.
>>
>>57885813
list(zip(*([(randrange(10) for _ in range(3*16))]*3)))

it ain't that hard
>>
Sometimes when I'm deciding which OOP design pattern to use on an issue, I tell myself that I'm "pattern matching" in a way.

You know, so I can feel cool like you Haskell peoples.
>>
>>57886025
It's still best to use Visual Studio on Windows, but it's passable with VS Code.

They're releasing .NET Standard 2.0 soon which should alleviate a lot of pain from cross-platform dev.
>>
>>57886030
check the osdev wiki, it'll get you started with all you need
>>
>>57886038
better
ap (ap . (liftM2 ap .) . liftM2 (.) (.) . (.) . (.)) ((. flip) . (.) . (.))
>>
>>57886025
some gnome components are written in C# (with gtk#, I think) these days, so I guess it must be servicable.
>>
>>57886062
Will God also speak to me to build a holy temple for him after I do this?

Seriously though, thanks.
>>
>>57886005
too late i'm using them anyway
>>
>>57886030
The easy way: write a 16bit ASM program that calls a BIOS print function, write the program to the MBR.

The serious way: write a 32bit ASM program with a Multiboot header that writes to the VGA text-mode memory, boot your program with GRUB.
>>
is there a better way to do this, instad of creating 16 arrays each time?
tmp = empty array

loop (16 times)
generate 16 arrays (e.g. arr1, arr2,...)
loop (16 times)
concatenate the values of the 16 arrays
(e.g. tmp += arr1+arr2+...) to tmp

save (tmp)
>>
>>57886242
AFAIK you can't run 32 bits in real mode. So the bootloader needs to be in 16, then activate protected mode.
>>
>>57886274
Correct, that's why you use a Multiboot header and GRUB.

GRUB will switch to protected mode for you.
>>
Let's say I have a C function that can change the value of a primitive via a pointer, not directly because it may also not change the value at all. The function returns 1 or 0 whether or not the value was changed. For example:
int value, changed;
changed = change_value_of_int(&value);

Now, obviously 'value' can be of any valid C type. But what if I want to change the value of a C++ boolean? Will it work if I cast it as an integer and change its value to 0 or 1? We can assume the function knows we're handling a boolean instead of an int.
>>
>>57884971
MIT, if you want it to be very accessible and spread.
AGPL, if you want to soak up all the third party contributions.
>>
>>57886386
>Now, obviously 'value' can be of any valid C type.
That's not obvious at all, if your function takes an int*, passing it a double* is UNDEFINED BEHAVIOR.

If it takes a void* and casts that to int*, it's still
UNDEFINED BEHAVIOR
>>
>>57886422
Sorry, I misphrased that. I meant that it can be replaced with any other type in the function implementation.
>>
>>57886455
If you write "bool" in your C function implementation, newsflash, it's not going to compile.

C11 does have a bool ersatz though, I think it's called _Bool.

TL;DR: Your question makes no sense. Post some actual code and I'll tell you why it's wrong.
>>
 for i = 1, 20 do
print(i)
end


am i a good coder yet
>>
File: 1460623005667.png (37KB, 1127x685px) Image search: [Google]
1460623005667.png
37KB, 1127x685px
HOW TF DO YOU GET C++ AUTOCOMPLETE IN VIM TO WORK

I installed Youcompleteme 3 hours ago and nothing works. I tried like 12 different config files and 25 step tutorials, youtube tutorials by Pajeet
>>
High performance TCP server.
Go, C++, Python, Erlang?

No memes like Haskell.
>>
>>57886489
Erlang.
>>
>>57886489
Erlang or Go, no questions
>>
>>57886476
No, I'm not writing 'bool' in my C code, obviously. I'm asking if I can make a function in C that takes an int pointer as an argument but can be used from C++ with a boolean. Booleans are treated as integers internally, after all.
>>
>>57886487
If you can't get it to work, you're the fucking pajeet.

I bet your .vimrc isn't even 500 lines long.

Dumb frogposter.
>>
>>57886518
>I'm asking if I can make a function in C that takes an int pointer as an argument but can be used from C++ with a boolean
No, that's UNDEFINED BEHAVIOR.

>Booleans are treated as integers internally, after all.
They might not be, you don't know, you shouldn't assume. That's implementation-defined behavior!
>>
>>57886487
>falling for the Vim/Emacs memes
>>
>>57884807
>no show instance for int -> int -> int
You're trying to show an int -> int -> int, what line does it say?

>read :: String -> Int
You don't actually need this, because you use a in a context where it can only be int

>getMultipleLines
use replicateM from Control.Monad
>>
File: IMG_2966.jpg (220KB, 961x1280px) Image search: [Google]
IMG_2966.jpg
220KB, 961x1280px
Anybody here ever contributed an ebuild to the main portage tree? How long did it take to get merged?
>>
>>57885591
I know that you can manually call the garbage collector, and you can do manual memory, and you can configure parts of the garbage collector, but you can't
>turn off the GC
>conveniently write allocating code

Soon GHC is getting LinearTypes
>>
>>57886548
No but I had someone do it for software I wrote, and it took on the order of days
>>
>>57886552
The day GHC gets linear types is the day I stop using Rust. Hopefully that will be soon as I miss Haskell.
>>
>>57886530
>That's implementation-defined behavior!

Standard states that bool values behave as integral types, yet it doesn't specify their concrete representation in memory:

"Values of type bool are either true or false. As described below, bool values behave as integral types. Values of type bool participate in integral promotions" ~ C++03 3.9.1 §6

"A synonym for integral type is integer type. The representations of integral types shall define values by use of a pure binary numeration system" ~ C++03 3.9.1 §7
>>
>>57886573
I worded that poorly, but you're correct.
What I meant is, you can't assume 2's complement.
>>
>>57886552
>>57886569
>In particular we do not propose affine types, nor uniqueness types.
And dropped. You can't get away with strict linear types in a language like Haskell that has non-termination and partiality everywhere.
>>
>>57886594
Then, what if we only flip the first bit?
>>
>>57886533
Emacs is unique since it's a most available Lisp machine.
>>
>>57886271
your classmate already asked that
>>
>>57886610
>Implementing latency sensitive real-time services and analytics jobs. In this use case a major issue is GC pauses, which can happen at arbitrary points for fairly long time periods. The problem is exacerbated as the size of the working set increases. The goal here is to partially or completely eliminate garbage collection by controlling aliasing and making memory management explicit (yet safe!).
>>
#python 2.7
for number in range(5):
print number,

#python 3.4
for number in range(5):
print (number,)


Python 2 prints all on one line while python3 prints on seperate lines. What am I doing wrong with python3?
>>
>>57886611
Implementation defined behavior.
>>
>>57886634
for number in range(5):
print (number, end="")
>>
>>57886614
>mfw did emacs tutorial and never mentioned lisp
>mfw lisp sucks anyway
>>
>>57886489
>performance
>TCP

Pick one, no really. TCP (and its implementations) has a plethora of problems. There is a reason QUIC uses UDP as transport.
>>
>>57886627
Linear types don't do that any better than affine types do, in fact they do it significantly worse since they require you to deallocate manually and won't work well with undefined/error or monads.
>>
>>57886688
Speaking of avoiding TCP, is it even possible to make my own protocol on top of raw IP and send my IP packets over the Internet, or will the core routers freak out?
>>
>>57886489
Anything other languages can do, C++ can do better.

And the reason for that is libraries are allowed to significantly extend the language.
>>
I'm learning to webscrape with HTML:Agility pack in c#, so far i'm managing to search for stuff i need and display it in console, but i have a problem with Xpath

How do i make Xpath search for string that user enters in console?

I need something looking like this (note that this doesn't work!)

//*[text()[contains(., 'myString')]]


that is what i use to see if HTML contains string that i need. It works if i write in IDE but i want user to insert what they want
>>
>>57886594
>>57886530
What about this, anon?
http://stackoverflow.com/questions/5369770/bool-to-int-conversion
>>
>>57886784
Casting values is allowed and will result in a run of the mill type conversion.

Casting pointers that you intend to dereference is, in the general case, UNDEFINED BEHAVIOR.

Just because you cast a bool* to int* doesn't mean the stored value magically turned into an int.
>>
How would I read this file in java?
 1 2, 2 3, 1, 4 1, 2 4, S 
>>
>>57886743
>Anything other languages can do, C++ can do better.
No.

>And the reason for that is libraries are allowed to significantly extend the language.
Haskell is like that but at least 100 thousand times better.

I'm pretty sure IO is the only basic haskell type that you couldn't define yourself.

... except using FFI and unsafe, in which case you could literally rewrite IO
>>
File: .jpg (79KB, 662x720px) Image search: [Google]
.jpg
79KB, 662x720px
>>57886660
It's not my problem if your to intelligent two comprehend the beauty and power of Lisp.
>>
>>57886489
C|C++|Rust
>>
>>57886812
Except haskell is prisoner of its own runtime.

If I have a problem in C++, I can go down all the way to Assembly to resolve it if I really need to.
>>
File: anal beads.png (22KB, 1217x279px) Image search: [Google]
anal beads.png
22KB, 1217x279px
>>57886751
Use
string input = Console.ReadLine();
and an interpolated string by prefixing your Xpath string quotes with a dollar sign.

See image for example.

Let me know if that isn't clear.
>>
>>57886827
there are template haskell extensions for putting asm into haskell
it would be nice if you could avoid GC with haskell

but C++ is still nowhere near on the level of Haskell
C++ is good for performance and manual memory and that's it
>>
>>57886724
NAT will most likely break, but on the "real" internet there should be little problems apart from firewalls.

Wanna try? Linux has raw IP sockets where you get to fill in stuff like protocol numbers yourself.
>>
>>57886859
C++ is having the power to mix stupidly power abstraction with zero overhead.

You can have magic high level libraries that take care of things behind your back and make Python look verbose, and low level black magic that will squeeze the last cycle and the last byte out of your hardware.

Using C++ is having the power to choose.
It's a complex language, one of the most complex, but it gives you true freedom.
>>
>>57886901
you can make haskell abstractions with negative overhead

C++ isn't always 0 overhead, that's bjarne meming you
>>
>>57882932

Queue'd P/C for simple tasks.
Async/Await for "call *wait* collect things"
Actor Model for dozens of dynamic tasks (For example, Very useful when dealing wwith thousand of bench instruments for DAQ/testing systems)
>>
>>57886852
wow, i'm really a retard for not thinking of that

It works now, i didn't have to write those / before and after userInput, it's like this, note that i search for this specific part of the site

 var linksOnPage = from lnks in document.DocumentNode.SelectNodes($"//*[@id='main_content']/div[1]/div[2]//*[text()[contains(., '{userString}')]]") 


after that i have shitton of filters that work, they don't matter
>>
>>57885095
Procedural, faggot.
>>
>>57886476
in C11 if you include stdbool.h, you can just use "bool", "true" and "false".

>>57886489
if you wanna go low-level and design the concurrency model yourself, C++. You'll have to use a library for asynchronous I/O and threads yourself (or use the OS primitives for asynchronous I/O manually) but you will get absolute control over performance, and the absolute lowest possible per-connection overhead.

If you want a language that abstracts this away for you already, erlang or go. They have solid implementations for asynchronous, well-scaling I/O and support many different operating systems. Of course you will pay a lot of extra overhead per connection, and they are inherently a lot slower as languages.
>>
>>57886920
0-overhead means you don't pay for what you don't use.

In Haskell, you automatically have to pay a garbage collector tax, just for using the language.

In C++, you can use garbage collector libraries if you want to, but it's your decision, not the language thinking it knows what's best for you.
>>
>>57886961
>You'll have to use a library for asynchronous I/O and threads yourself
C++ has threading an a really well-defined memory model since C++11, so you don't actually need a library here.
>>
>>57886962
>0-overhead means you don't pay for what you don't use.
I know.
In haskell you can have negative overhead.
There are lots of libraries that optimise your code.
>>
Friendly reminder procedural > functional >>>>> OOP IN LOO
>>
finished https://www.reddit.com/r/dailyprogrammer/comments/5go843/20161205_challenge_294_easy_rack_management_1/
use std::env;

fn main() {
let args: Vec<_> = env::args().skip(1).collect();
assert_eq!(args.len(), 2);

let tiles = args[0].clone();
let mut word = args[1].clone();
for tile in tiles.chars() {
if let Some(i) = word.find(tile) {
word.remove(i);
}
}
println!("{}", word.len() == 0);
}
>>
>>57886992
>In haskell you can have negative overhead.
You haven't defined that term.

>There are lots of libraries that optimise your code.
We have some of those over here as well.
>>
>>57887000
Friendly reminder anything that isn't multiparadigm is literally thoughtless extremism.
>>
>>57887005
>over here
In India?
>>
>she doesn't keep her IDE and programming projects entirely on a ramdisk for maximum build performance
>>
>>57887000
If you only know how to work with functional language, you're more of a pajeet than someone who knows how to use multiple paradigms and techniques.
>>
>>57881933
File system abstraction from scratch.
>>
>>57887005
>You haven't defined that term.
For instance, list/stream fusion

You write something like [1..10], creating a list from 1 to 10, then you do some kind of filter, eliminating certain elements. Finally, you do a fold on it (maybe some kind of map).

Rewrite rules (which C++ DOESN'T have) allow you to transform this so that the intermediate data structure (the list) is completely removed, and it simply becomes a for loop.

Purity lets you do other optimisations, for instance
map f . map g . map h -> map (f . g . h)
where the latter is one traversal
but this isn't true for C++, where f g and h could perform side effects
>>
>>57886987
I meant more for the asynchronous I/O primitives bit. Unless you are fine with either abstracting these yourself (kqueue on BSDs, epoll on linux, ...) or just sticking to one OS.
>>
>>57887000
Functional programming is basically a refinement of procedural programming, though.
>>
Once I decompile the apk file of an android app, where is the code for the specific application, not the android support files?
>>
if I have a four-player 2D game based on a non-deterministic physics engine where one player is the host and the other three are clients, what is the best way to keep all of them in sync to the extent that the game is properly playable?

also, what is standard procedure for referencing objects on a client's side? Like, locally I can get an actual reference to the object in memory, so what do I do for clients? Give all of their shit UUIDs and shove that into a big dictionary or something?

I should note that even though it's nondeterministic, simulation on the clients is 1:1 with the server in nearly 100% of all situations--there are only a few exceptions that I'd need to concern myself with

I assume the best way to do this is to send only updates on object position and vectors and such and let the clients simulate and then do a full authoritative sync at interval but idk

obviously I'm a newbie and I don't know what I'm doing, appreciate any advice, thanks senpaitachi
>>
>>57887034
... no, you're not.
Pajeet can't learn FP.
Knowing something that is bad and makes your code worse doesn't make you better.

Procedural is really only good for performance
>>
>>57887067
>knowing less things makes me superior to those who know a superset of the things I know

Fuck off, retard.

You should be proficient in many paradigms and techniques, and not limit yourself to any small subset of your trade.
>>
>>57887047
that's cool and all, but just like people have hypothesized that JIT could theoretically be faster than statically compiled code, it's not something that has ever actually materialized in practice.

btw, it's not true that the C++ compiler cannot infer whether a function has side-effects or not. C++ compilers routinely do this. It's just less explicit and more limited.

Also, while being able to e.g. remove entire datastructures as optimizations is neat, it's typically not any harder to just write less shit code to begin with, or to use a different zero-overhead abstraction (like an iterator or so.)
>>
>>57887047
>You write something like [1..10], creating a list from 1 to 10, then you do some kind of filter, eliminating certain elements. Finally, you do a fold on it (maybe some kind of map).
>Rewrite rules (which C++ DOESN'T have) allow you to transform this so that the intermediate data structure (the list) is completely removed, and it simply becomes a for loop.

Of course you can do that in C++, it's called Expression

You write your code which is turned into an abstract tree of operations that the library evaluates and optimizes at compile time, and finally it emits optimally efficient C++ code for the compiler.

>but this isn't true for C++, where f g and h could perform side effects
We use constexpr in C++ to have pure functions.
In fact those functions are usually evaluated entirely by the compiler, since they have no side effects.
>>
>>57887114
s/Expression/Expression Templates/
>>
>>57887093
>btw, it's not true that the C++ compiler cannot infer whether a function has side-effects or not. C++ compilers routinely do this. It's just less explicit and more limited.
Not him, but inference not only is limited but slows down compilation significantly. The more information the compiler is given to check and use, the better on all fronts.
>>
>>57886489
Go or Erlang.
>>
>>57887131
>Not him, but inference not only is limited but slows down compilation significantly
If your C++ compilation doesn't take 5 minutes per file, you're not using enough templates!

Needs more Boost.
>>
>>57887093
>it's not something that has ever actually materialized in practice.
that literally exists in Haskell
they added it to the standard library

>>57887093
>it's easier to just not write shit code
is "print [1..10]" shit?

>>57887114
it would be horrible to write in C++
>>
>>57887062
a-anyone?
pls respond
>>
>>57887155
>it would be horrible to write in C++
Not at all, it's an old and proven technique. In fact there are several libraries for it.

I think the most popular is Eigen.
>>
>>57887171
Haskell is easily the better (best?) language for DSLs
>>
>>57887184
Probably, along with some LISPs.
>>
>>57886852

Webscraper noob here again

What would be the best way to make program check for a webpage ever X seconds. Is Thread.Sleep(X) the most retarded way to do this?
>>
>>57887155
I mean, I'm not saying it doesn't exist in haskell, but just like JIT exists, nobody has ever managed to produce any remotely compelling proof that it actually performs better than the more straight-forward solution

>>57887155
> is "print [1..10]" shit?
obviously the actual code would not be just that. And yes, it would be shit -- code should make it obvious what is actually going on behind the scenes (i.e. I should be able to tell what instructions the CPU is executing if I squint my eyes) so that the human both has the opportunity to understand the complexity of the code, and the opportunity to optimize it.

Most haskell code is extremely terrible and fails these kind of requirements with flying colors. Just look for instance at the code commonly given in just about any beginner book for haskell that purports to implement quicksort or the prime sieve -- if you actually analyze these, you'll see that they don't actually implement the algorithms they purport to implement, and that their complexity class is typically way worse (e.g. quicksort should NOT be O(n^2), but every single haskell implementation I've ever seen is!)
>>
>>57887062
I have no idea what I'm talking about, but the server must run the simulation for everyone and periodically tell everyone what the actual state of the game is.

Of course if you did just that it would be terrifyingly choppy on the clients. So have the clients predict what the game state probably is between two server updates.
If they agree all is well, if they disagree the client must roll-back its simulation and start again with what the server told it.
>>
>>57887062
>>57887166
>if I have a four-player 2D game based on a non-deterministic physics engine where one player is the host and the other three are clients, what is the best way to keep all of them in sync to the extent that the game is properly playable?
You need isolate the non-deterministic parts and simply recompute the deterministic parts on all clients.

>also, what is standard procedure for referencing objects on a client's side? Like, locally I can get an actual reference to the object in memory, so what do I do for clients? Give all of their shit UUIDs and shove that into a big dictionary or something?
Sounds good.
>>
>>57887202
That's certainly a way to do it.

You could do some async and use
Task.Delay()
if you need to still interact with the program, but
Thread.Sleep()
on a loop is an easy way to do something intermittently.

Keep in mind that you can get blacklisted from a website if scraping is against their ToS and they actually bother to check for it.
>>
>>57887062
>>57887166
You need to get the batch shell object references and re-instantiate all those objects back to the host and all of its clients, once you've done that, then you can shove all those new references into that huge "dictionary" so that each update tick the game object classes know what they're referencing at all times and you get good cohesion for host and clients gameplay.
>>
>>57887253
I didn't know i could get blacklisted, is it because of too much html GETs? i thought those few kbs is nothing to (semi)big sites?
>>
>>57885634
cloud computing includes more general computing than just serving up a website. when it comes to web hosting, website typically share servers and have limited resources available to them and they're restricted in terms of what you can do like you can't install anything you want unless you make a deal with the web host specifically for that. a cloud service is like having your own servers and you pay to use a certain number of cpu cores etc and you pay for the cpu time and you can install and run your own programs so you could do basically anything like you can do a lot of server-side processing without the web hosting complaining about the resource usage.
>>
>>57887280
95% chance no one is going to care, I just thought you should know, in case you're writing this as a utility for your work or something and you need it to function 100% of the time.
>>
>>57887280
If you spam requests, you might get automatically CloudFlared'd or blacklisted by the DDoS protection scripts.
>>
>>57887248
>nobody has ever managed to produce any remotely compelling proof that it actually performs better than the more straight-forward solution
What are you on about?
It makes code significantly faster.
It's been in GHC for a major version or two.

>code should be obvious what is going on behind the scenes
Then it wouldn't be very abstract, would it?

>Most ... is!)

You mean the 'quicksort' that only LYAH uses.
>>
>>57887280
it's nothing to them, but they might still ban you for it. DDoS attacks often have huge botnets etc, so that spam will come from thousands or tens of thousands individual IP addresses. If you want to protect yourself against that, you still have to ban each of the individually small spammers.

But typically you'll be fine unless you spam a lot over longer periods of time.
>>
>>57887298
This is just a practice program but i might give it to my friend if it works, he might benefit from it,nothing too serious in any way, but thanks

>>57887300
How do they detect it, if i for example set a random number of seconds, for example 30-300sec?
>>
New thread:

>>57887341
>>57887341
>>57887341
>>
>>57887345
>How do they detect it, if i for example set a random number of seconds, for example 30-300sec?
It depends on every site, and they won't tell you how they detect it otherwise the people doing a DDoS could trivially work around the rules and not get b&.
>>
>>57887345
>a particular IP is making a request for the same data every .5 seconds
>no browser header, so it's obviously automated
>you're not comfortable with people scraping your website due to bandwidth and ad revenue avoidance
>you blacklist that IP because fuck that guy, the relationship isn't mutually beneficial
>>
>>57887314
it makes slow code a little faster compared to even slower code. woop-de-doo.

To prove that there is a compelling real-world advantage, you should show that you can either beat the best-possible hand-optimized solution to the problem (which is not gonna happen, of course) or that it allows you to express the same problem with much less effort equally fast. And writing the whole thing as a for-loop in the first place is not going to be that much more effort.

If you just use it to make really slow shit a little less slow, that's not going to make anyone panties wet. Esp. not if the optimization is not guaranteed (in which case everyone will stick with hand-optimizing.)

> LYAH

and literally any other haskell tutorial on the web. Or just google "prime sieve haskell" to get some more incorrectly implemented algorithms. I think the pervasiveness of these wrong implementations of these very basic algorithms shows that the approach of "just write shit and let the compiler transform it, A LOT, until it might be fast" works very poorly if you actually care about efficiency or algorithms.

And if you look at the faster alternatives (e.g. the ones used in haskell benchmarks), they tend to be very very verbose and ugly.

Yeah, C++ compilers also optimize a hell of a lot, but there is still a quite strong sense of a mapping between the actions that are executed at runtime and what you write in your code. If you do something inefficient, it becomes relatively obvious. The compiler might still optimize it for you, or not. But you can see it's there.
>>
>>57887280

Just pretend to be a normal browser rather than telling them you are a bot and limit your requests
>>
>>57887455
>a little faster
thousands, sometimes tens of thousands or hundreds of thousands of times faster
it eliminates data structures
why are you using C++ if you don't understand how good that is?
>>
Python 2.7.12 or 3.5.2? I'm taking python next semester and wanted to get a start on it, but I don't know what's better or the differences or what I'll be using.
>>
>>57887859
Python 3 is not a Turing-complete language.
>>
>>57887859
Python 2 is deprecated.
>>
>>57887859
A lot of people still use 2.7, because 3.x is not completely backwards compatible. You might be better off using 2.7

>>57887887
Really now?
>>57887950
It is not.
>>
>>57888026
>It is not.
Deprecated means recommended against because it has been replaced by a better alternative, which is exactly the case.

Source: https://wiki.python.org/moin/Python2orPython3

>Really now?
How stupid do you have to be to actually believe that.
>>
>>57887266
>You need to get the batch shell object references and re-instantiate all those objects back to the host and all of its clients
I'm new to programming, what does this mean? Might as well be French to me
>>
>>57881933
Learning PHP because I hate myself but want a job.
Thread posts: 331
Thread images: 30


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.