[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 25
File: 1285_render_Balalaka .png (2 MB, 648x767) Image search: [Google]
1285_render_Balalaka .png
2 MB, 648x767
old thread: >>53649121

make something useful by the end of this thread or else
>>
first for C++ is a good language
>>
File: IMG_20160319_110314.jpg (30 KB, 720x539) Image search: [Google]
IMG_20160319_110314.jpg
30 KB, 720x539
I want to print numbers like this:
1 and 1
1 and 2
1 and 3
...
1 and 20
2 and 1
2 and 2
2 and 3
....
19 and 19
19 and 20
It is stopping after 1 and 20, how do make it work?
>>
File: 1434526965001.gif (4 MB, 375x346) Image search: [Google]
1434526965001.gif
4 MB, 375x346
Python newb here.
Simple, simple question, hope you can help me:

How do I add a string to a regex?
Say: d = '\d\d\d'
mo = re.compile(r #d goes here)

Pasting it, separating it with a comma, or with a plus gives me errors.
Normally, as you know, it would be re.compile(r'\d\d\d')
>>
>>53656035
Learn to use for loops.
#include <stdio.h>
#define MAX 20

int main(int argc, char** argv)
{
int i, j;
for (i = 1; i < MAX; i++) {
for (j = 1; j < MAX; j++) {
printf("%d and %d\n", i, j);
}
}
return 0;
}
>>
>>53656035
int
main()
{
int inner, outer;
for (outer = 1; outer < 21; outer++)
{
for (inner = 1; inner < 21; inner++)
{
printf("%d and %d\n", outer, inner);
}
}
}
>>
>>53656038
You can just compile a string
re.compile('\d\d\d') works
>>
>>53656113
>unnecessary macros
>>
     int script_lock = 1; //lock is open
while (true) {


if ( script_lock == 1){
script_lock = 0; //lick is closed
auto future = async (script, execute);
auto status = future.wait_for(chrono::milliseconds(0));

if (status == future_status::ready) {
script_lock = 1; //lock is open
}
}

//do something
}

When the program runs inside the while loop it will only run the thread if the previous thread has closed. Problem is once the lock is set to 0, and closed off inside the loop, I can't access the loop again to retest if the thread is still running or not. How can I get around this?
>>
>>53656200
>unnecessary meme arrows
>>
I hate python but I like machine learning. I also don't know much maths.

Should I learn some maths?
>>
>>53656261
>unnecessary butthurt
>>
>>53656336
C++ has a machine learning library too y'know
>>
>>53656352
I know. Will I be able to do anything with it without knowledge of maths?
>>
>>53656366
The whole point of the libraries is so you don't have to implement the complex math required. All you need to worry about is how to implement it into whatever project you're working on.
>>
>>53656113
>>53656149
Thanks. I was trying to do that using while loop. My aim is to find prime numbers using this method. It will give a list of prime numbers from 1 to n, we enter n. I just started to learn c programming. I learned how to use arrays and pointers. Just to make sure, is it not possible to do that using while loop?
>>
>>53656388
>finding prime numbers

oh boy....
>>
>>53656388
Prime numbers are hard for computers. It's the whole reason RSA works so well. The best prime checking algo is the AKS and that shit is still O(log(n)^6)
>>
>>53656388
Any for-loop can be rewritten using a while loop. In that case, a for loop is easier to write
>>
>sizeOf
>alignment
I really wish they'd been consistent and gone with either `sizeOf` and `alignOf` or `size` and `alignment`. Preferably the former.
>>
>>53656638
>size as a keyword
>>
>>53656644
They're not keywords, just functions.

FYI it's the Haskell `Storable` type class.
>>
>>53656654
point stands
>>
>make a website
>hope it gets really popular
>since almost everyone's browser will execute any javascript you throw at it, use them to mine bitcoins
>get filthy fucking rich
has this been done before?
>>
>>53656675
It's two different things m8

sizeof(shitbucket);
shitbucket.size();
>>
>>53656738
javascript stops executing once you navigate away from the page. It doesn't stay clientside.

It's been done in desktop apps/games though.
>>
>>53656744
from what i know about haskell, it doesn't work like that
someFunc :: Num a => a -> a
someFunc size = (*) 2 size

is size here referring to the function size or the argument to someFunc? who knows?
>>
>>53656774
Why don't you stop being a fag and just do it infix?
>>
>>53656787
it's inconsistent. all prefix or all infix fuck backticks and other gay shit
>>
>stack overflow
>ask valid question that requires opinion based answer
>closed because of an opinion based answer

No fucking shit SO sometimes you are retarded.
>>
>>53655652
Are there any errors in this?

#include <iostream>

using namespace std;

int main()
{
double kilometers_per_day = 0;
double cost_per_liter = 0;
double kilometers_per_liter = 0;
double parking_fees = 0;
double tolls = 0;
double passengers;
double total;

cout << "How many kilometers do you drive every day?\n" << endl;
cin >> kilometers_per_day;

cout << "How much does one liter of gasoline cost?\n" << endl;
cin >> cost_per_liter;

cout << "How many kilometers per litre does your vehicle get?\n" << endl;
cin >> kilometers_per_liter;

cout << "How much do you pay for parking each day?\n" << endl;
cin >> parking_fees;

cout << "How much do you pay in tolls each day?\n" << endl;
cin >> tolls;

cout << "How many people are you car pooling with?\n" << endl;
cin >> passengers;

total = ((kilometers_per_day / kilometers_per_liter)*cost_per_liter) + parking_fees + tolls;

cout << "The total cost is " << total << ".\n" << endl;

cout << "You save " << total - (total / (passengers + 1)) << " by car pooling.\n" << endl;

system("PAUSE");

}
>>
>>53656675
No, it doesn't. What you're saying is completely irrelevant.

>>53656774
The parameter, because parameters shadow definitions.
>>
>>53656826
yes
>it's C++
>using namespace std;
>\n" << endl;
>system("PAUSE");
>>
>>53656826
No, but you forgot to initialize your last two variables. Also you should initialize them like

 double passengers = 0.;


This clearly indicates you are initializing a float.
>>
>>53656336

>I like machine learning
>Should I learn some maths

Yes. You will not understand anything close to complex in machine learning without a good foundation in probability theory.
>>
>>53656846
>>it's C++
I have to use C++.
>using namespace std;
Why would I write std::cout or std::cin every time?
>\n" << endl;

What is wrong with this?

>system("PAUSE");

If I don't do that it will close after you enter the data and you won't get to see the results.

>>53656878

It's a double, not a float. Is that how you're supposed to initialize doubles? I noticed I forgot to initialize them after posting it.
>>
>>53656846
>fuck you c++ is good if you know how to use it
>namespace std; is fine for main.cpp
>newline then newline flush buffer. Nothing wrong with that
>system("PAUSE") nothing wrong but you should really issue "return 0;" instead

Keep feeling smug.
>>
>>53656826
Fucking kek, why the fuck do you have \n and then endl?
Also, using namespace std; is ok for small programs like this but in actual ones it will fuck up the compiler,
>>
>>53656892
A double is a float with twice the number of bytes. It's literally the same, just takes up twice the memory.
>>
>>53656894
Who are you quoting?

>system("PAUSE") nothing wrong
Serves literally no purpose and makes the code pointlessly unportable.
>>
>>53656912
It's a shitty ass program I don't think portability is going to be a problem, but that's why I mentioned he should return a value since it's int main() for fuck sake.
>>
>>53656939
>I don't think portability is going to be a problem
That doesn't make it any less retarded.

>he should return a value since it's int main() for fuck sake
C99, C11 and all C++ standards have an implicit return 0 at the end of main.
>>
>>53656939
So does system("PAUSE") only work on Windows or something? I added return 0; and initialized the last two variables.
>>
>>53656969
yes. system issues a command and that is explicitly a windows command. And it suspends the program which is unnecessarily retarded.
>>
>>53657028
So what happens if it issues that command on OS X or Linux?
>>
>>53657032
sh: PAUSE: command not found
>>
>>53657032
If you're still not convinced, read all of these. I wish I had when learning C/C++. http://www.gidnetwork.com/b-61.html
>>
The MS twitter AI was just taken over by a shitposting Human right?
As far as I know, chat bot machine learning/AI is not at that level yet.
I refuse to believe it wasn't a Human.
>>
I'm working on a tool much like IDA Pro but for java using ASM 5.

Currently working features:
* Finding class's parents / children
* Searching for String constants
* Remapping classes(names, fields and methods) - Output is runnable
* Searching for references to a given class (fields/methods/cast checks/instantiations)

Working on a bytecode editor but I can't come up with an intuitive UI for the life of me. Trying to use JavaFx but the UI always ends up clunky and bloated.
>>
>>53656892

>\n" << endl;
>What is wrong with this?
Printing a new line twice. Nothing particularly wrong, but it's unnecessary.

>system("PAUSE");
>If I don't do that it will close after you enter the data and you won't get to see the results
So... here's the deal... you're running it wrong. If you're writing to stdout and reading from stdin, you're using what's called a console program. This is in contrast to a GUI program. A console program is intended to be run from within the context of a console -- a command line interpreter -- or a shell script run from a console. The program is invoked by providing the console a relative path (or just its name if it is stored in the console's PATH environmental variable), and the program is spawned as a child process of whatever shell it was launched from. It may optionally have its stdout and/or stderr redirected to a file or another process, and may have its stdin read from a file or another process, instead of from some user having to type things in manually.

When a console program terminates, control is given back to its parent process. If it is run from a console as it should, you will still be able to see your output, because only your process died, not the shell that launched it. If you try and run it from the graphical shell, however, Windows does some odd things... namely, it's going to create a console window for you, temporarily, and then destroy that window when your program terminates.

You may think "well, it's okay to do this, because I want to run it like that." To which I say, fuck you, you're going to break someone's autograder. If you're doing this for a class at all, chances are your professor is going to have a script that compiles your program and runs it through a number of tests. Your program may be launched multiple times. It is expected that it will terminate.

If I were a professor, and a student used system("PAUSE") in a homework assignment, I would give them a 0 on the assignment.
>>
Where can I learn to implement markov chains for generating sentences?
>>
>>53657152

Are you in a Computer Science program at a decent university? I suggest you get in one if this is an area you seriously want to play in.
>>
If I can't even understand markov chains, do I have any chance in machine learning?

I'm really interested in it, but I'm fucking dumb, should I just give up?

I've only done basic linear algebra.
>>
Does anyone have a good library they can recommend to left pad a string?
>>
>>> 0.2+0.1
0.30000000000000004
>>> from decimal import Decimal
>>> Decimal(0.2)+Decimal(0.1)
Decimal('0.3000000000000000166533453694')
>>>>>>python
>>
>>53657293
kek
I read that article
>>
>>53657293
Boost.
>>
File: 1438291692748.png (10 KB, 300x300) Image search: [Google]
1438291692748.png
10 KB, 300x300
>>53657304
>
>>
>>53657304
I tried this in a bunch of different languages, all gave the same result.
>>
>>53657293
top fucking kek, can we just nuke california? this is where most of these fucks come from
>>
>>53657293
>>53657309
>>53657369
Link?
>>
>>53657374
http://www.haneycodes.net/npm-left-pad-have-we-forgotten-how-to-program/
>>
>>53657374

http://theamazingking.com/crypto-diff.php
>>
File: BigDecimal.png (13 KB, 514x282) Image search: [Google]
BigDecimal.png
13 KB, 514x282
>>53657304

:D
>>
File: jQSpanMenus.png (71 KB, 1589x719) Image search: [Google]
jQSpanMenus.png
71 KB, 1589x719
So, I was practicing a little of the new jQuery library that I learned.

Still got a ways to go, but I threw this together kinda quick just to see what I can do.

So, I made an SAO UI. Very basic version. Could obviously use work, but it's functional.
>>
>>53657367
you'd think a Decimal class made specifically to deal with this kind of problems would fix them

but nooo it's of course fucking worthless
>>
File: 1428448116831.png (152 KB, 359x414) Image search: [Google]
1428448116831.png
152 KB, 359x414
>>53657383
Jesus fucking christ
>JS devs
>>
>>53657304
>>53657414
>>> from decimal import Decimal
>>> Decimal('0.1')+Decimal('0.2')
Decimal('0.3')

:p
>>
Here guys:
http://left-pad.io/

No more dependency problems!
>>
>>53656881
How do I learn probability theory?
>>
>>53657562
Read a book
>>
>>53657566
With one?
>>
>>53657575
The Gender Fairy.
>>
>>53657526
doesn't javascript have a fucking standard library or something?
>>
Guys, how do you decide when determing your programming langauge level? I'm applying for uni, and I don't know what is the borderline, between "beginner" and "advanced" in language (specifically Java). I have never had Java related job, but I know way more than fizzbuzz in it.
>>
Bleh, coreclr isn't really documented well, so I am now trying to jot down some notes for myself to track the execution of the program, in the event that I actually want to go through with porting it to RISC-V.
>>
>>53657593
if you can implement dijkstra's algorithm you're advanced by uni standards
>>
>>53657624
I don't know what that is, but I will look into it and see what can I do.

Another problem is, that my most notable projects are either 4chan or Minecraft related and I don't know if I should admit it.
>>
>>53657591
It was a node.js package. The author decided to unpublish from the node package manager and it broke a bunch of dependecies.
>>
>>53657591

There's a reason "use jQuery" became a running joke. It basically implemented a standard library.
>>
>>53657591
>>53657693
>>53657931

You can't even add 5+5 without a library.

https://github.com/jackdcrawford/five
>>
Reading the source code to the .NET runtime at 3 in the morning may not be the best idea in retrospect.
>>
Creating a new FF profile and getting your filters cleared may have not been the best idea.
>>
>>53657949
five.smooth() // S

Cheeky.
>>
I don't get it, I really fucking tried to learn linear algebra but I'm a horrible learner. Especially lots of theory. What are some good resources about linear algebra? Preferably something with lots of practical exercises and examples.
>>
>>53658365

All of these questions on how to teach yourself <math subject> may be better directed at /sci/, which is much more focused on math than we are. I personally learned linear algebra and probability theory several years ago, in my undergraduate studies, and I don't think I have the book for it anymore. I don't know many people who teach themselves math outside of a university context (compared to a much larger amount of people who teach themselves how to program), but when they do, I think Khan Academy is one of the places they look in general.
>>
>>53658417
I only want maths for programming. I want to do graphics programming and AI. They seem more about actually using that stuff with proofs and other related theories.
>>
What is the best book to learn (x64) assembly?
>>
File: emojicode.png (47 KB, 1005x881) Image search: [Google]
emojicode.png
47 KB, 1005x881
>he doesn't program in emojicode
>>
>>53658491

Anon, computer graphics and AI are some of the more math heavy subjects within computer science. Whether or not you see yourself writing any proofs, it would at least help to become very comfortable with theory, especially in AI.
>>
I'd like to create an async chat server in D, any material to read?
>>
>>53655652
>>53655652
>>53652098
>>53652090
>>53652067

Like in the terminal, made out of "*"s. Now I laugh at how stupid it was, it's like the 3rd day I'm learning to code C and using linux with 1-2 hours a day of study and pratice.
>>
I have a bit of an odd pointer question.

I've noticed that returning and then passing a char array of fixed size (e.g char x[128]) vs fails, but allocating heap memory using malloc works. Can anyone shed some light on why this happens??
>>
>>53659540
I don't understand what you are trying to say. Can you post an example please?
>>
>>53659540
Because arrays decay into pointers and the sizes don't match.
>>
File: 1458644924201.png (293 KB, 500x793) Image search: [Google]
1458644924201.png
293 KB, 500x793
Are there general programming books out there that focus on teaching the common concepts that programmers should know or should I just focus on a book on a specific program?
>>
>>53659553
So I had something along the lines of this, sorry for being vague in the question

char* rtn_ptr()
{
char x[128];
memset(x, 0, 128);

x = "Testing1234\0"
return x;
}

void print(char* str)
{
print("The string is %s", str);
}

int main(int argc, char** argv)
{
char* x = rtn_ptr();

print(x);

return 0
}


>>53659555
So basically my pointer was getting lost somehow when it was passed to the function?
>>
What is a good style guide for learning good c/c++ idioms and practices? Google style sheet?
>>
>>53659636
Oh, in that case, that's because stack variables are gone when you're going out of scope.
>>
>>53659636
>char* rtn_ptr()
>{
> char x[128];
> memset(x, 0, 128);
>
> x = "Testing1234\0"
> return x;
>}
x dies after you exit rtn_ptr.
You also don't need the \0 at the end of the string or the memset.
>>
>>53659661
Ahh alright, I thought this might have been the case. It's basically getting blasted (or trampled) off the stack after the function returns yeah?
>>
>>53659668
Thank you very much, I understand now. Sorry, I just wrote that up really quick haha.
>>
>>53659636
struct jews
{
char x[128];
};

struct jews rtn_ptr()
{
struct jews jews = {"Testing1234");
return jews;
}
>>
Is C++ a meme language?

The syntax looks so fucking messy and unnecesarily complex.
>>
How to execute stuff in GPU by using OpenGL alone? Let's say I don't want to draw anything - just want to perform some simple calculations. How do I do that?
>>
>>53656388
>Just to make sure, is it not possible to do that using while loop?
Anything is possible.
You can make it using goto (this is what the compiler actually does when it turns it into machine code)

You can use an infinite while loop with a shit ton of ugly if statements that check when to break it.

You can even write a recursive solution if you want (don't do this unless it's tail recursive)
>>
Currently wrinting a chip8 emulator in c99. Any ideas for graphics and input handling? Using visual studio on win10. Don't really want to use external libs
>>
>>53659912
Make primitive objects and transform them but instead of drawing them on screen just get their coordinates?

Find some way to represent this as matrices.

Or just google for some lin algebra library that makes use of the GPU.
>>
>>53659912
OpenGL is not fit for that.

https://www.nvidia.com/object/cuda_home_new.html
>>
>>53659939
WinAPI? You can handle input and use bitmaps to draw stuff albeit very slowly
>>
>>53659912
You're looking for OpenCL
>>
>>53659912
Shaders

>>53659977
It is
>cuda
>>
>>53659912
You can do it with just OpenGL, It's called a Compute Shader.
But this >>53660101 guy is right. Use OpenCL
>>
>>53659939
>Using visual studio on win10
Doesn't support c99.

>win10
Get the fuck out of /g/.
>>
Where can I learn more about reading raw data file formats for sound, image files, etc?
I just need to import simple .bmp, .tga, .wav files and nothing else.
>>
>>53660101
>>53660130
OpenCL is shit. Use a language that compiles to SPIR-V
>>
>>53660132
>win10
Get the fuck out of /g/.

You send more private data to Jewgle doing the reCaptcha then you send to Microshit using Windows 10.
>>
>>53660211
Not really.
>>
>>53657367
idiot
>>
>>53659908
"meme language" is a meme, and a retarded one at that.
>>
>>53659912
opengl isn't really suited for that but i can see where you're coming from like if you're targeting android which has shit gpgpu support

you could render some stuff in a special way and use glReadPixels or something to get the result, but it's slow

what exactly do you want to compute?
>>
>>53660130
>Compute Shader
also probably this if your opengl version supports it
>>
File: tugo1_500.jpg (22 KB, 500x285) Image search: [Google]
tugo1_500.jpg
22 KB, 500x285
>>53657383
>That whole post
>isArray package
>is-positive-integer package
>A blank jspm/npm-based app template now starts with 28,000+ files
How? Why? I started learning node because it seems to pay well, but what the fuck?
>>
>>53660488
There is literally nothing wrong with any of these. They're useful shortcuts. You should avoid writing low level code like x * 1 === x && x % 1 === 0 && x > 0
>>
File: facepalm star trek2.gif (897 KB, 300x225) Image search: [Google]
facepalm star trek2.gif
897 KB, 300x225
>>53657383
this is why web devs and jsfags need to fuck the hell off to >>>/g/wdg
>>
>>53660616
Of course you should be using functions instead of repeating common checks, but jesus christ don't include a library that does one tiny thing you could just copy/paste yourself.
>>
>>53660616
>Functions are too small to make into a package and dependency. Pure functions don’t have cohesion; they are random snippets of code and nothing more. Who really wants a “cosine” dependency? We’d all really like a “trigonometry” dependency instead which encompasses many “tricky” functions that we don’t want to have to write ourselves. This is much more akin to how .NET and other frameworks create a “core” library of basic functionality. Such a library is vetted by the creators of the language and pretty much guaranteed to be correct and bug-free.
>>
>>53659673
yes
>>
File: what.jpg (107 KB, 613x533) Image search: [Google]
what.jpg
107 KB, 613x533
>>53660616
>low level code like x * 1 === x && x % 1 === 0 && x > 0
>>
>>53660734
much lower level than isPositiveInteger(x)
>>
>>53660663
>what is reusability
>>
>>53660772
kill yourself retard
>>
>>53656113
Isn't it better to just say >20 instead of using an variable MAX? (no haterino, c/c++ Newfag here)
>>
>>53660941
it will use less memory but it will be less readable.
>>
>>53656113
>>53660941
Same guy here
Also why you use %d? Since I and j are ints should you use %I ?
>>
>>53660965
>less memory
What in the sweet fuck are you talking about? Macros have no impact on memory usage.
>>
>>53660965
No it won't, do you know why preprocessor has the word pre in it?
>>
>>53660987
What is a macro? (Newfag here.)
>>
>>53660965
lolwut

if it was a const variable you may have a point because compilers are autistic as shit but a macro should be fine
>>
File: bait.gif (3 MB, 300x252) Image search: [Google]
bait.gif
3 MB, 300x252
>>53660968
>>
>>53661001
it replaces the text so that the compiler sees it as if you actually wrote >20 in the source code
>>
>>53659636
you can only return a pointer from inside a function if it has static allocation or it was allocated on the heap.
>>
>>53661007
No bait dude, i am currently taking cs50 course through edx.com and I learned that we use %I for ints %s for strings and so on.. But I am on week 1 so maybe I'll learn %d later
>>
>>53659636
You're returning a pointer that points to an object on the stack of rtn_ptr(), and that object is gone when the function ends.
>>
>>53661001
Part of the C preprocessor, which is basically a search-and-replace with bells and whistles and autism.
>>
>>53661014
So you make macros with the define command right?
>>
>>53661007
>>53661064
https://en.wikipedia.org/wiki/Printf_format_string#Type_field
%i works but %d is by far more used.
>>
>>53661064
Do yourself a favour and learn from an actual book instead of getting the basics from 4chan.

You'll learn in an order that actually makes sense, and wont be called a faggot every time you don't know something.
>>
Hmm. Should I go to sleep or start a Rails / Ember D&D sheet manager. Fuck. Sleep is so gay.
>>
>>53661094
yes

and it can do more than simply replace text like making function-like substitutions and turn tokens into strings
>>
File: Angry_loli.png (148 KB, 400x400) Image search: [Google]
Angry_loli.png
148 KB, 400x400
Anyone knows if there are other GUI markup that is very similar to XAML? I find it nice to work with but since it only supports C# it kinda limits the platform it can run on. Are there any other GUI markup that relies on Python/Java?
>>
>>53661183
>since it only supports C# it kinda limits the platform it can run on
XAML is the part that's limited, not C#.

C# is cross-platform.

WPF is not.
>>
>>53661064
>They are the same when used for output, e.g. >with printf, but different when used as input >specifier e.g. with scanf, where %d scans an >integer as a signed decimal number, but %i >defaults to decimal but also allows hexadecimal >(if preceded by "0x") and octal if preceded by >"0".

>So "033" would be 27 with %i but 33 with %d.

Straight from stack overflow. Use it and you will save so much fucking time with simple shit
>>
Doing C++ courses, and was asked to create a 3x3 matrix calculator. I know I'm still retarded, but is there really no faster ways to get several numbers at once from a multidimensional array?
#include <iostream>  
#include <string>
using namespace std;
int main(int argc, char* argv[])
{ int p;
int gradient=0;
int matrix[3][3] ;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
cin>>matrix[i][j];
}
}

