[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]

What are you working on, /g/? Previous thread: >>59852366

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: 319
Thread images: 29

File: dpt.png (554KB, 934x1000px) Image search: [Google]
dpt.png
554KB, 934x1000px
What are you working on, /g/?

Previous thread: >>59852366
>>
File: 1465007261700.webm (363KB, 600x480px) Image search: [Google]
1465007261700.webm
363KB, 600x480px
First for webm related
>>
File: 1482459435387.jpg (567KB, 595x842px) Image search: [Google]
1482459435387.jpg
567KB, 595x842px
What's a good total language for doing all of my computation at compile time?
>>
>>59858414
nth for youre about 30 years late to the flappy train, m8
>>
File: pepe.png (135KB, 360x358px) Image search: [Google]
pepe.png
135KB, 360x358px
>http://people.eng.unimelb.edu.au/lee/src/nuprolog/
>nu-
>>
>>59858416
souplesse
>>
We should ask 'Whom quoteth thou?' instead of 'Who are you quoting?' because it's grammatically correct (see >>59858349) and more economical.
>>
>>59858420
Smaller data types can implicitly convert to larger data types, because there is no risk of destruction of data.

The concept of 3.222 cannot be stored in an integer, but the concept of 3 can be stored in a double.
>>
File: triangle-registers.png (204KB, 825x1056px) Image search: [Google]
triangle-registers.png
204KB, 825x1056px
>3d graphics programming in asm
is it feasible?
should I try it?
will it drive me insane?
>>
Name a better language than C or Scheme
>>
>>59858387
OOP is shit.

Discuss.
>>
>>59858482
Quote properly next time, please.
>>
>>59858484
c++17
>>
>>59858387
2 + 2 = 4

Discuss.
>>
>>59858496
I was quoting myself from yesterday's thread
>>
>>59858491
>>59858511
install gentoo
>>
>>59858424
Stupid frogposter
>>
>>59858511
Invalid assignment statement
>>
>>59858491
your mom is shit

discuss
>>
>>59858519
Link?
>>
>>59858523
>=
>assignment statement
What sort of shitlang are you using?
>>
>>59858491
>needing a discussion on a true statement
>>
>>59858556
Please do not misuse the quoting function.
>>
>>59858319
>>59858476
Literally nothing wrong with using double since by using int he's making an useless conversion and int is a subset of double
>>
>>59858529
shit I actually searched for it
>>59850424
>>
>>59858570
Except for the fact that it gives the user the option for a nonsense choice like "2.7 coin flips."
>>
File: goto.png (26KB, 740x201px) Image search: [Google]
goto.png
26KB, 740x201px
>>59858542
4 = 2 + 2
>>
>>59858576
"3d graphics programming in asm"
You didn't say that though.
>>
>>59858587
I knew you would troll me
>>
>>59858603
My post is completely legitimate, even though your post is related you still didn't say the thing you were quoting.
>>
>>59858581
Making it an int will give the user the option of -5 coin flips
>>
>>59858542
C, and don't you dare call it a shitlang
>>
>>59858628
I already did.
>>
>>59858482
How do you think RollerCoaster Tycoon came about?
>>
File: 1.gif (2MB, 500x400px) Image search: [Google]
1.gif
2MB, 500x400px
>>59858387
An inverse kinematics library written in C. It implements an insanely fast algorithm (FABRIK).
https://github.com/thecomet93/ik

I wrote wrappers for the Urho3D engine, which was merged into master a few weeks ago.
https://github.com/urho3d/Urho3D/pull/1871

You can follow progress here:
http://discourse.urho3d.io/t/inverse-kinematics/1819/28
>>
>>59858565
>Being ironically autistic
>Not understanding implied quoting
>>
>>59858693
Really, who were you quoting?
>>
File: flappy-vim.webm (962KB, 802x458px) Image search: [Google]
flappy-vim.webm
962KB, 802x458px
>>59858414
>>
>>59858714
>Peeeeenus weeeeenus ;D
What is that , though ?
>>
File: anal beads.png (20KB, 707x397px) Image search: [Google]
anal beads.png
20KB, 707x397px
>>59858620
Good point.

I'd try to parse to int, and then check that constraint.

You could even do something like pic related.

int.TryParse(ReadLine(), out var muhInput);

switch (muhInput)
{
case int i when i > 0:
WriteLine("Input is valid!");
break;
case int i when i < 0:
WriteLine("Please enter a positive number!");
break;
default:
WriteLine("Please enter a whole number!");
break;
}
>>
>>59858721
>vim is so bloated it has tetris and now this
Who would have thought.
>>
>>59858758
>i < 0
i <= 0
*
>>
>>59858751
She took a real beating...
>>
>>59858768
Or just add that as a case:
switch (muhInput)
{
case int i when i > 0:
WriteLine("Input is valid.");
// do logic here
break;
case int i when i == 0:
WriteLine("You didn't flip any coins!");
break;
case int i when i < 0:
WriteLine("Please enter a positive number!");
break;
default:
WriteLine("Please enter a whole number!");
break;
}
>>
>>59858719
> It's OK to be jealous. A brony just wrote a piece of software that outdoes anything you'll ever write.
>>
>>59858387
avl tree to pass classes without attending
>>
>>59858721
horrible
>>
Apologies for not being a programming question per se. How do you sudo a command in Windows? runas /profile /user:admin command works, but if I add any options for that command it kicks me back into runas help.
>>
>>59858502
Mmmhm delicious
>>
>>59858446
The power function. i didn't know it could take int arguments in c# the google doc said double, so i just used double to be save

