[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: 29
File: unixprogrammingenv.gif (36 KB, 255x339) Image search: [Google]
unixprogrammingenv.gif
36 KB, 255x339
"Real Programmers Use UNIX®" Edition

Old (warning! frogpost): >>54676367
>>
FIRST FOR C++ A BEST LAGOOGOge
>>
>>54682976
no~~~~ u can't! ;A;
>>
>>54682976
MOOOOODS
>>
File: 11219396.jpg (115 KB, 960x543) Image search: [Google]
11219396.jpg
115 KB, 960x543
>>54682976
That's a fat cock
>>
why is haskell so based
>>
File: 1463771665495.jpg (88 KB, 1280x720) Image search: [Google]
1463771665495.jpg
88 KB, 1280x720
>>54683076
Because it's so pure.
>>
>>54683121
lisp just can't compete, horrendous syntax
>>
Anyone using Julia here? Looks pretty neat, clean, I love the style and the potential.
>>
>>54683142
>implying
>>
File: cat-looking-disgusted.webm (240 KB, 275x154) Image search: [Google]
cat-looking-disgusted.webm
240 KB, 275x154
>>54683159
http://zverovich.net/2016/05/13/giving-up-on-julia.html
http://danluu.com/julialang/
>>
>>54683271
python is slow af. Doesnt make it a bad language. Julia has a better syntax, can import C directly, isn't made by "pythonistic hipsters"
>>
What would be a good casing to make night vision goggles with a raspberry pi and a NOIR camera, lads?
>>
EE here. I'm really new to programming and at them moment I'm doing shit on a Z8.
Anyway, I have this piece of code:
a = ax_curser;
while(a >= 0x02)
{
a>>1;
b++;
}


ax_curser is a single bit that is moved left and right (can be values 0x01, 0x02, 0x04 etc up to 0x10). I want to find out how many times is has been moved relative to the first position (0x01). For some reason, variable 'a' gets stuck at 0x02 and won't bitshift right to 0x01, so it gets stuck in the while loop.

Sorry if it's an obvious problem and thanks for any advice.
>>
>>54683594
You have a typo, a>>1 should be a>>=1
It happens to everyone...
>>
>>54683594
>>=
>>
>>54683604
>>54683606
Oh, of course. Cheers mates.
>>
New at haskell, what is the best way of excluding conditions? In this function:
time12 h m =
let hour = h `mod` 12
ampm = if h > 12 then "pm" else "am"
in show hour ++ ":" ++ show m ++ ampm

How would be the best way to show a message then return if the input is invalid, i.e. hours or minutes isn't a sane value.

I thought you could use a guard but i'm not sure how to follow with the whole function after that, or maybe a where? Not sure
>>
Just tried Visual Studio Code. Holy shit that thing is cancerous. Back to vim.
>>
File: image.jpg (2 MB, 2592x1936) Image search: [Google]
image.jpg
2 MB, 2592x1936
i dont understand. anyone get this?
>>
i know this works: >>54682605

but when comparing signed with unsigned as in >>54682566, do they get converted to signed or unsigned? and indeed >>54682576 with the right compiler setting it should give a warning
>>
>>54683945
1.5 im talking about and sorry phone flipped to side
>>
>>54683945
I broke my laptop while trying to look at your picture. Fuck you.
>>
File: image.jpg (193 KB, 640x960) Image search: [Google]
image.jpg
193 KB, 640x960
>>54684008
>>
>>54684008
thanks for the good laugh. Its natural selection
>>
>>54684008
pics please
>>
File: broken-laptop.jpg (97 KB, 628x428) Image search: [Google]
broken-laptop.jpg
97 KB, 628x428
>>54684054
>>
>>54683750
This seems to work fine dunno if the best way but it seems simple enough, could probably do it in one line but I think 2 functions is a bit clearer

time12 h m =
if not (validh h && validm m) then "Invalid input" else

let hour = h `mod` 12
ampm = if h > 12 then "pm" else "am"
in show hour ++ ":" ++ show m ++ ampm

validh h = (h >= 0 && h < 24)

validm m = (m >= 0 && m < 60)
>>
File: screen.1463926351.png (68 KB, 1578x755) Image search: [Google]
screen.1463926351.png
68 KB, 1578x755
>making scripts for an API that has 0 documentation
>have to rely solely on what the method names are called and guess what it does

Why the fuck do developers release undocumented API's to users? Do they expect everyone to just figure their shit out though painful trial & error?(code monkeying until shit works)

Hell I comment things I make even if I have no intention of releasing it. It's just good habit.
>>
Do you use a custom keymap? If not why?
>>
>>54684331
they're amateur neckbeards
>>
>>54683750
>>54684249
While I don't know Haskell that well, why are you writing it in that style?
It's like you're trying to write procedural code.
>>
>>54684422
I don't know how to do functional, what's wrong with it?
>>
>>54684434
It's defeating the entire point of Haskell.
>>
>>54683750
Why are you doing input validation inside of that function? That returns a String. You want the function to take a String and return a String and that's it. If you want to referee user input do that elsewhere in the actual IO code.
>>
>>54684469
I was just messing around with the interpreter so you can't do that I don't think but you are right that is a more sensible way to do it I was just trying to find out how let works
>>
>>54684382
Why would I? It would just make things painful when using any other computer.
>>
>>54684331
Documentation is a meme.
>>
>>54684511
Even an amateur biker would choose the bike that suits him best.
>>
>>54684538
default keymap suits me best

where is your god now?
>>
>>54684538
That's the most unfit analogy I've ever heard.
I don't know about you, but my custom bike isn't an international standard, and I don't have to use stranger's bikes at my job.
>>
File: 4pol_anzuja.jpg (276 KB, 1066x1600) Image search: [Google]
4pol_anzuja.jpg
276 KB, 1066x1600
>>54682930
>>54682885
>>54682894
thank you
>>
>>54684590
>that semen stain
>>
>>54684482
Just remember that if its type is "String", the only thing that function can consist of is expressions which result in a "String", so unless you want to return some String like "Invalid input" (which would be silly obviously) you just don't do that. What you could do in such a case, however, is something like:

time12 h m
| h < 1 || h > 24 || m < 0 || m > 60 = "Invalid input, bud."
| otherwise = concat [hour, ":", min, amPm]
where hour = show $ h `mod` 12
min = if m < 10 then '0' : show m else show m
amPm = if h < 12 then "am" else "pm"


if you want to use a guard.
>>
>>54683750
>>54684683
why not use exceptions?
>>
>>54684683
Thanks, that looks a lot better. Does the $ before
h `mod` 12
tell show to include all of that, rather than just h?
>>54684751
Exceptions are for when something you can't really recover from happen, rather than just an invalid input, is my thinking.
>>
>>54684751
Exceptions are for IO code. https://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Exception.html
>>
>>54684770
The $ is an operator that just does function application. It's to make it more convenient to write expressions without a fuckton of parentheses.

show $ h `mod`12 == show (h `mod` 12)
>>
>>54684770
div 3 0
is an invalid input yet it throws.
In this case I'd use a Maybe instead tho.
>>54684782
>In addition to exceptions thrown by IO operations, exceptions may be thrown by pure code
Example:
Prelude> let f x = if x /= 0 then x else error "oops"
Prelude> f 9
9
Prelude> f 0
*** Exception: oops
Prelude>
>>
>>54684802
Yeah, the error function works from anywhere, but if it's outside of IO then you generally only use that for stubs or for a small handful of fuckups that you can't recover from, like using "head" on an empty list.
>>
>>54684054
thanks for the help guys, i looked up the answer and the difference is that

applicative order is post-order, so (test 0 (p)) infinitely calls itself when p is evaluated since p calls itself

whereas in normal order values are expanded with what they stand for until its' maximally expanded, and then reduced to a single solution so, (test 0 (p)) is replaced with the value of test given the arguments 0 (p) so (if (= 0 0) 0 p) so 0
>>
Is double inheritance a really bad thing to use?

I'm in the situation where it's elegant to use it, ie
class Z : public X, public Y {
public:
Z();
~Z();
void Xvirtual();
void Yvirtual();
};

But I'm thinking another solution would be
Class Z : public X {
public:
class ZY : public Y {
public:
ZY();
~ZY();
void Yvirtual();
};
ZY* y;
Z();
~Z();
void Xvirtual();
};


Which one is better?
>>
>>54685153
>Is double inheritance a really bad thing to use?
No
>>
>>54685153
Any inheritance is usually a bad idea.
>>
>>54685153
why would it be a bad thing? my school's beat me over the head with java and i'm just now teaching myself functional language bc i dont want to be a pleb anymore so redpill me
>>
I give up, anyone know how I can sort these files into human readable order with Java?

1.jpg
10.jpg
11.jpg
12.jpg
13.jpg
14.jpg
15.jpg
16.jpg
17.jpg
18.jpg
19.jpg
2.jpg
20.jpg
21.jpg
22.jpg
23.jpg
24.jpg
25.jpg
26.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7.jpg
8.jpg
9.jpg

I was originally using just Arrays.Sort(), but then I found out about a natural order comparator which I've been using yet still these files and others alike fail to sort into alphanumerical order, I'm completely out of ideas at this point.
>>
>>54685244
check if it has only 1 digit in the filename before .jpg and if so change the name to have a 0 before it
>>
>>54685153
Mixing interfaces is one thing. Mixing inheritance... doesn't feel right.
>>
>>54685244
Write your own sort, add padding, or something
>>
>>54685244
or create an array and put them into the location of the number if their filename in the array
>>
>>54685244
Convert file name without suffix to integer and sort on that instead.
>>
>>54685244
When comparing, compare lengths, then if the lengths are equal compare their alphanumerical order.
>>
>>54685153

Why not use composition? IS there a valid reason to make Class Z a X and a Y versus making X and / or Y members of Z?

Typically OOP prefers composition over inheritance unless there is a direct reason to use inheritance.
>>
>>54685244
make a system call and cat them with a pipe to sort -h

cat ... | sort -h
>>
File: cut.webm (2 MB, 1280x720) Image search: [Google]
cut.webm
2 MB, 1280x720
/dpt/-chan, dai suki~

Ask your much beloved programming literate anything (IAMA)

>>54685153
Multiple inheritance is a fair alternative to interfaces (more powerful but more messy)

>>54685237
>why would it be a bad thing?
Diamond

>>54683121
Sauce ?

>>54683076
"avoid success at all costs"
>>
>Be self taught programmer
>Mediocre at best but good enough to do my job
>Friends went to study CS in the university
>Meet up after 4 years
>One of them starts telling us about quantum computing and how it will affect the languages of the future
>Everyone but me struggles a bit but nods along
>I get maybe 10% of what has been said but know enough to realize the incredible utility of the concepts illustrated
>Realize I won't be able to be a programmer in 10 years because the bare minimum skill floor is going to skyrocket
I..it's not like I wanted to be a wizard or anything..
>>
>>54685328
in ten years quantum computing will still be irrelevant
>>
>>54685328
Most CS majors have a popsci level of understanding of quantum computing. They just can't into math.
>>
>>54685304
sort -n
not -h
>>
>>54685328
Everyone else nodding along was probably thinking the exact same thing.
>>
File: ZhKsvZ8.jpg (378 KB, 800x2265) Image search: [Google]
ZhKsvZ8.jpg
378 KB, 800x2265
>>54685328
Dat guy is a fake. Quantum computing is very far from replacing daily computing, it's only useful for a very minor set of problems and still today the technology is barely usable (how many quantum computers in the world ? what's their computing power (flops) ?)
>>
>>54685344
I imagine it will be useful just for things like generating high quality random numbers if nothing else. Plus as far as I understood there are a few relatively common calculations you can do quicker with a quantum computer. I know you will be able to do these things via library functions but then you can't make your own when doing so would make sense and you've pretty much relegated yourself to being a code monkey.
>>
>>54685366
they seem to both do the same thing without suffixes though