gradient=
matrix[0][0]*(matrix[1][1]*matrix[2][2]-matrix[1][2]*matrix[2][1])-
matrix[0][1]*(matrix[1][0]*matrix[2][2]-matrix[1][2]*matrix[2][0])+
matrix[0][2]*(matrix[1][0]*matrix[2][1]-matrix[1][1]*matrix[2][0]);

cout<<"gradient :"<<gradient<<endl;

.
>>
I need some help. I'm 18 and for my highschool gradualation I need to bring a project, any ideas? I'm mediocre at programming but better than my classmates
>>
>>53661238
>highschool gradualation
how about a dictionary? it won't be that hard
>>
>>53661238
What's your favorite fruit?
>>
>>53661218
You can run C# on Linux? I've only tried it with wine
>>
>>53661224
too lazy to read your code, also dont fuck with c++. Look up array.map and array.reduce or whatever the equivalent array methods are in c++.
>>
>>53661238
Just build a basic calculator with a simple gui in Java even a total newbie can do it.
>>
>>53661262
C# and .NET are open source now, ya dingus.

You can use C# + GTK# for some pretty good results.

http://www.mono-project.com/
http://www.mono-project.com/docs/gui/gtksharp/
>>
>>53661262
average anime shitposter right there
>>
>>53661224
if you're using C++ then abstract a matrix into rows/columns of vectors
>>
>>53661263
then what do I fuck with?
>>
File: 1458332275678.jpg (1 MB, 1000x1972) Image search: [Google]
1458332275678.jpg
1 MB, 1000x1972
>>53661238
Since no one has given you a serious answer let me be the first to offer one. Try to code a program that can find all Kaprekar Constants.
>>
>>53661291
Ok, thank you.
>>
>>53661276
Ah I didn't know that thanks!