>>59858494
What?
What did I do wrong?
>>
>>59858387
You didn't put /dpt/ in the subject, dipshit.

I'm willing to bet a new thread or two is going to crop up because of this.
>>
>>59858788
Whom art thou quoting?
>>
>>59858802
Being logged in as an admin?
>>
>>59858811
You haven't done anything wrong, necessarily, but prematurely doing every optimization possible is a bad habit.

Focus on making your code work correctly, then tune performance to acceptable levels starting with most to least impact.

See
>>59858758
>>59858785
for some options for you to use in your code.
>>
>>59858674
that's not 3d though.
>>
>>59858802
>Apologies for not being a programming question per se.
Stopped reading right there.
>>
>>59858802
"cmd.exe -muhOption" runas ...
>>
>>59858802
Right-click on cmd/cygwin then Run As Administrator?
>>
>>59858833
It's 2D sprites via a 3D capable library (DirectX).

There's not a whole lot of difference between rendering something in the world with a ortho cam vs rendering it with a perspective cam and a z coordinate
>>
If i have a character 'B' for example, how would i assign a variable say Test1 equal to the characters decimal value
>>
sum = reduce(add, list(filter(lambda x: x%3==0 or x%5==0, range(1000))))

why is python and functional programming so cute bros
>>
>>59858936
uwotm8
>>
>>59858946
the character B has a number value of 66
>>
>>59858794
How rude
>>
>>59858923
iirc, RCT uses directdraw (2d only). and its engine is based on TT which was plain vga.
anyway I was talking about programming the gpu hardware registers directly, without using an API.
>>
>>59858959
I dont know what youre asking though.
>>
>>59858936
how about
int test = 'B';
>>
File: asciifull.gif (27KB, 715x488px) Image search: [Google]
asciifull.gif
27KB, 715x488px
>>59858979
Nah I figured it out. I wanted to take a string and convert each character to the numeric value of said character

i used the uint8 function
>>
>>59858936
>characters decimal value
I could maybe try giving you an answer, maybe if you had said what language you're "working" with, but then it's like giving a condom to a woman: they don't have the background to use it, so grow yourself a dick, and understand that codepoints are not at all decimal but numbers, plain numbers regardless of any numeral system.
>>
>>59859001
uint8 is a function now?
>>
>>59859001
It ain't a function and you don't get what you are doing.

Also WHAT FUCKING LANGUAGE?
>>
>>59859014
in MATLAB yes
>>
I have a couple of functions which may or may not return a tuple of nonetypes, (None, None) in Python.

What does (None, None) equate to though? It isn't True or False. The same applies to any tuple with Booleans. Even using isinstance((None, None), tuple()) equates to False.
>>
>>59859001
Now what's the numeric value of
'ñ'
?
>>
>>59859041
No idea
>>
File: anal beads.png (1KB, 163x53px) Image search: [Google]
anal beads.png
1KB, 163x53px
>>59858936
>>
>>59859066
Thank you
>>
>>59859029
>isinstance((None, None), tuple())
>>> isinstance((None, None), tuple)
True

Ftfy
Btw
>>>tuple()
()
>>>list()
[]
>>>int()
0
>>
>>59859087
Oh yes, I don't know why I was using tuple(). So that's just it, it's a tuple but Python can't tell whether it's True or False?
>>
>>59859133
You can just equate it to None?
a = (None, None)
if not (a[0] == None and a[1] == None):
>>
>sim cards are their own computers
>you can program on them
>Oracle has a stripped down version of Java on them
What? It seems like there's no garbage collection, so how do you delete objects? I'm just curious how that pseudo-Java of theirs works.
>>
Could you use Scheme instead of Lua as an embedded scripting language in a C++ game?
>>
>>59859234
Sure why not
>>
>>59859234
you can do whatever the fuck you want
>>
>>59858859
not an option
>>59858850
invalid parameter

I'll chalk this up to Windows being inferior and ask my boss.
>>
>>59858387
Reworkng old code so that it works for what i want it to do, also spending the time to add in documentation this time around.
>>
>>59858387
>no /dpt/ in OP
retarded animeposter
>>
File: ?.png (7KB, 120x120px) Image search: [Google]
?.png
7KB, 120x120px
Why can't you use doubles to index arrays?

e.g.
array[122.3]
>>
>>59859304
>ah yes, id like to see the 122.3 person in line please
>>
>>59858586
>goto is for lazy programmers
This meme has to die. Dijkstra himself has admitted he's not even that dogmatic about it but was rather concerned with its use.

Goto is fine.
>>
File: 7035-6-3.jpg (204KB, 1200x1200px) Image search: [Google]
7035-6-3.jpg
204KB, 1200x1200px
>>59859304
>vitamins[0.3]
Hmmm let me just open one of the containers for my vitamins all the way to actually get them and then partially unseal the other just for the fuck of it
>>
>>59859304
you'd ask for index 0.5 and get a half-value
>>
>>59859304
You can
>>
>>59858511
Uncaught ReferenceError: Invalid left-hand side in assignment
>>
>>59859383
I'd expect you have a special function for handling fractional access. So you could have it return the average.
>>
In java, you can have numbers represented by underscores. e.g 1_2_3_4
how would you convert a string to int in this special case?
int a = Integer.parseInt("1234")
System.out.println(a); // prints 1234


but
int a = Integer.parseInt("1_2_3_4")
System.out.println(a);
// trows error:
// java.lang.NumberFormatException: For input string: "1_2_3_4"


