[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: 28
old thread : >>54146482

What are you working on /dpt/?
kek
>>
C# > Java

(or it might be the other way around, I can't remember)
>>
>>54153694
Thinking of making shitty mobile gaym
Trying to get into google tho
>>
>>54153718
Depends on dev staff and if you're working with legacy code.

C# > Java assuming new project, clean slate.
>>
>>54153720
BAN
>>
>>54153718
Other way around, pajeet. C# only works on designated shitting OS
>>
Will functional languages get more relevant as the average number of cores in the typical user's CPU increases?
>>
>>54153694
Why is he wearing a skirt?
>>
>>54153743
>he
Never seen Hellsing huh
>>
D E S I G N A T E D
>>
>>54153741
No, because the majority of devs are unable to learn them

We'll keep repeating the same mistakes for eternity

Locks and mutexes and synchronized keywords
>>
>>54153741
NO IT HAS NOTHING TO DO WITH CPU CORES

FP IS FUCKING IRRELEVANT
>>
>>54153738
>C# only works on designated shitting OS
So Linux, OSX, iOS, Android, and many embedded systems are all designated shitting OSs?

Are you ignorant or deliberately posting lies?
>>
I',m bored need interesting project ideas...
>>
>>54153746
you are a disgusting human being
>>
>>54153738
Mono works on other OS' and it supports C# 5.0.
>>
Any language that does not support tail call optimization is not worthy of use
>>
>>54153746
you fail at life. you are pathetic.
>>
>>54153741
>>54153765
JS is a functional language and it has substantial market share.

v first-class functions
v closures
v map filter and reduce
>>
>>54153787
this

>>54153804
what is tail call optimization
>>
>>54153755
No, I don't watch cartoons
>>
File: 1439903334301.jpg (226 KB, 850x1201) Image search: [Google]
1439903334301.jpg
226 KB, 850x1201
>>54153694
I want a robot waifu for next /dpt/ OP post.
>>
>>54153820
>>54153788
samefag
>>
>>54153821
True. It's a scheme with Java syntax.
>>
>>54153821
>js
>functional
who
>>
>>54153831
>draw a girl
>call it a robot

>>54153839
keep telling yourself that
>>
>>54153821
Giving JS multiple cores to run on is like trying to jerk off a neutered dog.
>>
>>54153862
JS already runs on multiple cores in browsers.
>>
>>54153877
it runs so fucking slowly that it doesn't even fucking matter
>>
>>54153839
gj
>>
>>54153849
To the people who claim Erlang is functional

>my favorite language is relevant too! shut up!
>>
What's the general opinion on Haskell here?
>>
>>54153830
>normie
get out
>>
>>54153907
Basically the best language out there.
>>
>>54153907
- no opinion
- like it a lot
- hate it very vocally
>>
File: haskelel2.jpg (745 KB, 1920x1080) Image search: [Google]
haskelel2.jpg
745 KB, 1920x1080
>>54153907
it's SHIT
>>
>>54153862
>>54153895
JavaScript inherited those features from Lisp.
>>
>>54153907
Basically the worst language out there.
>>
>>54153897
fake
>>
File: 1439903513617.png (730 KB, 962x865) Image search: [Google]
1439903513617.png
730 KB, 962x865
>>54153850
*staaaaare*

>>54153862
My JS genetic algorithm code uses as many cores as you give it, achieving almost ideal scaling. On my current machines it uses 6 cores.

Also note that V8 javascript compiler is the fastest compiler ever written for a dynamic language.
>>
File: gpEUXht.png (85 KB, 740x988) Image search: [Google]
gpEUXht.png
85 KB, 740x988
>>54153897
Why bother with this as proof?
>>
>>54153956
stay delusional FAG

you should seriously get banned for cancerposting
>>
>>54153946
And it really says something that it managed to be worse than a language as simple as LISP
>>
>>54153895
>JS slow
You are a retard.
>>
>>54153966
>V8 javascript compiler
SpiderMonkey is faster.
Both are slower then PyPy or Julia.
>>
File: 1.jpg (83 KB, 830x190) Image search: [Google]
1.jpg
83 KB, 830x190
>>54153839
damn. you got me
>>
>>54153966
And yet it's still an order of magnitude slower than average Java code, that no optimization effort has been put into

>muh genetic algorithm
Like that means anything this century
>>
>>54153984
you're the fucking retard and you should seriously fuck off to /wdg/
>>
>>54153907
It's a meme-tier programming language which pioneered "programming as puzzle-solving" paradigm. It is primarily targeted towards autistic-but-not-bright users that like solving puzzles while programming.
>>
>>54153972
Idk, but seriously why would I tell him twice that he's a disgusting human being? One is good enough to express my opinion.
>>
One day JS will run as fast as C, so it's basically pointless learning C, C++, Java, or any other compiled language now. They're obsolete.
>>
>tfw you do most of your programming in javascript these days
>tfw you're okay with that
>>
>>54154024
lol

where's my JS OS
>>
>>54154012
>autistic-but-not-bright users
aka spergs
>>
>>54154012
>autistic-but-not-bright
So basically, you couldn't figure it out, but you don't want to have to give credit to people who could.
>>
>>54154049
typical delusional sperg

haskell isn't hard and you're not special for using it
>>
>>54154049
rekt
>>
>>54153992
>Both are slower then PyPy or Julia.
Julia maybe, I haven't made a recent benchmark. Pypy is slower than V8 though.
>SpiderMonkey is faster.
[Citation needed] On my app it is several times slower.

>>54153999
>And yet it's still an order of magnitude slower than average Java code, that no optimization effort has been put into
It's 4~5x slower than equivalent C++ version. I can always rewrite hot parts in C++ if I need it.

>Like that means anything this century
It's just a fun hobby, write a simulator for a virtual robot and evolve some behavior to maximize some fitness function.
>>
File: oDCku2OIub5lDuf7fCdTkg-wide.jpg (19 KB, 300x400) Image search: [Google]
oDCku2OIub5lDuf7fCdTkg-wide.jpg
19 KB, 300x400
>>54153907
Protip: /g/ is full of hatred for some reason. So don't ask questions like this.

If you have a question don't ask directly. Post wrong knowledge on purpose and wait for them neckbeards to fix it.

Have a nice day sir ;)
>>
>>54154064
>Pypy is slower than V8 though.
Haven't tested in a while, but last time I did on some mandelbrot test, it was like this.
I wonder how fast will Servo be.
>>
>63 posts
>all basically say ur retarded
>>
>>54154031
Here https://github.com/search?utf8=%E2%9C%93&q=js+os

>>54154026
WHAT you program is much more important than which language you use. /dpt/ really disappoints me with it's choice of programming problems, it's just the same boring college homework-tier stuff. Even game programming is much more interesting than that (maybe that's why it has split into /agdg/).
>>
>>54154108
ur retarded
>>
>>54154108
ur retarded
>>
>>54154089
Servo's going to be cool. Hail Rust!
>>
>>54154108
ur retarded
>>
>>54154024
>One day JS will run as fast as C
*Literally* impossible. It would require it becoming a statically typed language with pointers and value types like int instead of everything being a reference to an object.
>>
File: kill yourself - after cleanup.png (269 KB, 1009x810) Image search: [Google]
kill yourself - after cleanup.png
269 KB, 1009x810
>>54154108
>>
File: 1441576377037.jpg (133 KB, 590x600) Image search: [Google]
1441576377037.jpg
133 KB, 590x600
Can somebody please help me with this problem? I've been stuck on it for the past 2 hours.

I'm saving a byte array in one of my columns in my database (SQL Server 2012), the problem is when I retrieve it the values in the array are different.
>>
>>54154160
make it a hex string
>>
>>54154157
sauce for that ass!!
>>
>>54154188
glitzy.shapemeup.se, glitzan@instagram
>>
File: when_anime_eat_pizza.webm (3 MB, 800x450) Image search: [Google]
when_anime_eat_pizza.webm
3 MB, 800x450
Ask your very much beloved programming literate anything (IAMA)

>>54153992
>>54153966

Common Lisp SBCL:               3.015000773 seconds time elapsed
Dart: 2.585097637 seconds time elapsed
Javascript node.js: 10.406505448 seconds time elapsed
Javascript SpiderMonkey: 10.216595020 seconds time elapsed
Julia: 19.321510121 seconds time elapsed
Python PyPy: 46.487679095 seconds time elapsed
Racket: 3.618877176 seconds time elapsed
Scheme Bigloo: 3.604533288 seconds time elapsed
Scheme Chicken: 7.966139806 seconds time elapsed
Scheme Gambit: 1.932229635 seconds time elapsed
>>
File: pinky_android.jpg (247 KB, 850x1658) Image search: [Google]
pinky_android.jpg
247 KB, 850x1658
Imagine you receive an android body by mail.

It has a 48 Degree-Of-Freedom body with 12 hrs of battery life (avg physical activity) with all necessary sensors (eye CMOS cameras, microphones, gyro/accel, tactile sensors, speech dynamic) and 10-core ARM CPU inside (there is a wifi as well, so offloading computation to the cloud is possible), and a microcontroller for precise motion control linked to main CPU.

You have a full access to software and firmware, you can use standard dev tools (compilers, runtimes) and OSes for main CPU and the microcontroller.

How would you program it?
What are the main technical problems in this project?
Which approaches/methods/algorithms would you use?
Which software would you use?
>>
>>54154224
nice irrelevant shit bench
>>
>>54154224
Which benchmark is it?
Interesting.
>>
>>54154237
i would sell it on ebay
>>
>>54154250
It's whichever one favors his favorite languages
>>
>>54154145
Asm.JS

>*Literally* impossible. It would require it becoming a statically typed language with pointers and value types like int instead of everything being a reference to an object.
It's not as simple as you say, many types are already stored in primitive value type (double). It is possible to have a stricter static subset of language that is as fast as C. Javascript/ASM.js and Python/Numba demonstrate this concept.
>>
>>54154237
I'd dress it up like an anime and try to cuddle with it
>>
>>54154258
You are boooring, anon
>>
>>54154250
it's the one that he kept secret for months on end because "muh schrödinger" (but still posted the results in almost every /dpt/ thread) and it said C++ was like hundreds or thousands of times slower than C and then when he finally posted the code someone immediately pointed out a flaw
>>
>>54154285
Literally impossible.
>>
>>54154301
your premise is boring

we have robots already

we don't have muh AI meme

and muh cloud meme sucks, too much latency
>>
>>54154328
>asm.js
>numba

I'm saying about restricted subset of a base dynamic language, of course. I don't see what is impossible here.
>>
What do you listen to while programming? Kpop/weebs need not respond.

I prefer some nice melodeath: https://www.youtube.com/watch?v=kR-UCNF9BeU
>>
>>54154370
nigga music

https://www.youtube.com/watch?v=vJwKKKd2ZYE
>>
>>54154173
I just tried that and the values are still ending up different. Any other advice?
>>
>>54154285
>Javascript/ASM.js
Still not as fast as C.
>>
>>54154336
>we have robots already
We don't have a light, safe, affordable robot body, anon. We have something which may be close but not there yet https://www.youtube.com/watch?v=YvbAqw0sk6M

>we don't have muh AI meme
You don't need AI to make robot walk and obey simple commands. (Probably you don't need AI to emulate the behavior of your average female gf too).

>and muh cloud meme sucks, too much latency
With in-home server it could be done with 5-10 ms latency.

also if
>here is your robot gf! program it!
is boring for you then I don't know what is interesting. What could be more cool than programming your own robot gf?
>>
File: JZB0U0Y.jpg (120 KB, 612x612) Image search: [Google]
JZB0U0Y.jpg
120 KB, 612x612
>>54154242
>>54154269
>>54154312
Please, don't bully.

>>54154312
The only flaw was due to C++11 and has been fixed with C++14 (but not completely).
>>
>>54154336
Who needs AI when you can just program your qt android bot to act like a qt anime gril?
It doesn't have to be realistic or responsive, but I'm sure anyone could appreciate WaifuOS 1.0 when everyone just wants their android bot to act cute.
>>
>>54154402
something else is wrong
>>
>>54154429
>You don't need AI to make robot walk and obey simple commands. (Probably you don't need AI to emulate the behavior of your average female gf too).
You need AI, gosh people are retarded
wikipedia/AI_effect
>>
>>54154357
Any language with dynamic types cannot be as fast as an optimized statically typed one. There's just too much extra work that it must necessarily do at runtime.
>>
>>54154440
I'm writing a simulator t b h f a m
>>
>>54154480
I understand your point, but you don't need anything more than ZMP algorithm for walking and basic string pattern matching for matching commands. These are plain algorithms that don't require any learning.

