[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: 53
File: DPT.png (389 KB, 934x1000) Image search: [Google]
DPT.png
389 KB, 934x1000
What are you doing, /g/?
>>
First for Javascript is a programming language
>>
>>52509824
Learning Haskell.
Getting frustrated.
>>
File: ;D.png (57 KB, 800x334) Image search: [Google]
;D.png
57 KB, 800x334
show me your fizzbuzz
>>
your mom
>>
File: WHAT.png (2 KB, 154x76) Image search: [Google]
WHAT.png
2 KB, 154x76
WHAT'S GOING ON?
>>
>>52509898
lel, kid
http://0.30000000000000004.com/
>>
>>52509898
What do you mean?
0.1 + 0.2 = 0.30000000000000004

Can't you into maths?
>>
>>52509898
Basic understanding of binary representation of floating point numbers is going on.
>>
>>52509824

http://codeshare.io/4chan
>>
File: womm.png (748 B, 136x32) Image search: [Google]
womm.png
748 B, 136x32
>>52509898
Works on my machine.
>>
>>52509955
It depends on the language idiot
>>
>>52509955
>0.3
wrong
>>
>>52509910
But 1 tenth plus 2 tenths should be exactly equal to 3 tenths, not 3 tenths and a bit.
>>
>>52508359
>>52508424
>>52508442
this?
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>

void sleep(float time);

int main()
{
char msg[] ="WARNING: SHITTY CODE IN PROGRESS ";
float freq=0.01;
float amplitude = 40;
float speed =0.02;
int i,j,k,len,s;
char c;

for(i=0;;i++)
{
s= amplitude *(sin(2*M_PI*freq*i) + 1);
for(j=0;j<s;j++)
putchar(' ');
puts(msg);
c=msg[0];
len=strlen(msg);
for(k=0;k<len -1;k++)
msg[k]=msg[k+1];
msg[len -1] = c;
sleep(speed);
}
return 0;
}
void sleep(float time)
{
clock_t time_end;
time_end = clock() + time * CLOCKS_PER_SEC;
while(clock() < time_end);
}
>>
>>52509961
then why do people feel the need to use shit languages?

>>52509971
you're mome
>>
Any amazing tutorial on opengl shaders?

I understand making buffers and pushing data to buffers via opengl api but looking for a tool on linux just to practice developing shaders and reading material that explains whats going on.
>>
>>52510037
>tutorial
>good
pick one
>>
>my language is better than yours because the default precision for printing is smaller and hides floating point errors better
>>
>>52510037
not sure if there is one at all tbqh

look at various things online like the opengl wiki and maybe look in the opengl superbible

also read these for a start:
https://rbt.asia/g/thread/S52403869#p52404910
https://rbt.asia/g/thread/S52403869#p52405043
>>
>>52510091
well, that is a legitimate advantage
>>
File: lu.jpg (30 KB, 396x500) Image search: [Google]
lu.jpg
30 KB, 396x500
Is Beginning Lua a good book?

also wtf is this cover?
>>
Complete beginner here

I'm doing bjarne stroustrup's programming: principles and practice using c++, spent like 2 hours and I can't figure out what's wrong or find a solution online.

the error is unresolved external symbol "int foo", but it's what it tells me to put in the book.

my.h
extern int foo;
void print_foo();
void print(int);


my.cpp
#include "../../std_lib_facilities.h"
#include "my.h"

void print_foo()
{
cout<<foo;
}

void print(int i)
{
cout<<i;
}


use.cpp
#include "my.h"

int main()
{
foo = 7;
print_foo();
print(99);
}
>>
Trying to work out how to read user inputs in C from the console without having scanf blocking since the rest of the code has to be running if there's no input/while waiting for one, any ideas?
>>
>>52510110
>wtf is this cover?
It's a photo of two typical Lua programmers.
>>
>>52510091
Actually it's better because it knows the required precision based on the input used and removes errors automatically so that the programmer can bother fixing actual problems.
>>
>>52510122
Threading
>>
>>52510122
It's called "threading". Have fun.
>>
>>52510110
https://learnxinyminutes.com/docs/lua/
>>
File: OpenGL-ES-2_0-Reference-card.png (2 MB, 1944x1320) Image search: [Google]
OpenGL-ES-2_0-Reference-card.png
2 MB, 1944x1320
>>52510037
>>52510103
also these reference cards give you a quick overview of what's available to you

look into each individual thing that you're interested in on the opengl reference pages
>>
>>52510156
>>
>>52510037
Unless you're looking for help with linear algebra there's nothing special about shader programming compared to regular programming, besides different considerations when it comes to optimization,.
>>
>>52510120
>reading bjarne's book
first mistake
>>
>>52509824
Thank you for using an anime picture.
>>
>>52510178
yes but it's not so easy in the start if you don't have the first clue of what's going on. most tutorials are very bad at explaining things and just throw some code at you to copy.
>>
>>52510205
it's not animated
>>
>>52510120
You didn't define foo anywhere.
>>
>>52510210
I disagree. I think there's a myth around shader programming that makes it seem really arcane or different and people actually fall for it. This may have been true back in the day of writing shaders with vendor-specific assembly when the GPUs were actually quite different from one another, but that's been left far behind.
>>
File: 1448825677254.png (10 KB, 354x432) Image search: [Google]
1448825677254.png
10 KB, 354x432
>>52510127
I see

>>52510153
I already skimmed trough it, but meta programming is completely new to me
>>
>>52510257
opengl in general gets explained very poorly to beginners
>>
>>52510256
doesn't "extern int foo;" define it
>>
File: 1443225682058.jpg (33 KB, 600x360) Image search: [Google]
1443225682058.jpg
33 KB, 600x360
>>52510153
>metatable-based OOP
>>
>>52510315
It's a scripting language
For script kidding yourself
>>
>>52510315
who is this boner moaner?
>>
File: 1449540436324.jpg (236 KB, 560x822) Image search: [Google]
1449540436324.jpg
236 KB, 560x822
>>
>>52509898
Basically, 0.1 in binary is 0.00011001100110011001100110011001100110011001100110011001100110

and 0.2 in binary is 0.00110011001100110011001100110011001100110011001100110011001100. Adding those together give a remainder
>>
File: 1449540488870.jpg (307 KB, 560x822) Image search: [Google]
1449540488870.jpg
307 KB, 560x822
>>
>>52510358
what is this?
>>
>>52510370
HAHA IN YOUR FACE TOLD YOU C++ IS BETTER
>>
>>52510120
>>52510256
no wait I'm seeing what I'm doing, I'm misunderstanding the book
>>
This guy wrote a compiler and bytecode interpreter in minecraft command blocks.
https://www.youtube.com/watch?v=t4e7PjRygt0&app=desktop
>>
File: barely 9000.gif (2 MB, 500x281) Image search: [Google]
barely 9000.gif
2 MB, 500x281
>>52510429
Literally nobody cares.
>>
>>52510457
>>>/out/
>>
>>52510429
>that isPrime function
Awful
>>
>>52510476
Go back to youtube or reddit or whatever the fuck you came from
>>
Anyone got experience with ffprobe? I'm trying to list all the available metadata as json.
>>
File: minecraft.webm (1 MB, 720x404) Image search: [Google]
minecraft.webm
1 MB, 720x404
>>52510429
yes, today minecraft modders are the turing award laureates of tomorrow.
>>
>>52510476
>>52510429
No, you fuck off. Nobody cares about your shitty electronic toys for manchildren
>>
File: VNyk86k.png (651 KB, 1067x800) Image search: [Google]
VNyk86k.png
651 KB, 1067x800
>>52510521
>>
>>52510263
Just read PiL. the old version is available on their site. And newer versions 'around'.
>>
File: 1448473404155.jpg (114 KB, 720x960) Image search: [Google]
1448473404155.jpg
114 KB, 720x960
>>52510370
>javascript has been used server side recently
>>
>>52510602
What's truly disgusting is that it's actually one of the better options for server side dev.
>>
>>52510429
kill yourself

>>52510499
>>99.99% of them really aren't
>>
>>52509982

#include <iostream>
#include <cmath>
#include <unistd.h>
#include <string>

using namespace std;

#define PI 3.141592654/180;

int main()
{
string str ("_-^-_-^-_-^-_-^-_-^-_-^-_-^-LEL");
unsigned long strsize = str.length()-1;
while(1){
for(int i=0; i<360; i++){
if (i%20 == 0){
cout << " ";
double pimag = i*PI;
double sinfunc = sin(pimag) +1;
double space = sinfunc*20;
for(int j=0; j<floor(space); j++){
cout << " ";
}
str = str[strsize] + str;
str.erase(strsize+1,1);
cout << str << endl;
usleep(100000);
}
}
}
return 0;
}
>>
>>52510521
>>52510621
Why are you in a programming thread if you don't like programming?

I don't think you understand how amazing it is that someone wrote a compiler in minecraft command blocks.
>>
>>52510679
amazing, yet very VERY autistic and useless.
>>
>>52510639
>#define PI 3.141592654/180;
stopped reading there
>>
>>52510679
>building a house made of lego is somehow more impressive than building a conventional brick house
>>
>>52510690
good for you
>>
>>52510705
thanks anon :)
>>
>>52510679
Here look at my C interpreter:

#include "filepath.c"

(compile & run)
>>
>>52510689
>VERY autistic and useless.
That's not the point.

>>52510692
Yeah see, you don't understand at all what's going on in the video, your just a retarded fizzbuzzer.
This isn't playing with legos at all.
>>
File: beta squad.jpg (66 KB, 848x640) Image search: [Google]
beta squad.jpg
66 KB, 848x640
>>52510110
>also wtf is this cover?
What do you have against gay couples?
>>
>>52510718
Holyshit you're retarded.
>>
>>52510712
that was sarcastic you autist
>>
>>52510724
ok he made a compiler in minecraft golly gee how fucking impressed i am i should contact all the major newspapers and nominate him for the turing award or someshit
>>
>>52510743
Thanks for noticing.
>>
I want to write a script that uploads lots of thumbnails to google image search, downloads the result web page(text only), and deletes it if "No other sizes of this image found." is present inside.
In the end I want to get filenames of files that can be found in other resolutions.
How do I make that?
>>
>>52510747
turing was probably autistic tbf
>>
>>52510747
its easy to impress manchilds and 12 year olds and unfortunately theres way too many of them.
>>
>>52510818
>>52510747
Let's see what you've made recently, buckaroo's
>>
>>52510841
sorry anon, but all my work is proprietary and owned by my company.
>>
>>52510877
same

