[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: 35
File: himegoto2.webm (3 MB, 854x480) Image search: [Google]
himegoto2.webm
3 MB, 854x480
old thread: >>54297329

What are you working on, /g/?
>>
>Trapshit
Report and do not post in this thread.
>>
Official new thread. It's decided.
>>
>>54301582
>wuh buh wuh wuh I dun like the image
Too bad. This one was made after the bump limit, and before the other one.
>>
>>54301567
thank you for not posting a nichijou image
>>
>>54301582
Wow dude, janitors don't like multiple threads, stop pissing them off and post only in the first one, you fucking autist.
>>
so, wtf happened
>>
Why aren't you using D?
>>
>>54301620
Is it a systems programming language?
>>
>>54301567
So in the /g/ wiki, the books for C++ are from 2000 and 2010. Can anyone recommend me a more relevant book? Preferably something extensive. Or maybe 2-3 books? Thanks.
>>
>>54301643
Do you already know how to program?
Because if you don't, the year of publishing doesn't matter.
>>
>>54301643
C++ is backwards compatible.
>>
>>54301651
That's the thing, I first studied C++ 6-7 years ago, and know the most basic stuff, like pointers and arrays, but I've mostly forgotten the more complex stuff like OOP.

Also I'm not looking for a free pdf/book, I don't mind buying a good programming book.
>>
I took that Evo Lisa genetic graphic vectorizer program and bolted on multi-threading. It can export graphics but I kinda broke the DNA export.

If anyone wants it, here's source. I'd be interested to see if someone could find a more efficient way to do MT. :^)
https://www.dropbox.com/s/n7ypg45r70ydffq/Multi-Threaded%20Genetic%20Image%20Vectorizer.7z?dl=0
>>
>>54301692
Why can't you just use C?
It's C without any of the garbage.
>>
I heard Go will be renamed to C22, is this true?
>>
Posted this in the other DPT, but it seems you guys like traps more, so I'll post it here...

--------

Decided to look into JScript.NET, since it's apparently installed onto my computer by default. By the looks of things, it's just JavaScript, but for .NET.

Does anyone actually use this? Like... there are C# and VB.NET compilers for Mono, but JScript apparently hasn't had its compiler updated since 2008. Searching up the language doesn't seem to show that many projects using it either. So why does Microsoft ship it with the .NET runtime instead of, say, F#?
>>
>>54301759

Mostly to compete with node.js (although there is node.js integration now for Visual Studio so its not a big deal).

I mean, its not a terrible idea and it does facilitate some unique interop opportunities in managed code space you wouldn't normally get. But unless you are using it to leverage existing .NET libraries with your code all written in javascript I wouldn't think it to be useful otherwise.
>>
>>54301759

C# forever.
>>
What's a simple quick way to find the most frequently occurring vowel in a char array in C/C++?
>>
>>54301808

Obviously you wouldn't use it to do anything other than to leverage .NET. But strictly speaking, if you're going to use a compiled .NET language, why JScript over C# or F#? And if you want a scripting language for .NET, why not PowerShell instead?

>>54301887

Iterate over array, maintain count of each vowel. Calculate max.
>>
File: figure_1.png (60 KB, 1675x832) Image search: [Google]
figure_1.png
60 KB, 1675x832
I got a function from a proprietary piece of code, plotted it from 0->999, and got this. Anyone know what this function might be?
>>
>>54301939
Lots of lazy web devs wouldn't have to learn a new programming language to get on board with this shit, for one. The other thing is it would make it easier to facilitate user/dev tunables that perhaps instead of compiling at build time to CLR bytecode might just be scooped up by the program later when its actually needed.

There aren't many cases it would be preferable to use JS, but if its all you know it might be of benefit.
>>
>>54301887
Theres only 6 vowels, so just make a count for each one of them. Update the count as your iterate over the vowels.
>>
got some game design questions

my tiles are currently stored in a one dimensional array, I access them by using a formula

tile = (column * rows) + row


when checking for object collision, I was using the formula

for ( int col=0; col<columns; col++ ) { 
for ( int row=0; row<rows; row++ ) {
tile = ( col * rows ) + row
// if the object intersects this tile in any way...
return true;
}
}
return false;


but I feel this may be too slow in the long run, so I began to check in this way:

col = floor( coordinateX/tilesize )
row = floor( coordinateY/tilesize )
tile = ( col * rows ) + row
// if the object intersects this tile in any way...
return true;


to check ahead, coordinateX is actually the result of the x coordinate + the speed the object is going, same can be said for coordinateY. Problem is this way I have to do two seperate functions (as far as I know), one to check horitionzontally, the other checking vertically.

Can I consolidate this into one function if I change my tiles to a two dimensional array?
>>
>>54301971
Search for the first few values in OEIS.
>>
>>54302157
My second question pertains to the tilesize, lets say it's 16

Well what if my object's hitbox is 12x32? Horizontally it's fine, as it's less than the tilesize. But what about vertically? What is an optimized way of checking (if we are moving horizontally) if there is a tile in the top part or bottom part?