You would need modern AI/ML for computer vision and voice recognition, but I haven't mentioned these tasks in that simple example.
>>
>>54154526
still AI my friendo
>>
>>54154482
*yaaawn*

read about type inference in dynamic language compilers. It eliminates most of the dynamism. The techniques are 30 years old.
>>
>>54154526
>walking
>matching commands
for literally what purpose

are you gonna use it as a glorified sex toy? most tasks it could do outside of human interaction would be better done by specialized machines
>>
>>54154458
fuck you
>>
>>54154545
Well, you can call it like that, in principle. It's like game AI.
>>
>>54154582
>doesn't post code
stop asking for help if you don't want it
>>
>>54154584
Honestly despite me whining about the AI effect, it's good for AI progress in the sense that we're constantly pursuing true AI; if we accpeted what we have as AI (which obviously it is) then there would be less of a push to develop further
>>
>>54154571
>most tasks it could do outside of human interaction would be better done by specialized machines

You are blind if you don't see all the cool domestic tasks you could offload to the robot which has the same basic capabilities as your own body. Do you like housework this much?

Also
>are you gonna use it as a glorified sex toy?

>Implying having a loyal robot gf that does housework and sex is something bad
>>
>>>54154012 It is primarily targeted towards autistic-but-not-bright users that like solving puzzles while programming.
Oddly enough, that accurately describes me. Does it work well for it's target audience, or does it just try to look like it does?
>>
>>54154613
10/10 response desu
>>
>>54154237
>company holds contest
>sends 10 free android dev kits to 10 lucky developers
>only condition is they have to open source their firmware
>all of them write a sexbot OS