but yes I guess
>>
>>54685237

This guy explains it rather well for a quick video.

https://www.youtube.com/watch?v=wfMtDGfHWpA
>>
Anyone know of any good books for learning...

[sigh's deeply]

...Java?
>>
File: watermelon.jpg (393 KB, 1600x1200) Image search: [Google]
watermelon.jpg
393 KB, 1600x1200
>>54685403
>>54685328
Also, the only usable quantum computer (D-Wave) is being programmed in ... python !
>>
>>54685413
-h will interpret M and G as size suffix.
>>
>>54685450
This picture made me unreasonably happy. I must be turning into a woman.
>>
>>54685427
>>54685295
It's a real time physics engine. Using composition would require me to use dynamic_cast to identify objects rather than a cast to a mutual base class.

>>54685236
Bjarne BTFO

>>54685237
Risk of ambiguity
>>
>>54685431

the internet

try to program something

when you have a question, google it
>>
>>54685153
it should be avoided at all costs, it's disgusting and never necessary
>>
what kind of math do I need to know to make games?
>>
File: 1.png (76 KB, 941x903) Image search: [Google]
1.png
76 KB, 941x903
I've been trying to write an HTTP server in C#, everything seems to work except loading the default document for a browser to render
>>
>>54685669
What kind of game?

Anywhere from simple boolean algebra to linalg to calculus to statistics
>>
>>54685669
geometry
trigonometry
elementary algebra
linear algebra
calculus
newtonian physics
>>
>>54685682
You have a "warning" at line 16. Fix it.
>>
File: wew2.jpg (139 KB, 1392x913) Image search: [Google]
wew2.jpg
139 KB, 1392x913
>making a video tagger to tag my "video collection"

Not sure if this is productive or tragic.
>>
File: 1463668075787.jpg (30 KB, 514x578) Image search: [Google]
1463668075787.jpg
30 KB, 514x578
>>54685630

So, there's zero good books for Java? Nothing akin to "Javascript: the good parts"?
>>
>>54685580

Really sounds like you've already locked yourself into a design. In the future I'd really look into starting from the onset without a modular approach.

Physics is typically a bunch of properties acting on a set of a data. Honestly, it's better represented as a base set of properties (Position, Velocity, Mass, etc) with a set of functions interacting on them.
>>
>>54685697
>no diffy eq
>no fourier
>no diffy geometry
>>
>>54685722

with a modular approach* Damn auto correct.
>>
>>54685730
Do not that fall under calculus and linear algebra?
>>
>>54685730
>diffy eq
for planets and shit or what do you have in mind?
>fourier
for what purpose
>diffy geometry
explain
>>
>>54685633
That's what I'm thinking as well.

>>54685669
Middle school tier math.
Retards may say you need linear algebra but the mathematics of projection and matrices in 3D environments are all written on some old chalkboard and everyone's been copying it from there ever since.

>>54685688
>>54685697
>>54685730
Kill yourselves.
>>
>>54685715
I know, it mostly complains about a deprecated method of specifying a port number, it works for opening a port nonetheless.
>>
>>54685744
Not usually
>>
>>54685750
you're making a physics engine and you think you only need middle school math? you're delusional

>Retards may say you need linear algebra but the mathematics of projection and matrices in 3D environments are all written on some old chalkboard and everyone's been copying it from there ever since.
just because you don't understand it, doesn't mean others don't understand it, retard
>>
>>54685751
So you're not annoyed by a warning or an error in your code? Fix it.
>>
>>54685669
http://www.cc.gatech.edu/~turk/math_gr.html
>>
>>54685750
>Kill yourselves.
fuck you anon I said anything from the simple to the more complex

if you are able to read about matrices and apply the maths then you clearly know at least a bit about the mathematics in question

nobody said you had to have a PhD in mathematics.
>>
>>54685749
See
>>54685769
>>
>>54685722
I'm not making a "simple" physics engine. This needs to be advanced and able to do callback mechanisms, triggers, etc.
>>
>>54685768

Deprecation doesn't mean something will actually be a problem.
>>
>>54685763
Calm down bud, stop projecting your lack of maths knowledge onto me. Linear algebra is literally middle-school tier.
>>
>>54685808
You should not use a deprecated method. Just fix that damn code.
>>
>>54685845
>Linear algebra is literally middle-school tier.
no it's not, nice backpedaling
>>
>>54685857
>You should not use a deprecated method.

I use gets in my C programs every day.
>>
>>54685845
>i was just pretending to be retarded, h-haha

real smooth, bud
>>
>>54685669
As someone who actually makes games: it heavily depends on the type and how good of a designer you are. You're pretty much always going to make use of geometry/algebra/trigonometry and a small amount of linear algebra. You're going to need a whole lot more if you want to do anything which simulates physics or is 3D. If your game has a high branching factor and you want a good AI then you will need some Real Math. A ton of games also need statistics.

With that said make sure you actually study *game design*. Programming a 2D game with a simple AI is a fairly trivial endeavor for the majority of programmers yet they don't go and get rich by making video games. Why? Because designing good rules is the hard part. Here's a starting point:
https://www.youtube.com/watch?v=qwPe3OHR04c
>>
>>54685669
Linear Algebra, a lot of it. Especially if you want to go into 3D stuff, it's essential.

Most games involve some physics, so you might want to look into basic calculus as well.

Of course, you can always rely on finished solutions for those things, but some basic understanding of what you are doing makes it much easier.
>>
>>54685871
>OSGTP
Ho shit, I forgot to always ignore you. You're a retarded code monkey.
>>
>>54685859
Not that guy but we studied it in high school. Not in depth, mind, but well enough.

>>54685750
There are a lot of games out there mate. Some definitely, absolutely require more advanced mathematics. Many require very little.
>>
>>54685896
>You're a retarded code monkey.

It's banter, m8. But really, though, using the old constructor for TcpListener isn't going to do anything bad.
>>
>>54685917
high school != middle school
>>
File: normiesunwanted.jpg (464 KB, 1131x1600) Image search: [Google]
normiesunwanted.jpg
464 KB, 1131x1600
Where were you when the functional programming revolution happened, anon ?
>>
>>54685682
are you sure you're getting the file open and reading it line by line?
>>
>>54685879
>being this mad
Wow I didn't expect this.

>>54685917
Rarely does a game engine implement math that has never been used in a 3d engine before. Just saying most of the math is out there and common.
>>
>>54685949
>implying it ever happened
>>
>>54685949
I was there since a long time. I wrote my first caml-light code in 1999.
>>
>>54685431
head first java werks for me (but some people hate it)

plus the helsinki OOP course, that thing is GOAT
>>
>>54685960
>Just saying most of the math is out there and common.
doesn't mean you shouldn't know it, especially if you're DIYing something like a physics engine. and if it's such common knowledge then why did you get so incredibly butthurt when we listed topics in math that anon might be interested in?
>>
>>54685304
>make a system call
mon negre
>>
>>54685968
nice, what languages you working with now?
>>
>>54685786

"Needs to be advance" is already a sign something might be going wrong. There should never be complexity just for the sake of having it. The simplest most straightforward easy to understand and use approach is generally best unless there is a real specific reason to use a complicated approach.

"Able to do callback mechanisms, triggers, etc"
is a basic expectation of a physics engine.

I'm not trying to be mean or insulting but from your statements, I'd seriously recommend taking a bit of time and going over your design and requirements so far before you end up with a painful mess.
>>
>>54685987
OCaml for hobbying and C# for earning money.
>>
>>54685768
You know, I tried using the new method, but it requires that I also specify an IP address in the TcpListener(); function which requires me to also specify the IP in long int form which I have to convert back into decimal so that TcpListener(); doesn't throw and exception.

For the time being I am happy with how it works, I'll implement the new method later on.
>>
>>54685254

Cheers, that was the best way it seems. Feels a little long winded having to check for that but I'm just glad it's sorting correctly now.
>>
If you have two players,
one player has played 100 games and has won 60%
the second has played 15 games and won 80%

how do you rank their performance? More games should make win ratio count more, but how much?
>>
https://www.youtube.com/watch?v=wSV1UFbhJ-A
>>
>>54686057
Maybe use ELO ratings

Alternatively you can use a Bayesian score
>>
>>54686037
Filthy lazy pig.
>>
Why would I ever use something like TCP when I jave a reliable token ring ethernet network?
>>
>>54686057
winning % is winning %, but you could apply a threshold (eg only show players with more than 20 games)
>>
>>54686116
>When tackling such issues ask yourself these questions:

pajeet tier of thinking
>>
>>54686057
>>54686111
More specifically:
http://math.stackexchange.com/questions/169032/understanding-the-imdb-weighted-rating-function-for-usage-on-my-own-website
>>
>>54686057
This is not a programming question. This is a design question and as such has no absolute correct answer.

When tackling such issues ask yourself these questions:
What am I trying to achieve?
Why am I trying to achieve that?
How can I achieve that?
What is the cost?
Should I be trying to achieve something else?
>>
>>54686127
>token ring ethernet
>>
>>54685960
>Rarely does a game engine implement math that has never been used in a 3d engine before. Just saying most of the math is out there and common.
That kind of mindset is what generates shitty code monkey programmers that do shitty work. They implement things they don't understand, and you can't optimize what you don't understand.
>>
>>54686057

A common approach would be use a elo system. Give players points when they win and take away points when they lose. Adjust the amount of points given base on the number of points the opponent has accrued and match people withing a similar point threshold. Have all players start with a base amount of points.
>>
>>54686196
dusk gaidys
>>
File: 1463607602615.png (302 KB, 1920x1080) Image search: [Google]
1463607602615.png
302 KB, 1920x1080
rollup
>>
File: hqdefault.jpg (13 KB, 480x360) Image search: [Google]
hqdefault.jpg
13 KB, 480x360
>>54686237
Rölli
>>
>>54686237
please no shit challenge
>>
how do I switch top and down rows?
>>
>>54686358
(2 - y)*64
>>
>>54686405
>I just trolled you lol
>>
>>54685244
implement your own comparator
ascii codes of chars might be enough as '.' < nums < alfas
should be pretty simple
>>
>>54686237
thanks
>>
>>54686442
you wot? doesn't the x*64 and y*64 determine the position, then do (y - 2)*64 to reverse the order in the y direction
>>
Should I use the AGPLv3 license for my website or just the regular GPLv3 license?
>>
>>54682943
gnew is not ultrics
>>
>>54686585
you should read them
>>
Hello /dpt/,
I decided writing my own OS would be a good learning experience. The problem is I can't wrap my head around the Makefiles.
If my directory is like this:
Makefile
kernel/
--vga.h
--vga.c
string/
--string.h
--string.c

vga.h depends
string.h
but when I try to compile with:
SOURCES=kernel/vga.h kernel/vga.c kernel/main.c string/string.h string/string.c
CFLAGS=-std=gnu99 -ffreestanding -O2 -Wall -Wextra
INCLUDES= -I string.
all:
i686-elf-as kernel/boot.s -o boot.o
i686-elf-gcc -Istring/ $(SOURCES) -o nos.o $(CFLAGS)

gcc throws an error that string.h is missing. What do I do?
>>
Hello /g/entelsirs, I just finished High School and would like to program, specifically Android apps. I am quite new to programming so I have little to no experience, except HTML but many of you say that it is a meme language. Do tell me, what language is needed to develop Android apps, how hard is it, where can I learn it, and possibly point me to some resources or sites. Right now, I am not looking to make career out of it but would like to see my chance at making a bit of money on the side.
>>
>>54686750
Ignore that INCLUDES= line please
>>
>>54686756
HTML is not a language but a markup.
You need java. Download the Android Studio. Then read the docs at https://developer.android.com/studio/intro/index.html . Then you can read http://www.tutorialspoint.com/android/ . If you can do all of that you're pretty much set. Note that you need to learn java first so http://www.tutorialspoint.com/java/
>>
>>54685431

Head First Java if you have no programming experience.

The official Java tutorials if you do.

And don't be afraid of children complaining about Java, they simply want to fit in and feel accepted somewhere, it has nothing to do with the programming language.
>>
>>54686750
You need to pass -I. to gcc, then #include it as "string/string.h"
>>
>>54686806
it's a markup language you melt
>>
>>54685307
Gochuumon wa Usagi desuka
>>
>>54686872
>>54685972

Thanks you two! I think I'll have a mixture of both, I think I can quickly burn through head first in a weekend.
>>
File: 1459531573747.webm (3 MB, 352x640) Image search: [Google]
1459531573747.webm
3 MB, 352x640
How much Java do I have to know to attract pic related?
>>
File: image.png (125 KB, 1215x776) Image search: [Google]
image.png
125 KB, 1215x776
>>54685718
cosmos is comfy af

i made a 4chan image downloader in python.
>>
>>54686886
Doing -I.string/ and then including string/string.h still doestn't work...
>>
>>54687076
Why don't you follow PEP8?
>>
>>54687076
In the line where you use requests.get, it's better to use .format as it's clearer, faster and you don't have to str a number
>>
>>54687122
i'm a noob. i'll give it a look.
>>54687126
thanks for suggestion. i'll clean it up.
>>
>>54685403
It's nowhere near close to replacing normal computers, but there's immense potential. Some quantum algorithms like Shor's Algorithm (https://en.wikipedia.org/wiki/Shor's_algorithm) have the potential to make integer factorization crypto obsolete (like RSA). It's important to switch to post-quantum crypto now, before the NSA gets their hand on a working quantum computer capable of breaking RSA. Just another reason to use elliptic curve crypto.
>>
>>54687156
>Just another reason to use elliptic curve crypto.
Bzzt! And you were doing so well until this point.
ECC is not post-quantum safe.
>>
>>54687156
>integer factorization
>immense potential
k kid, haven't you a fizzbuzz to finish ?
>>
>>54687120
Doing -Istring doesn't work too. Selfbumping is lame but please guys
>>
Is it possible to do some cool stuff in excel which could get me interested in VBA? I've been programming in C as a hobby for 6 years and i need to lie for a job interview that i am really good in excel shit. I have a few days to git gud in excel.
>>
>>54687203
Mate osdev is hard, like really hard.
If you can't even get a trivial project to compile by yourself, you'll have much worse problems very very soon.
>>
>>54687246
I'm not gonna go balls deep anyways. I'll just do display and a shell. I'm just not used to having a lot of directories...
>>
>>54687307
>display and a shell.
That's extremely hard, man. Honestly. Perhaps just try making a simple shell, first.
>>
>>54685344
this
>>
>>54687246
>>54687321