My third (and hopefully final for tonight) question is say my object is (on the scale i've already established) is moving horizontally at a speed of 1.5; with the formula which I have now, it will find a collision, but there will be some space inbetween the object and the tile depending on where the tile is. The same can be said vertically. What could I do so that even if there is less space than the speed at which it moves, I can still move in til it's touching.
>>
>>54302027
>locale specific program
>>
So... I've seen a few games floating around where programming is a key part of the game. Untrusted was basically "program Javascript to solve puzzles", TIS-100 was "admit it, you needed an excuse to write assembly", and now I've been linked to a game called "pony island", which has some puzzles that somewhat represent general flow control of programming (although you do not write any code).

Why not a game that involves lisp programming?
>>
How's msvc for C?
>>
>>54303020
Because Lisp is shit
>>
>>54303467

It's shit. Use GCC.
>>
>>54303020
why not a game where you bash yourself over the head repeatedly?
>>
>>54303467
don't listen to this >>54303489 faggot, msvc is faster than gcc for c/c++. intel is fastest but obviously most expensive
>>
>>54303571
MSVC doesn't even support C11 or most of C99.
>>
>>54301608
Pissing of jannies is just another reason beyond pissing of trannies

Why can't our janitors do anything about the constant /v/ posting here? Or the bloody purchase advice threads?
>>
>>54301637
it's anything you want babe
>>
>>54301692
Get this
>>
>>54303594
hime isn't a tranny
>>
how can i make it so some member variable
.Add(&someObject)
in class A functions the same way as a constructor initialiser list in class A?
    A(vector<someType*> name) :
m_name(someType {}
>>
>>54303679
eh i'll just post the code i'm working with i dont think that snippet got my point across

                    Composite compositeObject;


                    compositeObject.Add(&clusterObject);


    Composite(vector<Cluster*> clusters) :
m_clusters(clusters) {}
>>
sup /dpt/

I have one more week at my shitty meat job.

I intend self teach android development release a "good" app and get enough experience for a job in tech before my 25th birthday.

Is this possible? I am of course not looking for 50k+ really just any job in tech that deals with programming.

I just completed my Algorithms and Data Structures C++ class. Java is kind of fast to pick up because it looks a lot like C++ so I am kind of comfortable with that.

But what can I learn in 4 months to put on my resume for a entry level/shit tech job.

I really don't want to go back to school part time again.
>>
>>54303776
>self teach android development and publish on android for experience for a job for my birthday
How broad is your neck?
>>
>>54303808
average?
>>
>>54303822
How tight do you want the rope?
>>
>>54303839
Depends.
>>
>>54301887
Heh, this one's a classic. It can be solved in O(N).
>>
>>54303877
>>tries to solve in O(N^2)
>*teleports behind you at O(N)*
>Heh, nice try kid, this one's a classic
>>
>>54303877
actually that's the worst case, you can do it in as little as N/2 depending upon the contents of the string.
>>
>>54301887
>>54303877

#include <iostream>
#include <algorithm>

char arr[10000];
//this is the given array, which requires you to tell the most frequent vowel

int appr[5];
// this array stores the appearances of each vowel

// appr[0] - stores the count of "a" appearances
// appr[1] - stores the count of "e" appearances
// appr[2] - stores the count of "i" appearances
// appr[3] - stores the count of "o" appearances
// appr[4] - stores the count of "u" appearances

For (int i=0, i<=array_length-1; i++)
{
if(arr[i]=='a') appr[0]++;
if(arr[i]=='e') appr[1]++;
if(arr[i]=='i') appr[2]++;
if(arr[i]=='o') appr[3]++;
if(arr[i]=='u') appr[4]++;
}

int appearances;

appearances=max_element(appr, appr+4);

if(*appearances==0)
{
std::cout<<"No vowel found";
return 0;
}

if(appearances==appr) std::cout<<"a";
if(appearances==appr+1) std::cout<<"e";
if(appearances==appr+2) std::cout<<"i";
if(appearances==appr+3) std::cout<<"o";
if(appearances==appr+4) std::cout<<"u";

//I did not write C++ code in a long time, I hope I didn't make any syntax problems

>>54303973
yes, but I think he wants the algorithm to work in any case
>>
File: register generator.png (68 KB, 1164x674) Image search: [Google]
register generator.png
68 KB, 1164x674
>decide to get started with assembly
>spend hours developing a tree module and an expression to generate all the registers neatly in a tree

>>54303973
O(N/2) is O(N)
>>
>>54304045
oh, it should've been
" int* appearances " instead of " int appearances "

sorry
>>
>>54304056
>O(N/2) is O(N)
explain
>>
>>54304077
How often do you hear the following:

O(2N^2)
O(3N)
O(6N + 2)
O(3.5N / 2)
O(log2 N)
O(log4 N)

How often do you hear the following:

O(N^2)
O(N)
O(log N)

Is this just a coincidence?
>>
ok I finished my 8ch image scraper

first project in python, so it's pretty rough around the edges but it encapsulates a lot of the data in xml in case you are doing other projects (like text scraping). It's easy to adapt to stuff like that.

took me a long time to write actually
http://pastebin.com/qmeRNrg1
>>
>>54304077
It's because as you scale greater and greater, the /2 becomes insignificant.
>>
File: lispfags on suicide watch.png (13 KB, 530x291) Image search: [Google]
lispfags on suicide watch.png
13 KB, 530x291
>>54304162
Unless you're working with linked lists
>>
>>54304152
Nigger host your projects on Github
>>
File: Trying to fix this.png (28 KB, 666x466) Image search: [Google]
Trying to fix this.png
28 KB, 666x466
print('Hello and welcome new employee to the company\n First i would like you to create a login and password')
login1=input('please choose a login.')
m='your password must be 8 characters' #to explain that the password is too short
l='both a lowercase letter and uppercase letters'#to explain a missing character
n='a number'
b='a special character'
y='Sorry,'
Passport=input(m+' and contain:\n '+l+'\n '+n+'\n and'+b) #to prompt a password choice
def length_passport(): # this is a method that measures the password
while True:#infinit loop
global Passport
if len(Passport)>=8:#comparator to see if password is long enough
break
else:
print(y,m) #Finishing up printing if the password isn't long enough &promt for new password
Passport=input# Prompts a new input
length_passport()


abc=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] #list for alpabet comparison
>>
>>54304173
Are you new to 4chan too?
>>
>>54304171
That is still O(n) is it not?
>>
Okay, this is driving me crazy. I'm just gonna dump the whole code here.

#!/usr/bin/env python
import os, urllib2, json

input = raw_input

def clear(): os.system('cls' if os.name == 'nt' else 'clear')
def prompt(): input("Press enter to continue")

while True:
clear()
print("Please enter your nation's name")
#nationName = input("> ").lower().split()
nationName = ["the", "opal", "fleet"]

nationName_url = "_".join(nationName)
api_url = "http://www.nationstates.net/cgi-bin/api.cgi?nation=" + nationName_url

print("Fetching data from " + api_url + "...")
try:
response = urllib2.urlopen(api_url)
break
except urllib2.HTTPError:
print("Error! Nation not found!")
prompt()

print("Analyzing data...")
data = json.loads(response.read())

print("Dumping data...")
print(response)

prompt()


So I'm getting a ValueError about how there is no valid JSON file deteced. I've tried changing json.load to json.loads, adding removing read.() and all different combinations. I have no idea what's going wrong, and I don't really understand what's going on in the documentation. My code has matched all the solutions I'm finding on stack overflow. I'm beginning to get frustrated trying to figure out what's going on.
>>
>>54304173
yeah y?
>>
>>54304172
but my name is associated with that
>>
>>54304185
>>54304176
this is too good
>>
>>54304152
>8ch image scraper
The technical term is Garbage Collector
>>
>>54304185
>>54304173
hahahaha this is gold
>>
>>54304200
>>54304194

are both of (You) (You) or just (You)?
>>
File: samefag.webm (3 MB, 900x488) Image search: [Google]
samefag.webm
3 MB, 900x488
>>54304214
attachment related
>>
>>54304214
yeah, it's just inconceievable that two people find the same thing funny
they must be the same person!
>>
>>54304214
just 1 (You) today, sir
>>
>>54304228
>>54304250

I like how you waited an extra minute and ten seconds
>>
>>54304250
Well, since the moment has passed,
Now back to work!
>>
>>54304256
i was having trouble with the captcha, but it was being autistic
>>
File: _.jpg (74 KB, 1280x720) Image search: [Google]
_.jpg
74 KB, 1280x720
[edited pic of reply with one of the (You)s removed] x 2
>>
>>54304256
its not worth arguing with you because there's no way for either side to prove anything

for example I could edit the html and you could just say we're posting from proxies
no way for either side to win
>>
The real question is, where's the caveman?
>>
>>54304279
>>
>>54303640
the guy that posts hime is an actual tranny
>>
>>54304180

Have you tried doing it like this, instead?

try:
response = urllib2.urlopen(api_url)
print("Analyzing data...")
data = json.loads(response.read())
break
>>
>>54304227
what's the point of this webm?
>>
File: 1461949722724.jpg (1 MB, 2591x3624) Image search: [Google]
1461949722724.jpg
1 MB, 2591x3624
I have an ArrayList of coordinates (x, y ,z). I need to find sets where every coord.z is the same. How can I do this in Java?
>>
>tfw C++ polymorphism
I see the light.
>>
File: 91i328.jpg (142 KB, 740x740) Image search: [Google]
91i328.jpg
142 KB, 740x740
>>54305025
>subtype polymorphism via inheritance
>>
>>54305051
Don't see what the problem is. Seems perfect for my physics engine.
>>
>>54305106
fragile base class problem
>>
>>54305134
Easily avoidable.
>>
>>54303571
>>54303577

It doesn't support all the features after C11, but i'm not gonna eat shit, the performance is pretty good.
>>
>>54305178
either by using composition or through a great cost.
checking the implementation of each type and how any subtype down the entire type tree might override that behaviour and how that might result in bugs because of the implementation of the type itself is EXTREMELY tedious.
the fragile base class problem makes debugging related to overriding a shitload more expensive.
if you want inheritance without overriding, you get a mechanism like Go's type embedding, and that's effectively just composition and doesn't suffer from huge debug costs.
>>
>>>/a/140881885

/a/ is stealing or memes!
>>
>>54305261
You make it sound like there isn't a huge overlap between /a/ and /g/.
>>
File: test5.webm (2 MB, 640x640) Image search: [Google]
test5.webm
2 MB, 640x640
I'm trying to parallelize code. I looked into openmp
#pragma omp for parallel num_thread( NUMBER_OF_THREADS )
for ( uint32_t k = 0; k < NUMBER_OF_REVOLUTIONS; ++k )
{
gen_image ( k );
}

It doesn't seem to parallelize anything however. At least it's not faster at all. Why is that?

(pic related, what I'm trying to parallelize — each frame should be generated in its own thread)
>>
File: 1231231231.jpg (2 KB, 125x92) Image search: [Google]
1231231231.jpg
2 KB, 125x92
>>54305285
>1 thread per frame
>>
>>54305285
because parallelization doesn't essentially make things faster
>>
>>54305293
I actually thought that parallelizing the biggest chunks of the program as possible would be easier.
>>
>>54305285
>omp for parallel
I don't know if the order of OpenMP arguments matter, but if it does, you've for it backwards.
>num_thread( NUMBER_OF_THREADS )
I don't think you want to specify that
>each frame should be generated in its own thread
Starting and stopping a thread is actually really expensive. Doing that is going to make performance worse.
>>
>>54304752
lambda functions? If you're in j8 at least
>>
Can someone link me to a website on how to install a python module with the file extension tar.gz?
>>
>>54305344
kek
>>
>>54305344
Have you installed this yet?
https://www.gentoo.org/
>>
>>54301971
Looks like isotopes.
>>
>>54305344
nvm got it, just used pip with the package name.
>>
>>54305312
>Starting and stopping a thread is actually really expensive. Doing that is going to make performance worse.
Calculating a single frame takes about 10 – 20 seconds, so I guess it won't matter much. I don't know what's wrong, I can't get a single example working with openmp, no matter how simple.
>>
>>54304180
>>54304645

Okay, I've done a bit more work on it. I incorrectly thought that XML would work the same as a JSON file. So I had to install xmltodict and mess around with a few smaller things and I'm good.
>>
>>54305450
>Calculating a single frame takes about 10 – 20 seconds
Ok, that's not a big deal then.
Just to be sure, you have -fopenmp as a command line option, right?
>>
>>54305398
>>54305344
jesus christ man
>>
>>54305519
I'm using clang, so the command is -openmp, but it's there. This is my first time with openmp or parallel programming in general, so this is about the level of stupidity you can expect.
>>
>>54305571
Does something like
#include <stdio.h>
#include <unistd.h>

int main()
{
#pragma omp parallel for
for (int i = 1; i < 8; ++i) {
sleep(1);
#pragma omp critical
printf("%d left sleep\n", i);
}
}

work?
>>
>>54305603
It really doesn't (it's exactly the same with -openmp and without). So I guess it's a problem with openmp or the compiler. I'm trying a different one. Thanks
>>
>>54305603
>>54305650
I just tried running my example on clang (clang test.c -openmp), and it seems to run sequentially, with 1 number being print after each second. With GCC (gcc test.c -fopenmp), all 8 lines are printed after one second.
If I recall correctly, clang only got OpenMP support pretty recently (while GCC has had it for ages), so I guess that clang's support is still shit.
>>
>>54305650
Okay, gcc-5 works, while clang doesn't. Thanks, that solved the problem.
>>
I'm trying to find out how to properly implement heapifying process for putting lowest (but with value greater than 0) value as root.
This is first version:
http://pastebin.com/gSBK5enJ
This is the second one:
http://pastebin.com/1WMnVF6C
This one covers most of cases, but still is not working super properly. Does anyone had to do such a thing and can help me with my problem?
>>
i know there's a really easy way to do this but i'm a bit stuck and i honestly cant think of a solution

object temp;
for (i ... n){
temp.setter("some text");
}


how can i make it in cpp that the object temp isn't getting overwritten everytime? i know i should use a vector but i'm having trouble placing my finger on how i should use it
>>
File: moot.jpg (85 KB, 1024x512) Image search: [Google]
moot.jpg
85 KB, 1024x512
>>54305720
>how do I stop the setter setting
What did he mean by this?
>>
I have a folder containing many folders, and inside each of those folders is 1 image.

How would I be able to extract all the images so that they're under the same directory?

A python solution would be lovely.
>>
>>54305720
What is your task to do? The solution depends on what you have to do.
>>
>>54305734
>>54305737
i just want to create n temp objects as opposed to the 1
>>
>>54305740
Then you need container for every single object. Or if you need only one object at the moment then just one object pointer. But what is this setter for?
>>
>>54305756
the name field
>>
>>54303020
http://sentidodelamaravilla.blogspot.com/2012/02/mathematics-and-science-fiction-turing.html

In Diamond Age there was such lisp game and it was pretty epic.
>>
>>54305770
So you probably need container for every object you want in that case. But I think there is no point to do something like that. Show me your task.
>>
>>54305736
just use stackexchange, I'm almost 100% sure your exact question is answered there so me repeating wouldn't be that helpful
>>
I wrote a JavaScript 2d game engine.
>>
>>54305795
>game engine
>javascript

No you didn't
>>
>>54305803
I did. I took google's V8, SDL2, designed a very simple API and put it all together as a C++ application.

You are a meme btw.
>>
I recently checked the course list of the uni I want to attend and most of the subjects consist of C++ & C.
Since I want to start out earlier which one do you think I should start out with? Have exp in python, c#, VB and other web oriented languages.

My workspace is linux if you take that into account
>>
>>54304077

O(N) means "linear time complexity".

The "/2" in O(N/2) is just a constant factor (ie. multiplying by half). It's still linear complexity, just with a different slope.

In fact, anything of the form O(aN + b) where a,b are both constants is just O(N). It's still linear.

Another way of looking at it is, when an array grows in length, half its length will grow at proportionally the same rate. So it doesn't really matter whether an algorithm depends on the array's length or half the array's length, in terms of complexity classes.

The same isn't true for (say) the square of the array's length, though! Think about it.

>>54304146

Way to just be smug and not actually explain the answer, faggot

>>54304162

While sort-of true, what you said is a bad explanation of what's going on.
>>
>>54305842
Pure C takes about 2 weeks to get into. C++ is more importat, has more posibilities and is better for algorythimcs, so learn C in very basic way and then jump into C++ strongly.
>>
>>54305736
find . -iname "*.png" -exec mv {} newdir/ \;
>>
>>54305866
ok anon. I will start out with C :) Thanks!
>>
>>54305866
would you recommend "learn c the hard way"?
>>
>>54304227
Is it even legal to have this many autistic ginger-nuts in such close proximity.
>>
>>54305949
No. It's shit.
>>
>>54305814
>very simple API
>application
so it's not a game engine
>>
>>54305968
OK, what would you recommend then anon?
>>
>>54305949
yes
>>
>>54305986
not him but you may find python most easy to pick up since you webdev
it exists more on a server level unlike java or c#