i'm never going to post my serious projects/code on 4chan
>>
>>52510877
>>52510888

>I haven't made anything because I've been too busy shitposting and watching anime
Yeah, I figured as much.
>>
File: 1451683583776.gif (2 MB, 400x600) Image search: [Google]
1451683583776.gif
2 MB, 400x600
>mfw finding out I've implemented some CHIP-8 codes in a more restricting manner
So the opcode for loading a group of memory to registers and vice versa doesn't load 16 bytes at a time, it loads up to how many you want. Also the option for adding a number to the I counter has an undocumented functionality where it lets you loop once you hit the end and sets the VF flag to 1. Safe looping means CHIP-8 Snake will be much easier in regards to node manipulation

Things are moving lads
>>
File: x.png (4 MB, 2576x3872) Image search: [Google]
x.png
4 MB, 2576x3872
I'm working on improving a stereovision system.
I found a simple way to find areas in image which are uniform and shouldn't be matched between left-right image pair. I'm computing local standard deviation (in an area 5-21 pixels) and accepting only areas with standard deviation above a certain threshold.
I've implemented this in a fast way by using box blur and squaring operations:
StdDev(Img) = Box(Img^2) - Box(Img)^2

Pic shows image and 21x21 standard deviation. The less uniform the area, the lighter. It turns out to mostly highlight edges but also areas with lots of texture, and is relatively resilient to noise. It kind-of looks like a blurred sobel/laplace.
>>
>>52510788
sounds like a neat idea anon, want to work together at it?
>>
>>52510895
>projecting this hard
ok kid keep playing with your minecrafts
>>
>>52510907
My first post was asking what you've made, I couldn't care less about minecraft. Fact of the matter is, I'm sure it's more than you've done any time recently. No projection. I work full time, I barely have time to program, which changes nothing about my original statement.
>>
>>52510877
Lol cuck.
>>
>>52510933
> No projection. I work full time, I barely have time to program.
>I work full time
>I barely have time to program.

why are you in /dpt/ ?
>>
>>52510974
I read the posts, which over the last few months have only been about OS/language wars, general shitposting, trapfaggotry and little progress/code. Your question is way too valid, and I have no idea anymore.

Are you implying someone who works full time can't be interested in programming?
>>
Does anyone here experience working with the IBM data studio? Could anyone tell me if there is a simple autocomplete function in the damn IDE?
>>
>>52510479
It should have been

for j = 2 to (x - 1) / 2


right?
>>
>>52511027
> Are you implying someone who works full time can't be interested in programming?

I'm implying someone who is interested in programming SHOULD BE programming.
>>
>>52511071
Some of us have responsibilities. One day you'll understand.
>>
>>52511085
>programming can't be a hobby.

geez anon, you're just making excuses now.
stop projecting.
>>
>>52511085
the responsibility to funpost on 4chins?
>>
>>52509961
English, but I think more languages have the same numbers desu, senpai.
>>
>>52511145
someone has to do it.
>>
>>52511132
After working all day, I'm way too tired to think about programming. I try to get some in on the weekends.

>>52511145
Work. Rent. Food. Bills.
>>
std::Stack<BaseState*> stateStack;

stateStack.emplace(new GameState());
stateStack.top()->onEnter();


Does anyone have any idea why this code is executing the base State class's onEnter function rather than the GameState's onEnter function?
>>
File: 83421.png (14 KB, 203x248) Image search: [Google]
83421.png
14 KB, 203x248
>>52511166
>emplace
>>
>>52509898
let's say you can store a decimal number with a limited number of significant figure

like 1 / 3 = 0.333....

if you can only store for example 4 digits then it would be

0.3333

and then 3 * 0.3333 = 0.9999 instead of 1

same principle with 0.1 + 0.2

in decimal (base 10) you can store numbers like 0.3 exactly

in binary (base 2) with a limited number of bits you can't
>>
>>52511166
Why are you using emplace here? It doesn't make sense.
Also, is that function marked virtual?
>>
>>52511196
>>52511222
I was under the opinion that emplace created a new element on the top of the stack, was I mistaken?