>>53661289
This is an anime image board tho
>>
>>53661224
so pretty much in the language i use map will iterate over the array and apply a function to every index, returning a new array. and reduce will take every index from 0 up and run them though a function one by one while saving the previous result until it has one value to return.
>>
>>53661293
sorry i meant i dont fuck with c++ lol
>>
>>53661314
>/g/ - Technology
>>
>>53661337
haha ok
>>
>>53661337
fuckin 1337 baby, looks like im staying up and making some D&D dog shit app today after all.
>>
File: 1451337320315.jpg (25 KB, 400x386) Image search: [Google]
1451337320315.jpg
25 KB, 400x386
>when you use physically based rendering and can account for the refraction when under water
>don't have to manually fiddle with values, just look up the refractive index of water and plug it in
>>
>>53661224
you could make your matrix be a 3-element array of 3-component vectors
>>
tfw youve found a solution, but its not an elegant solution
>>
>>53661709
leftpad = require('left-pad')
>>
at least someone made a less retarded version of it now that it got so much attention, the fag better accept it

https://github.com/azer/left-pad/pull/11
>>
Does anyone have any good books or online resources to learn javax.swing.*
>>
>>53661768
Oh fuck son I forgot we're all kill
>>
>>53661768
return toString.call(arr) == '[object Array]';
>>
Can I safely assume that my program can use 99% of the CPU on a constant basis for the purpose of determining minimal requirements?
>>
at least most of the time you shouldn't really even have to left-pad strings on a website, just align them with html5+css or someshit, fucking cancer
>>
>>53662152
not really