[spoiler]let him try[/spoiler]
>>
>>54687321
I've done one. Display is super easy you just put characters in 0xB8000 for a simple VGA Terminal.
>>54687344
I have a lot of free time so even if I fail miserably i still might learn something (like how to use gcc). Let me try and Instead of discouraging me, maybe help if you can?
>>
I bet most of the people posting here use GNU/Linux instead of Unix.
>>
>>54687392
>Display is super easy you just put characters in 0xB8000 for a simple VGA Terminal.
That's assuming the BIOS or Bootloader does all the VGA setup work for you, in which case it's usually mapped at 0xB8000, but that's not guaranteed.

And programming the VGA registers yourself in *not* fun. Especially since doing it wrong can make your CRT monitor implode or catch fire.
>>
>>54687439
Isn't the original UNIX proprietary? And nonexistent anymore?
>>
>>54687439
Does real att UNIX still exist in any usable form?
>>
>>54687445
>That's assuming the BIOS or Bootloader does all the VGA setup work for you
I don't want to sound like "that guy" but the BIOS does that on my machine so it's fine for now.
>doing it wrong can make your CRT monitor implode or catch fire
I don't use a CRT *??*
>>
recommend me a c++ compiler
>>
>>54687521
msvc for the best optimizations
>>
>>54687535
my res is too small therefore i cant even install it
>>
>>54687486
>I don't want to sound like "that guy" but the BIOS does that on my machine so it's fine for now.
That's fair enough, if you just want to try something simple, have at it.
But display is not, in fact, super easy. It's the most retarded part.