And yes, the BaseState's onEnter function is virtual
>>
>>52511166
>using an explicit stack
http://www.gamedev.net/page/resources/_/technical/game-programming/brain-dead-simple-game-states-r4262
>>
>>52509824
Just had to start PowerShell and it drives me nuts since I'm not used to it. Made the same code in bash it runs smooth and perfect "translate" it to ps and it always returns a 0.
hulp
>>
File: 1448224356554.jpg (41 KB, 390x390) Image search: [Google]
1448224356554.jpg
41 KB, 390x390
>>52510594
Yeah, thanks I looked around a bit more an found PiL 3rd edition, currently reading it. So far it really as comfy as some anons say it is
>>
>>52511238
Change it to push, see what happens
>>
File: 1448101989331.png (31 KB, 915x589) Image search: [Google]
1448101989331.png
31 KB, 915x589
>>52510897
It really is inspiring seeing you progress, pleas do continue posting.
>>
>>52511334
I've tried, but there's no change.
>>
>>52511365
post more code
>>
>>52511238
Yes, emplace constructs an element ant that's the problem. The element constructed is of type pointer to base (casted from pointer to derived).
>>
>>52510263
Metatables != metaprogramming
>>
is there a site that will teach me coding 1 on 1 for free? I want to make a better search engine than google
>>
>>52511238
But is it marked as virtual in both classes?
>>
File: 1451683513443.gif (2 MB, 400x225) Image search: [Google]
1451683513443.gif
2 MB, 400x225
>>52511361
That means a lot lad

With my new found info, I'm sure being able to move the snake will be easier (the hard bit was figuring out how to do the conditionals. If you were forced to load or unload all your registers to read/write to memory, you'd have to backup your registers somewhere and shit would get messy. The looping around memory was also a nice touch because finding the tail node was also a stumbling block in design).

I might have it tonight
>>
>>52511400
>better search engine than google
>>
File: 36743.gif (855 KB, 500x281) Image search: [Google]
36743.gif
855 KB, 500x281
>>52511409
>is it marked as virtual in both classes

Does anybody here know C++?
>>
on the other hand my chip 8 project is going well... lol
>>
>>52511438
>Does anybody here know C++?
no this /wdg/, try /dpt/
>>
>>52511427
googlel sux m8
>>
>>52511500
heh
>>
>>52511500
what you're saying is
>i'm gonna make a better algorithm than google even though they spent years perfecting the algorithm to optimize searches

sure go ahead
>>
>>52511531
will you help me?
>>
>>52511400
this is bait

>>52511500
the search engine is good
>>
Google spy on you and profit from it, and so you owe it to them to profit from spying back on them
>>
>>52511561
nah too hard. google search engine is perfectly fine for me
>>
>>52511308
Lua is just comfy. LuaJIT makes it fast. Lua is love and Lua is life.

I have some issues with it that keep it from use as a general purpose system scripting language, mostly just about the addition of integers in 5.3 (they should be a separate type, i.e. type(1) == "integer") and the incompleteness of the metamethods (proxy tables are a fucking dumb idead, make a __get and __set method and register them as fast access metamethods), but also support for zero-basing) but after become well versed in Python I would rather choose Lua and it's idiosyncrasies.

desu, if I could find a sponsor I'd take over the JIT project.
>>
>>52511594
Sorry for the incorrectnesses, I'm tipsy. One too many glasses of brandy. But my opinion is truthful, not a result of drunkenness, Lua is awesome.
>>
>>52511594
kill yourself
>>
>>52511631
Okay. brb... Or not actually.
>>
>>52511410
cool
>>
>>52511594
>>52511629
Dynamic typing is garbage
>I'm tipsy
Not surprising
>>
File: 1453191306930.gif (2 MB, 400x360) Image search: [Google]
1453191306930.gif
2 MB, 400x360
>>52511631
>>
File: 1430444266556.png (835 KB, 1024x1820) Image search: [Google]
1430444266556.png
835 KB, 1024x1820
does anyone here know Unreal Engine 4 Blueprint?
i cant find any good source to learn from
>>
>>52511731
>>>/vg/agdg
Those are the best (well better) people to ask for video game development related questions chap
>>
>>52511738
this

at least for enginebabby stuff
>>
>>52511671
>Dynamic typing is garbage
Nice opinion. Do I need to illuminate you to the fact that the JIT is nearly as fast as your shitty statically typed language? If it's Java or C#, as fast.

When I write in Java I spend too much time worry about properly specifying class relations and also writing any of that shit is just tedious and time consuming. I recently wrote a Java application and finished the algo in like an hour, then spent 4 hours writing the fucking thing because I tried to adhere to all of the goddamn OOP, type abstraction bullshit. Static typing has it's uses, but it's just a waste of time in most applications. That's why dynamic typing is useful. Also weak typed languages are better than strong. There is nothing wrong with C.

