[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: 24
File: an-older-worker-in-his-office.jpg (737 KB, 1348x1134) Image search: [Google]
an-older-worker-in-his-office.jpg
737 KB, 1348x1134
Previous threads: >>52987029

What are you working on, /g/?
>>
still averaging 2 ints
>>
MEMORY
O
D
E
L
>>
>>52992368
DELETE THIS THREAD AND MAKE IT ANIME RELATED!
>>
>>52992470
>ANIMUUUUUUUUUUUU
take it easy, pedofag!
>>
File: FING DING DING DING.png (48 KB, 576x694) Image search: [Google]
FING DING DING DING.png
48 KB, 576x694
https://rbt.asia/g/thread/S52822113#p52825047
>if you want a nice deal, look at fingerprint cards. at 300-350 SEK per share it'll be the deal of the year.

THERE IT IS

THE 2016 DEAL OF THE YEAR

AND THIS IS ONLY #BEGINNIN

https://www.youtube.com/watch?v=nGt_JGHYEO4
>>
>>52992495
ALSO THE 2015 DEAL OF THE YEAR

KILL YOURSELVES AMERIBURGERS

#LIFESTYLE

https://www.youtube.com/watch?v=nGt_JGHYEO4
>>
>>52992495
put me up for 10 thousand shares, stat!
>>
Why make apps for an existing smartphone when you could make your own smartphone. Imagine how much control and raw power you would have available to you. And then you can write your own game engine for your own smartphone, that way you have ultimate control over every aspect of your game. And all the money from in-app purchases go directly to you. I literally can't find a single flaw in this plan, there are no downsides.
>>
>>52992528
>could make your own smartphone
no gee shitposter would ever be able to
>>
>>52992538
But imagine how much potential your game can have. The sky is the limit. Why reinvent the wheel when you can just make a whole new shape!
>>
>>52992528
>>52992558
>muh games
CS freshman?
>>
>>52992566
no, average /g/ troll
>>
So tell me gee, why haven't YOU been able to average 2 ints? Too hard for /dpt/?

>inb4 muh fizzbugz
>>
>>52992610
print ((a+b)/2.0)
>>
Can you make a game in HTML that can average 2 ints?
Please do not downvote I need this for my final exam in designing average games.
>>
>>52992645
+1
>>
File: businessman-counting-money.jpg (2 MB, 2121x1414) Image search: [Google]
businessman-counting-money.jpg
2 MB, 2121x1414
>>52992495
>le "can't beat the index" /biz/ meme
I ALREADY DID
>>
Daily reminder that Python is literally the best programming language in the world. You should be ashamed for using anything else.
>>
Is this undefined behaviour?

#include <iostream>
#include <string>

class B;

class A {
public:
int x;
};

class C {
public:
int getx(A* a) {
return a->x;
}
};

class AA : public A {
public:
B* b;
C c;
};

class B {
public:
int y;
void* aa;
};

int main() {
B* b = new B();
AA* aa = new AA();
C c;
aa->b = b;
aa->c = c;
aa->x = 1;
b->y = 2;
b->aa = (void*)aa;
std::cout << aa->c.getx((A*)(b->aa)) << std::endl;
}
>>
What engineering degree are you chasing /g/?
>>
>>52992684
kill yourself
>>
>>52992684
It's not the best but it's certainly well suited for a lot of tasks.
>>
>>52992368
>What are you working on, /g/?
I implemented MD5 and it's ever so slightly faster than md5sum.

$ time md5sum ONE_12_A.01_15600.zip 
41bf0d0da20b71366191903b0dd8819a ONE_12_A.01_15600.zip

real 0m1.485s
user 0m1.412s
sys 0m0.072s
$ time md5 ONE_12_A.01_15600.zip
41bf0d0da20b71366191903b0dd8819a

real 0m1.484s
user 0m1.384s
sys 0m0.092s
>>
An F# application I hope to make a bit of dosh out of.
>>
>>52992696
no
>>
>>52992732
thanks
>>
>>52992729
Does it work on arbitrarily large files?
>>
>>52992726
which one's the best?
>>
>>52992729
Have you compiled md5sum yourself with the recommended flags?
>>
>>52992749
I haven't tested it but it should almost certainly work with files of up to 2^60-1 bytes or 1 Exbibyte.

>>52992765
No, I guess I should do that.
>>
>>52992755
There's no single language that could be titled "the" best. They all excel at different domains, and of those that specialize in the same domains they all have some pros and cons.
>>
>>52992789
fp hipster confirmed
>>
Working on a proper init system for linux, called systemG. Already started working on it: installed Inkscape and the logo is almost finished.
>>
>>52992755
java/C# or C/C++ depending on the use case
>>
>>52992821
Jokes on you, my favorite languages thus far are C++, Python and Lua, and I've yeat to enter the realm of FP, I've only ever skimmed over summaries of various FP languages but never gave them a chance personally yet.
>>
>>52992856
python and lua are only "good" for scripting, not for serious programming
>>
>>52992765
>>52992787
>No, I guess I should do that.
md5sum is part of the coreutils - this is going to be tedious.
>>
>>52992873
>srs programming
yeah, you need node.js for that
>>
>>52992873
SRS BSNS
>>
>>52992854
ask me how I know you've never done anything worthwhile
>>
>>52992921
ask me how I know you've never worked on embedded systems
>>
>>52992921
the ones i listed are literally the top industry standard programming languages

http://www.tiobe.com/index.php/tiobe_index
>>
Since the other thread is dying, I think I'm exciused for posting this here as well(?):

I can't understand the behaviour of the following C program, can someone explain wtf is going on?
#include <stdio.h>

double sqr(x) {return(x*x);}
#define sqr(n) n*n

int main(int argc, char *argv[]) {
double a[] = {1.0, 7.0};
double *p = a;

printf( "sqr(3.0) = %f\n"
"sqr(3) = %d\n"
"sqr(3+3) = %d\n"
"!sqr(3) = %d\n"
"(sqr)(*p++) = %f\n"
"(sqr)(3+3) = %f\n",
sqr(3.0), sqr(3), sqr(3+3), !sqr(3), (sqr)(*p++), (sqr)(3+2));
p--;
printf("(sqr)(*p++) = %f\n", (sqr)(*p++));
return 0;
}

I'm aware the macro should be
#define sqr(n) ((n)*(n))

but that's not what I can't understand. Running the program prints:
sqr(3.0) = 9.000000
sqr(3) = 9
sqr(3+3) = 15
!sqr(3) = 0
(sqr)(*p++) = 25.000000
(sqr)(3+3) = 25.000000
(sqr)(*p++) = 0.000000

My problem is with the last and third to last lines. What I was expecting to see was
sqr(3.0) = 9.000000
sqr(3) = 9
sqr(3+3) = 15
!sqr(3) = 0
(sqr)(*p++) = 1.000000
(sqr)(3+3) = 25.000000
(sqr)(*p++) = 1.000000

For some reason, (sqr)(*p++) takes the same argument as whatever is in the second sqr call, in this case 2+3 = 5 and 25 is printed and the p pointer is not incremented. I confirmed by changing the argument of second call to sqr to 3+3 and having (sqr)(*p++) print 36.0. At first I thought since x isn't explicitly assigned a type and is assumed to be int might have something to do with it, however if I change the declaration of sqr to
double sqr(int x) {return(x*x);}
it prints what I expected it to.

I know it's probably something stupid, but for the life of me I can't figure out what.
>>
>>52992993
>top industry standard
>tiobe
Great job Rajeev! 87 paise have been transferred to your account.
>>
>>52993022
two increments of the same variable in one expression is undefined behavior. if you use the macro with n++ it expands to n++ * n++
>>
>>52993022
Could it be because the macro expands to (*p++) * (*p++)?
>>
>>52993022
you cant omit types in parameters. what are you compiling it with, python?
>>
Can someone give me an example of how to do a + b in python, i.e it prompts the user asking for the value of a and b then prints the answer? before anyone asks it's not homework I'm just a retard who can't figure it out
>>
>>52993046
>>52993059
the macro doesn't expand. that's why sqr is in parenthesis. I even run
gcc -P -E to confirm that. :(
>>
>>52992973
>java/c#
>embedded systems
you're embarrassing yourself, lad
>>
>>52993081
No, but doesn't the compiler assume the type is int if it's missing?
>>
>>52993125
never heard of this. can anyone back this up?
>>
>>52993148
it's true
>>
>>52993114
>or C/C++ depending on the use case
>>
>>52993199
>backpedaling hard
>muh damage control
>>
>>52993090
a = raw_input('gimme an a: ')
b = raw_input('gimme a b: ')
print int(a) + int(b)
>>
>>52993164
>>52993125
interesting. I tried this one.

#include <stdio.h>
double sqr(x) {return(x*x);}

int main(int argc, char *argv[]) {
printf( "%f %f\n", (sqr)(1.0), (sqr)(3+3));
return 0;
}


and it fails too. defining sqr(int x) makes it work. not using parenthesis while calling sqr also works. weird, compiler bug maybe?
>>
>>52993114
you literally omitted half the languages I referred to. also, there are reasons java is so popular in embedded systems, but i'm sure you don't really care.
>>
>>52993269
it's literally what i wrote in the first place
>>
>>52993090
print(int(input("a: ")) + int(input("b: ")))
>>
>>52993311
how safe is this, coming from someone else who doesn't know python?
>>
>>52993402
it will delete your windows folder
>>
>>52992765
Okay the results are in.
Ran each program 100 times and ignored the first run of each due to caching.
Only observed the real time that the programs ran, ignoring sys and user time.

Reading the tables into R and their resulting structure:
> str(md5)
'data.frame': 99 obs. of 1 variable:
$ V1: num 1.38 1.35 1.36 1.35 1.36 ...
> str(md5sum)
'data.frame': 99 obs. of 1 variable:
$ V1: num 1.38 1.38 1.38 1.38 1.38 ...


Here's their average:
> mean(md5$V1)
[1] 1.356929
> mean(md5sum$V1)
[1] 1.382707


and their variance:
> var(md5$V1)
[1] 5.196434e-05
> var(md5sum$V1)
[1] 1.527046e-05


Already you can see differences - my md5 implementation is ever so slightly faster, but has a much higher variance. Possibly because it is written in C++ and uses istreams?

Applying a t.test:
> t.test(md5$V1, md5sum$V1)

Welch Two Sample t-test

data: md5$V1 and md5sum$V1
t = -31.28, df = 151.02, p-value < 2.2e-16
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.02740603 -0.02414953
sample estimates:
mean of x mean of y
1.356929 1.382707


The p-value strongly suggests they are equal, however the 95% confidence interval does not contain 0.
I'd say the difference in speed is negligible.
>>
>>52993333
desu I looked for confirmation that type int is assumed and while it's mentioned in answers at stackoverflow, those that I found didn't provide sources. Also, (sqr)(1) instead of 1.0 works too...
>>
>>52993402
it will crash if you enter something that isnt a valid int, like string or 42.0
>>
>>52993441
I have no idea why my code tags aren't working all of a sudden
>>
>>52993402
Very.

>>52993412
Not only that, it'd also eat your steak, drink your beer, rape your girlfriend (and she will like it!) (that's assuming you have one, which, it being /g/, I strongly doubt), and then will shit right into your family heirloom, Ming Dynasty vase.

Power of Python, baby.
>>
>>52993414
>The p-value strongly suggests they are equal,
Nevermind, p-value suggests the difference is not equal to 0. Therefore the difference in speed exists with a 95% confidence.
>>
>>52993337
>java is so popular in embedded systems
webcuck detected
>>
>>52993424
it got weirder,
#include <stdio.h>
double sqr2(x) {return(x*x);}

int main(int argc, char *argv[]) {
double t = sqr2(1.0);
double t2 = sqr2(6.0);
printf("%lf %lf\n", t, t2);
return 0;
}

prints 1.0 1.0.

either not declaring parameter types does not do what we think it do or gcc is buggy in this case.
>>
>>52993022
>I was expecting
all you can expect is undefined behavior
>>
File: presentation.jpg (209 KB, 1300x867) Image search: [Google]
presentation.jpg
209 KB, 1300x867
What I expected working with a team
>>
>>52993587
>gcc is buggy
well memed
>>
File: Frankenstein.jpg (25 KB, 275x546) Image search: [Google]
Frankenstein.jpg
25 KB, 275x546
What the project really was after working with a team
>>
>>52993472
fag
>>
>>52993594
It's more like this senpai. https://www.youtube.com/watch?v=smr0kH2XvIE
>>
>>52993333
Actually, not using parenthesis i.e.
#include <stdio.h>
double sqr(x) {return(x*x);}

int main(int argc, char *argv[]) {
printf( "%f %f\n", sqr(1.0), sqr(3+3));
return 0;
}

still prints 36.0 for me
Also interesting changing it too
printf( "%f %f\n", sqr(1), sqr(3.0+3));

or even
]printf( "%f %f\n", sqr(1.0), sqr(3.0+3));/code]
prints 1.0 1.0
>>
>>52993588
If C defaults parameters to int when they are not defined (I am still doubtful on that), it is not related to undefined behaviour.
>>52993587
fails too
>>
>>52993022
>I know it's probably something stupid
>what is undefined behavior
>>
>>52993424
floats and ints are passed differently to functions on your platform and without a proper function prototype it gets confused and will use whatever value was in the register used for int passing as the value
>>
>>52993657
>If C defaults parameters to int
it doesn't
>not related to undefined behaviour
that's exactly what it is
>>
>>52992368
This, for fun and shit.
>>
>>52993614
lrn 2 teamwork m8
>>
>>52993678
what is gcc doing while compiling in this case?
>>
>>52993022
>>52993333
>>52993587
>>52993653
>I don't know C
>>
>>52993684
What did you write it in? C#?
>>
>>52993684
literally just write an expression parser
>>
>>52993702
whatever it wants; do you understand the concept of undefined behavior?
>>
>>52993703
More like 'I don't know what gcc do in this case.'
>>
>>52993735
>undefined behavior
>what does the compiler do?
see >>52993728
>>
>>52993717
Better than fucking fizzbuzz
>>
>>52993706
Visual Basic.
C# is coolio, but thought I'd try it out - what with them being similar and all desu
>>52993717
"For fun."
>>
>>52993728
>>52993760
that is not undefined behaviour. that should be a compile error, in gcc's case it is not.