what do?
>>
>>59859304
You can with associative arrays.
>>
File: riddle answer.png (1KB, 234x38px) Image search: [Google]
riddle answer.png
1KB, 234x38px
What the only thing worse than installing gentoo?
>>
>>59859436
Replace underscores with blanks.
>>
>>59858387
Higher-order Taylor methods for numerical approximations to solutions of first-order initial value problems.
>>
>>59859465
having your code GPL'd
>>
>>59859483
damn you are a smart boy
>>
>>59859476
still not working
Exception in thread "main" java.lang.NumberFormatException: For input string: "1 2 3 4"
>>
>>59859465
if all your computer use is at the command line, are you a user or a coder?
>>59859489
that's a close second, but i'll give you credit
>>
>>59859436
Keep a new soln string, then walk through each character of the input, only appending (push backing? what is the java version?) when the current character is a digit, then run parseInt on your generated solution.
>>
>>59859502
I meant removing all underscores.
>>
>>59859459
?
post an example pls

>>59859511
Java 8
>>
>>59859511
He might aswell write his own parseint at that point but it's an OK solution.
>>
>>59859518
but i already did that.

can't you see?
>>
>>59859520
Integer.valueOf("1_000".replace("_", ""));
>>
>>59859554
thanks.
>>
>>59859436
int a = Integer.parseInt("1_2_3_4".replaceAll("_", "");
>>
>>59859483
>babby's first mathematical analysis
>>
>>59859304
Someone doesn't know what pointers is
This is what OOP does to people...
>>
>When you decide to give Haskell a chance and realize that "monads" are just objects by another name
>Hasklelfags are literally shitting on OOP while using it and being too dumb to realize
I'm fucking LMAOing IRL. What the fuck.
>>
59859619
I like the commitment to filterdodge
>>
>>59859619
but they aren't
>>
>>59859619
I'm reading a small summary on monads and they really don't seem to encompass everything objects in OOP encompass. Some similarity though.
>>
File: 1469607283458.jpg (26KB, 854x510px) Image search: [Google]
1469607283458.jpg
26KB, 854x510px
>>59858482
John Carmack could. Why can't you?
>>
>>59859619
mathlet detected
>>
>>59858416
common lisp or C++ with lots of TMP
>>
>>59859663
Had no idea C was ASM
>>
>>59859655
>>59859661
>>59859664
I guess it takes an outsider to think outside the box and see things for what they are.
>>
>>59858690
I think your manequin has autism bro
>>
It just sunk in that I've effectively wasted months, if not years, posting on 4chan that I could have spent becoming a good programmer.
>>
>>59859711
>I guess it takes an outsider
I >>59859661 am an outsider.
>to think outside the box
This is often what people say to justify when they made up bad ideas or make statements that aren't factual.
>see things for what they are
I think your confusion is that you think there's some similarities between concepts that means they can be equated.
>>59859757
At least we had fun right?
>>
>>59859707
Half of Doom source code is Assembly.
>>
>>59859304
thats ridiculous.
Each position in an array contains one element, how would accessing the 0.3rd element even look like?
1 third from the first, 2 thirds from the second??
>>
>>59859619
you are too dumb to realize just how dumb you are by making that dumb statement.
>>
>>59859707
C is just a fancy macro system for asm anyway.
>>
>>59859776
https://github.com/id-Software/DOOM
no its not
>>
File: 1478609742190.jpg (80KB, 478x644px) Image search: [Google]
1478609742190.jpg
80KB, 478x644px
>>59859833
jesus christ
/*
=================
=
= CheckParm
=
= Checks for the given parameter in the program's command line arguments
=
= Returns the argument number (1 to argc-1) or 0 if not present
=
=================
*/

int CheckParm (char *check)
{
int i;

for (i = 1;i<myargc;i++)
if ( !stricmp(check,myargv[i]) )
return i;

return 0;
}
>>
speaking of asm.
is asm the only language without undefined behaviour?
>>
>>59859866
>e without undefined behaviour?
literally any pure functional language
>>
Do you know calculus? If so, how does it help you in your work?

What's your favorite programming language?
What programming langugage is used on your work?
>>
>>59859865
>
int             i;

for what reason john
>>
>>59859866
Java is fully specified.
>>
>>59859865
What's the problem?
>>
>>59859866
HDLs are also quite anal about not allowing anything underfined.
>>
>>59859897
>Do you know calculus? If so, how does it help you in your work?
Yes but I only took a single 40 hour university course on it and had a smaller introduction in highschool. I don't use it all that frequently. I think I'd be way worse off having skipped calculus even where I don't use it.
>What's your favorite programming language?
I don't like the languages but I have to answer C or C++.
>What programming langugage is used on your work?
C++
>>
>>59859897
>Do you know calculus? If so, how does it help you in your work?
no
>What's your favorite programming language?
c++
>What programming langugage is used on your work?
neet
>>
>>59859897
>Do you know calculus?
no. had a touch of it in 8th grade
could get into it and do well if it were relevant to my life or work
>If so, how does it help you in your work?
i don't use it directly, but i use tools which were made by using it.
>What's your favorite programming language?
currently C#
>What programming langugage is used on your work?
C#
>>
>>59859897
>Do you know calculus? If so, how does it help you in your work?
I only know basic calculus. I never use it, so it's getting quite rusty.
>What's your favorite programming language?
I'm liking Clojure so far.
>What programming langugage is used on your work?
Mainly Java.
>>
>>59859897
>Do you know calculus? If so, how does it help you in your work?
I had some calculus at uni, already forgot almost all of it. When I need it I just search for some numeric implementation on stack overflow. It has nothing to do with my work.

>What's your favorite programming language?
C# and Python
>What programming langugage is used on your work?
C# and web shit aka html/css/js
>>
>>59859897
>Do you know calculus?
Yes.
>If so, how does it help you in your work?
I develop PID-controllers, although it's pretty surface level calculus, and enterily in an applied context.
>What's your favorite programming language?
Forth.
>What programming langugage is used on your work?
C and asm (avr, arm).
>>
anyone in here working on AI?
what do you think of the current progress?
https://www.youtube.com/watch?v=mQO2PcEW9BY
will we ever have Data, Millennium Man, T-1000, Agent Smith?
what is the key to bring machines to life?
>>
>>59860114
no
shit
no
nothing
>>
>>59859661
The Monad type class is just a higher kinded "interface" of sorts. That's the only similarity to OOP.
>>
>>59860143
>interfaces are now OOP
>>
>>59860114
>what is the key to bring machines to life?
I'm of the opinion that there's nothing magical about intelligence. Once you have enough to interconnections, feedback and processing power you're there.
So there probably wont be a single moment where we suddenly gave strong/general AI, it will just gradually happen and no one will really notice.
>>
>>59860168
They're a big part of OOP and the only thing I can see getting compared between OOP and monads.
>>
>>59860143
Yeah I was thinking about message passing. But the implicit carrying of extra data that the haskell wiki describes sounds similar to member variables right? And because that's there there's some coupling of data and function.

Similarities aren't big.
>>
>>59860182
You are only describing State.
>>
>>59860114
>what is the key to bring machines to life?
power and efficiency thats probably atleast another few decades off.
>>
I want to get into emotion recognizion especially body language, where do I start?
>>
>>59860202
go outside and make some friends
>>
>>59859897
Yes I know calculus. Usually applications that require knowledge of it are done in libraries though. Most of machine learning is predicated on finding gradients of cost functions, DFT/DCTs show up everywhere, taylor series approximations also show up all over the place. Doing any kind of materials research also requires extensive knowledge of calculus. The list goes on and on. But again, most of the time the math is abstracted away into a few simple function calls.
>>
>>59860202
3D models
pattern recognition
>>
File: yui does the cute thing.gif (802KB, 500x545px) Image search: [Google]
yui does the cute thing.gif
802KB, 500x545px
Friendly reminder that:
>math is not programming
>a program is not a mathematical proof
>haskell is "programming" in much the same way as SQL statements are "programming".
>monads are a haskell hack that attempts to reinvent object oriented programming but in an obtuse way

Friendly reminder to sage all math autists.
>>
>>59860114
>working on AI
As hobby yes
>current progress
We won't see enough computation power that current techniques are going to achieve all that impressive results when we set 'super fast human' as a standard.
>bring machines to life
We will have human brains supported entirely by machine bodies before we 'bring machines to life' in the sense that sentience of these machines should be a concern. People will of course not be able to separate their perception of sentience from actual intelligence. People just don't appreciate how complicated even basic lifeforms are. Anyone who argues for robot freedoms shouldn't be eating plants basically.
>>
>>59860248
yui youre 2baka to program anyway
>>
/g/'s favourite programming language poll:
http://www.strawpoll.me/12732251
>>
So i made little program to add stuff to right click in windows, whether for folders or files and now when i think about it I dont need it at all. Added 1 thing and thats it. At least i learned how to do registry related shit in C#.
>>
>>59860248
haskell's programming because it can do things. it has do blocks and the IO monad
>>
>>59859897
Do you know calculus? If so, how does it help you in your work?
Yes. I use it for signal processing. Many functions are already defined for ARM processors, but there are some that aren't and you need to define them yourself. I have made a frequency estimation algorithm and a logarithm calculation routine at the moment. Fourier and Wavelet transform are a must if you want to mess with audio.

What's your favorite programming language?
C

What programming langugage is used on your work?
Verilog, C and Matlab. I need to port something written in Java as a previous version of the same thing I'm doing.
>>
>>59859912
I'm pretty sure it's just github fucking up some formatting.
Some of my ruby code is never formatted correctly on github despite being perfect in nano.

extern    que_t        inque, outque;

void jump_start( void );
extern int uart;

int usemodem;
char startup[256], shutdown[256], baudrate[256];

extern int baudbits;

void ModemCommand (char *str);

int myargc;
char **myargv;
>>
File: haskell.png (12KB, 225x321px) Image search: [Google]
haskell.png
12KB, 225x321px
>>59860355
>>
>>59860368
github was a mistake
>>
>>59860372
>he posts the virgin comic
>>
what's the most efficient way of replacing all occurrences of a char in a string in C?
>>
>>59860368
copy from nano
paste into microsoft's notepad (or similar dumb text editor)
copy from there, paste to wherever
if still errors, you probably keep trading tabs/spaces
>>
>>59859897
>Do you know calculus?
Up through multivariable
>If so, how does it help you in your work?
Understanding how to change coordinate systems is very very useful for my hobby projects and working with graphics programs, but otherwise not at all directly. The logic behind calculus helps a lot though.
Linear Algebra has been far more useful.

>What's your favorite programming language?
C
>What programming langugage is used on your work?
C# with some inline C and a whoooole lot of powershell
>>
>>59860368
>Some of my ruby code is never formatted correctly on github despite being perfect in nano.

because you're mixing tabs and spaces
>>
does anyone have the /sci/-approved guide to computer science textbooks?
>>
>>59860395
It's O(n) no matter what so naive approach is fine...
>>
I just made my first bash script, backing up my home directory minus cache to my raspberry pi server I can now connect to outside my own network.

Its all new for me, but Im pretty excited.
>>
>>59860395
iterate through it once, how else?
>>
>>59860395
a for loop and some pointer arithmetic
>>
>>59860395
>most efficient
Depends on string size but you're really asking a question that's too difficult for anyone to answer.
For moderately small strings iterating and replacing them is good.
>>
>>59860416
/sci/ i imagine, probably should go back there
>>
>>59860423
Well he is doing C so he of course thinks there is haxxor way of doing it.
>>
>>59860440
retard
>>
C# brainlet here, does anyone know of a realistic tutorial/demonstration of MVVM that doesn't involve project-embedded xml and LINQ and isn't relatively gigantic? I've been searching for a decent tutorial that isn't just someone going absolutely crazy with every possible feature they can cram into a tutorial. My need is just to have a filebrowser pop up, allow file selection, and put the file name into the filepath so I can later use that path elsewhere.
>>
>>59860320
>no asm
>>
>>59860451
But anon you need enterprise quality.
>>
>>59860320
>5 JVM languages
>only 1 JS based language
c'mon, it's 2017
https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js
>>
>>59859897
>Do you know calculus? If so, how does it help you in your work?
I knew it while in school, but there's not much need for it unless you're working with specific types of data, or in specific fields.

>What's your favorite programming language?
C#
>What programming langugage is used on your work?
C#
>>
>>59860248
>in much the same way as SQL statements are "programming".
What if I'm writing stored procedures to be used by an application later?
>>
>>59860451
>My need is just to have a filebrowser pop up, allow file selection, and put the file name into the filepath so I can later use that path elsewhere.
Then you do not need MVVM.
>>
it's not working guise
char *replace(const char *s, char ch, const char *repl)
{
int count = 0;
char *t;
for (t = s; *t; t++) {
if (*t == ch) {
*t = "";
}
}


return s;
}
>>
>>59860465
Why would anyone translate their programs to JS?
>>
>>59860502
Do you want to replace individual characters or a whole string?
>>
File: 1474407097679.png (36KB, 1032x421px) Image search: [Google]
1474407097679.png
36KB, 1032x421px
>>59860320
>2k17
>not using java
Kill yourselves neets.
Java is best language ever made
>>
Why is a so called "memory leak" considered bad?
>>
>>59860520
why would translate their programs to JVM binary code?
>>
>>59860520
To make them run slower in case they are too fast.
>>
>>59860450
Told you so and I'm retard>>59860502
>>
>>59860533
individual chars

for example:
replace the letter 'a' with a empty char
input: a5698cda
output: 5698cd
>>
>>59860465
shit. never knew there were that many hipsterscripts.js.
also
https://github.com/jterrace/js.js
literally what the fuck, who comes up with this bullshit? how does this even have a user base?
>>
>>59858511
// simple program to test if 2 + 2 = 4 is true
#include <iostream>

enum Booleans : bool { T = true, F = false};

void isTrue(Booleans statement, Booleans* output) {
if (statement == Booleans::T) {
*output = Booleans::T;
} else { if (statement == Booleans::F) {
*output = Booleans::F;
}
}
}

using number = int;
number main(int argc, char * * argv) {
char stringFalse[6] = {'F','A','L','S','E','\0'};
char stringTrue[5] = {'T','R','U','E','\0'};
Booleans temp;
Booleans statement;

if (static_cast<number>(2) + static_cast<number>(2) == static_cast<number>(4)) {
statement = Booleans::T;
} else {
if (static_cast<number>(2) + static_cast<number>(2) != static_cast<number>(4)) {
statement = Booleans::F;
}
}
isTrue(statement, &temp);

if (temp == Booleans::T && temp != Booleans::F) {
std::cout << (std::string(stringTrue)).c_str() << std::endl;
} else {
if (temp == Booleans::F && temp != Booleans::T) {
std::cout << (std::string(stringFalse)).c_str() << std::endl;
}
}
return -1;
}

it gave me true
>>
>>59860535
>leaves memory that will eventually cause a out-of-memory condition
>calls it good
>>
@59860248
>a program is not a mathematical proof
This is factually incorrect. It's about as retarded as denying any law of physics.
>>
>>59860502
strings in C are call by reference
>>
>>59860553
empty?
do you mean a space (0x32) or a null byte (0x00)?
>>
>>59859576
We've all got to start somewhere.
>>
>>59860535
You run the risk of running out of memory if you're constantly leaking more in an event loop or something. In garbage collected languages it can make the GC take longer as well.
>>
>>59860568
Why are you typing like a retard? Could you rewrite your post in a non-retarded fashion?
>>59860581
What if I don't use much memory?
>>
>>59860492
I've been trying to pick it up for a larger project with a GUI that's causing me a lot of grief, mainly with BackgroundWorker. I've read that the pattern relieves some of that. I can do what I originally posted already in a window's codebehind.
>>
>>59860562
>
char stringFalse[6] = {'F','A','L','S','E','\0'};
char stringTrue[5] = {'T','R','U','E','\0'};

beautiful
>>
>>59860577
>space (0x32)
come on...
>>
>>59860570
1) You have to go back
2) You've never taken a discrete math class
>>
>>59860593
If you have a memory leak then you are using more memory than you need and often memory leaks build up the longer the program is run.
>>
>>59860593
>calls memory leak good
>not a retard
pick one
>>
@59860604
Ignore, disbelieve, keep playing games.
>>
>>59860577
in the example i gave you, it's basically to delete all a's