If you can't write good software in a weakly typed or dynamically typed language you probably suck at programming and should just stop as soon as possible.
>>
>>52511766
To summarize, static typing is a tool. use it when necessary.
>>
>>52511738
>>52511756

thanks /dpt/, i hope one day i'll be as cool as you.
>>
for i in ("Fizzbuzz" if i%3==0 and i%5==0 else "Fizz" if i%3==0 else "Buzz" if i%5==0 else i for i in range(100)): print(i)
>>
>>52511738
Ow wow, I didn't know about that.

That looks like a fun place to funpost too.
>>
File: B8yoFc1IcAEl5_2.png (36 KB, 473x328) Image search: [Google]
B8yoFc1IcAEl5_2.png
36 KB, 473x328
>>52511766
>Java
You're complaining about Java, not static typing.

>Also weak typed languages are better than strong
pic related

>>52511788
It's never not useful though. It's always better to find bugs at compile time than at run time.
>>
File: ookbuzz.jpg (576 KB, 1349x539) Image search: [Google]
ookbuzz.jpg
576 KB, 1349x539
>>52511822
I'll raise you orangutan fizzbuzz
>>
>>52511822
for i in range(1,101):print"FizzBuzz"[i*i%3*4:8--i**4%5] or i


nice try faggot
>>
>>52511849
>>Also weak typed languages are better than strong
>pic related

>Can't reason through it
You are stupid, obviously. The rules for it are pretty obvious. As is whoever wrote that.
>>
>>52511849
>It's never not useful though. It's always better to find bugs at compile time than at run time.
It's all about development time. If you write your program and it tells you when you run it there are type errors, then there is no functional difference in error checking. Just development time.
>>
>>52511880
>The rules for it are pretty obvious.
Their not really. It's very very easy to end up with bugs caused by weak typing and it happens all the time. There's no benefit to it either.

>>52511899
>It's all about development time.
Precisely. Static typing saves a lot of development time.
>>
>>52511913
>Their not really.
So you are admitting you are stupid. Good luck finding a job.

Dynamic typing saves a lot of time. Not having to build type abstractions actually SAVES time, didn't you know?
>>
>>52511822
for(int i=1;i<101;++i)
cout<<(i%15?i%5?i%3?to_string(i):"fizz":"buzz":"fizzbuzz")<<endl;
>>
>>52511913
Additionally
>>52511941
>Their
Confirmed for idiot.
>>
File: 14457039361390.jpg (7 KB, 232x197) Image search: [Google]
14457039361390.jpg
7 KB, 232x197
>need to read raw image data from files for my toy program
>not sure if I should write a small single file format reader or use a third party library with all the formats
>third party library is very big and has 100 page documentation
>writing png readers is hard
>other formats make too large files for what I want to use
>not sure what to do
>start procrastinating
>get depressed
>haven't programmed in 5 days
Why is my willpower so weak?
>>
>>52511941
>So you are admitting you are stupid.
No, i'm talking about experience in every project that used dynamic languages I've worked on.

>Good luck finding a job.
I actually have a great job, and I actually write a lot of JS in it.

>Not having to build type abstractions actually SAVES time, didn't you know?
What kinds of abstractions are you talking about? There's nothing about dynamic typing that saves any time at all.
>>
>>52511913
>Precisely. Static typing saves a lot of development time.
not according to studies.
>>
What's with everyone fizzbuzzing? that shits fucking worthless as fuck, here's a cool project for those aspiring game designers:

>Noise function to make a light flicker realistically

The aim was to have a light source "flicker" on and off, with rapid flashes but also with periods where the light is completely on. A linear combiantion of sine waves is my first attemp at this, suggestions welcome.

    private static float base = 0.6f;
private static float r;

// Tune these to adjust flicker
private static float min_cutoff = 0.25f;
private static float max_cutoff = 1f;

private static final float[] freq = {0.25f, 3.5f, 2.2f, 1.15f, 14.2f, 30f, 68.01f};
private static final float[] ampl = {0.3f, 0.5f, 0.25f, 0.25f, 0.125f, 0.125f, 0.0625f};

public static float flicker(float t) {
return flicker(t, 0f);
}

public static float flicker(float t, float offset) {
t = t + offset;
r = base;
for (int i = 0; i < freq.length; i++)
r += ampl[i] * MathUtils.sinDeg(t * freq[i]);

// Cutoff frequencies
r = r > max_cutoff ? 1f : r;
r = r < min_cutoff ? 0f : r;
return r;
}
>>
>>52512042
probably some shitty ass studies that didn't include maintenance and continued development
>>
>>52512044
>suggestions welcome
use a better language for game dev
>>
>>52512042
No, according to common sense. I can easily explain many ways that static typing saves time. No one can explain any way that dynamic typing saves time that makes any sense.