gcc does something weird in this case. it is compiling it into something weird while it shouldn't. I am just wondering what that is, or is it intentional. if yes what sqr2 is doing.
>>
>>52993702
x64 linux?
If so, first int arg is passed in rdi, first float arg in xmm0, by not specifying the type of x it defaults to int (i.e assumes arg in rdi), but you use a double arg at call site, so gcc puts a value in xmm0 and leaves garbage in rdi.
It's a mismatch between the compiled callee and caller.
>>
>>52993678
Well fuck me.
>>52993788
Dunno about error, but I would've liked a warning.
>>
Gee, I wonder...

        .file   "test.c"
.intel_syntax noprefix
.text
.globl sqr
.type sqr, @function
sqr:
.LFB0:
.cfi_startproc
push rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
mov rbp, rsp
.cfi_def_cfa_register 6
mov DWORD PTR [rbp-4], edi
mov eax, DWORD PTR [rbp-4]
imul eax, DWORD PTR [rbp-4]
pxor xmm0, xmm0
cvtsi2sd xmm0, eax
pop rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size sqr, .-sqr
.section .rodata
.LC1:
.string "%f %f\n"
.text
.globl main
.type main, @function
main:
.LFB1:
.cfi_startproc
push rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
mov rbp, rsp
.cfi_def_cfa_register 6
sub rsp, 32
mov DWORD PTR [rbp-4], edi
mov QWORD PTR [rbp-16], rsi
mov edi, 6
mov eax, 0
call sqr
movsd QWORD PTR [rbp-24], xmm0
movsd xmm0, QWORD PTR .LC0[rip]
mov eax, 1
call sqr
movsd xmm1, QWORD PTR [rbp-24]
mov edi, OFFSET FLAT:.LC1
mov eax, 2
call printf
mov eax, 0
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1:
.size main, .-main
.section .rodata
.align 8
.LC0:
.long 0
.long 1072693248
.ident "GCC: (Debian 4.9.2-10) 4.9.2"
.section .note.GNU-stack,"",@progbits
>>
>>52993788
>not undefined behaviour
it is
>should be a compile error
nope
>compiling it into something weird while it shouldn't
undefined behavior allows that
>>52993817
>mismatch between the compiled callee and caller
aka. undefined behavior
>>
>>52992368
Hey GOYS, maybe you can help me. I need to implement Petri nets (Those useless Graphs that aren't really used IRL) in an engineering project/situation. Any idea what could it be?
>>
>>52993657
>C defaults parameters to int when they are not defined
parameters yes, arguments no
>it is not related to undefined behaviour
that's exactly what it is
>>
>>52993938
>>52993817
interesting. so if you omit parameter type in function decleration, callers uses arguments as they are. not converting them to int. but in callee assumes they are int in function body. right?

Is there a use for this?
>>
>>52993938
Is the reason that
double sqr(int x) {return(x*x);}

work also undefined behaviour?
>>
>>52994092
no, that's not undefined behavior
>>
>>52994092
in that case callee knows x is int and casts arguments to int before calling the function.
>>
>>52994081
There's no use for it other than adding a potentially subtle bug.
You can't rely on it doing something specific, the int register might have been used for anything, no way to control what value you get.
>>
>>52994081
>if you omit parameter type in function decleration, callers uses arguments as they are
not exactly; it performs default argument promotion
>Is there a use for this?
in new code, no; this is compatibility crap since before function prototypes were introduced in C
>>
Where's the random project roll list? Got a couple hours to kill
>>
File: 1454955714257.jpg (33 KB, 600x476) Image search: [Google]
1454955714257.jpg
33 KB, 600x476
>building/programming a robot for the embedded development class in my college
>we're forced to use a pos microcontroller that nobody has even heard about
>proprietary IDE (Keil uVision) is constantly fucking us over with it's proprietary bullshit
>apparently our uni is too poor to afford licenses, so we have to use the demo version
>32kbyte limit to codesize
>our shithead profs actually rewrote the drivers, because the ones supplied by the vendor were "too big"
>no I2C, no PWM, only one of the three UART ports work
>trying to import the vendor drivers breaks everything because the profs rewrote entire sections of the device drivers and deleted everything that they didn't use for some reason
>no comments anywhere
>I spent 90% of the time trying to figure out what the fuck is going on
>project is due in 2 days
mfw
>>
Working on my anime manager server. Got the basics (database, logging, config file) all ready. I'm currently implementing pagination for the logs and wire it to the HTTP server.
>>
>>52994286
That's absolute bs desu.
You have my sympathies anon, educational institutions are absolute fucktards when it comes to this.
>>
File: 1455554167001.jpg (2 MB, 2142x2856) Image search: [Google]
1455554167001.jpg
2 MB, 2142x2856
just sayin
>>
>>52994330
>double decked train
WHERE
>>
>>52994287
what are you writing the http server in, and is that done?
>>
>>52994369
I'm just using the default implementation from the Go library.
>>
>>52994357
really common in western europe
>>
Give me one reason to learn D instead of C++
>>
>>52994357
Bern is apparently in Switzerland, you poor victim of murican edumakashun system
Netherlands and Germany have double-decker trains, too
not quite sure about Austria/France/UK, but it's not impossible
>>
If I port my software to another language do I make a new repo or just a new branch?
>>
>>52994437
Not in the UK :c
>>
>>52994330
This has to be shopped.
No way in hell based Stallman would support that shithead.
>>
>>52994492
new repo
>>
>>52994492
Just branch it, then join it with the main repo once it's stable.
>>
>>52994525
The original pic said 'install gentoo'.
>>
File: cpp_vs_D.png (902 KB, 1198x608) Image search: [Google]
cpp_vs_D.png
902 KB, 1198x608
>>52994448
C++ cup on the left, D cup on the right.
Any other questions?
>>
>>52994555
I like petites
>>
>>52994555
those are some nice cups
>>
How do I learn SQL?
I did that 4 steps course on codecademy but I feel like I learned nothing
>>
>>52994081
>Is there a use for this?
contrived example
int f_new_style(int n, char (*x)[n])
{
return sizeof *x;
}

(this function just returns n but suppose it does more interesting things and it actually needs to work on a pointer to array)
suppose you need to change the arguments around; there's no way to write it except by using old-style function definitions:
int f_old_style(x, n)
int n;
char (*x)[n];
{
return sizeof *x;
}

at this point, the caller can use any arguments he likes for f_old and will trigger undefined behavior if the first is not a pointer to char array or the second doesn't promote to int; to avoid this, you'd better add a prototype to enforce the argument types:
int f_old_style(char (*x)[*], int n);


>inb4 swinging past yo' knees
>>
>>52994448
You can pretend to be a special snowflake for knowing a language that nobody uses because everything D can do, C++ can do better.
>>
Since the web daily isn't anywhere to be found I'm gonna try my luck here.

I have a project in asp.net MVC and want to implement the typehead.js to my project and database.
How would I do that ?
>>
>>52994600
learn B then, what's the matter
>>
>>52992368
I'm writing some basic neural nets to test out using them as a hash table.

I.e. neuralnet.set(k, v) is effectively training and neuralnet.get(k') for k' similar to k should give me some v' that is similar to v
>>
>>52994635
pedo >>>/a/
>>
>>52994621
>I have a project in meme.net memeVC and want to implement the meme.js to my project and meme.
>>
>>52994621
Kinda sucks there's no /wdg/. We like it when you guys dick around in your own playpen with easily googled questions and 1st year CS students shilling frameworks they've used
>>
>>52994712
>I have never made anything of value
>>
>>52992538
>buy RasPi
>buy Case
>buy Touchscreen
>buy Wifi Modem
>buy LTE Modem
>assemble
>Install Gentoo
That was really hard.
>>
>>52994734
>buy
>make
>>
>>52994727
>they actually think this
You are literal scum. The 80% that use shilled corporate shit are not the same as the elite that don't.
>>
>>52994125
>>52994612
thanks a bunch. Any suggestions on what I could read for things like this to make more sense in the future?
>>
>>52994726
well go create one
containment areas ain't gonna create themselves
>>
>>52994756
K and R
>>
>>52994727
>I'm a webcuck
>I have never made anything of value
>>
>>52994619
But the only advantage C++ has is that it has more libraries
>>
>>52994750
What the fuck do you think companies like Samsung are doing?
The CPUs are based on ARM, made by Globalfoundries, the chipset is made by Qualcomm, and the smartphone is assembled by Foxconn.

Do you think they dig up their own sand and magically turn it into highly advanced chips?
>>
>>52994734
>That was really hard.
really? writing it down should have been easy; because of course you've never actually done those steps
>>
File: lisp_cycles.png (37 KB, 640x211) Image search: [Google]
lisp_cycles.png
37 KB, 640x211
Are you a Knight of the Order of the Brothers of the Greater House of Lisp, /dpt/?
>>
>>52994924
inb4 autistis hate on xkcd since they don't understand a joke
>>
>>52994948
i get the jokes but xkcd is usually very lame and the author is just a 100-110 IQ uneducated normie
>>
>>52994948
to clarify they think randall is trying to do a "hey guys look how smart i am" and not just be funny
not that they dont understand the joke
>>
>>52994992
these smug ass comic strips aren't funny if they aren't smart/witty
>>
>>52994992
That might be a valid point if it wasn't completely false
>>
>>52994973
it used to be p. good back around 2006-2008 or so
then it got more shallow, more, I dunno, angry, and somewhat SJWy
some bad shit happened to him, like his GF had cancer, not sure if survived, this probably affected him
>>
>>52995048
tru tru
>>
>>52995025
except it is
it got more TBBT-ish over time
nowhere near actual TBBT in terms of stupidity mashallah
but there are certainly bits of BAZINGA here and there
in the audience, even more so
>>
if os.path.isfile(fl) and os.path.splitext(fl)[1].lower() == '.epub':
return True


Stupid here, can someone tell me what this line of Python code does?
>>
>>52995118
Checks if 'fl' is a file and has the '.epub' suffix. Are you really that retarded?
>>
>>52995118
It puts a cock in your mouth, but then again all Python does that.
>>
>>52995141
I need some of that!
>>
>>52994899
I'm a computer engineer, so I know what I'm talking about more or less (might be the beer talking through me though).

Here's your shopping list:

http://www.amazon.com/Raspberry-Pi-Model-Project-Board/dp/B00T2U7R7I/ref=sr_1_4?s=pc&ie=UTF8&qid=1455562976&sr=1-4&keywords=Raspberry+pi

http://www.amazon.com/Edimax-EW-7811Un-150Mbps-Raspberry-Supports/dp/B003MTTJOY/ref=pd_bxgy_147_2?ie=UTF8&refRID=1XX30W4ZNAE0SE6NDFDA

http://www.amazon.com/Tontec%C2%AE-Raspberry-Display-Touchscreen-Transparent/dp/B00NANNJLQ/ref=sr_1_3?s=pc&ie=UTF8&qid=1455563218&sr=1-3&keywords=raspberry+pi+touch

http://www.amazon.com/Huawei-Megafon-Broadband-150mbps-Simfree/dp/B0165W2H1Q/ref=sr_1_2?s=pc&ie=UTF8&qid=1455563268&sr=1-2&keywords=lte+modem

http://www.amazon.com/MAXOAK-50000mAh-Portable-External-Notebook-Most/dp/B00YP823NA/ref=sr_1_1?s=pc&ie=UTF8&qid=1455563374&sr=1-1-spons&keywords=power+bank&psc=1

wew lad that was really hard.
Of course it's far from optimised, but it's a proof of concept.
>>
>>52995209
faggotry is thataway:
cm / hm / lgbt / y
>>
>>52995228
>he knows the fag boards by heart
>>
>>52995228
but what if >>52995209
is actually a grill?
>>
>>52995246
>they're listed at the bottom of the screen
>>
>>52995256
>grills
>in /g/dpt
>>
>>52995256
>grill
>/g/
pics or didn't happen
>>
>>52995273
>>52995280
Maybe she even has a feminine penis?
>>
>>52993333
$ cat > sqr.c
#include <stdio.h>
double sqr(x) {return(x*x);}

int main(int argc, char *argv[]) {
printf( "%f %f\n", (sqr)(1.0), (sqr)(3+3));
return 0;
}

$ gcc -Wextra sqr.c
sqr.c: In function 'sqr':
sqr.c:2:8: warning: type of 'x' defaults to 'int' [-Wmissing-parameter-type]
double sqr(x) {return(x*x);}


>201X
>compiling without warnings
>>
>>52995224
>muh authorita
sure thing lad, let me know when it's built; shouldn't take you too long, it's not like it's hard
>>
>>52995256
>grill
>/g/
pi_cs or di_dn't hap_pen

(aight, apparently there's some autoreplace going on)
>>
>>52995304
fuck off websperg
>>
>>52995334
pics or it didn't happen
>>
>>52995228
>2016
>not surrendering to faggotry
why live
>>
>>52995317
It's not about authority, m8.
I'm just saying that it's not hard to build something resembling a smartphone if you have a basic understanding of how computers work.
Of course you won't get the same level of integration as your average smartphone, but it'll work.
>>
>>52995359
yeah, I just had a bit of brainfart apparently
>>
File: 1455237958457.png (550 KB, 1500x1800) Image search: [Google]
1455237958457.png
550 KB, 1500x1800
>>52993587
>gcc is buggy
>>
>>52995390
>it's not hard to build something resembling a smartphone
have you done it?
>>
>>52992684
It's a badly designed language. However, it has a very big ecosystem.
>>
>>52995411
we got that covered already, pajeet, back to your designated area!
>>
>>52995430
>badly designed
>implying
stale b8, m8
>>
>>52995390
>it's not hard to build something resembling a smartphone
I think your definition of 'hard' may be skewed, even for those who are experienced in related subjects.
>>
File: PEPSI-SMARTPHONE.jpg (86 KB, 1400x850) Image search: [Google]
PEPSI-SMARTPHONE.jpg
86 KB, 1400x850
>>52995390
it's not hard to make your own smartphone if you have the money for it, but you'll probably want to use "off-the-shelf" components like SoCs and antennas etc, and hire people to assemble it for you
>>
File: pepsi smartphone.jpg (25 KB, 550x306) Image search: [Google]
pepsi smartphone.jpg
25 KB, 550x306
>>52995457
here's the pic of the actual phone
>>
>>52995457
>and hire people to assemble it for you

Yes, that's how you 'make' your own smartphone!
>>
>>52995304
Clang doesn't give a flying heck.
>>
>>52995477
""""""""""""actual pic""""""""""""
My ass tells me that's a render.
>>
>>52995496
You should be concerned. Have you tried every -W option you can find?
>>
>>52995516
it's supposed to be from the TENAA certification, but you're right the display looks like it has that gay fake glare
>>
>>52992470
Harold is animu
>>
>>52995525
Turns out I'm a pleb. It's -Weverything on clang
>>
>>52995415
>>52995455
Nigga, I described how to do it a few posts ago.
adding a bunch of stuff to a RasPi is not rocket science.
Most of the components should work out of the box.
Of course you'll look like Autismus Maximus if you walk around with something like that, but if you value your freedom...

>>52995457
>>52995477
>>52995483
The point was that you can assemble a device that can perform the same work as your smartphone with off-the-shelf components.
>>
>>52995563
raspberry pi is very weak compared to a high-end smartphone
>>
im writing some stuff on python but for that purpose python is starting to be too slow (webcrawler to a db) [400k inserts over 2 hours]

should i leap to c/c++ or i should give Go a go?
>>
File: pepsi phone.jpg (57 KB, 728x438) Image search: [Google]
pepsi phone.jpg
57 KB, 728x438
>>52995516
>>52995548
http://www.gsmarena.com/pepsi_phone_p1__an_affordable_metal_phone_with_a_fingerprint_reader-news-15099.php
>>
>>52995563
but have you done it?
>>
>>52995604
>400k
m8, those should not take more than 1 second
>>
>>52995604
Before you rewrite everything, confirm that you're CPU bound and not just sitting around waiting for the DB to respond.
>>
>>52995620
No, because I'm not an autist obscessed with privacy. My iPhone 6S works fine for me.
>>
>>52995451
> stupid __names__
> no private methods
> half-assed OOP
> "has one way to do things" - adds some interesting things, like lambdas, reduce, etc., however using them is unpythonic. Pls use for-loops instead like it's 1979
> : everywhere
> Lacks any dynamism, metaprogramming, could be as fast as Lua, however is slower than PHP, Ruby, Perl
> whitespace significance
> Nothing from FP: no map, filter, reduce, functions are not first-class
> self in method definitions...
>>
>>52995649
>it's easy to do
>I have no experience doing it
the classic cuck, everyone
>>
>>52995643
i know, but it is taking absolutely forever with python parser (lxml) and sqlite3 db
>>
>>52995604
use java or go unless you already know c/c++
>>
>>52995651
>b8 intensifies
>>
File: scala logo.jpg (16 KB, 1280x720) Image search: [Google]
scala logo.jpg
16 KB, 1280x720
What does /dpt/ think about Scala?

>functional language, suited to every memester's needs
>JVM language, able to use any of the millions of Java libraries
>fixes a lot of Java's problems
>better than Python

What's not to like?
>>
>>52995451
>python isn't badly designed
>baby duck syndroming this hard
>>
>>52995651
It sounds like you combined the bad parts of Python with the bad parts of C++ to create the worst programming language ever.
>>
>>52995704
Scalia is dead
>>
>>52995704
>fixes a lot of Java's problems
>better than Python
this has to be bait, you can't be this stupid
>>
>>52995704
It's shit, literally everything and the kitchen sink language
>>
>>52995646
Doesn't seem an issue with DB response, but rather the parser is slow as hell.
>>52995688
Don't know any of C/C++, but I am okay to learn it
also, fuck java.
>>
>>52995651
>stupid __names__
so you dont overwrite built in methods

>: everywhere
as opposed to { } everywhere
>>
>>52995704
it's disgusting, just something for smug hipster fags to delude themselves into thinking they're using something better than java
>>
>>52995704
>JVM
>>
>>52995708
>samefagging
>>
>>52995716
well
it isn't exactly hard to be better than python

>>52995720
why do you think so?
>>
>>52995726
>also, fuck java.
>thinks go isn't shit
epic meme
>>
>>52995704
>guaranteed replies
>>
>>52995735
the syntax barely resembles java at all
>>
>>52995709
It has a lot of bad parts. The list is not exhaustive. It's only popular because of ecosystem it has. But the language itself is meh
>>
>>52995758
Are you retarded? I don't like Java.
Go is certainly better than Python.
>epic meme
Yeah, you can go fuck yourself.
>>
>>52995764
you say that like it's a good thing
>optional semicolons
holy shit
>>
>>52995743
>I really am that stupid
anon...
>>
>>52995790
seems like you're rather clueless about scala
>>
>>52995784
>retarded
>Go is certainly better than Python
you're retarded, alright
>>
>>52995811
I've never used Go and don't know much about it and I can honestly say it's better than Python
>>
>>52995811
You're a funny guy, aren't you.
Go is better than Python. At least performance-wise.
>>
>>52995785
>semicolons
go back to the 80s, grandpa
>>
>>52995809
>I'm mad for getting told
buckle up, anon, you can easily get raped on these mongolian forums
>>
>>52995726
>the parser is slow as hell

lxml is C-accelerated. If I was getting 400k in 10 minutes I'd think about switching languages. 400k in 2 hours tells me there is something very wrong with my code.
>>
>>52995825
>never used Go and don't know much about it and I can honestly say
designation status: confirmed.
>>
>>52995838
>guy states scala is shit
>ask him to explain
>haha ur so stoopid
wow I sure got """""""""""""""""told""""""""""""""""""
>>
>>52995829
a lack of punctuation and grammatical structure is ok in a chatroom or on 4chan but not in a serious software application
>>
>>52995604
>400k inserts over 2 hours
lol, you can do those in 1 cycle, m8!
>>
File: 1455364120001.png (15 KB, 517x464) Image search: [Google]
1455364120001.png
15 KB, 517x464
>>52995838
You haven't even presented any arguments and you say he got "told"
Go to sleep kiddo.
>>
>>52995720
>literally everything and the kitchen sink
what is this supposed to mean?

are you retarded?
>>
>>52995811
how can you be this butthurt that you got tricked into learning python, just move on and learn a better language
>>
>>52995855
>>52995878
>MAXIMUM DAMAGE CONTROL
>>
>>52995704
same as C++'s problem of putting too many features together, but even worse. it started from an OOP base and then they half-tried to turn it into Haskell by adding more features without really any attempt to make them go well with the language, leaving it chock full of inconsistencies, bugs, or just plain ugly parts of the language. That's not to say FP and OOP can't work together, but the design they used just dumped a lot of shit in the blender with a few good bits.
>>
Is fucking everybody a 12 year old all of a sudden?
>>
>>52995845
I don't think I have something very wrong in my code, but I forgot to mention that I'm using BeautifulSoup with lxml since HTML that I'm parsing is very broken. BeautifulSoup fixes that. That could affect performance. All I do is get table rows and gather text content to the DB, is all. Maybe sqlite is being retarded, I should try apsw, but I never had luck compiling it to pypy.

I'll have another look, regardless..
>>
>>52995892
>I got rekt by python and now I'm bitter
>>
>>52995898
I see

what language do you think is a good blend of OOP and FP?
>>
>>52995915
>2016
>not being 12
get on my level, fegit!
>>
Please... C++ me

//Create a program that presents simple math problems to be solved.
//The program will prompt the user to select either an addition('+'), subtraction('-'), or multiplication('*') problem.
//It will then present the problem in the following format

//123
//+ 6

//prompt the user for the answer, and tell the user whether or not they were correct.
//The numbers to be used should be between 0 and 999.

//Your program should report an error without displaying a problem or prompting the user if the user enters any other character than '+', '-', or '*'.
//You must use a switch statement to detect the type of operation(or an incorrect value).

//The presentation of the problem needs to be formatted such that the corresponding places are aligned(as above)
//and the width of the problem should be no more than necessary;
//that is, no more than two spaces more than the number of digits in the longest number.
//Further, for addition and multiplication problems the number on top must be greater than or equal to the bottom.
#include <iostream>
>>
>>52995924
Ruby
>>
>>52995948
I wasn't asking you
>>
>>52995946
I don't /g/ is here to help you with your homework.
>>
>>52995924
JavaScript
>>
>>52995915
we seriously have underage fags in /dpt/, someone got banned like a week ago, and then there's a couple of minecraft-playing python babbies that are still around
>>
>>52995961
Like I give a fuck
>>
>>52995966
>minecraft
>python
minecraft was written in java though, no?
>>
>>52995966
>someone got banned
oh noes! from the chink animu jerking forums?
>>
>>52995966
I don't know where they're coming from, they're like fucking rats
>>
>>52995975
they use python scripts for mods or something
>>
>>52995924
depending on which you put more emphasis on, it depends
Common Lisp has pretty good OOP and it's decent for FP
C# is much more conventional OOP and yet very usable for FP
F# and OCaml are great if you put more emphasis on the FP part but still care about the OOP part a lot
>>
>>52995974
you clearly do

>>52995990
thanks
Thread replies: 255
Thread images: 24

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.