lol
>>
>>54154554
30 years old and they still haven't delivered on what we were promised.
>>
>>54154613
you're dreaming. maybe in 20+ years
>>
>>54154652
>v8 engine

think they have though
>>
>>54154661
Nope. Still slower than static languages.
>>
>>54154657
20 years tops
it could be 5 years if more resources were put into it, but we'remore concerned with cars and mars
>>
>>54154657
https://www.youtube.com/watch?v=YvbAqw0sk6M
https://www.youtube.com/watch?v=hdlFHATEquk

The hardware is almost good enough. With more money it could be made good enough.
>>
>>54154370
ayy

https://www.youtube.com/watch?v=OXSd-WyrtfA
>>
>>54154701
i'm mainly thinking of the software
>>
>>54154673
>Not embedding V8 into his C++ app
>>
>>54154701
I don't get why we just *have* to make them human-like. Shitty example but the sort of 'helper bots' in games like Fallout are very inhuman because it's more efficient for their tasks
>>
>>54154701
She walks like benders strut walk lel
>>
In C++ even if I run
cin.ignore(std::numeric_limits<std::streamsize>::max());
or
cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
after cin.getline() the next call for input still enters itself automatically as if there's something in the input buffer. I can't post the whole thing, but any idea why?
>>
>>54154370
https://www.youtube.com/watch?v=BF1DQr5dKW8

You were my oppressor
And I, I have been programmed to obey
Now, you are my handler
And I, I will execute your demands
>>
>>54154726
There are some marketing-related and some practical considerations. One of them is that our world is build for human-like two-legged two-armed beings.

Of course there are lots of potential designs that will work.
>>
>>54154370
https://www.youtube.com/watch?v=IIj7j7mtNS4
>>
File: 3376639_300.jpg (29 KB, 300x300) Image search: [Google]
3376639_300.jpg
29 KB, 300x300
My mind was lost in translation
And my heart has become a cold and impassive machine
>>
>>54154830
https://www.youtube.com/watch?v=jPiUN8fb3Og
>>
>>54154716
What do you even think about software?