>I don't use a CRT *??*
Well I hope you have a VM anyways, so you don't have to run your kernel on real hardware. Point is, VGA is more awful than it looks like if you want to do anything more complicated than your BIOS's default 80x25 at 0xB8000.
>>
>>54687452
>>54687455
Solaris, FreeBSD, OpenBSD, NetBSD, DragonFlyBSD
>>
>>54682943
Working on a package for atom.
>>
>>54687541
>>54687535
...need something 1995-tier in 800x600
>>
>>54687439
And you do, faggot? Installed HP-UX on your laptop?
>>
>>54686750
Get rid of the .h files in your SOURCES variable.
>>
>>54687557
I don't like the license and their compatibility with my window managers is spotty at best.
>>
>>54687535
gcc and clang are both better.
>>
>>54687557
>>54687557
>linux for contrarians who want less packages available to install
Damn buddy that's a hell of a typo you made.
>>
>>54687543
>It's the most retarded part.
Any resources on how not to kill my display.
>I hope you have a VM anyway
Qemu my friend

>>54687568
SOURCES=kernel/vga.c kernel/main.c string/string.c
CFLAGS=-std=gnu99 -ffreestanding -O2 -Wall -Wextra
all:
i686-elf-as kernel/boot.s -o boot.o
i686-elf-gcc -Istring $(SOURCES) -o nos.o $(CFLAGS)
clean:
rm -r *.o