Studies neither prove not disprove that static typing saves time, because setting up a way of measuring language productivity is incredibility difficult.
>>
>>52512044
such math
much object oriented
wow
>>
>>52512140
reddit is down?
>>
how can i delete my embarrassing memories, /dpt/?
>>
File: listerino.jpg (15 KB, 256x197) Image search: [Google]
listerino.jpg
15 KB, 256x197
>>52512140
>epic maymays

go diddlyfuck yourself
>>
>>52512164
memories are what defines you
>>
File: 1452092658416.jpg (20 KB, 460x276) Image search: [Google]
1452092658416.jpg
20 KB, 460x276
>>52512164
there is only one way
>>
>>52512164
a generous dose of cyanide.
>>
>>52512183
we don't really know what "consciousness" is, anon
>>
>>52512125
>common sense
apparently not common enough...
well then what's YOUR reasoning?
>>
File: neat.png (9 KB, 325x345) Image search: [Google]
neat.png
9 KB, 325x345
Never knew VS was so user friendly. Only used shit editors up until now.
>>
>>52512262
epic b8
>>
>>52512262
You are still using a shit editor though
>>
>>52512125
>I can easily explain many ways that static typing saves time. No one can explain any way that dynamic typing saves time that makes any sense.
then feel free to enlightening us.
>>
>>52512262
basically any ide can do this
>>
>>52512260
>>52512296
Only among dynamic typing advocates who are simply ignorant about type theory.

And obvious one is static typing catches many kinds of bugs at compile that, and provides a lot of information about the source of those bugs at compile time. These same bugs would otherwise happen at run time in a dynamic language. When these happen at run time they can often take a long time to track down the source of the bug, because undesirable behaviour may only start far away from the code that caused the problem.

Seeing things like a UI field showing "Undefined" or seeing a run time error like "typeerror: undefined is not a function", which are very common in most dynamic code bases are impossible to happen in statically typed languages.
>>
File: 1452125095649.jpg (152 KB, 1280x720) Image search: [Google]
1452125095649.jpg
152 KB, 1280x720
I'm going to order a bunch of programming books from Amazon within the next hour.

I prefer books I can feel over pdfs.

Any suggestions?
>>
>>52512549

i prefer dicks i can feel over pictures of them
>>
>>52512549
What programming topics do you want to read about?
>>
Does anyone know anything about Lainchain? Trying to get it's board catalog JSON, and it just repeatedly throwing exceptions when I try to grab it.

The exact same code works perfectly fine for 8ch and 4chan. Literally no idea why it isn't co-operating.
>>
>>52512670
are you using the vichan API?

https://github.com/vichan-devel/vichan-API/
>>
File: Dlqmnzs.png (36 KB, 878x353) Image search: [Google]
Dlqmnzs.png
36 KB, 878x353
>>52512670
>>52512705

Yup, I've already got it working perfectly for 8ch and 4chan, but I'm failing to even get a response from the server when it comes to Lainchan, it just immediately throws this exception.
>>
File: 1452124713854.jpg (51 KB, 879x879) Image search: [Google]
1452124713854.jpg
51 KB, 879x879
>>52512576
JavaScript mainly, but books for other languages are welcome.
>>
>>52512670
>i heavily rely on someone else's JSON library and have no clue how to trouble shoot it when it stops working

~just webdev things~
>>
File: snake movement.gif (41 KB, 652x578) Image search: [Google]
snake movement.gif
41 KB, 652x578
Labels, whitespace and increased self-knowledge of masking is making development very smooth lads
>>
>>52512743
Literally nothing to do with the JSON, it's purely an issue of an exception being thrown when I try to even download the data

Low quality shitpost, 2/10 for not even reading or correctly understanding the post you were responding to.
>>
File: 1413139477993.jpg (170 KB, 850x1100) Image search: [Google]
1413139477993.jpg
170 KB, 850x1100
Did you make your CV in LaTeX, /g/? Or maybe as a web page? Care to show for inspiration?

Found some decent ones in the archive
>>
>>52512722
As the message says, you have a task which threw an unhandled exception.

Turn on Break on All Exceptions (Debug, Exceptions) and rerun the program.
This will show you the original exception when it was thrown in the first place.

try {
// your code
} catch (AggregateException e) {

}
>>
>>52512352
I know enough type theory. There is no benefit to catching errors at compile time rather than runtime if the scripts are short and execute quickly. Which is exactly the use case of dynamic languages. most development time analysis shows for small programs dynamically typed languages fair better (this may be connected to language feature, but intuitively specifying types take more time than not). this is not the case in large programs however. static typing has advantages there, like you said.

So its all about cost, static typing is a tool which keeps large software from getting unrulely.

Saying static is the only proper method is the unrealistic idealist academic opinion. AKA worthless.
>>
>>52512722
I see the problem but I'm not going to tell you.
>>
>>52512203
it's being conscious.
>>
File: resume1-fs8.png (124 KB, 797x896) Image search: [Google]
resume1-fs8.png
124 KB, 797x896
>>52512785
>>
So, I'm working on a program that constructs random names from a list of phonemes, but I'm fairly newish to software development, so I'm unsure of how to proceed in certain areas.