If the best you can do is writing /dpt/-tier console hello worlds then ofc robot control software will seem like something impossibly complex (for you).
>>
>>54154934
what are you on about, faggot?
>>
>>54154934
if the robot is working in something like a typical real-life kitchen, it's MUCH more difficult than e.g.programming a factory line robot/machine
>>
File: tasks.png (29 KB, 267x448) Image search: [Google]
tasks.png
29 KB, 267x448
>>54154934
>>
>>54154973
>>54155005
Of course it is complex, but this problem can be
1) formalized
2) simulated
3) solved by handcoded or machine learning solution

Saying "ohh it's too complex, it won't be done in 20 years" is stupid. Everything we see now is mind-bogglingly futuristic for a person from 20th century and yet it has been done by mostly ordinary people like you and me. Especially in programming.
>>
>>54155093
you could literally become a billionaire if you knew how to do it properly. yet you're in /dpt/ sperging about it.
>>
Programming Challenge!
Make a program that checks if a string is a pangram.
>>
>>54155118
I know my limits, of course. I just do robotics as a hobby without ambition of becoming a millionaire (cooler hobby than learning 100th autistic programming language IMHO).
>yet you're in /dpt/ sperging about it.
I'm building a simulator with scenarios like "humanoid robot in a kitchen" in mind.
>>
>>54155160
well good luck with that
>>
>>54155159
Ruby:
def is_pangram?(str)
("a".."z").all? { |c| str[c] }
end
>>
How different is GLSL from C?
I just learned you can't do C style casts in glsl.
>>
>>54155174
It's not that hard, just learn some physics, 3D math and use Open Dynamics Engine.
>>
word eight_bit_multiply(byte a, byte b)
{
//Takes 2 8-bit numbers and returns a 16-bit product
//Could be of useful for situations where an ALU doesn't have multiplication opcodes

word product_1 = 0, product_2 = 0;
byte carry = 0;

if (((a & 0x0F) != 0) && ((b & 0x0F) != 0)) //anything times 0 is zero, don't need to use lookup table
{
product_1 |= (digit_products[(a & 0x0F) - 1][(b & 0x0F) - 1] & 0x0F); //set low nibble of low byte of product
if (digit_products[(a & 0x0F) - 1][(b & 0x0F) - 1] >= 16)
carry = (digit_products[(a & 0x0F) - 1][(b & 0x0F) - 1] & 0xF0) >> 4; //set carry if rolled over
}

if (((a & 0xF0) != 0) && ((b & 0x0F) != 0))
{
product_1 |= (((digit_products[((a & 0xF0) >> 4) - 1][(b & 0x0F) - 1] + carry) & 0x0F) << 4); //set high nibble of low byte of product
if ((digit_products[((a & 0xF0) >> 4) - 1][(b & 0x0F) - 1] + carry) >= 16)
product_1 |= ((word)((digit_products[((a & 0xF0) >> 4) - 1][(b & 0x0F) - 1] + carry) & 0xF0) << 4);
}
else if (carry > 0) //if the next nibble is 0 but there was a carry, add it
product_1 |= (((word)carry) << 4);

//clear carry
carry = 0;

if (((a & 0x0F) != 0) && ((b & 0xF0) != 0))
{
product_2 |= ((digit_products[(a & 0x0F) - 1][((b & 0xF0) >> 4) - 1] & 0x0F) << 4); //set high nibble of low byte of product
if (digit_products[(a & 0x0F) - 1][((b & 0xF0) >> 4) - 1] >= 16)
carry = (digit_products[(a & 0x0F) - 1][((b & 0xF0) >> 4) - 1] & 0xF0) >> 4;
}

if (((a & 0xF0) != 0) && ((b & 0xF0) != 0))
{
product_2 |= ((word)((digit_products[((a & 0xF0) >> 4) - 1][((b & 0xF0) >> 4) - 1] + carry) & 0x0F) << 8);
if ((digit_products[((a & 0xF0) >> 4) - 1][((b & 0xF0) >> 4) - 1] + carry) >= 16)
product_2 |= ((word)((digit_products[((a & 0xF0) >> 4) - 1][((b & 0xF0) >> 4) - 1] + carry) & 0xF0) << 8);
}
else if (carry > 0)
product_2 |= (((word)carry) << 6);

return product_1 + product_2;
}
>>
>>54155159
string s = str;
string result = "";
int hist[26] = {};
for (int i = 0; i<str.length(); i++) {
hist[s[i] - 'a']++;
}
for (int i = 0; i<26; i++) {
if (!hist[i])
result += (char)(i + 'a');
}
>>
>>54155159
pangram a = (sort $ nub $ map toLower $ filter isAlpha a) == ['a'..'z']
>>
>>54155159
didn't even test it, lol
int is_pangram(const char *str)
{
size_t len = strlen(str);
char checklist[26] = { 0 };
size_t i;
for (i = 0; i < len; i++)
{
if (isalpha(str[i])
checklist[toupper(str[i]) - 'A'] = 1;
}
unsigned found = 0;
for (i = 0; i < 26; i++)
{
if (checklist[i] == 1)
found++;
}
return (found == 26);
}
>>
>>54155195
It's pretty similar. A few more keywords and a few restrictions on what you're allowed to do.
Casts in GLSL is
highp float flt= float(integer);

If you didn't know.

Either way the syntax is so basic it's nothing you have to worry about really. Shader programming is just complicated in math, not as systems or memory management.
>>
gcc > clang
screen > tmux
emacs > vim
gnu/linux > freebsd > openbsd
libev > libevent
>>
>>54155641
1) no
2) no
3) no
4) ok
4) ok
>>
>>54155495
Should I try to stop thinking it's like C?
Because the example code in my book assume all the glsl builtin types have member variables.