doesn't work...
>>
>>54687629
>Any resources on how not to kill my display.
Don't use a CRT, and don't mess with the CRTC timings.

>Qemu my friend
Good choice. I can also recommend Bochs for debugging.
>>
>>54687575
>don't like a licence since it gives you more freedom
>>54687616
Spotted the aggressive conformist.
>>
>>54687665
I still don't have a CRT but I still want to use more than 25x80.
>>
>>54687629
>doesn't work...
vga.c should include just "string.h"
>>
>>54687688
Holy shit that worked thanks man!
>>
>>54687672
I'm comfortable with Linux, I don't need to switch to a different OS to inflate my ego.
>>
>>54686237
Rolling
>>
>>54687679
Then you're covered. Your non-CRT hardware will emulates the CRT registers and the CRTC, but if you feed it crap the worst than can happen is a black screen.
>>
>>54687672
>>54687672
I'm not a conformist, I'd just love to hear any practical reason to install a BSD ask your desktop computer over any Linux with a large support base besides being a tech hipster like you currently are in this thread.
>>
>>54687724
It's comfy, the config files are in easy places, management is easy, the package managers actually work, nouveau doesn't brick your system, it actually comes with vi instead of vim, etc.
>>
>>54687815
What shitty distros are you using where virtually any of these is an actual problem? Also, I have no idea why you'd want to use vi over vim, but every distro I've used installs vi as part of its base packages and forces you to explicitly install vim. As an Arch user I have none of these problems.
>>
>>54687881
Debian, OpenSUSE, Fedora
If I remember correctly, one of these didn't even have ed
>>
>>54687815
For what reason do you want vi over vim? Besides you know that vim acts just like vi until you make a .vimrc file, right?