my theory is you know one you know all of them, so I don't think it really matters... well ok actually java is a good first language because its very strict, it tells you exactly what is wrong with it, and in eclipse its a much better way to learn because of its console and the run button actually works all the time
>>
>>54305986
I haven't read it myself, but I've heard good things about "C Programming: A Modern Approach".
I do know for a fact that "Learn C the hard way" is complete shit. It's literally just "copy my poorly explained code".
>>
Assuming I'm learning Py 2.7, which book would I choose:
Py cookbook 2nd ed (Py 2.4) or
3rd ed (Py 3.3)?
>>
>>54301567
Hello I am currently taking an advanced excel class in college and its really tough, is there a source I could check out to help me ease into this?

We are currently looking at matricial equations, desref,indirect,and advanced conditional formats.

The thing is that the tests are all moving charts with varying names and hidden characters that change places. They enjoy making the tests so hard, its the hardest class in my carreer.
>>
>>54306021
I have been playing around with python using "Automate the boring stuff with python" also made a text adventure using Java.

Hm, not sure if I want to commit to an IDE. But I've used eclipse before and it's pretty neat. Have to consider it.


>>54306023
I'll check have a look at that book, been flicking though 40 or something pages of "learn c the hard way" and it looks kinda shit. there isn't a lot of explaining going on. might just be me though
>>
>>54306132
>might just be me though
No, it really is poorly explained.
>>
Is there a freecodecamp version for python?
>>
File: Diamond%20Age.jpg (461 KB, 943x1500) Image search: [Google]
Diamond%20Age.jpg
461 KB, 943x1500
>>54303020
https://lirias.kuleuven.be/bitstream/123456789/357750/2/review.pdf