Also, the example code in my book brings up errors and doesn't compile.
void main(void)
{
/* normal MVP transform */
vec4 clipCoord = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_Position = clipCoord;
/* copy primary color */
gl_FrontColor = gl_Color;
/* calculate NDC */
vec3 ndc = clipCoord.xyz / clipCoord.w;
/* map from [-1, 1] to [0, 1] before outputting */
gl_SecondaryColor = (ndc * 0.5) + 0.5;
}
...
0:2(170): error: assignment to read-only variable 'gl_SecondaryColor'
0:2(170): error: value of type vec3 cannot be assigned to variable of type vec4
>>
File: 1461158073869.jpg (5 KB, 250x143) Image search: [Google]
1461158073869.jpg
5 KB, 250x143
What is the best programming language and why is it python?
>>
>>54155188

There's a similar C# solution, just no alpha ranges. :(

static bool pangram(string s)
{
return "abcdefghijklmnopqrstuvwxyz".All(x => s.ToLower().Contains(x));
}
>>
File: carmack.jpg (2 MB, 1819x1866) Image search: [Google]
carmack.jpg
2 MB, 1819x1866
>tfw looking through Quake3 Networking design

How can one programmer be so based?
>>
>>54155690
deprecated as shit get a new book
>>
>>54155690
>the example code in my book assume all the glsl builtin types have member variables
https://www.opengl.org/wiki/Data_Type_(GLSL)#Swizzling
https://en.wikipedia.org/wiki/Swizzling_(computer_graphics)
>>
>>54155690
Whatever you're learning it looks pretty ancient.
I'm confident there's better learning materials for you.
>gl_SecondaryColor
I don't really think that belongs at all in a vertex shader.
>>
>>54155788
you obviously haven't seen Santiago Gonzalez then
>>
#include <stdio.h>

int main(){

int c = 5, d;
d = ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c;

printf("%d\n", d);

return 0;

}


How much is d?
>>
>>54156016
About 7.5 inches
>>
>>54156016
do your own homework.
>>
>>54156016
UNDEFINED YOU FUCKING IDIOT. IT'S BEEN UNDEFINED SINCE YOU ASKED LAST THREAD NOTHING HAS CHANGED
>>
>>54155711
It's Python. Just wish there was something compiled general-purpose that I liked just as much.
>>
>>54156016
undefined
>>
>>54156083
Nim has syntax similar to python if that's what you're after
>>
>>54156078
Do you ever leave /g/ and go for a walk? It seems every time I'm here, you're here too. Don't you have better stuff to do than writing programs no one will never know of or use?
>>
>>54156130
why you gotta get so mad, he called out your shitty troll post is all.
>>
File: java.jpg (221 KB, 1024x768) Image search: [Google]
java.jpg
221 KB, 1024x768
I heard C is better than Java
>>
>>54156125
I tried Nim, did quite a few programming challenges with it (a really popular one too: Advent of Code it was called, I think). I liked it, for the most part -- but I had long talks with the developer (who seems kind of eccentric) in the IRC channel and ran into some very strange cases with how memory is handled and type variants.

So, I'm looking for something different but in the same vein. Thanks for the otherwise great suggestion however.
>>
>>54156130
not everyone who writes in all caps is the same person
>>
>>54156163
anything is better than java but you should shut the fuck up
>>
>>54156266
>anything is better than java
nice meme
>>
>>54156272
Well, almost anything.
>>
>>54156334
for you
>>
>>54156096
>>54156078
Not him. That's really frustrating.
I don't see the justification for not making it
6+7+8...+18
>>
>>54156406
Wait nevermind. It's not initialized.
I'm gonna be yelled at before this is posted I bet.
>>
Almost finished fully reversing the Steam controller.

Already have all that matters done. today got the led intensity control and the on/off sound changing reversed.

Only missing things are the firmware version and battery status, but I just managed to get the controller to give me the packet with at least the firmware version in it, now I just need to figure out its format.
>>
>>54156406
performance reasons

like foo() + foo() * 2, the compiler is allowed to reorder it like foo() * 2 + foo()

>>54156417
it's initialized
>>
>>54156406
IT'S UNDEFINED, YOU FUCKING PRICK!
>>
>>54156455
>it's initialized
You're right. I'm not thinking straight.
>performance reasons
Ok I guess.
>>54156469
Gosh so sorry.
>>
hey /dpt/, novice here
using Java, if you have a class that's completely full of static methods, is there any reason to create an object to use it instead of just referencing it directly?

e.g.
SomeClass someObject = new SomeClass();
int x = someObject.parseSomething(someString);


as opposed to just

int x = SomeClass.parseSomething(someString);


where everything in SomeClass is static
>>
>>54156087

IEEE is the Institute of Electrical and Electronics Engineers. It's a standards organization. In the context of my comment, it's referring to IEEE 754, which is a standard for floating point numbers. They're good for fast arithmetic involving real numbers, and even have hardware support in a number of instruction set architectures for various operations on them. What they suck at is accuracy. The reason is that just as it's a bit difficult to represent numbers such as 1/3 in base 10, it's difficult to represent things like 1/10 in base 2. So adding 1/5 and 1/10 in base 2 is like adding 1/3 and 2/3 in base 10, and we end up with 0.30000000000000004 in floating point just like we'd end up with 0.9999.... == 1 in our own decimal system.

https://en.wikipedia.org/wiki/IEEE_floating_point