And the only times I've had a package manager break my system was when I tried to do something incredibly stupid.
>>
File: 1459300544433.jpg (124 KB, 641x1024) Image search: [Google]
1459300544433.jpg
124 KB, 641x1024
im working on a uni project dealing with digital signing. i got stuck at verifying. how do i get the public key (generated after signing the document) file stored in the disc and assign it to PublicKey pubKey variable?

ways i tried that didnt work:
got the public key via FileInputStream and then casting it to PublicKey
also tried ObjectInputStream
>>
>>54688181
>im working on a uni project dealing with digital signing
What's the name of the project so I never use it?
I'm serious, please tell me, because your incompetence is terrifying.
>>
>>54687239
>VBA
>>
File: 1459298627997.jpg (403 KB, 1080x1350) Image search: [Google]
1459298627997.jpg
403 KB, 1080x1350
>>54688181
forgot to mention im using java
>>
>>54688219
Why, of course you are
>>
Here's a challenge for you all: Write a program that converts data into an audio signal which can be stored on cassette tapes.
The person whose program is the most reliable (most data recovered without corruption) and most efficient (most data stored in the least space/time on the tape) wins.

Will anyone do it?
>>
>>54688255
Opus with a heavy Reed-Salomon encoding, what do I win?
>>
>>54688181
>>54688219
might be a trap, might be a roided up chick
>>
>>54684422
that's not procedural
there's no side effects in the code and no need to proceed in a certain way even
>>54684469
well they could make it return Maybe String, but yeah the input validation should ideally occur before the data is passed into that function
>>54684751
exceptions are seen as bad in Haskell/FP because they generally represent a failure that can't be recovered from (meaning the code absolutely should crash). for functions that are pure, this is quite rarely the desired effect so people prefer to limit exception use and use a different representation of error/success states (Maybe or Either)
>>
So I have an array list, insert two items, and then I call a function to return the item at index 3.
This should be an error, since there will be nothing at index 3.
Here's the get method:
template<class ItemType>
ItemType ArrayList<ItemType>::getIndex(int index)
{
if (index < 1 || index > itemCount)
{
cerr << "Index is out of bounds." << endl;
}
else
{
return list[index];
}
}