in Java, it would be something like
"a5698cda".replace("a","");
>>
>>59860553
you can't just replace a with nothing, it doesn't work like that. there's literally 2 programs in K&R that do exactly what you're wanting to do, just read the book. chapter 2
>>
how do versions work? like how do I decide 0.1 0.11 0.12 etc
>>
>>59860535
It's in the name.
>>
>>59860608
Who are you quoting?
When did I ever call anything "good" or "bad"?

>>59860606
Would it be noticeable if I don't use a large amount of memory?
>>
>>59860616
http://semver.org/
>>
>>59860616
Semantic versioning or bust.
>>
>>59860612
I don't know how java deals with empty strings, that would be a null byte in C, since an empty string is a char array with a single array member, the null terminator.
So if you were to replace 'a' at the beginning of the string with a null terminator, no C stdlib function will read your string because it'll think it ends right at the first character.
>>
>>59860535
Because in real applications they're an issue.
Since you're asking you've probably come in contact with someone who explains this to you while you're writing very basic programs.

Memory leaks imply that you're not managing your memory well. But there's lots of caveats here. Just know that you shouldn't allocate memory without knowing how to handle it. Some tend to ensure you should always end your program in a state where all the memory is freed at the end (even if the OS does it for you when it kills your process) so they know that they didn't have any memory they weren't really handling well.