https://www.goodreads.com/work/quotes/2181158-the-diamond-age

>“Princess Nell had to reconstruct them, learning the language, which was extremely pithy and made heavy use of parentheses.”
>>
>>54306086
kys MBA cancer
>>
>>54305051
nice meme
>>
>>54305986
Don't listen to this plebe.
Just read K&R and try writing simple games in C with SDL2 library. An example game: http://pastebin.com/AcmcNzMX
>>
>>54305213
overusing inheritance is disgusting
overusing composition is disgusting
>>
>>54306277
What is that? I am not doing an MBA.
>>
File: meanwhileAtGoogle.png (224 KB, 395x596) Image search: [Google]
meanwhileAtGoogle.png
224 KB, 395x596
Somebody with apache2 know how here?

I have to turn on content-md5 so it let to check md5 of a file with
getHeaderFiled(Content-MD5")


I wrote at the end of /etc/apache2/apache2.conf

ContentDigest On


after service reload *& restart, it does not return content-md5 header.

Any ideas?
>>
>>54306297
Using inheritance instead of composition is only beneficial when the type hierarchy and the code at hand is so small that you can still easily debug it, and at that point the advantages of inheritance over composition are minor.
Inheritance makes you write less code, but that doesn't mean that you don't have to think about that code, and in fact, in type hierarchies you'll have to think about the code you didn't write more than you would've otherwise had to for the code you would've written with composition.
Inheritance trades development time for maintenance sanity, and this is almost always a bad tradeoff (except for scripting, but at that scale you shouldn't worry about OOP anyways).
>>
>try some easy problems on spoj
>have problems solving them
welp
>>
>>54306070
>I'm learning Py2.7
If you're going to learn pyshit why the fuck wouldn't you go with the updated version?
>>
>>54301971
Collatz conjecture maybe?
>>
>>54305862
Very interesting! I'll give you 3 internets.
>>
File: leavemealone.webm (372 KB, 400x300) Image search: [Google]
leavemealone.webm
372 KB, 400x300
Ask your much beloved programming literate anything (IAMA)

>>54305986
C primer plus

>>54303571
>msvc is faster than gcc for c/c++. intel is fastest but obviously most expensive

Source ?
>>
How do I program?
>>
>>54306385

from https://httpd.apache.org/docs/current/mod/core.html#contentdigest

>Context: server config, virtual host, directory, .htaccess
you should put it in httpd.conf or wherever you vhost is defined
>>
File: life_rs.png (201 KB, 1920x1080) Image search: [Google]
life_rs.png
201 KB, 1920x1080
I wrote Conway's Game of Life in Rust + SDL2
>>
>>54306694
noice, martin. rust is the future of software development.
>>
New thread >>54306745
>>
>>54304752
Iterate the array of coordinates and the array of coordinates groups of same z value. If the coordinates match, append coordinate to the group, if not group found add the coordinate as a new group.
>>
>>54306760

>Creating a new thread halfway through the current thread
Really, faggot? This thread still has plenty of life in it.

>>54306694

Looks fairly nice. Link to repo?
>>
>>54305285
Threads and map-reduce.
>>
>>54306797
Lol Idk what happened, I thought it was at 321.
>>
>>54306797
It's fairly simplistic: https://github.com/mglagla/life-rs
>>
what's the fastest way to learn PHP? i need it for a job. i'm looking something like google's python class, which taught me python really fast
>>
File: 1381544849239.jpg (50 KB, 500x500) Image search: [Google]
1381544849239.jpg
50 KB, 500x500
>>54306614
>>
>>54306825

Conway's Game of Life, I don't think is supposed to be super complex. I mean, you can make it complex by allowing the grid to be infinite, and trying to figure out how to optimize for that, but that's really up to you.
>>
>>54306977
It's easy, you just stick a bunch of bytes into a file, save it with a certain extension then run it through a compiler

Or better yet, just stick some bytes into memory and JMP to it
>>
>>54307006
I had an idea to do this a while ago, you can do it by making the grid a spiral and only loading what you need
>>
>>54307015

Just watch out for this:

https://twitter.com/ppcinstructions/status/558306855756513282
>>
>>54306935
Don't take the job.
>>
>>54307096
>allowing your processor to rearrange your instructions before execution

C U C K
>>
>>54307203
i'm taking it bro. i thought about not taking it but it's ridiculous to not take a job just because i think php is ugly
>>
aren't there any (free or paid) established resources for internationalization for common things like "username", "password", "email", "required", "reset password" in different languages without having to resort to using google translate or some dictionary

are you supposed to hire a shitty fiverr translator for each language or steal the translations off facebook or something
>>
Daily reminder Java is better than your language
>>
>>54307363
>believing in the absolute superiority of a language that has spent countless millions on implementing a system by which it can collect and despose of its own regurgitated shit
>>
>>54307377
Superior Java garbage collector which is much better than your shit language

noprogrammer get out
>v
>>
>>54307363
this

java as a language is literally better than all other programming languages
>>
>>54307238

Out of order execution is good for performance though. And it's not as if it's going to do anything other than what you programmed it to do.
>>
>>54307393
somewhere in here is an example of exactly that
https://www.youtube.com/watch?v=X1T3IQ4N-3g
>>
>>54307355
Google has an option to do that for Android apps, not sure about anything else.
>>
File: libpng.png (164 KB, 399x261) Image search: [Google]
libpng.png
164 KB, 399x261
Does anyone know why is this happening with libpng? I think I had the same problem with SOIL a while back but I don't remember what I did/what was going on.
>>
>>54301567

Is it possible to make a javascript program with multiple programs without using html

I'm using phantomJS and i'm starting to think this is some kind of internet only meme language
>>
>>54307410
they support for internationalization/localization but they don't provide resources themselves, they leave it up to the developer to obtain the actual strings
>>
>fucked over by /r
every damn time
>>
>>54306694
Game of life is the proper hello world, good job!
>>
>>54307453
Reddit or Carriage Return?
>>
Java shall replace all other programming languages and you will all be forced to program in Java
>>
done a tokeniser for infinite sequences

>>54307469
both desu
>>
>>54307437
>this is some kind of internet only meme language
yes

i believe it's possible to use javascript to make standalone programs using nodejs and cordova and such things, but i would strongly recommend against it. for proper programs i would suggest using java or C++.
>>
>>54307498
hello pajeet!
I heard there is a site for you to find a job on
>>>>>> upwork.com
>>
>>54307437
Yes it is. Use https://github.com/search?utf8=%E2%9C%93&q=PixelScript

Also you can try node.js but it doesn't have working SDL2 bindings
>>
>>54307363
P A J E E T
GB2
U P W O R K . C O M
>>
>>54307559
>>54307581
my name is Patel get is right faggots
>>
>>54306614

1. Download Notepad++.

2. Open Notepad++, create a new text file.

3. Copypaste this HTML5 code into your file:
<html>
<head>
<title>
Simple Canvas Demo
</title>
<style type="text/css" media="screen">
body { padding: 0; margin: 0; }
div { padding: 0; margin: 0; }
</style>
</head>
<body>
<center><canvas id="screen" style="height:100%"></canvas></center>
<script>

var SWIDTH = 320;
var SHEIGHT = 240;

function getbyid(id) { return document.getElementById(id); }

var c = getbyid("screen");
c.height = SHEIGHT;
c.width = SWIDTH;
//c.style['image-rendering'] = 'pixelated';
var ctx = c.getContext("2d");
var imgData=ctx.createImageData(SWIDTH, SHEIGHT);
var pixels = imgData.data;
var t = 0;

function draw() {
var x, y, fx, fy, red, green, blue, r, phi, cx, cy;

t += 0.15;

for (y=0; y<SHEIGHT; y++) {
for (x=0; x<SWIDTH; x++) {
fx = x/SWIDTH;
fy = y/SHEIGHT;

cx = (fx-0.5+Math.cos(t/20)*0.1);
cy = (fy-0.5+Math.cos(t/15)*0.1);

r = Math.sqrt(cx*cx + cy*cy);
phi = Math.atan2(cy, cx);

red = Math.sin((r+1/(r+0.1))*10-t/5);
red = red*red;
green = (Math.sin((phi*10)+(Math.sin(r*10)*2)+(t/10))+1)/2;
blue = (Math.sin((-phi*20)+(Math.cos(r*10)*2)+(t/10))+1)/2;

pixels[((y*SWIDTH)+x)*4] = (red*255); // R?
pixels[((y*SWIDTH)+x)*4+1] = (green*255); // G?
pixels[((y*SWIDTH)+x)*4+2] = (blue*255); // B?
pixels[((y*SWIDTH)+x)*4+3] = 255; // A?
}
}

ctx.putImageData(imgData,0,0);
}

function step() {
requestAnimationFrame(step);
draw();
}

step();

</script>
</body>
</html>


4. Save as hello.html

5. Open in any modern browser

6. Try to understand how it works. It is helpful to google, read MDN pages, read "JavaScript: the good parts"
>>
>>54307597
Patel is a surname representing a caste of village leaders. The 'Patel' of a village in the ... Consequently, the name "Patel" referred to one who was tasked with taking care of or farming that piece of land ... Of this nearly one-third have the surname Patel - a popular one among Indian Gujaratis (those that came from Gujarat).


O.K, Sandeep.
>>
File: smug_maki.jpg (61 KB, 500x375) Image search: [Google]
smug_maki.jpg
61 KB, 500x375
>>54307527
>for proper programs i would suggest using java or C++.
>>
>>54307642
what would you suggest then
>>
>>54307630
You sure do know a lot about this kind of stuff

Nice try Mr.Singh
>>
>>54307614
Groovy
>>
>>54307666
do you really thing a dumb anime frogposter would be the kind of person to program anything but a fizzbuzz in brainfuck
>>
>>54307666
There is spectrum of approaches for building native applications. If it is a game people often just use Unity/UE4. If it is a web connected application ("app") companies often use electron/nwjs for desktop and titanium/phonegap for smartphones. Only if it cannot be done in any other way do people use heavy artillery like Qt/C++, because using C++ takes easily 3x the time you'd spend creating an electron app.
>>
>>54307689
do you really think a dumb antifro(g) animhator would be the kind of person to program in anything but brainfuck

oh right
java
>>
>>54307676
Have you tried it?
[spoiler]^____^[/spoiler]
I allow you to modify it and learn how it works, anon!
>>
>>54307712
So should I just read the code and try understand why is does what it does?
>>
>>54307695
>Unity/UE4
C#/C++

>If it is a web connected application ("app") companies often use electron/nwjs for desktop and titanium/phonegap for smartphones
LOLWUT this is literally the first time i've heard about electron/nwjs/titanium. java and C++ are by far more common than what you mentioned
>>
>>54307695

Javascript is not an appropriate technology for desktop development. Just because you can do something doesn't mean you should. If you don't want to use C++, that's perfectly fine. Java and C# both have excellent frameworks for desktop GUI applications that don't involve embedded an entire web browser into the program.

Don't recommend people to use Electron. It is an application of the wrong tool for the wrong job.
>>
>>54307695
believe it or not responsiveness and battery drain does matter, you can easily earn more than enough revenue to make up for the dev time with a bug-free app that performs well and doesn't rape the user's battery
>>
>>54307780
        if (*ch == '@')
{
char *t = ch + 1;

ch = strchr(ch, ' ');
if (ch != NULL)
{
while (1)
{
char *next = strchr(t, ';');
char *eq = strchr(t, '=');

if (next != NULL)
{
*next = '\0';

if (eq > next)
eq = NULL;
}

if (eq != NULL)
*eq++ = '\0';

if (*t && *t != ' ')
msgbuf_append_tag(msgbuf, t, eq, 0);
else
break;

if (next != NULL)
t = next + 1;
else
break;
}

*ch++ = '\0';
}
}
>>
>>54307772
webui is the future. deal with it.
>>
>>54307772
Java is also great or making mobile video games
>>
>>54307780
struct PrivilegeSet *
privilegeset_set_new(const char *name, const char *privs, PrivilegeFlags flags)
{
struct PrivilegeSet *set;

set = privilegeset_get_any(name);
if (set != NULL)
{
if (!(set->status & CONF_ILLEGAL))
ilog(L_MAIN, "Duplicate privset %s", name);
set->status &= ~CONF_ILLEGAL;
rb_free(set->privs);
}
else
{
set = rb_malloc(sizeof(struct PrivilegeSet));
set->status = 0;
set->refs = 0;
set->name = rb_strdup(name);

rb_dlinkAdd(set, &set->node, &privilegeset_list);
}
set->privs = rb_strdup(privs);
set->flags = flags;

return set;
}
>>
>>54307806
nice meme
>>
>>54307813
>privilegeset_get_any
>not check_privilege
>>
>>54302157
>>54302264
bumping questions
>>
>>54307807
this you can get easily 10-100x better performance than unity with java
>>
>>54307832
higher order functions
>>
>>54307721
Yup. If you forgot the highschool math it may seem complex though.

You can also look at this demo, it is simpler:

<html>
<head>
<title>
Simple Checkers Demo
</title>
<style type="text/css" media="screen">
body { padding: 0; margin: 0; }
div { padding: 0; margin: 0; }
</style>
</head>
<body>
<center><canvas id="screen" style="height:100%"></canvas></center>
<script>

var SWIDTH = 320;
var SHEIGHT = 240;

function getbyid(id) { return document.getElementById(id); }

var c = getbyid("screen");
c.height = SHEIGHT;
c.width = SWIDTH;
c.style['image-rendering'] = 'pixelated';
var ctx = c.getContext("2d");
var imgData=ctx.createImageData(SWIDTH, SHEIGHT);
var pixels = imgData.data;
var t = 0;
var increment = 10;

function drawPixel(x, y, red, green, blue) {
var offset = ((y*SWIDTH)+x)*4;
pixels[offset] = red;
pixels[offset+1] = green;
pixels[offset+2] = blue;
pixels[offset+3] = 255;
}

function draw() {

t += increment;
if (t>=255) { t = 255; increment = -increment; }
if (t<0) { t = 0; increment = -increment; }

//For each pixel
for (y=0; y<SHEIGHT; y++) {
for (x=0; x<SWIDTH; x++) {
//If x divided by 16 is odd and y divided by 16 is odd
if ((x>>4)&0x1 && (y>>4)&0x1) {
drawPixel(x, y, 255*(x/SWIDTH), 255*(y/SHEIGHT), t);
} else {
drawPixel(x, y, 255-(255*(x/SWIDTH)), 255-(255*(y/SHEIGHT)), t);
}
}
}

ctx.putImageData(imgData,0,0);
}

function step() {
requestAnimationFrame(step);
draw();
}

step();

</script>
</body>
</html>


Also look at this book http://bdcampbell.net/javascript/book/javascript_the_good_parts.pdf
>>
>>54307844
i'm going to need you to elaborate on that
>>
>>54307865
what language are you using? looks like C++
>>
>>54303571
>msvc is faster than gcc for c/c++
No.
>>
>>54307894
this
>>
>>54307876
I play around in C and Java and C#, it's not necessarily tied to any of those
>>
>>54302157
changing to 2d array wouldn't fix anything, what you're doing now with the 1d array is equivalent to using a 2d array
>>
>>54307797
>this kills the thread
>>
nigga.c:30:2: warning: reading through null pointer (argument 2) [-Wformat]


C is shit lmao
>>
>>54307855
>embedding javascript code into the html document
I don't even do web dev and I'm throwing up right now
>>
>>54306668
I tried both,
I edited /etc/apache2/apache2.conf
with
Different variations of
ContentDigest On

trying to put it plain or with <Directory>

I have also tried to edit
VirtualHost

In sites-available/

no luck
>>
File: download (1).png (9 KB, 320x240) Image search: [Google]
download (1).png
9 KB, 320x240
<html>
<head>
<title>
Simple Checkers Demo
</title>
<style type="text/css" media="screen">
body { padding: 0; margin: 0; }
div { padding: 0; margin: 0; }
</style>
</head>
<body>
<center><canvas id="screen" style="height:100%"></canvas></center>
<script>

var SWIDTH = 320;
var SHEIGHT = 240;

function getbyid(id) { return document.getElementById(id); }

var c = getbyid("screen");
c.height = SHEIGHT;
c.width = SWIDTH;
c.style['image-rendering'] = 'pixelated';
var ctx = c.getContext("2d");
var imgData=ctx.createImageData(SWIDTH, SHEIGHT);
var pixels = imgData.data;
var t = 0;
var increment = 10;

function drawPixel(x, y, red, green, blue) {
var offset = ((y*SWIDTH)+x)*4;
pixels[offset] = red;
pixels[offset+1] = green;
pixels[offset+2] = blue;
pixels[offset+3] = 255;
}

function draw() {

t += increment;

var cx = Math.floor(35*Math.cos(t*0.018));
var cy = Math.floor(10*Math.sin(t*0.018));

//For each pixel
for (y=0; y<SHEIGHT; y++) {
for (x=0; x<SWIDTH; x++) {

var xx = Math.min(Math.max(x+cx, 0), SWIDTH-1);
var yy = Math.min(Math.max(y+cy, 0), SHEIGHT-1);

//If x divided by 16 is odd and y divided by 16 is odd
if ((xx>>4)&0x1 && (yy>>4)&0x1) {
drawPixel(x, y, 255*(x/SWIDTH), 255*(y/SHEIGHT), t%255);
} else {
drawPixel(x, y, 255-(255*(x/SWIDTH)), 255-(255*(y/SHEIGHT)), t%255);
}
}
}

ctx.putImageData(imgData,0,0);
}

function step() {
requestAnimationFrame(step);
draw();
}

step();

</script>
</body>
</html>


lol this demo may trigger your autizm
>>
>>54308103
>cos t
>sin t

Mate, your circle is upside down
>>
>>54308103
|)3/\\/\\05(3|\\|3 !5 |)34|) |<!|), |2(_)|\\| 7|-|47 _|4\\/45(|2!|D7 5|-|!7 0|\\| 4|\\| 4/\\/\\!94 0|2 97|=0
>>
>>54308147
MY DEMO HAS BROKEN YOUR MIND, ANON
>>
File: Erwin_Schrödinger_profile.jpg (602 KB, 1263x1699) Image search: [Google]
Erwin_Schrödinger_profile.jpg
602 KB, 1263x1699
Looking for great videos related to programmers or programming to watch while eating.

I need to relax my mind, yet I still desire my focus to be on programming.
Can be talks, interviews, presentations, fun stuff ---- anything.
>>
>>54308147
>DEMOSCENE IS DEAD KID, RUN THAT JAVASCRIPT SHIT ON AN AMIGA OR GTFO
>>
Is there any way in F# to force the compiler to evaluate something without printing the result?
>>
>>54308196
http://www.parens-of-the-dead.com/
>>
>>54308196
https://www.youtube.com/watch?v=V1vQf4qyMXg
or
YT: derek banas
YT: stanford programming
>>
File: sweating_pepe.jpg (38 KB, 600x568) Image search: [Google]
sweating_pepe.jpg
38 KB, 600x568
>tfw you've been struggling with a problem for a week and the code suddenly starts working

WHERE IS THE MEMORY LEAK
>>
>>54308376
>what is valgrind
>>
Why should I learn C++ over C?
>>
>>54308402
because you probably don't want to pass on +50 years of plt
>>
>>54308402
time
>>
File: 1429227688890.jpg (483 KB, 766x721) Image search: [Google]
1429227688890.jpg
483 KB, 766x721
>>54308376
>using a language without garbage collection
>>
>>54308196
https://www.youtube.com/watch?v=XrFegNHpHfc
>>
File: thread broken.png (118 KB, 1091x695) Image search: [Google]
thread broken.png
118 KB, 1091x695
>>54308443
>writing a program that produces garbage
>>
>>54308450
These people need to fuck off and die.
>>
>>54308459
>sperging out over terminology
>>
>>54302157
You can improve the speed of collision testing from O(n^2) to O(n log n) by doing "area testing". Divide your map into multiple areas. Give tile an area attribute and do the same for whatever objects your testing them against. Now when checking for collision, first check if the area value is the same. If not, skip over all other tiles within the area that's just been tested.
>>
>>54308494
>thinking that all computer programs must treat memory like a 5 year old
>>
>>54308450
I still don't understand this ASMR bullshit
>>
>>54308196

Terry Davis on youtube
>>
>>54308504
>thinking that all computer programs need to be brittle pieces of shit that could crash at any moment
>>
File: browser #113.png (1 MB, 1318x925) Image search: [Google]
browser #113.png
1 MB, 1318x925
>>54308459
some would say I'm a pro at that. =)
>>
>>54308515
>switching sides mid argument
Thread replies: 255
Thread images: 35

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.