My main:
int main()
{
ArrayList<int> a;
cout << "empty " << a.isEmpty() << endl;
cout << "length " << a.getLength() << endl;
cout << "a.insert(1, 5) " << a.insert(1, 5) << endl;
cout << "a.insert(3, 9) " << a.insert(3, 9) << endl;
cout << "length " << a.getLength() << endl;
cout << "get 3 " << a.getIndex(3) << endl;
}


And then my output:
empty 1
length 0
a.insert(1, 5) 1
a.insert(3, 9) 1
length 2
Index is out of bounds.
get 3 6299776


Shouldn't only say "Index is out of bounds" ?
Why am I getting "get 3 6299776" ? I'm guessing 6299776 is the memory address, but I feel that shouldn't even get printed.
>>
>>54688333
Ah, fuck. I'm an idiot. I'm inserting at 3 so something is there but the item count is 2.
Sorry everyone.
>>
>>54688333
Undefined behavior.

Your function returns a ItemType, but one of the paths does not have a return statement.
>>
>>54688125
It's lightweight and I don't have to worry about stuff I'm not using, like Ugandan children.
vim also removes features if it claims they're useless
Do you know about ex/vi's open mode?
>>
Why is Rust's memory semantic so glorified when it's basically RAII/std::unique_ptr from C++?
>>
>>54688277
You must actually have a working program to win. £5
>>
>>54688377
Nice try kid, I'm not gonna do your homework.
>>
>>54688368
because the borrow checker is enforced for every pointer
>>
>>54688368
Because it's actually much more than RAII/unique_ptr. You could only do the same in C++ with a smart-pointer aware static analyzer.