i'm using around 5-30% just idling with my shitty core 2 duo
>>
Should I learn Common Lisp or Scheme?
>>
>>53662194
Haskell
>>
>>53662194
Racket
>>
>>53662194
no
>>
>>53662187
Aww. Thank you. Do you have any idea what are the agreed conventions for determining minimal requirements in terms of CPU usage percentage?
>>
>>53662223
don't know if there is any standard set, i think it's mainly just testing or estimating which hardware will be enough to provide a tolerable user experience for a typical use case
>>
>>53662223
You can make a CPU get to 99% load easily, but there's no way to make sure your program is using that 99%.

If you could, any virus or malicious software would just wreck the CPU time to stop any other processes from detecting it.
>>
...Are the Himegoto OPs a pun based on her being Princess GoTo, as in Princess JMP?
>>
>>53662292
...No.
>>
File: this is snek.png (2 KB, 833x22) Image search: [Google]
this is snek.png
2 KB, 833x22
>>53656149
>>53656035
>meanwhile in python
>>
>>53662523
>MEANWHILE IN PYSHIT

>>> a = 1
>>> b = a
>>> a = 2
>>> b
1
>>
File: 1457550501121-2.jpg (143 KB, 620x387) Image search: [Google]
1457550501121-2.jpg
143 KB, 620x387
Working on my file server with torrent support. Currently working on making my first HTML template. It's really nice that Go checks the template at compile time. The website is pure HTML and doesn't even use CSS for now and will never use JS.
Hopefully I'm able to release version 0.1 today.
>>
>GHC 8 has actual dependent types with intensional equality on the type/kind level (i.e. kinds dependent on types)
woah
>>
>>53662603
that's how it works in any language
>>
>>53662603
Are you dense?