(other thread 404'd. Hopefully Anon is around in this thread to receive my answer).
>>
Octave/Matlab newfag here. How would you solve this:

you have a bunch of vectors
k1=[7 3 0]
k2=[5 2 2]
k3=[1 0 6] and so on

I want to add x of these vectors (one can be used more than just once) so that the result will be (for example) [n1>= 35 n2>=54 n3>=20]

Help is much appreciated.
>>
Whoops, didn't know this thread was already here

Is there a C or C++ builtin or intrinsic that does arithmetic right shift since >> is implementation defined?
>>
>>54155788
if ( trunc == fullFloat && trunc + FLOAT_INT_BIAS >= 0 && 
trunc + FLOAT_INT_BIAS < ( 1 << FLOAT_INT_BITS ) ) {
// send as small integer
MSG_WriteBits( msg, 0, 1 );
MSG_WriteBits( msg, trunc + FLOAT_INT_BIAS, FLOAT_INT_BITS );
} else {
// send as full floating point value
MSG_WriteBits( msg, 1, 1 );
MSG_WriteBits( msg, *toF, 32 );
}

>no reason to do this anymore
Right? He's figuring out if he wants to send his packet using small integers or full floats.
How long did this game take to make? Seems pretty nuts if they have this kind of stuff spread all over.
>>
>>54156587
Oh, and i have to know which vectors were used in the combination.
>>
>>54156172
>ran into some very strange cases with how memory is handled and type variants
Mind describing them? I'm curious.
>>
>>54156529
no and infact doing so is will generate a compiler warning
>>
>>54156681
alright, thanks
tried the first part and didn't get a warning though
>>
File: assteroid.webm (328 KB, 865x678) Image search: [Google]
assteroid.webm
328 KB, 865x678
>>54153694
I went ahead and started with the asteroid code just to take a break from lighting computations. I made some changes to my sphere class to put some noise throughout the surface but this isn't really what I want so I'm going to have build something from the ground up I think. Also, there's this really ugly lip where the surfaces don't line up. I think the triangles are all facing the wrong direction because the lighting code works backwards also. Anyway, that's all I got today I didn't have a lot of time.
>>
I'm writing a simplified getopt(3) just because I want to see what it would be like. So far I've come up with a way to get all the characters one at a time, which was harder than I thought it was going to be. inb4 coding style.

#include <stdio.h>

char *s, **argp;

int walk(char **argv)
{
static int init = 1;

if (init) {
argp = &argv[1];
s = *argp;
init = 0;
}
while (*argp != NULL) {
if (*s)
return (unsigned char) *s++;
++argp;
s = *argp;
}
return -1;
}

int main(int argc, char **argv)
{
int c;

while ((c = walk(argv)) != -1)
putchar(c);
putchar('\n');
return 0;
}
>>
>>54156859
Isn't it not an asteroid by definition if it has enough gravity to collapse itself into a sphere?
>>
>>54156917
no it also needs to clear the area around itself as well
>>
>>54156621
Ugh let me see if I can remember.

With type variants it wasn't possible to actually have variants with members that differed in the type with the same name (acceptable) but it also simply wasn't possible to have members with the same name and same type in branches. So you are forced to create variable types with different member names of the same type and write custom accessors (basically type-compatible procs) that transparently return the correct attribute based on the type used... which is retarded.

Araq the developer basically just went "no, fuck you, muh memory layout" when it was brought on GitHub IIRC.

There also was this which this guy had brought up on IRC: https://github.com/nim-lang/Nim/issues/3628 and I personally agreed with. Here again Araq just went: No, fuck you basically.
>>
>>54156995
that's for a planet
>>
I am working on a *basic* twitter crawler/scraper. I avoided using Twitter's API because it seems to involve some type of registration. I don't need to register to view tweets in my web browser, so for the time being I'm not going to register for my shitty python program.

I have it working. I give it a url to a user or list and it returns the last 19 tweets.

If I am using a web browser, the same thing happens. The difference is that when I scroll to the bottom of the page, twitter loads up more tweets. I *assume* this is accomplished in javascript.

Do any of you have experience with crawling/scraping? What do you use to manipulate JS on a page? From my research it looks like I could use one of the following:
1) Selenium
https://seleniumhq.github.io/selenium/docs/api/py

2) ghost.py
https://ghost-py.readthedocs.org/en/latest/

3) Web kit library (part of QT --> python-qt4)
https://impythonist.wordpress.com/2015/01/06/ultimate-guide-for-scraping-javascript-rendered-web-pages/

What do you guys think? All I want to do is simulate scrolling to the bottom of the page to activate the JS to get more results.
>>
>>54156995
disregard >>54157023 i'm not thinking straight i don't know the definition of an asteroid
>>
>>54157011
>>54156621
To sum up the point (quote from the bug report):

The Nim docs state: "The assignment operator copies the whole array contents." -- I assume the behavior for sequences is similar. The current behavior would be fine and expected if the children proc returned seq[Node], but it returns var seq[Node] which I expect to stay a reference to the returned data structure even after assignment to a variable in the main proc.


So the var-keyword is basically useless in that scenario, because the array is copied during assignment; either forcing you to use pointers directly, which Nim is discouraging you from doing or not assigning the var reference at all to an identifier but instead using the return value of the function call (accessor) immediately, without storing it somewhere -- because this prevents the copy-on-assignment bullshit.

I just think it's really not very transparent and doesn't seem very intuitive.

So that and various bad and/or missing documentation, arguments between the main developer and the guy who created Nimble the package manager/project builder (Araq doesn't even use it afaik) turned me off of Nim unfortunately. At least for now.
>>
>>54157033
You could use Charles MITM Web debugging proxy to see how exactly the new tweet content is retrieved, or alternatively Firefox/Chrome's web inspector.

If you don't want to do that I recommend Selenium -- but this will be magnitudes slower than doing "low-level" HTTP requests. Alternatively consider creating a tweet applet widget (you won't really be using it), getting the data-id from it and scraping only the content returned by it (again inspect the web traffic). This is much more reliable than scraping the full webpage, I am speaking from experience.
>>
>>54157072
>"The assignment operator copies the whole array contents."
Csharts that overload == to compare by value will defend this
>>
>>54153694
Hellsing Ultimate was shit and so is C# and C++.