I want to, somehow, "weight" different phonemes and multi-phoneme constructs to be more likely at the beginning, middle, or end of a name. For example, "son" is more common at the end of a name (eg, "Jackson", "Wilson") than it is at the beginning (eg, "Sonny"). My intention is to give middle, beginning, and end, each their own weight variable as a decimal value, with a total value of 1. Anyone see any issues with this plan?

Secondly, I want to also weight different phoneme and phoneme-constructs to be more/less likely to appear following one another, up to 100% weight (eg X always is followed by Y and only ever Y), and in a way that can be modified programmatically on the fly. An example (from Wikipedia): in English, the sound of "ng" as in "sing", occurs only at the end of a syllable, never at the beginning. However, it can appear at the beginning of a syllable in other languages, such as Māori, Swahili, Tagalog, and Thai. So, I want to be able to say to the program, "This instance treats "ng" as end-of-syllable only, but this other instance treats it as either-or".

Suggestions? I'm having a hard time even figuring out exactly how to store the data on these relationships.
>>
Just started learning php. How can I search an sqlite table for an id and get the info from the columns of that specific id? I basically want to generate a random number between 1-30 and grab the info of the columns that correspond to the number that gets generated. I've set up the database already and have the random number working.Just want to be pointed in the right direction as I have no clue what to do.
>>
File: 1305404915402.jpg (6 KB, 159x200) Image search: [Google]
1305404915402.jpg
6 KB, 159x200
>>52512808
>>
>>52512738
Eloquent JavaScript
Secrets of a JavaScript Ninja
are my recommendations, I've read them and they were pretty enjoyable.
>>
>>52512793
Can't even get the thing to handle the exception properly.

Can't wake up.
>>
>>52512816
Looks god. What did you use? Moderncv?
>>
>>52512800
>making small scripts
>programming
what you're doing is 'scripting' or 'coding'
>>
>>52512822
>each their own weight variable as a decimal value, with a total value of 1.
That's how it's usually done, yes.

>rest
You'll just need to have different likeliness-fields for every single language.
>>
How do you guys structure C projects?

I would ideally use GNU Make to build the project, and have some mechanism for doing unit-level testing.
>>
>>52512936
Go read a book on programming.
>>
>>52512894
I don't recommend Eloquent Javascript, it's written by a male feminist and his ideology seeps into his writing in surprising ways, you will probably not enjoy it.
>>
>>52512961
kill yourself python shitter
>>
>>52512984
while (1):
goto reddit;
>>
>>52512894
>Secrets of a JavaScript Ninja
Why did it have to have such a cheesy name?

>>52512962
I remember seeing [sic] next to "he" when he was quoting someone, I got triggered by it, but it's still a good introduction into JavaScript.
>>
File: 1452802632148.png (17 KB, 418x359) Image search: [Google]
1452802632148.png
17 KB, 418x359
>submit Bash script for class right at deadline
>realise in one of the cases I put a space before the equals sign
>>
>>52509857
stop wasting your time. also kill yourself.
>>
>>52512936
Maybe if you're autistic
>>
>>52512997
literally no u
>>
Working on an android app
>>
>>52510107
Not if the values passed around are inaccurate.
>>
>>52513005
does the professor even run your code?

mine doesn't
>>
>>52513008
what do you even do all day that requires these small """"""""programs""""""""? write web/mobile app shovelware?
>>
>>52512936
there's no difference.
>>
>>52512932
check out creddle.io
>>
File: chip8.gif (80 KB, 961x491) Image search: [Google]
chip8.gif
80 KB, 961x491
>>52513035
useful helper tools
>>
>>52513039
the difference is that your trivial little scripts run like ass and have very poor functionality compared to full-fledged programs
>>
Reminder that dynamic types can be encoded in a static (& dependently) typed system but not the other way around.
>>
What are the comments with male pronouns used for?

I don't think I've ever felt the need to include comments with pronouns in it, but I really want to because of the people who object to them.
>>
>>52513077
>I don't think I've ever felt the need to include comments with pronouns in it, but I really want to because of the people who object to them.

That's just going to make them object more and louder, which is literally the opposite of "ignore them and they'll go away".
>>
Implementing quick sort in java
>>
IT'S OFFICIAL

DYNAMIC TYPING A SHIT

STATIC TYPING MASTERRACE

https://strawpoll.me/6398631
>>
>>52513047
Those are some ugly stars, m8
>>
>>52513090
Ignoring them would be to continue using them, not by giving into their demands.
>>
>>52512962
Why the fuck would someone care about the personal ideology of the maker of the product they are using?
>>
>>52513113
I'm not davinci you melt
>>
>>52513041
>check out creddle.io
Great, hadn't heard of it yet. Thanks
>>
>>52513118
>Ignoring them would be to continue using them, not by giving into their demands.