for a, b in product(range(21), repeat=2): print(a, b)
>>
>>53662688
Second thing was for
>>53662523
>>
>>53662523
one-liners like that are generally shit, fucking shitter
>>
>>53662653
so nothing useful
>>
Has anyone here used Nim/Nimrod programming language? What's it like? I want to contribute to it but I know jack shit on programming language design(I'm mostly into AI and computational science)
>>
>>53662679
>>53662688
>what are pointers
>>
File: 1449700279793.png (74 KB, 300x256) Image search: [Google]
1449700279793.png
74 KB, 300x256
>>53662760
>I want to contribute to it but I know jack shit on programming language design
>>
>>53662771
I'm really glad you finally understand pointers anon. But you're retarded.
>>
>>53662771
if a and b are pointers then b will still be 1
>>
Can you guys help me with something

I have an array listvof WordDefs in java and i need to figure out how to change the definition of whatever word the user chooses

Ive just got the scanner
>>
File: 1415785682446.jpg (127 KB, 768x1024) Image search: [Google]
1415785682446.jpg
127 KB, 768x1024
>>53662776
What?
>>
>>53662760
>I want to contribute to it but I know jack shit on programming language design
There's always code cleanup you can do or write documentation. That'll get you familiar with the Nim codebase.
>>
File: 1457757422953.jpg (1 MB, 1000x1414) Image search: [Google]
1457757422953.jpg
1 MB, 1000x1414
>>53661970
please
>>
>>53662807
let mr. butt work on it himself, we don't need incompetent shitters destroying every new language out there
>>
>>53662807
>I want to contribute to the CERN LHC but I know jack shit on particle physics
>>
>>53662796
for example in C
int a = 1;
int *b = &a;
a = 2;
cout << *b;
>>
>>53662827
swing sucks, so does java
my advise is spent your time more usefully.
>>
>>53662828
ok rumpf doesn't mean butt but w/e
>>
>>53662847
>for example in C
>cout
>>
>>53662865
int a = 1;
int *b = &a;
a = 2;
printf("%i", *b);