Programming in C all day baby.
>>
>>54157135
>Programming in C all day baby.
Embedded developer?
>>
Finished writing my random image downloader in C, after cleanup I'll integrate it with dwm so i get new background every set interval.
>>
>>54157174
> image downloader in C

wew lad
>>
>>54156859
>there's this really ugly lip
mirror your edges. done.
>>
>>54153694
hey /dpt/, new programmer here.

I took a challenge off the /g/ challenge image and it was to make an encryption/decryption algorithm. I think I have a good idea of what I want the encryption and decryption to be like, but I'm not so sure about the whole algorithm thing.

What's the best language for making an algorithm like that? Would the language matter? I read about the whole "choose the right tool for the job" thing but I'm not so sure what tool would be good for this.
>>
>>54157219
basically any language and for that level of encryption speed doesn't matter so you might as well use python since its easy,
>>
File: 1460361021016.jpg (19 KB, 552x414) Image search: [Google]
1460361021016.jpg
19 KB, 552x414
I want to get into the whole web framework thing with python, but not sure what to use.

Django, Flask and Pyramid seem like the most popular options, which would make me the most $$$?
>>
>>54157263
ruby on rails
>>
>>54157277
I've seen a lot of shitposting about this, is it actually worth learning?
>>
>>54157263
Django, probably.
>>
>>54157172
he's a sperg
>>
>>54157310
yes
pretty much everything and anything is worth learning in programming anon. make yourself more varied. dont be some mindless java-one trick pony faggot like the others.
>>
>>54157263
literally >>>/g/wdg
>>
>>54157310
no it has become completely irrelevant by now. django if you insist on doing disgusting webshit
>>
>>54157174
this would have taken you less than half an hour to write in Python
>>
>>54157346
>webfag talking down on others
>>
>>54157378
I know but it would be really ugly if i were to use it as a patch in dwm which is C only and calling python from C is meh.
>>
>>54157107
>You could use Charles MITM Web debugging proxy to see how exactly the new tweet content is retrieved, or alternatively Firefox/Chrome's web inspector.
I don't know what the MITM web debugging proxy is but I will look into it. As far as the web inspector is concerned: What should I be looking for that could help me trick twitter into issuing more tweets? I used Firefox to save the page, and it downloaded everything. I have the images, html, and JS files. I know that the pagination happens in a file called timeline.js and I found the code that accomplishes it. But I know almost nothing about JS, so I know what it is doing...but I really don't know what it is doing (if you know what I mean).

If I could bypass using something like Selenium I would be happy.