The short story is that if you keep allocating memory without giving it back you run out eventually.
>>
>>59860612
No one gives a shit, pajeet. The question was about C.

Every high-level language has a string replace in the standard library.
>>
>>59860612
Create a new char* of the same length as the input string
iterate over each index of the string checking if its 'a'
If it isn't, copy that value into the current index of the new char* and increment it forward by one
If it is, don't copy it

Then you can malloc a new string of the exact length of the new char* and copy it in to save memory, if you want
>>
>>59860649
>Because in real applications they're an issue.
What is a "real" application? Is it possible to somehow create a "fake" or "not real" application?
>you've probably come in contact with someone who explains this to you while you're writing very basic programs.
Nope, I'm just interested in the concept since I heard it was bad.

>The short story is that if you keep allocating memory without giving it back you run out eventually.
I see, thanks for the explanation.
>>
>>59860636
>Would it be noticeable if I don't use a large amount of memory?
No it's not a problem for small allocations. It's a 'best practice' thing.
Most of the programs you find yourself writing in languages that leave memory management to you don't really need you to free anything.
>>
File: 1.png (96KB, 1180x786px) Image search: [Google]
1.png
96KB, 1180x786px
I came up with a new project to keep myself busy: 'realtime' visualizing the popularity of boards on 4chan. It should look and feel the same as a stock trading application like pic related would.
So first up I have generate the data set. My current idea is to create a script which calculates the posts per hour (PPH) for each board at a fixed interval, say 1 minute. The result of the script is appended to a file. Finally, the file gets uploaded to a server so the client can access it through HTTP.
The main purpose of the client will be to retrieve the data at a fixed interval and present it to the user. To make things more interesting, I want the user to be able to buy and sell stock based on the data set.
I'm currently struggling with two things
>script
The file holding the data set will grow at an insane rate.
My current idea is to format the data like this:
<timestamp>
<board>|<pph>
<board>|<pph>
...
<timestamp>
....
Which means that each run of the script adds n (= number of boards) + 1 (for the timestamp) lines to the file.
Is there a way to reduce the size of the file? Should I split it up?
>client
Should I start with a GUI or a CLI application?
>>
>>59860657
>Create a new char* of the same length as the input string
you don't need to do this, strings in C are call by reference
>>
>>59858474
This has nothing to do with ramming progs.