wew lad
>>
>>53662847
not equivalent to the python code

int a = 1;
int b = a;
a = 2;
cout << b;
>>
>>53662881
Okay then try to implement >>53662877 in python k
>>
>>53662831
>What are internships
Your analogy is flawed anyways.

>>53662857
I'm not getting the joke

>>53662814
The only real answer, it seems.
>>
>>53662904
i don't even use or like python but the complaint implied by >>53662603 is fucking retarded
>>
>>53662936
Why is it a flawed analogy? Why do you think you'll be useful to the development of a programming language if you admit you know zilch about the subject?
>>
>>53662955
The LHC itself was built by engineers and phycisist of other branches, to meet the needs of particle phycisists and their research. Your euphoria is showing.
>>
>>53663024
Fuck off autist.
>>
>>53663033
You got issues mate, better call that psychiatrist.
>>
>>53656410
Ive been looking into this a lot lately. Wikipedia says the fastest known algo for integer factorization is O(n^2), but its still unknown if there can be anything faster.

I have an idea, but the numbers they're testing are hundreds of bits long, way more than a 64 bit integer can store. How are these numbers even dealt with? How do you work with numbers bigger than 64 bits in high level languages?
>>
>>53663113
Scratch that, I meant polynomial time, not strictly quadratic time
>>
>switch projects at job because other projects needs more programmers
>completely new to code base
>still I am easy to adapt and in a few days I am assigned to more tasks than most others in the team