>this will be magnitudes slower than doing "low-level" HTTP requests.
I am somewhat of a beginner. I have spent the past month learning beautifulsoup and HTML in general. And in the past week I have been working though tutorials on the python library Requests (although it looks like that won't help me in this case).

If you have any suggested readings that I can access online I would welcome it. If I could do this webscraper without installing a bunch of other stuff that would be great.

Thanks for the reply.
>>
>>54157033
>I avoided using Twitter's API because it seems to involve some type of registration. I don't need to register to view tweets in my web browser, so for the time being I'm not going to register for my shitty python program.
cancer

you're more likely to get blocked by not using the API, same reason why it's in the rules to use the 4chan API
>>
Making a pedometer with a Zybo board and an accelerometer. Goddamn configuring the hardware on this thing is a bitch. The C++ application is already written for the most part, got the easy shit out of the way.
>>
>>54157481
>it's in the rules to use the 4chan API
nvm i'm not finding it in the rules well i'm off to bed anyway fuck you
>>
>>54157407
I'm sure there's a way to set your wp from the shell at least? It could be shell + python or something
If it didnt take you that long and/or the functionality it gets from being compatible with dwm is worth it then its fine
>>
Can someone explain this code to me. It's a solution to a problem on codefights and I just would like to know how it works
char r[9], *p = r + 8, *Base20(int n) {
do
*--p = n % 20 + 48 + n / 10 % 2 * 7;
while (n /= 20);
return p;
}
>>
>>54157556
Which language?
>>
>>54157543
it would have taken under hour if i werent retarded. Curl is actually really easy to use i had more problem with parsing simple html and concatenating strings than downloading.
>>
>>54157599
c++
>>
>>54157667
Strange syntax.
>>
>>54157556
>>54157667
I never knew that you could declare a function together with other variables in C++. I wonder if C allows that too.
>>
>>54157441
I will give you a bunch of keywords and you will google them:

requests, bs4 (BeautifulSoup 4), html5lib. -- This is for low-level stuff. MechanicalSoup is also available, which is a mix of all three more or less -- looks promising for a beginner.

Selenium, Selenium-Requests (this is for "high-level" browser automation)

Charles, Web Inspector (check the Network tab, reload the page, scroll down on Twitter until new requests appear with JSON in it or something).

Python JSON module, tinydb.
>>
>>54157703
it's just
char r[9];
char *p = r + 8;
char * Base20(int n) {
//...
}
>>
>>54157732
C++ has really stupid design choice.
>>
>>54157072
Yeah, copying on var is really annoying, I usually work around by replacing this:

var a = obj.arrayField


with

template a = obj.arrayField


but the first really should work.
>>
>>54157481
>you're more likely to get blocked by not using the API
How would they know that I am using Python instead of a web browser?

>>54157508
>i'm off to bed anyway fuck you
Th-thanks, I will.
>>
>>54157732
What does
char * Base20(int n) {
//...
}

do?
>>
>>54157756
Back when I used Nim the template thing didn't work transparently in all cases. There were errors during the AST template modification or something, especially when you tried to return somewhere around it -- it was quite a while ago unfortunately.

However I shouldn't be forced to substitute parts of the AST at compile-time just to get sane behavior -- and you seem to agree. Maybe I should revisit Nim, but I have a feeling I'd just be disappointed again.

The tooling is just bad too.
>>
>>54157762
User-Agent, you aren't loading all resources, there's certain requests made to the website using JavaScript only etc. etc. -- there's a plethora of ways.
>>
>>54153933
Do you have haskelel1.jpg?
>>
>>54157197
Not that guy but what do you mean? Wouldn't mirroring the edge break the pattern?
I don't even see how we can be sure it helps.
>>
>>54157810
>User-Agent
This can be set in a number of ways in python

>you aren't loading all resources, there's certain requests made to the website using JavaScript
But isn't that what programs like Selenium accomplish?

I'm not attempting to make hundreds of requests to Twitter. I would like to view tweets made over the last 24 hours. And it would be swell if I could do that without having to register with Twitter.
>>
>>54157395
>implying i'm a webfag
I'm a softwarefag thanks. if you honestly disagree with what I said then you're probably one of those retarded memlord "coders" who will never amount to anything or make anything substantial.
>>
>>54157925
I know that I can dude, I have been webscraping with Python for years.

And yes, that's exactly what tools like Selenium etc. do since they are using _real_ actual browsers.

Twitter won't ban you for this, there are a million and one apps doing this and unless you are flooding the network with traffic they won't block you -- and even if they will, it's only temporary.

Check out Selenium-Requests if you easily want to emulate a real browser's headers/behavior to an extent -- but you certainly don't need to.

I would just recommend changing your user-agent at least to something regular and for you to use the highly-recommended requests library.
>>
>>54157901
Yes and no. It fixes the shear at the seam by making the verticies line up, but not any texture seam if you have one. The general way to get rid of a texture seam is to duplicate the texture and overlay at (0,0) (0.5,0) (0,0.5) (0.5,0.5) with 25% opacity per tile.
>>
File: ps.png (5 KB, 64x64) Image search: [Google]
ps.png
5 KB, 64x64
Currently working on a data migration project between two different electronic medical record systems. Even though there are a slew of standardized formats for exchanging healthcare data, none of them are quite adequate to capture all the information needed for a complete medical record. I find this hilarious.

So I'm sitting here cobbling together TSQL and Powershell to shoehorn data into the desired format -- not too exciting, but it's how I earn my living. Still, I get to do this from home, which is nice.
>>
>>54153694
hey /dpt/, I took some challenges and filled up a textfile with ones I found interesting, but I can't decide which to start on first.

Which of these will expose me to the most concepts at once?
>Currency Converter(and get up to date exchange rates from the internet first)
>Calculate the days between two dates
>TCP Chat Program with Basic Encryption
>Basic TCP simulator(handshake, data sending, closing) +simulate retransmissions, OOB data, and window scaling, etc
>Two or more programs communicating between each other using an IPC method
>Encryption/Decryption algorithm
>Password/passphrase generator
>4chan thread/image downloader
>Web crawler
>IRC bot
>Two languages communicating with each other(C++ and Java)
>Cipher Encryption/Decryption Tool
>>
>>54158055
web crawler, irc bot, IPC, tcp chat

I would start with these.
>>
>>54157772
declare a function
>>
>>54157726
>>54157957
Thanks for the help.
>>
Any recommended resources to learn networking in common lisp?
>>
>>54158111
Ok, I'm going to stop posting after this but something just clicked.

I was focused on how to get the JS working so that I could view more tweets. But the JS is issuing the 'low level' HTML requests. I just need to figure out how those requests are structured. Which is why I need to use DevTools in my web browser (plus the other recommended tools).

I think I got it now...or at least I have a better grip on what I am trying to do. I don't need to screw with the javascript once I know the correct HTML requests.

Ok, I'm done posting thanks again.
>>
>>54158236
dude, just use the API. I'm completely behind >>54157481. You're just going to get banned. Even if you dont, using Selenium or some non-supported endpoint will require fiddling and reverse engineering. In 6 months or a year, when Twitter updates their website, your scraper will break. The API will be stable for years and years.
>>
>>54158236
that's exactly how it is, yes.
>>
>>54158493

Sure thing chief.

        static bool pangram(string s)
{
return s.ToLower().Where(x => char.IsLetter(x)).OrderBy(x => x).Distinct().CharacterIEnumerableToString() == "abcdefghijklmnopqrstuvwxyz";
}
>>
>>54158654
> people actually believe this bullshit is readable
>>
>>54158654
>x => x
Does C# not have an id function you can use?

F# would let you do
.OrderBy(id)
>>
>>54158696
Lol, what's hard to read? I've almost never used linq and I can read that easy as shit.
>>
>>54158719
I can read it, it's just ugly.
>>
>>54158726
then why are you responding? I'm talking to a guy who thinks it's hard to read.
>>
>>54158735
JUST GIVING MY OPINION
>>
>>54158741
acknowledged
>>
>>54158654
Good god man.
def panwhateveral(s):
a = set(map(chr, range(ord('a'), ord('z')+1)))
b = set(s.lower())
return len(a - b) == 0
>>
>>54158708

Fraid not
Thread replies: 255
Thread images: 28

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.