>>59858476
>The concept of 3.222 cannot be stored in an integer
Actually it can, assuming you don't want it indefinitely repeating. You can use a 32-bit integer, storing "3222" in the high word and "1000" in the low word. You can then convert it into a float by dividing the high word by the low word.

>>59858482
It would be extremely painful.

>>59858491
It provides a useful syntax for encapsulating behavior, but is overused and has become a meme.

>>59858542
What are YOU using? ALGOL 60?

>>59858620
Then you could use an unsigned int.

>>59858936
There's no such thing as a "decimal value" in programming unless you're on a BCD machine (which, let's face it, you're not). Decimal is just a matter of representation. In C for example, you have decimal literals, and functions which can display values as decimal, but everything internally is binary. So are character codes. So doing
int x = 'B'
is the same as assigning the character code of B to integer x. And no, the fact that it's declared as int isn't triggering any implicit conversion, it's really just a convention that the byte-sized integer type is called char, you can use chars for integer data, and store character codes in an int (in fact, some libc functions do this already). So if you want to DISPLAY the decimal value of a character, you could basically do something like
printf("%d\n", 'B');
. The compiler is aware of the character codes, so any character literal is converted to its character code at runtime.

>>59859066
What language is this?

>>59859234
You can use Ada as a scripting language in a Brainfuck game if you want. Nobody's stopping you.
>>
>project partner does 0 usable work for project

>didn't even know the component he was supposed to be working on was clearly defined in the instructions

>does all the work on his part the day before its due

>so shit I literally have to write it all from scratch

>next project we have to work together again

>I offer to just do the entire project this time

>He says "but I actually want to learn to do the coding, you just did the whole project last time"

obviously I did it because this kid spent an entire day trying to figure out how to move a text file into a string. On top of all of that on we have to submit a review of our partners and what we did for the project and hes claiming responsibility for code that I spent nights researching on how to make it work.