But you said yourself you've never felt the need to use such comments. So, you're obviously not ignoring them.
>>
>>52510110
I wouldnt waste money on a book. There's plenty of free resources on the web to get acquainted with a new language.
>>
>>52513098
>fags unironically voting for dynamic typing
kill yourself python pisskids and web dev tards
>>
>>52513119
It is a bit sicking when they push their ideology in a programming book.

Is it really necessary to say "he [sic]" when quoting someone? "[sic]" is for spelling mistakes, not to show it's not being inclusive to women.

It is a good book though.
>>
>>52511041
You only need to count up to sqrt(x). If there's any divisor of x, say y, greater than sqrt(x), then x/y is a divisor of x less than sqrt(x) so it's already checked, and you don't need to check for y separately.
>>
>>52513142
>everyone right now are voting for dynamic
KILL YOURSELVES YOU ARE CANCER
>>
>>52513133
Just tell me what those comments are generally used for, anon.
>>
File: 41PO1bThFJL.jpg (23 KB, 304x500) Image search: [Google]
41PO1bThFJL.jpg
23 KB, 304x500
>>52509824

So I spent the last year as a software developer trying to get a sense of perspective. I was pleased to find that Architecture is a sister subject of sorts and most of the things that are happening in software have already happened in architecture.

Has anyone else studied this?
>>
>>52513169
now they're just doing it for the lulz haha very funny
>>
I wish my code wasn't so feminine.
>>
>>52513119
>he [sic]
wow
so progressive
down with men
maybe if i put women on a pedestal i'll get laid

this shit doesn't belong in a programming book
>>
>>52512808
>>52512722

Alright, I'm clean out of ideas, mind giving me a hint?
>>
>>52512800
>There is no benefit to catching errors at compile time rather than runtime if the scripts are short and execute quickly.
That's utterly retarded. Why does it make a difference how short the program is?

>most development time analysis shows for small programs dynamically typed languages fair better (this may be connected to language feature, but intuitively specifying types take more time than not)
No it doesn't.

>So its all about cost, static typing is a tool which keeps large software from getting unrulely.
And also helps you get small scripts working faster.

You still haven't explained a single reason why dynamic typing is useful at all.
>>
>>52513182
I haven't, but the patterns, restrictions, things to consider and general workflow of development can kind of imitate the decisions you make in architecture. Not that it's useful, but it's interesting
>>
>>52513034
yeah he does

it was only one of the bash scripts, just fixed it and submitted it late. it takes a directory as an arg and then if it finds any files that are duplicates it deletes all but the one w/ "lowest lexicographical" name and then creates hard links to the lowest named one
>>
How to architecture:

Pass dependencies explicitly and you will tend to produce a good architecture that is well-decoupled and cohesive, because anything else is a pain in the arse to write.
>>
>>52513234
>anything else is a pain in the arse to write.
Don't forget a pain to maintain as well
>>
>>52513213

The patterns, restrictions, things to consider and general workflow are almost exactly the same and both can be viewed as a series of interconnected patterns that build a living structure.
>>
>>52513234
and use explicit types
>>
>>52513240
Of course, but the point I'm trying to make is that you pretty much have to be starting off working with crutches (e.g. making systems global singletons) to produce a bad architecture.
>>
in terms of required effort to write:
nominal typing > (structural typing = dynamic typing)
in terms of things you have to keep in your head at once:
dynamic typing > structural typing > nominal typing
in terms of required effort when refactoring:
dynamic typing > (nominal typing ? structural typing)
(nominal typing vs. structural typing depends on the kind of refactoring you do: structural typing yields the benefit of being able to change stuff more easily while it imposes a higher risk that you get mismatching things that are not enforced by the compiler, while refactoring dynamic typing is a pain either way since you have to check every single path of execution)
>>
>>52513276
True, I think bad design decisions like those are usually created due to poor foresight and present convenience.
>>
How come realloc is corrupting my arrays after resizing them?

Here's my array
5 4 9 10 7 3 2 1 6

The number of items is 9.
So if I do
arr = (int *) realloc(arr, 9);

the array becomes
5 4 9 10 7 3 134561 0 6
>>
>>52513234

You could inject them! State and all - like beans!
>>
>>52513245
with software the sky is the limit of what you can do with it

architecture is just buildings

the data processing you can do with a program can be far more complex than whatever the building gets used for
>>
>>52513306
Hey guise why don't we use a DI container and turn a large portion of our statically typed code into an ugly dynamically typed scripting language which only works within XML?
>>
>>52513302
>9
>>
>>52513333
oh nevermind i'm dumb
sizeof(int) * 9
>>
File: 8MmVHVZ.png (10 KB, 808x143) Image search: [Google]
8MmVHVZ.png
10 KB, 808x143
>Try
>Catch
>Implying
Thread replies: 255
Thread images: 53

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.