sometimes I am wondering if I should take things slow.
>>
>>53663113
>I have an idea about how I can break whole cryptology
no you don't
>>
>>53663177
Thanks for contributing
>>
>>53663113
First of all crunching prime numbers is normally SANELY only done in low level languages, using large number libraries.
>>
>>53663209
Let's be real; not a single person who frequents this thread is capable of improving modern cryptology in any meaningful way.
>>
>>53663493
Those who are crazy enough to think they can change the world are the ones who do.
>>
Hey idiot here in need of help with c++.

Im reading in a bunch of numbers from one file into a 2D array in the first function.

How would I access the array I made in the first function, to use in a second function?
>>
>>53664085
pass it as a parameter or store in a variable both functions have access to
>>
>>53664085
pass by reference... probably

// prototype
void stupidFunction(int arr[]);

int main(){
int arr[3][3];
stupidFunction(&arr[3][3]);
}

void stupidFunction(int arr[]){
// gay shit
}
>>
Where can I meet a friendly and helpful community of Pascal programmers?
>>
>>53664085
>>53664333
screwed that up, here's the right syntax
void stupidFunction(int (&arr)[3][3]);

int main(){
int arr[3][3];
stupidFunction(arr);
}

void stupidFunction(int (&arr)[3][3]){
// gay stuff
}
>>
>>53656035
>>53656388
>>53663645
you still have some way to go
>>
>>53663645
Optimism doesn't solve equations... if you aren't at MIT with quantum computers you aren't actually anywhere close to solving modern cryptos.
>>
>>53664461
What if I told you I am?
>>
>>53664480
I wouldn't believe you if you were the retard who posted this >>53656035
>>
>>53662904
Easy.
a = [1]
b = a
a = [2]
print b
>>
>>53664519
btfo
>>
>>53664492
I just wanna know how you work with numbers larger than 64-bit integers in a language like C or C++. I'm not >>53656035
>>
>>53664519
>>53664538
Actually hold on, I messed up. This is 100% correct:
a = [1]
b = a
a[0] = 2
print b
>>
>>53664551
I told you already, large number libraries.... https://gmplib.org
>>
i bet y'all niggas can't even left-pad a string in C
>>
>>53661299
too easy, done in some minutes with 1 cycle and 2 sorts
>>
>>53664605
We can because you see, a real language requires actual skill to write... unlike Java"written in 10 days"script
>>
>>53664551
big num libraries
>>
should i learn c sharp
>>
>>53664572
Im a windowsfag
>>
>>53664659
learn java
>>
>>53664659
no
>>
>>53664671
I hate java
>>53664675
Why
Thread replies: 255
Thread images: 25

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.