t. C++ expert, Rust beginner
>>
>>54688361
>It's lightweight and I don't have to worry about stuff I'm not using, like Ugandan children.
Mate, vim.tiny is 1.0MB, does your system run on a floppy? Do you know how much bigger than Vim your current web browser is?

>vim also removes features if it claims they're useless
>Do you know about ex/vi's open mode?
Vim still has Ex mode, Q in normal mode to enter it.
>>
>>54688398
>>54688402
Eh doesn't seem to be that much of an advantage for even more verbose syntax than C++.
>>
>>54688455
It's a good retort for the "C is inherently unsafe and all bugs ever are because of C programmers, everyone should use Python/Ruby!" crowd.
>>
>>54688402
I'm not even a rust beginner but doesn't rust's development package essentially come with a static analyzer? So that doesn't seem special. My understanding was that a rust install is essentially a full kit.
>>
>>54688553
The rust compiler is required to do some form of static analysis of lifetimes, this is Rust's Borrow Checker.

Since C++ is much less constrained, it's practially impossible to do the same, unless you restrict yourself to a subset of the language or annotate your code.
>>
>>54688361
>Do you know about ex/vi's open mode?
Yes and it's useless
>>
>>54688427
>imblyng open mode is ex mode
"Vim does not support open mode, since it's not really useful."
One of vi's five modes, considered not useful enough to be included in vim.
>>
>>54688629
Oh I'm sorry, I didn't realize you were a hipster, you probably care more about appearances and pretending to do work than actually producing anything.
Why don't you use Ed, I hear it's what the cool kids had a couple decades ago.
>>
>>54688358
OH.
Thanks!
>>
>>54688674
It seems to me that you're the one that cares more about the hacker aesthetic and anyone who isn't a part of it is a hipster.
Protip: Hipster is a buzzword now.
>>
>>54688785
I use Vim because it's powerful and featurful. You want ancient stuff because it's "lightweight" and doesn't have as many features that you're "not using". And then you complain about the most useless features in the world, alternate modes so shitty they were removed long ago.

Nice.
>>
>>54688858
Wasn't removed from vi.
Stop assuming vim is the sole successor to vi, the true successor to vi, etc.
>>
C, C#, C++ or Python for general coding?
Which is better, which is faster, which is more beginner friendly?
>>
>>54689042
C# and C++ are nice, you can do anything with good performance and many libraries.
Python is more for small one-off scripts, if your project grows bigger it becomes hell.
C is a legacy choice.
>>
>>54689042
depends but Python would be good for general purpose
neither is fast, languages cant be fast
Python
>>
>>54689042
Just start w C as everyone else does.
>>
>>54689042
C, C, C.
>>
>>54689042
Python for general coding, it's expressive and beginner-friendly, and unless you're doing very intensive software, it's fast enough.

Oh and it is suited for large projects, we have several at my work, and it doesn't fall short
>>
>>54689115
>neither is fast, languages cant be fast
The excuse only used by people whose languages are slow, coincidentally.
There's a reason Python is always last on every Benchmark.
>>
>>54689127
beginner friendly != easy
Python is easy for beginners, but toxic. Have fun trying to learn a 3GL after using Python.
>>
>>54685244
Extract the digits in the file name, convert to integer, associate the number with the file name, and sort by number.
>>
>>54689042
Whatever you choose stay the fuck away from C++. I'd recommend python though since I believe it has a repl
>>
>>54689180
>but toxic
Keep fizzbuzzing memelord
>>
>>54689197
How do you get to that?
Python hides much of what is up to the programmer in other langauges, hindering the beginner's eperience when learning them.
Kill yourself my man.
>>
>>54689221
So does every other language. Abstraction is necessary to further push technology.
>>
>>54689180

3rd gen languages are old hat. This is the future. We're moving on from such things.
>>
>>54689265
uh
>>
>>54689094
>>54689115
>>54689122
>>54689124
>>54689127
>>54689128
>>54689184
Why is C++ bad? Also, if I decide to start C# from scratch, how hard would it be transitioning from it to C or C++? And which IDE should I use for C#?
>>
What is the difference between a compiled language, a just-in-time compiled language and an interpreted language?
Thread replies: 255
Thread images: 29

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.