My only other alternative is to join another group which is a gamble and would mess up workflow since I would be put into a group of 3.
>>
@59860699
>"meme"
>>>/r/abbit
>>
>>59860697
You need a new place to store the modified string, unless you want an unusable string because of null char's in the middle of it
>>
>>59860699
>What language is this?
C#
>>
>>59860610
>>59860712
Learn how to quote you reddit loving fuck, jesus christ.
>>
>>59860718
Saying "call by reference" is stupid but he's right, you can do it in-place as you're never modifying ahead of where you're reading.
>>
File: 1482335576715.png (403KB, 521x520px) Image search: [Google]
1482335576715.png
403KB, 521x520px
>>59860710
who in the f*ck are you quoting?
>>
>>59860725
You're a dumb faggot for responding.

She's doing that intentionally to trigger people like you.
>>
>>59859304
Because arrays are just syntactic sugar for pointer arithmetic. base[offset] is just another way of saying base+offset (though it's subject to C pointer arithmetic rules where the offset is multiplied by the size of the pointed-to type). Doubles would this point to somewhere in between memory addresses, which is just plain nonsensical.

>>59859465
Trying to port a 16-bit Windows program with no source code.
>>
>>59860731
read this sentence.
>>
@59860710
Why the hell do you space your posts like that, redditor?
>>
>>59860741
>arrays are just syntactic sugar for pointer arithmetic
Arrays are not just pointers retard.
>>
>>59860691
Make it a webapp so anyone can participate without downloading it. That's pretty interesting, I'll check it out.
>>
>>59860731
inner monologue

>>59860751
they used to be known as autism spaces, newfag
>>
File: 1482444326492.png (61KB, 325x971px) Image search: [Google]
1482444326492.png
61KB, 325x971px
>>59860729
Okay so if you find an 'a' in the middle of a string and replace it with a null char, now you've effectively truncated that string in the middle of it.
You need to copy the values over to a new string so you don't have shit in the middle of it.

>>59860736
>>
>>59860755
>Arrays are not just pointers, retard.
ftfy
>>
in C, is 0 == '\0' ?
>>
>>59860770
>if you find an 'a' in the middle of a string and replace it with a null char
Who said this?
>>
>>59859866
"Undefined behavior" is really only a thing in the C family. Other languages may have unspecified behavior, or things where the behavior changes without updating the documentation, but the idea that "if you do something wrong, the compiler can do whatever you want" is pretty much specific to the C family.
>>
>>59860718
>You need a new place to store the modified string,
no you don't
>unless you want an unusable string because of null char's in the middle of it
then don't put a null char in the middle of it
>>59860729
>Saying "call by reference" is stupid
blame dennis ritchie for writing that C strings are call by reference in K&R then
>>
>>59860685
>What is a "real" application? Is it possible to somehow create a "fake" or "not real" application?
What I mean is that there's varying levels of concern.
If you're writing a server application that absolutely must never go wrong that's more "real" than an application that has a much lower expected runtime and memory footprint.

If you have programs that don't require a lot you have lots of headroom. If you have programs that require a lot you don't.
>>
>>59860774
In any language, that's true
>>
>>59860770
are you unintelligent??
>>
>>59860774
Yes.
>>
>>59860806
Very
>>
>>59860774
I would assume so.
> 0 == '\0'
true
>>
>>59860774
Of course.
>>
File: tarjan666.png (662KB, 960x720px) Image search: [Google]
tarjan666.png
662KB, 960x720px
>>59858387
i have seen a Japanese computardh virus themed after the incident of Fukushima but now I cannot find where the video went.
I think it's called Meltdown or JNPP (japanese nuclear power plant)

The way it works as I have watched it
>a picture of some politician about some MCSE thing appears in red in the center of the screen
>a sumo sound plays
>random letters of the Jap ABC flow in from the left to the right
>the virus renames every accessible file to "meltdown" with acceleration like a chain reaction
>finally it tries to format all available partition with the exception of C

I am creating it right now but there were some other events that it does. Does anyone know something about the virus?
>>
>>59860809
it shows. just don't put an '\0' in the middle of the string you goddamn java baby. this is why people hate OOP is because it rots your brain
>>
>>59859866
Most languages have stronger type systems and don't go as low level so they completely prevent many or even all scenarios that are undefined in C.
>>
>>59860793
>If you're writing a server application that absolutely must never go wrong that's more "real" than an application that has a much lower expected runtime and memory footprint.
It's not though, you might argue that it's more important from a certain perspective, but it's definitely not more "real". Being "real" or "fake" is obviously a binary state.
>>
>>59860763
I really hate JavaScript and everything around that. I'm leaning towards using JavaFX currently. It can plot fancy graphs.
>>
>>59860710
>next project we have to work together again
No, you don't. You tell the teacher you can't work with this person.
>My only other alternative is to join another group
Yes do that unless you want to be this persons friend or have other motives for working with them.
>mess up workflow
Anon if you carry assignments meant for teams you're just gonna be a positive to the group effort.
>>
>>59860770
>she
People say he all the time as an assumption why not spice it up with a she?
>>
>>59860520
Because JS is the assembly language of the web and supports structured, functional, and object-oriented programming.
>>
>>59860835
Yeah I do too but trust me, nobody would want to download some java application. Write the backend in java/whatever you like, and throw together the frontend using the latest hipster js libraries
>>
>>59860854
because in standard english, the default is he, even if you don't mean to gender them.
That's why it's mankind. Man refers to human as well as the male of the species.
>>
File: 1477292895415.jpg (263KB, 1000x670px) Image search: [Google]
1477292895415.jpg
263KB, 1000x670px
>>59860855
>JS is the assembly language of the web
>>
>>59860875
sexist
>>
>>59860691
Well its not that large desu.You should easily handle couple million lines...
>>
>>59860829
You may choose how you interpret my words for yourself anon.
>real and its anti has to be a binary state
No. We wouldn't have any distinction between sci-fi and fantasy if this were the case.
>>
>>59860887
sjw wussy
>>
>>59860895
imam al-akbar
>>
>>59860875
>because in standard english, the default is he, even if you don't mean to gender them.
I'm interested.
Source?
>>
>>59860570
>what is undefined behavior

>>59860712
Yes, go back there.

>>59860724
C# has a REPL?

>>59860755
Array INDEXING is just syntactic sugar for pointer arithmetic.
>>
>>59860875
/G/ demographics is mostly women, so assuming she is most likely correct.
>>
>>59860890
>No.
"x is real" is a proposition. Which means either it is true or its negation is true.
>>
>>59860926
(male)
>>
>>59860926
(You)
>>
>>59860875
The gender neutral is they. There's no "default" in English. If you say he or she there's an assumption made in the literary sense. Even if you didn't really mean to.
>>
>>59860859
Besides hating everything web, I also don't want to bother writing a backend and hosting it.
I know jars are not cool anymore, but JavaFX looks really impressive. I personally prefer CLI, but that would drive normies away.
>>
File: boy-or-boygirl.png (147KB, 798x597px) Image search: [Google]
boy-or-boygirl.png
147KB, 798x597px
>>59860935
>>
File: anal beads.png (13KB, 449x351px) Image search: [Google]
anal beads.png
13KB, 449x351px
>>59860918
>C# has a REPL?
Yes.
>>
>>59860931
You've made that proposition. You can make a proposition about non-binary things.
Stop being retarded anon.
>>
>>59860935
>>59860936
no man would be this bad at programming or tech in general as is displayed here daily.
>>
>>59860963
girls (male) are the best programmers
>>
>>59860944
they is not gramatically correct

stop trying to insert gender politics where it's not wanted
>>
>>59860889
Even if you have to redownload the file every minute to stay up to date?
>>
>>59860944
>The gender neutral is they.
that's plural. there is no singular gender neutral pronoun
>>
>>59860959
A proposition is something which can be only one of these things: true, false.
"x is real" is a proposition. So either x is indeed real, or it's not.
>>
>>59860971
paki
>>
>>59860973
Why would you redownload the JSON for threads on page 8 every minute?
>>
no programming language with

what if( )

for what purpose()

trilean type
>>
>>59860971
>>59860979
they/them can denote a single person you weenies
>>
>>59860971
>they is not gramatically correct
https://en.wikipedia.org/wiki/Singular_they#Older_usage
Stop inserting politics where we already have well established language.
>"If a person is born of a ... gloomy temper ... they cannot help it."— Chesterfield, Letter to his son (1759);[17] quoted in Fowler's.
>>
>>59860990
shut up, tranny
>>
>>59860985
The client has to stay up to date with, so it has to redownload the data set at a fixed interval.
I have to find the lowest post ID and highest post ID in order to calculate the PPH for 4chan. Which means that I have to go through all posts.
>>
>>59860986
>trilean type
So a nullable boolean?
>>
>>59860973
Can you give me small example because what you say shouldnt take that much.
>n (= number of boards) + 1 (for the timestamp) lines
>>
>>59860981
Yes but this is irrelevant to the word real. It's the structure of the question that determines the potential results.
Ignored.
>>
>>59861003
>Which means that I have to go through all posts.
You're incorrect.

I'll hack out a quick solution for this.
>>
>>59861006
How can something be "more" true than something else? That's complete nonsense.
>>
>>59860986
an if statement with more bloat
what even is the second one?
>>
>>59860986
>trilean type
What sort of retarded language doesn't let you define that?
>>
>>59861003
>have to find the lowest post ID and highest post ID
No you don't.
Check the top thread's last post to have a "start" number.
Then just keep checking whatever the top thread's last post number is and compare the difference against the time change.

Check every thread's last post if you want to account for sage replies.
>>
>>59860971
>advocating egalitarianism is "political"
>advocating patriarchy isn't
Really makes you think...

>>59860979
Wrong. It's a form normally used for plurals, but semantically it's singular.

>>59860995
Go back to your safe space, cis scum.
>>
>>59861005
A mock of a single run of the script:
https://pastebin.com/9ZB41XCH
>>
>>59861013
please
>>59861050
You're right. That'll work because the threads are sorted by bump order.
>>
File: anal beads.png (17KB, 1017x159px) Image search: [Google]
anal beads.png
17KB, 1017x159px
>>59861105
There are probably some exceptions to the rule to take into account, but this is a quick hack.

Pic related.
>>
>>59861093
Thats about 500 bytes thats what 30kb per min? Thats nothing you are safe to go without minimizing it in any way
>>
>>59860875
>the default is he
Anon please. hit me up with that source.
>>
>new thread

>>59861075
>>59861075
>>59861075
>>
>>59861151
30kb if you update every second otherwise per hour
>>
>>59861093
>that pastebin

What were you even trying to accomplish?

Pretty sure you fucked up whatever it was.
>>
>>59861185
Keeping track of the posts per hour for each board as a map. The first line is the timestamp.
>>
>>59861246
Look at your pastebin.

Do you think those values are correct?

Did you not notice the fact they just so happen to be in alphabetical order?
>>
>>59861266
It's something I made up as an example. I haven't started writing the script yet.
>>
>when no one in the thread remembers strcspn()
>>
>>59860710
Talk to your professor or TA and explain the situation
Thread posts: 319
Thread images: 29


[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.