[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 325
Thread images: 39

File: Pelles_C.png (364KB, 1024x768px) Image search: [Google]
Pelles_C.png
364KB, 1024x768px
What are you working on, /g/?

Previous thread: >>61915702
>>
>>61919998
Productivity tips? Currently:

>Having a sleep schedule (rise at 6 and go to bed at 10)
>Alternating between focused-work and rest (60 min for work, 30 min for rest) sessions
>Using Python and Make (free multithreading) for scripts (level generation from image) and C11 (need performance and too much of a brainlet for C++) for the game engine
>Sometimes using physical work (splitting logs) as rest from programming, but longer (90 min session for a full trailer). I think it's working just as well, maybe just as good as good as just resting, but you get perspired so that sucks.
>Reading random excerpts from C11 standard, OpenGL ES 2.0 guidebook, OpenGL ES 2.0 standard, GLSL 1.0 standard on free time when just can't think about programming anymore (it gets too much, maybe I don't like it as much as I thought I did, but it's too late to "search for myself" now, I'm fucking 20 already)
>Using Code::Blocks svn build (much fewer bugs and much faster) and IDLE as IDEs
>Dropped Lua because Python does its job (except for high-performance embedded game-engine scripting, but my little turd is very far from that) and focusing on Python
>Thinking about starting drinking coffee, maybe it improves focusing on code (or maybe I should look into aderall for a real thing?). So far not having any major bad habits (smoking, drinking, drugs) but this one might actually be beneficial.
>Got ~3.5 years to start my own company because then I get my university degree (software engineer) and if I'm not good enough to sell my own shit by then I'm officially a failure
>So far got some primitive matrix/vector math that I'm really using, nothing else, even algorithms (only BFS, DFS, backtracking and shit I have probably re-invented when I needed) in my head, maybe that's enough. Can't wrap head around physics with angular velocity (haven't really tried yet), for know I'm fine with "minecraft-like bit-array using primitive physics", access is O(1)
>>
>>61920029
Read PSP.
>>
>>61920029
yeah physical work/exercise is good

stay hydrated

i drink coffee everyday BUT i would not recommend it unless you need to be focused for a specific activity at a specific time at the cost of getting more tired at other times
>>
File: 10.png (309KB, 801x511px) Image search: [Google]
10.png
309KB, 801x511px
Trying to implement fresnel reflections in my c++ raytracer

Pic related is what I have so far, the triangle has a custom glossy BRDF
>>
>>61919998
Learn Go:
https://tour.golang.org
https://www.golang-book.com
>>
what are the best php books out there? i hate php, but if i don't learn it i won't find a job
>>
File: DHI3ogxXsAAvrRE.jpg (121KB, 1200x915px) Image search: [Google]
DHI3ogxXsAAvrRE.jpg
121KB, 1200x915px
>>61920167
Learn Nim:
https://nim-lang.org/docs/tut1.html
http://howistart.org/posts/nim/1/index.html
https://nim-by-example.github.io/getting_started/
>>
>>61919998
Rate my abstract Fizzbuzz:
#![feature(conservative_impl_trait, inclusive_range_syntax)]

use std::borrow::Cow;

fn fizzbuzz(until: usize) -> impl Iterator<Item = Cow<'static, str>> {//'
(1...until).map(|x| match (x % 3, x % 5) {
(0, 0) => "FizzBuzz".into(),
(0, _) => "Fizz".into(),
(_, 0) => "Buzz".into(),
_ => format!("{}", x).into(),
})
}


fn main() {
for fb in fizzbuzz(100) {
println!("{}", fb);
}
}
>>
>>61919998
Any books that aren't specifically about a programming language but instead are more about more general computation such as algorithms, math (and programming too).
>>
>>61919532
the chinese are better programmers than you and there's hordes of them, and they're cheaper. they're far from unintelligent, they just don't have a creative bone in their body. your webdev job isn't secure
>>
>>61916570
>>61916591

-- if empty, just insert it
insert_last x [] = [x]
-- if not empty, insert it at the end
insert_last x (y : ys) = y : insert_last x ys


Haskell is cute! CUTE!
>>
How do you pronounce clang, /dpt/? Cee-lang? Clang?
>>
>>61920356
Klang
>>
>>61919998
a bunch of Access VBA and SQL

i need a cup of coffee.
>>
>>61920375
WE
>>
>>61920234
Try Sedgewick's Algorithms, Bhargava's Algorithms, Goodrich and Tamassia's Algorithm Design, Ron Rivest et al.'s Introduction to Algorithms, Knuth's The Art of Computer Programming, Kernighan and Pike's The Practice of Programming, Scott's Programming Language Pragmatics, Lang's A First Course in Calculus, Rorres and Anton's Elementary Linear Algebra with Application, Ross' Probability Models for Computer Science, Wiley and Wilson's Much about Calculus, Lax's Calculus with Applications and Computing.
>>
>>61920225
What esoteric programming language is this?
>>
>>61920451
You asked this in the other thread already
>>
>>61920451
It's, may Allah forgive me for uttering such a word, Rust
>>
>>61920303
a good chinese programmer is going to move to a first world country or stay in china at a high tech company and take a large salary, the ones that would do outsourcing work for cheap would be the uneducated and malnourished peasants

you get what you pay for, as >>>/g/csg is very well aware of, you naive summer fuck
>>
What's the best statically typed, compiled and portable language for general purpose stuff and interfacing with?
>>
fuck
>>
>>61920221
Just use the W3Schools tutorial:
https://www.w3schools.com/php/
>>
>>61920167
>No generics
>Productivity

No. Mastering C++ makes you the most productive, because it's the most versatile language. It can literally do everything.
>>
>>61920234
sicp and hacker's delight
>>
>>61920479
that's not true, though. the cost of living in china is much lower, and there's plenty of code monkeys who are quantitatively smarter than the average american coder. it doesn't pay much because creativity isn't valued there, so all of them do boring jobs like programming even if they don't like it. in america, generally only people who are drawn to programming do it. everything you say is fueled by emotion and what you want to be true
>>
>>61920529
Pascal
>>
>>61920543
ok have fun outsourcing your website to the chinks
>>
>>61920529
c++
haxe
>>
Who here working on machine learning implementations on any of their projects?
>>
>>61920555
i'm not the one outsourcing anything. why are you angry at me? i'm just telling you the truth. there will still probably be web dev jobs, but it's going to be dealing with designing the website & requirements, maintaining, and testing the code written by other people. knowing a couple programming languages doesn't make you invaluable in the long term
>>
>>61920225
R8 mine:
interface FizzBuzzable {
public int value();
public String doFizzBuzz();
}
final class FizzBuzzableNumber implements FizzBuzzable {
private final int num;
public FizzBuzzableNumber(int n) { this.num = n; }
public final int value() { return this.num; }
public final String doFizzBuzz() { return new Integer(this.num).toString(); }
}
abstract class DivisibleNumber implements FizzBuzzable {
protected final FizzBuzzable original;
public DivisibleNumber(FizzBuzzable origin) { this.original = origin; }
public final int value() { return this.original.value(); }
public final String doFizzBuzz() {
String fizzBuzzed;
if (this.isDivisible()) fizzBuzzed = this.fizzBuzzing();
else fizzBuzzed = this.original.doFizzBuzz();
return fizzBuzzed;
}
protected abstract boolean isDivisible();
protected abstract String fizzBuzzing();
}
final class NumberDivisibleByThree extends DivisibleNumber {
public NumberDivisibleByThree(FizzBuzzable origin) { super(origin); }
protected final String fizzBuzzing() { return "Fizz"; }
protected final boolean isDivisible() { return ((this.value() % 3) == 0); }
}
final class NumberDivisibleByFive extends DivisibleNumber {
public NumberDivisibleByFive(FizzBuzzable origin) { super(origin); }
protected final String fizzBuzzing() { return "Buzz"; }
protected final boolean isDivisible() { return ((this.value() % 5) == 0); }
}
final class NumberDivisibleByThreeAndFive extends DivisibleNumber {
public NumberDivisibleByThreeAndFive (FizzBuzzable origin) { super(origin); }
protected final String fizzBuzzing() { return "Fizz Buzz"; }
protected final boolean isDivisible() { return ((this.value() % 15) == 0); }
}

public class Main {
public static void main(String[] args) {
for (int i = 1; i <= 100; ++i) {
System.out.print(new NumberDivisibleByThreeAndFive(new NumberDivisibleByFive(new NumberDivisibleByThree(new FizzBuzzableNumber(i)))).doFizzBuzz());
if (i < 100) System.out.print(", ");
}
}
}
>>
>>61920610
You're hired!
>>
>>61920603
>i'm not the one outsourcing anything
ok have fun sharing your deep insight with us
>>
>>61920555
Communists do better work because labor is appropriately valued in a Communist society.
>>
>>61920622
the chinese aren't communists, they will gladly do the bare minimum that would be considered a website, and charge you more than it's worth
>>
>>61920617
the best person to ask for an unbiased assessment of the future of an industry is surely someone who's just starting a career in that industry
>>
>>61920660
you're naive like a child, you think a chinese slave laborer can do as good of a job in a high tech industry as an educated first-worlder
>>
>>61920640
Yes they are, you dumb faggot.
>>
>>61920610
ENTERPRISE CODE!
>>
>>61920694
http://www.businessinsider.com/how-china-went-from-communist-to-capitalist-2015-10

fuck off clueless antifa scum
>>
>>61920029
Also don't jerk off.
>>
File: zdgjtrsrtst.jpg (44KB, 650x366px) Image search: [Google]
zdgjtrsrtst.jpg
44KB, 650x366px
>>61920748
>businessinsider dawt cawm
>he actually thinks that's a credible source about foreign political economy
kek
>>
>>61920800
why, it's like 10 mins/days max if you're not too picky
>>
>>61920803
you're going to get unmasked fag

>>61914056
>>
>>61920682
you don't know much about china, watch the last half or so of this video
https://www.youtube.com/watch?v=GI6_KjmmrSQ

programming isn't a special, super difficult job which only white people with a 4 year degree can do well. ESPECIALLY web or app development. small children can learn how to do both of those proficiently, let alone chinese people who have to learn college level calculus and trigonometry in high school to pass their university admission exam
>>
>>61920803
As opposed to?
>>
>>61920836
LOL stay delusional
>>
>>61920824
What website is that? I don't pointlessly march in the streets to get political shit done. I'm a dagger in the dark kinda guy, not one of the thousand swords at dawn.

You fags' problem is that you thought that we were playing chess.
>>
File: c9a.png (225KB, 373x327px) Image search: [Google]
c9a.png
225KB, 373x327px
>>61920857
>>
>>61920877
Not really, but little pussies like you won't ever understand real politics. You still believe that Trump was your victory.
>>
File: BnlzkhU.jpg (113KB, 720x720px) Image search: [Google]
BnlzkhU.jpg
113KB, 720x720px
>>61920933
>>
test
>>
>>61921155
test
>>
>>61920939
Do you have any more tired memes to share kiddo?
>>
>>61921165
test
>>
>>61920234
sicp
>>
File: 1490799370836.jpg (13KB, 375x375px) Image search: [Google]
1490799370836.jpg
13KB, 375x375px
>>61920748
>>
Hey /g/

I want to learn to program. Thinking about c# or java. Which of those should I pick?
>>
>>61922415
D
>>
>>61922415
between those 2? C#
>>
>>61922415
C# is a better language but .NET core isn't very mature yet, so cross-platform support is limited unless you use something like Mono.
>>
>>61920701
>>61920616
...you joke but there is a reason enterprise code is heavily layered and abstracted.
>>
Anyone experience with CCXT crypto lib?
Or bittrex api?

Currently fetching data from bittrex and another exchange and very often run into urlopen timeouts, suspecting the api server are just overloaded but some other experience would be good
>>
do i really have to use the stdint.h types
>>
>>61924212
Yes.
>>
>>61924212
https://matt.sh/howto-c
>>
>>61920223
seconded
>>
>>61920539
time to go back to /r/programmingcirclejerk with your nogenerics lulz
>>
File: govnocode.webm (924KB, 600x336px) Image search: [Google]
govnocode.webm
924KB, 600x336px
>>
>>61924398
t. buttplasted gopher
>>
/g/ I have about one month before my first C/assembly class, which in my university is taught by a very hard grading, cunt teacher.

What is the best video tutorials I can go for C, pointers, etc. that can help me go through the class more easily? I have time. Thanks!
>>
>>61924865
Just fucking go for it and if you have questions go to /sqt/. C isn't a hard language, it's just error prone if you're inexperienced.
>>
Should I use GPLv3 or AGPLv3 for a library?
>>
File: ida.png (95KB, 1440x900px) Image search: [Google]
ida.png
95KB, 1440x900px
>>61919998
Disassembling my mobo BIOS^WUEFI
>>
>>61924983
You may as well not release it if you're going to use a shitty cuck license.
>>
>>61920234
The Art of Computer Programming
>>
anyone familiar with using glibc in assembly can tell me how to fix this segfaulting?
;  Source name     : BOILER.ASM
; Executable name : BOILER -- though this isn't intended to be run!
; Version : 2.0
; Created date : 10/1/1999
; Last update : 5/26/2009
; Author : Jeff Duntemann
; Description : A "skeleton" program in assembly for Linux, using NASM 2.05,
; demonstrating the necessary code to preserve and restore EBP, EBX, ESI,
; and EDI. The program does nothing and is provided as boilerplate for
; assembly projects that link to functions written in C.
;

[SECTION .data] ; Section containing initialised data
StartMsg: db "Start",0

[SECTION .bss] ; Section containing uninitialized data


[SECTION .text] ; Section containing code
extern puts
global main ; Required so linker can find entry point

main:
push rbp ; Set up stack frame for debugger
mov rbp,rsp
push rbx ; Program must preserve ebp, ebx, esi, & edi
push rsi
push rdi
;;; Everything before this is boilerplate; use it for all ordinary apps!
push StartMsg
call puts
pop rax
;;; Everything after this is boilerplate; use it for all ordinary apps!
pop rdi ; Restore saved registers
pop rsi
pop rbx
mov rsp,rbp ; Destroy stack frame before returning
pop rbp
ret ; Return control to Linux


i stepped through with gdb and it gets to call puts fine. this is my makefile
timer: timer.o
gcc -o timer timer.o
timer.o: timer.asm
nasm -f elf64 -g timer.asm


i'm really fond of this assembly book i'm going thorugh, but he uses 32 bit and i can't find anything about this online. all the results are people trying to compile glibc binaries. i'm on the final chapter of the book
>>
>>61925041
>shitty cuck license
>waaahhh I can't just take it for free and sell it in a proprietary product
>>
>>61925089
You are absolutely delusional if you think big corporations give even the slightest fuck about your license. If your code is public, it's getting stolen. The chinks in particular give zero fucks.
>>
>>61925073
The abi for x86_64 is different then x86, you can't just replace e with r. Parameters get passed in registers not on the stack.
>>
>>61925073
http://wiki.osdev.org/System_V_ABI#x86-64
>>
File: ulamspiral.png (73KB, 610x624px) Image search: [Google]
ulamspiral.png
73KB, 610x624px
I got SDL to draw an Ulam spiral.

keen eyes will notice that the pattern is mirrored & inverted, this is because I'm dyslexic...
>>
>>61925140
do you have anything i can read about it?
>>
>>61925125
>some people will try to steal your work
>so you shouldn't even bother trying to discourage it or give yourself a chance of legal recourse
what am I even reading
>>
>>61925161
cool, thanks!
>>
>>61924993
alexy pls
>>
>>61925166
i wonder how hard programming actually is for dyslexics
>>
why is there no real open-source alternative to ida
radare2 is awful
>>
>>61925195
easier than for the blind and harder than for those with normal vision i assume
>>
>>61925218
then help improve it
>>
>>61925226
I'd prefer to start from scratch
>>
>>61925184
If your goal is for lots of people to use your library then GPL actively harms it as many people do not want to use poorly licensed code that infringes on their freedom.
>>
>>61925237
this

do you think so many game devs would be using ogg if it was GPL? no, they wouldn't
>>
>>61925237
>b-b-but a P-PROPRIETARY program might u-use it!! m-m-muh free s-software!!!
>>
>>61925166

good shit anon
>>
>>61925237
>>61925257
If you want to use software I wrote in a proprietary product then pay me.
>>
>>61925286
no thanks, i'll just take it anyway
>>
>>61925296
https://en.wikipedia.org/wiki/Software_Freedom_Law_Center
>>
>>61925286
The Chinese will take your code without paying for you anyway.

Might as well give American corporations the opportunity to do so as well. Unless you are a filthy chink.
>>
File: ulam.png (15KB, 400x400px) Image search: [Google]
ulam.png
15KB, 400x400px
>>61925166
i did this in python long time ago too
>>
>>61925319
>literally only six(6) cases of litigation being brought against someone who stole GPL code in ten(10) years
Please tell me you don't think that is even a miniscule fraction of the real number of proprietary software that uses GPL code.
>>
Should I go back to school and get a degree in computer science? I don't know how to do shit and need to start making money but I got Joe Computer in my ear telling me that degrees are essentially useless. Help /g/
>>
File: GPLvBSD.png (13KB, 758x155px) Image search: [Google]
GPLvBSD.png
13KB, 758x155px
>>61925089
We've already established in a previous thread that GPL is the real cuck license, not BSD.
>>
>>61925323
>>61925381
THE LAOWAI KNOW, SHUT IT DOWN!
>>
>>61925381
I never thought about it this way
>>
>>61925381
>opt to get fucked by twice as many entities
hmm
>>
>>61925409
The obvious solution is to never get fucked at all and never open source anything. "Free" software is a form of political correctness designed to shame Americans into releasing their property so the Chinese can get easy access to it.
>>
What is the difference between MIT and BSD?
>>
>>61925409
>helping your country
vs
>helping a foreign country
hmmm...
>>
>caring about who uses your code
>not just releasing it into the public domain where possible
>>
>>61925434
>not taking it from anybody who will give it to ya
Prude.
>>
>>61925346
Too poor to buy tools, too lazy to write one's own tool, and proud to admit to that state of affairs is a very unappealing combination, thief-wannabe anon.
>>
>>61925469
the ISC license is almost this

literally the only thing it says is "don't claim you made it and don't sue us"
>>
Has anyone ever used TinyXML in C++? I'm getting a weird error, and it only happens after I use TinyXML. The error is completely unrelated to the actual TinyXML code, but if I don't call any TinyXML functions, the error doesn't happen.
>>
Any assemblyfags here? Which one was the most interesting to you: x86, MIPS, ARM,PPC or Sparc?
>>
>>61925474
The part you don't understand is copyright laws are actually enforced here, unlike in China.
>>
File: wtfpl-strip.jpg (297KB, 1200x1500px) Image search: [Google]
wtfpl-strip.jpg
297KB, 1200x1500px
>>61925451
>>
>>61925500
6502
>>
>>61925508
Yeah, but where is MIT in that?
>>
>>61925488
i don't care, moralfag
>>
File: what the fuck am i reading.jpg (9KB, 190x200px) Image search: [Google]
what the fuck am i reading.jpg
9KB, 190x200px
>>61925381
>only Chinese businesses can steal your code
>>
>>61925522
It's the same as BSD, but sharply dressed and with the filter of the cig on the proper side.
>>
>>61925517
6502 is too simple. I want to learn a modern powerful processor.
>>
File: adv-china.jpg (176KB, 1000x1000px) Image search: [Google]
adv-china.jpg
176KB, 1000x1000px
>>61925390
laowhy?
>>
>>61925596
dumb frogposter
>>
Do I need to include the javadoc-like comments, which describe what a function is and does, both in the header file and in the source file of a single header library? or do I only need to include these in the header file?
>>
>>61925533
US copyright law doesn't hold in China
>>
>>61925650
Do you think the US is the only country with copyright laws?
>>
>>61925679
China doesn't care about any of them
>>
>>61925679
China doesn't adhere to any copyright laws
>>
>>61925692
>>61925700
So China's a writeoff. That leaves Canada, Europe, Australia, and lots of other countries besides the US.
>>
Unpopular confession: I don't count Python or JS experience as real programming experience when looking at resumes
>>
Is Erlang useful for anything if you don't have a large number of data centers?
>>
>>61925755
procrastination
>>
>>61925754
We need more people like you. Only a small portion of Python code isn't pajeet-tier.
>>
>>61924212
If you care about writing correct code that fucking works.
>>
File: adv-china-1.png (701KB, 1361x888px) Image search: [Google]
adv-china-1.png
701KB, 1361x888px
>>61925624
>not getting a chinese wife
>>
I'm still trash at asm /g/. Can someone tell me why it's not printing? Using nasm
>>
>>61924311
This is fucking awesome
>>
>>61925498
Pray tell
>>
>>61925870
is this AT&T syntax?
>>
>>61925870
what's your environment even
>>
>>61925910
That's Intel syntax.
>>
>>61925870
>>61925910
because it looks to me like you're jumping to the end if 40 is greater than 20
>>
>>61925910
intel

>>61925916
64 bit Ubuntu virtual box vm w/ nasm
>>
>>61925754
what even are you?

bigot
>>
>>61924311
>The first rule of C is don't write C if you can avoid it.

>If you must write in C, you should follow modern rules.

stopped reading there. bet he shills for rust. you're not going to fuck anything up by writing bad C code when learning, and if you have a job writing C, you're going to be writing C how THEY want with THEIR style guide, not what this dickhead says is the right way
>>
>>61925932
oh shit I'm stupid let me try again. ASM is hard to get used to.
>>
>>61926081
i think that's what your problem was, because cmp op1,op2 does the equivalent of op1 - op2. you can use gdb to test this type of stuff. i use ddd as a graphical interface
>>
>>61925772
this may sound retarded but i looked at the stdint.h file on linux and i saw that it redefines most of the types to be the "correct" ones anyway

is it safe to assume this will be true for stuff that doesn't use glibc?
>>
Wrote a program to scan every IP in my country for vulnerable printers

lel, prepare yourselves normies
>>
>>61925955
Your response times are getting worse, NSA.
>>
>>61926192
i'm not in the NSA asshole
>>
>>61925955
The reason you should avoid C is because a bug in any other language is just that, a bug, while in C a bug means a massive security breach.
>>
>>61926199
you've drank koolaid if you believe that
>>
>>61926188
shodan exists dude
>>
>>61926196
>p-pls keep using innately insecure software, anon
>trust me, I'm t-totally not NSA
Sure you aren't.
>>
>>61926208
I don't believe that, I KNOW that for a fact.
>>
>>61925900
I'm making a game using SDL. I have a TextField class for displaying text. TextField contains a member variable fontFile, which is a string containing the path to the font.
After I use TinyXML, I get errors where the fontFile variable will become null, and also the text will randomly disappear and reappear. These errors do NOT occur if I skip using TinyXML.
>>
>>61926229
when you 'know' something untrue it's called delusion, not fact
>>
>>61926243
I know, and the corollary of that is that you are either deluded or, like I said before, an NSA disinformant shill. Stay mad, NSA shill.
>>
File: astolfo 920.jpg (505KB, 707x1000px) Image search: [Google]
astolfo 920.jpg
505KB, 707x1000px
Can you write a program that generates all possible IP addresses in the IPv4 address space?
>>
File: will_summer_ever_end?.png (153KB, 321x290px) Image search: [Google]
will_summer_ever_end?.png
153KB, 321x290px
>>61926350
>can you write 4 nested loops?
>>
>>61926400
You'd be surprised how many people can't pull this off.
>>
>>61926407
Just like Fizzbuzz right?
>>
>>61926184
I for one am developing a language on top of a freestanding environment. No dependencies other than Linux system calls.

The stdint types are a godsend. Since I don't have to deal with junk like libc's functions, I don't have to use legacy crap types like int, ever. I don't have to deal with printf. I'm free. I'm like a god, erecting even the most basic features out of nothing. Freedom from the legacy of libc, of stupid str* functions. I typedef'd them to shorter, linux kernel style names like u8, u64, but that's just cosmetics.

Linux's system call interface uses long, but really, deep down its just whatever type whose sizeof == the processor's native register size. Why? Because the system call arguments get shoved into a bunch of specific registers, so any type with at most that amount of bits will work. On x86_64 it's 64 bits, so I simply used uint64_t for the system call interface. It works beautifully.
>>
>>61926183
Heck yeah I understand now. Thanks anon. I misunderstood now cmp does comparing. It's Dest - Source not source - dest
>>
>>61926452
dst, src will almost always be the order in asm (and even c)
>>
>>61926462
yeah I don't know why I thought otherwise
>>
>>61926452
good now that's enough assembly for you. C is unsafe enough
>>
>>61926462
except for AT&T syntax you'll find in c programs assembled by gcc
>>
>>61926350
>>61926400
As expected of a degenerate trap poster.
>>
Has anybody here ever written a compiler?
Show it!
>>
>>61926490
not using
>-masm=intel
or
>objdump -d --disassembler-options=intel
like a sane person.
>>
My professor said software engineering is not about programming.

is he right?
>>
>>61926530
Very. Now take in the idea that programming isn't about learning programming languages.
>>
>>61926530
Partially.
Computer programming languages are just one tool in your arsenal for building software.
Claiming that software engineering is about programming is like claiming construction is about hammering nails.
>>
>>61925796

I used to date a girl who was half Chinese. She was manipulative and emotionally abusive, and turned into a lunatic in the end.

>>61926199

Actually, bugs in other languages are just as easily capable of being security vulnerabilities. There are plenty of ways to gain access to a machine other than corrupting memory. Last year I participated in the International Capture the Flag -- which involves patching up vulnerabilities in some machine you are given while exploiting those of other teams -- with a cybersecurity class I was taking. I finding and patching up 2 vulnerabilities for my class during our timeslot, both of which were in Python programs.

>>61926350
>>61926400

It can be done in a single loop!

IP_MAX = 0xFFFFFFFF
(0..IP_MAX).each do |ip|
d = ip & 0xFF
c = (ip >> 8) & 0xFF
b = (ip >> 16) & 0xFF
a = (ip >> 24) & 0xFF
puts "#{a}.#{b}.#{c}.#{d}"
end
>>
>>61926576

>I finding and patching
Meant to say "ended up finding and patching"
>>
>>61926565
>>61926566
he said software engineering is not about programming in the sense that as a SE you'll work with requirements, diagrams who describe code, etc.

programmers convert those diagrams into code, that's the task of coding, which isn't the same as programming.

programming was more common in the 80's when out software wasn't that complex, and we didn't need SE
>>
>>61926576
Did she eat dogs?
>>
>>61926601
this sounds like grasping at straws

you're still a goddamn code monkey at the end of the day unless you're the lead dev and in charge of architecture
>>
>>61926603

No. Fortunately she was very much a dog person and thus would not eat one.
>>
>>61926669
>very much a dog person
ah yes the infamous 'dog woman'.
>>
>>61926669
literally bestiality.
>>
>>61926669
What about hotdogs?
>>
>>61926530
>>61926601
he's right
>>61926629
people are already outsourcing code and it'll just keep increasing. why pay a monkey $60k/y instead of $12k?
>>
>>61926693
Nah.

>>61926701
Probably. I don't think I've seen her eat one though.
>>
>>61926737
>why pay a monkey $60k/y instead of $12k?
At least at my old company, because the 12k/y code monkeys threw enough shit around while screaming to drive them into bankruptcy. I'm not saying keeping the in-house team would have saved them, but the software components didn't start dragging them down until after they started saving money on monkey chow.
>>
>>61924710
I've seen this no less than five times and I still have no idea what govnocode means

Is it an 'Ello, Govna! reference? I have no fucking clue
>>
Looking to learn coding from scratch to find work (without diplomas) and also creating games in the future.
Best languages to learn? (Java, C, Javascript and HTML?)

Best sites to learn+exercises for beginners? Is Sololearn ok?
>>
>>61926908

Govno is Russian for shit.

http://govnokod.ru/
>>
>>61926903
in china, 12k usd is a well paying job
>>
>>61926990
in china woman is for rape
>>
>>61926990
Too bad that's 1/2 the poverty line in the US.
>>
>>61926943
This kind of site would never work in the west, codemonkeys refuse to admit they're shit programmers and would never post snippets of their own code to make fun of themselves.
>>
>>61927009
costs less to live in china and labor is cheap
>>
>>61927008
>in china woman is for abortion or given away for adoption
ftfy
>>
>>61925796
Someone post the "you dont want to learn mandarin" pic
>>
>>61927038
..the daily wtf was popular for years and years..
>>
>>61926576
what language is this? care to explain?
t. noob
>>
>>61926990
It may have been a well paying job, but that payment got the company neither a good job, nor a job well done.
It's only one data-point, but "penny wise and pound foolish" didn't become a cliche by never being applicable.
>>
>>61927126
ruby
>>
File: DontLearnMandarin.png (946KB, 1400x5552px) Image search: [Google]
DontLearnMandarin.png
946KB, 1400x5552px
>>61927069

Hunted around on RebeccaBlackTech just for you
>>
>>61927159
Makes me rage every single time
If you guys want more read "poorly made in china" book, it's literally the "work yourself into a rage" book
>>
r8 mine

flist = [1..100]

fb n | mod n 3 == 0 && mod n 5 == 0 = "FizzBuzz"
| mod n 3 == 0 = "Fizz"
| mod n 5 == 0 = "Buzz"
| otherwise = show n

main = do mapM_ putStrLn (map fb flist)
>>
>>61926576
James, you shouldn't take about your ex-gf like that.
>>
>>61927402
>unemployed/10
>>
File: 1502215668338.jpg (9KB, 200x224px) Image search: [Google]
1502215668338.jpg
9KB, 200x224px
>>61927402
>mod n 3 == 0 && mod n 5 == 0
>>
whats the most sane data types for working with arrays of images and associated filenames in java, /dpt/?
>>
File: miku cock.png (388KB, 435x437px) Image search: [Google]
miku cock.png
388KB, 435x437px
>>61927492
If you value space efficiency, you'll make a flat array of pixel structs and access individual pixel data like so
img->arr[(img->height * i) + j]
>>
how to write this javascript code in less lines or a functional way
function handleQuery(e, q, s) {
if ((e.keyCode || e.which) == 13) {
window.location = "https://" + s + ".com/" + q;
}
}
>>
>>61927492
>Image[] images
>String[] filenames
>same index for both filename and image
>>
>>61927639
I meant packed shorts containing pixel data
>>
>>61927639
i value my time more, this code wont ever be used for anything

also my main concerns are simply reading and writing them from network locations to local storage.

>>61927682
sorry, should have specified im working with images on a network location i need to read. its been years since i last wrote anything in java.
>>
>>61927648
You can't, it's all object oriented from the get go. I'd say return the URL instead of changing window.location from the function so that the caller can decide where the URL goes.
>>
>>61927871
it's for a small box that you input the twitter user name click enter and goto to that twitter user page
changed to
 
function handleQuery(e, q, s) {
window.location = "https://" + s + ".com/" + q;
}


i think this way you can write a one liner, but now sure how
>>
>>61927639
Hi I fixed your code for you!

*((*img).arr + ((*img).height * i) + j)
>>
>>61927929
are you running low on newlines? why do you want that to be a one liner?

window.location = `https://${s}.com/${q}`;
>>
>>61927955
congratulations it's the same thing
>>
>>61927972
>>61927955
congratulations, it's uglier and harder to read!
>>
test.c: In function ‘main’:
test.c:9:41: error: invalid operands to binary % (have ‘double’ and ‘double’)
printf("%f\n", (((2.0*pi)/360.0)*i) % (2.0*pi));
~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~



how do I make a float map between say [0, 2pi] if it rolls over or under the endpoints?
>>
>>61927967
meh. i always write js functions like that and saw people writing shit like

(myButton.onclick=()=>Field.Content=generate())();


and wanted to write this way too
>>
>>61928005
% is an integer operator - use fmod or fmodf for doubles or floats.
>>
>>61927967
>are you running low on newlines?
This so much. Once you realize that no one is charging you per line printed any more, code gets so much easier to read.
>>
>>61928038
should not the compiler be able to tell that I wanted to use the floatfloat operator?
>>
>>61928110
C, with rare exceptions, doesn't fix shit for you. One cost of getting only what you ask for is that you have to spell out what you want.
>>
>>61928151
To add onto this: In a strictly type language, the compiler can/will assume more about your code because of the strict contracts. C is weakly typed (and most legacy C is barely typed..) so the compiler doesn't know if you wanted an implicit truncating conversion or an actual fmod. Would it fine if it truncated your two doubles to ints (or coerced them..) because you used an integer infix operator? What if you had two floats and it promoted them to doubles (to be used with fmodf?) even if you wanted to use an integer mod to coerce / truncate to ints? (because your architecture can't do hardware doubles, etc).

Its better to have it as an error, than a subtle bug.
>>
>>61927062
>still believing this meme
lmao goes to show you what crazy shit people will believe
>>
Where's the best place to host my personal website?
>>
>>61928324
OpenShift
>>
>>61928324
github gives you free web space so long as you make it a public repo
>>
>>61928324
digital ocean or ovh
>>
>>61928324
gandi.net
>>
>>61928324
LYLIX
GigaTux
vpsFree.cz
>>
>>61928261
>>61928151
well I suppose that makes sense. Thanks.
>>
>>61920610
>inheritance
>decorator that replaces behavior
3/10 at least it works
>>
>>61928324
ovh, cheap servers with unlimited* bandwidth and decent specs

* I believe you get 10TB of bandwidth in practice because your speed gets capped afterwards
>>
>>61922565
Yes. The reason is enterprises measure developer productivity in number of lines of code written.
>>
>>61928752
lmao, this does not actually happen. Even the most incompetent of management realizes that metric is goddamn awful
>>
>>61928829
You clearly haven't worked in this industry long enough.
Code is expendable, developers are a liability, developer time is expensive.
WE NEED TO GO TO PRODUCTION NOW
>>
>>61928829
>expecting anyone in the dpt to not be a NEET
>>
>>61928836
How is overproducing/bloating to meet an inflated SLOC metric beneficial for >WE NEED TO GO TO PRODUCTION NOW
That doesn't sound agile or _extreme_ to spend an order of magnitude more time writing fizzbuzz enterprise edition than it would to do it in a naive fashion.

(I think you missed the GP stating that the industry doesn't measure productivity as SLOC but rather features (poorly) implemented/shipped)
>>
>>61928836
if your company starts using total lines of code as a software metric, it's time to leave.
>>
>>61928752
Admittedly, my work was in embedded code on DSPs and some systems that coordinated the DSP based boards work, but productivity was always measured by how much progress had been made in implementing the requirements, not by how many lines of code had been written.
>>61928836
There's never time to do it right, but there's always time to do it over, after we ship it. Scotty is the only engineer who ever made under promise over deliver actually work.
>>
>>61925955
Everything he says in that article is correct.
>>
>>61919998

> made a shitty chatbot for omegle
> people spend 10+ minutes talking to it
> it's better than me at this
> I could be harvesting kik/skype contacts if I wanted
>>
whats the least painful way to read the contents of a text file in local storage on android? this is taking the piss
>>
>>61929377
get a real computer
>>
>>61929392
android dev senpai, doing anything in java is a fucking pain
>>
Is PyQt good?

Is it difficult to insert old school desktop UI widgets like field-sortable tables in Kivy?
>>
Alright... I'm stumped.

I am able to dereference the pointer to a "Digit" (data structure containing a short and two pointers, a doubly linked list) -- I print out the pointer in the call to "PrintAddresses(L_Int)", but when I do the call to printf, I get a seg fault, despite the pointer being able to be used.

I have no fucking clue what to do anymore
>>
File: 0321133048.jpg (70KB, 514x648px) Image search: [Google]
0321133048.jpg
70KB, 514x648px
>>61920234
Pic related. A background in calculus and linear algebra is recommended.
>>
>>61919998
Is anyone good with C++?

I'm writing something like an interpreter (symbolic execution) and I have a template 'SymbolicVariable' class that the different types inherit from (i.e. 'SymbolicDouble : public SymbolicVariable<double>)

My problem is now that I need to have different types in the same map. I thought you could just have a map of the template superclass but this is not allowed.

I know this is a longshot. Thanks in advance for any advice!
>>
Does anyone have much experience with Win32 API (no MFC, ATL, WTL, etc.)?
I have an application that is behaving strangely. I reduced it down to a test application and it works perfectly there.
It just resizes a listview (report) with two columns, and has the right column align to the right.

(sample code)
void Fit(const HWND parent, const HWND hwnd) {
RECT rc{0};
GetClientRect(parent, &rc);
MoveWindow(hwnd, 0, 0, rc.right, rc.bottom, true);

GetClientRect(hwnd, &rc);
LVCOLUMN lvc{0};
lvc.mask = LVCF_WIDTH;
ListView_GetColumn(hwnd, 1, &lvc);

ListView_SetColumnWidth(hwnd, 0, rc.right - lvc.cx);
ListView_SetColumnWidth(hwnd, 1, LVSCW_AUTOSIZE_USEHEADER);
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) {
switch (msg) {
case WM_CLOSE: PostQuitMessage(0); break;

case WM_ACTIVATE:
case WM_SIZING: Fit(hwnd, GetWindow(hwnd, GW_CHILD)); break;

default: return DefWindowProc(hwnd, msg, wp, lp);
}

return 0;
}


And in my real code (which is in C++ -- this was working last night, but today, after moving some stuff around and running a formatter over the code it broke.):
void FileList::FitListView() const {
RECT rc{0};
GetClientRect(hwnd_, &rc);
MoveWindow(listview_, 0, 0, rc.right, rc.bottom, true);

GetClientRect(hwnd, &rc);
LVCOLUMN lvc{0};
lvc.mask = LVCF_WIDTH;
ListView_GetColumn(listview_, 1, &lvc);

ListView_SetColumnWidth(listview_, 0, rc.right - lvc.cx);
ListView_SetColumnWidth(listview_, 1, LVSCW_AUTOSIZE_USEHEADER);
}

LRESULT FileList::DispatchEvent(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) {
switch (msg) {
case WM_ACTIVATE:
case WM_SIZING: this->FitListView(); break;
// ...
default: return DefWindowProc(hwnd, msg, wp, lp);
}
return 0;
}


ListView_SetColumnWidth
is returning false in my real code, and I can't find anything on the internet that explains why it'd return that.
>>
File: co.png (152KB, 400x400px) Image search: [Google]
co.png
152KB, 400x400px
>>61929652
In C++, you cannot have well-typed hetrogenous containers.
You have 3 choices:
1.
Ensure the classes you want to store together have a base class, and store a collection of pointers to that, dynamically casting as needed.
2.
Cast to/from void * and kill yourself.
3.
Use a different language.

Personally I'm a big fan of 3, but since I have to use C++ at work you generally just work with the design and introduce a bunch of useless classes.
>>
>>61929685
..ran out of spaace
And using that C Fit() method in the C++ code doesn't work either. It'll resize the listview to fit the parent window, but it won't resizes the columns.

..actually, disregard. Its something wrong with the code in the //.. part of the wndproc. Namely in my WM_NOTIFY.. Does anyone know why this WM_NOTIFY will cause the Listview to not resize its columns?

    case WM_NOTIFY: {
const auto pnmlv = reinterpret_cast<LPNMLISTVIEW>(lp);
if (pnmlv->hdr.hwndFrom != listview_) {
return 1;
}
switch (pnmlv->hdr.code) {
case NM_SETFOCUS:
case NM_RETURN:
case NM_CLICK:
case LVN_ITEMACTIVATE:
case LVN_ITEMCHANGED: {
auto item = reinterpret_cast<LPNMITEMACTIVATE>(lp);
if (item->iItem != -1 && (item->uNewState ^ item->uOldState) & LVIS_SELECTED && index_ != item->iItem) {
index_ = static_cast<size_t>(item->iItem);
callback(index_);
}
}
default: break;
}
} break;


(that just runs a callback and stores the index of a selected item in the list)
>>
>>61920446
Graham, Knuth & Patashnik’s Concrete Mathematics
>>
>>61929734
And disregard again. It seems like this was basically a case of rubber duck debugging. The return '1' from WM_NOTIFY was intercepting LVN_GETDISPINFO or LVN_SETDISPINFO. I don't actually know which message was being blocked, but since the column's (was it the row?) hwnd didn't equal the listview hwnd something was getting blocked. Making that a break fixed it all.

Win32api is shit.
>>
Anyone here like Go?>I kinda like it.
>>
>>61919998
I am trying to add a gui to my alarm clock.

Whats the best option for me here?
>>
>>61929982
>2012+5
>using golang
It's like you enjoy getting cucked.
>>
Creating console apps is so much more comfy. I used to make a GUI for all my shit even though i'm the only one who ends up using the app anyway usually and GUI making is a fucking tedious nightmare
feels good to be free
>>
>>61930314
>emily emily@donthackmeyoufuck
I think you need to fuck off
>>
File: smug_haskell_programmer.jpg (44KB, 636x616px) Image search: [Google]
smug_haskell_programmer.jpg
44KB, 636x616px
>>61930415
>being this mad
>>
>>61930430
>not really
>>
>>61930438
>lying this badly
>>
>>61930430
>An aggressive attitude on 4chan means that they're mad
Get lost, newfag.
>>
>>61930447
>being this new
I think you're the new fag
>>
>>61930415
Sorry. It was a joke from yesterday. It was my first time in the general and I couldnt get the code thingy to work. Some one told me to "register my user" by posting my email+name+password in the name field.

I never removed it.

I hope this is better now, though not really a reason to get so angry.
>>
>>61930430
Hang yourself, stupid animelover.
>>
File: smug_loli.jpg (29KB, 257x320px) Image search: [Google]
smug_loli.jpg
29KB, 257x320px
>>61930477
>>61930447
>being this mad
You guys really are new
>>
>>61920221
And if you're interested, the Laravel framework gives you things like ORM, MVC.

Very easy to build shitty web apps with it.
>>
File: blue fish.jpg (83KB, 960x768px) Image search: [Google]
blue fish.jpg
83KB, 960x768px
I like programming, it is fun.
>>
How do wait for async function in c# to finish?

Like let's say i have var poo = GetListOfPoopTypesAsync();

And i need the rest of the code to execute after i get the list, since i need to work with that list. And I looked at the thing doesn't provice non-async variant of that function
>>
File: 1446975741254.jpg (144KB, 1176x1000px) Image search: [Google]
1446975741254.jpg
144KB, 1176x1000px
Is this the proper way to generate WAVE files?
I feel like I'm doing this in a backwards way.
#define SAMPLES 10000000
#define RATE 44100
#define CHANNELS 2
#define BITS_PER_SAMPLE (sizeof(short) * CHAR_BIT)

struct wave {
char id[4];
int size;
char fmt[4];
};

struct fmt {
char id[4];
int size; /* size of everything below */
short fmt;
short channels;
int samplerate;
int byterate;
short blockalign;
short bitspersample;
};

struct data {
char id[4];
int size;
short *bytes;
};

int main(void)
{
struct fmt subchunk1 = {
"fmt ", sizeof(struct fmt) - 8, 1, CHANNELS, RATE,
(RATE * CHANNELS * BITS_PER_SAMPLE) / CHAR_BIT,
(CHANNELS * BITS_PER_SAMPLE) / CHAR_BIT,
BITS_PER_SAMPLE
};
struct data subchunk2 = {
"data", (SAMPLES * CHANNELS * BITS_PER_SAMPLE) / CHAR_BIT, NULL
};
struct wave header = {
"RIFF", (subchunk1.size + 8) + (subchunk2.size + 8) + 4, "WAVE"
};
fwrite(&header, sizeof(struct wave), 1, stdout);
fwrite(&subchunk1, sizeof(struct fmt), 1, stdout);
fwrite(&subchunk2, sizeof(struct data) - sizeof(short *), 1, stdout);
>>
>>61930836
I don't like you.
>>
>>61930857
call await?
>>
>>61929723
Thanks a lot!
>>
>>61930882
Do i look like stallman? I have no idea how to do that shit yet
>>
>>61930863
You've basically got the right idea. You could generate those fields more programatically, and handle shit like multiple channels and different sample rates and bitrates more easily, but if you don't need it, don't bother.
Also, using the stdint.h types might be more appropriate.
>>
>>61930914
async/await is very simple to use:
// ignore this, just waits for 5 seconds then returns an int
public Task<int> GetAsync() => Task.Delay(5000).ContinueWith(task => 42);

// for you
public async void Work() {
var foo = await GetAsync();
// this'll wait for 5 seconds then print 42
Console.WriteLine(foo);
}


The rest of the method context technically will be placed in a continuation and won't run until the previous await is done.
>>
Is there an efficient way to ger averages over multiple dicts in Python?

I have a few dicts, all of which have the same structure:
 {6: float, 7: float, ... 23: float 


now i want to get the average for each Key in all of the dicts. is there some easy way for this?
>>
>>61931092
You mean you want to average the keys or the values?
>>
>>61931122

I want to average the values of each key
I found something on stackoverflow though
>>
File: 1501869639061.jpg (40KB, 620x413px) Image search: [Google]
1501869639061.jpg
40KB, 620x413px
How do I use php to send a get request to Google Images (say the first 3 images) based on the values of an address field in a contact form and then show those images inline in an e-mail ?

Note: I need to do this within Wordpress...
>>
File: ruby_waifu.png (186KB, 362x560px) Image search: [Google]
ruby_waifu.png
186KB, 362x560px
>>61931143
>not using Ruby
It's like you don't want to be productive. Python is shit.
>>
>tfw can't free myself from the botnet
>>
>>61930373
It's a barrier people need to overcome to start using your software.
>>
How do you make your non-malicious apps not be blocked by AV?
>>
>>61931837
That's a question that security researchers have been trying to answer for decades.
>>
>>61931707
Python has more concise syntax and richer ecosystem, but to each its own i guess

>>61930373
>>61931828
>not making your shit a separate lib and make cli or gui as needed
>>
>>61931837
>have it OS or distributed through a reputable source
>most people know its a false positive

Didnt know people still used AV's
>>
>>61931877
How does Python have conciser syntax than Ruby? Python's philosophy is literaly "Explicit is better than implicit", while Ruby is all about being /comfy/ for the programmer, so you don't need to do a lot of syntactic bullshit like Python does.
>>
>>61931877
>just making libs
I approve of making libs but for software releases you need to give people opportunity to trial it.
>>
>>61931885
Haven't released popular software then. I get emails. It's annoying.
>>61931860
I was more thinking about the less general case. Is there something common that in general triggers them? I'm not doing any self-modifying code or other 'suspicious' behavior at all to my eyes. So I'm wondering if anyone knows what common pitfalls are.
>>
>>61931902
so you relase lib with one interface with possibility to add other in future

a g i l e
g
i
l
e
>>
>>61931922
>agile
Does this mean anything specific or is it just stating the obvious, that having code be malleable is good.
>>
>>61931921
Most consumer AVs are just signature-based garbage.
The AV companies have seen the malware before, so they just flag it if they see it again.
>>
>>61931954
just reminding the obvious
:^)
>>
File: 1502847807281.jpg (136KB, 1244x927px) Image search: [Google]
1502847807281.jpg
136KB, 1244x927px
>>
File: Agile-model.jpg (18KB, 630x325px) Image search: [Google]
Agile-model.jpg
18KB, 630x325px
>>61931981
I prefer to say code malleability because it's less confusing. Agile has connotations like agile development model.
>>
>>61931991
Doesn't windows let you switch to Japanese localization for specific apps only?
>>
>>61931707
>blacktexting
>>
Trying to get back into assembly. What is wrong with my code( yes this is running in real mode). It just won't print anything.
 
; boot.asm
mov ax, 0x7c00
mov ds, ax
mov ss, ax ; stack starts at 0
mov sp, 0x9c00 ; 200h past code start
loop:
mov si, msg
call print
jmp hang
print: ; si is string
mov ah, 0x0E
print_main:
mov bx, [si]
or bx, 0
je return
mov al, [si]
int 0x10
add si, 1
jmp print_main
return:
ret
hang:
jmp hang

msg db "Print Hello", 13, 0
times 510-($-$$) db 0
db 0x55
db 0xAA
>>
>>61932120
I just saw the typo. It is jz not je. I changed it but it still didn't work.
>>
How would I start learning programming windows applications?

I'm a completely beginner.
I've tried several tutorials but I find it very hard.

Languages i've tried are: Java and Python.
>>
>>61932340
Forgot to add this.
I want to implement a GUI in the programs I want to create.
>>
>>61932340
Learn C#. It doesn't differ from Java much.
>>
New thread:

>>61932358
>>61932358
>>61932358
>>
>>61932366
nvm use this >>61932368
>>
>>61932357
Why? Java is cross-platform and has a native GUI library.
>>
>>61932120
AL = Character, BH = Page Number, BL = Color (only in graphic mode)

bx should be zero (if you did not change the page that is).
You putting word into bx anyway, not a byte.
je and jz is the same thing.
Also what makes you think that your data is at 0x7c00?
>>
>>61932120
Even on such a short program, your code is messy.

Also, I don't think "or bx, 0" does what you want it to do.That is, if you want to test if bx is zero, do "or bx, bx". The zero flag is raised only if bx is zero. But even then, bx is 2 bytes, you'd rather test one byte only, use a one-byte register for that purpose.
Moreover, int 10h takes two arguments in bx, the page number in bh (usually 0) and the color in bl (7 for the default light gray). You should also set a video mode compatible with text beforehand (look up int 10h ah=0).
>>
>>61932442
>Also what makes you think that your data is at 0x7c00?
It's obvious, it's loaded as bootsector code, so the entry point is forcibly 0x7c00.
>>
>>61932510
Why not use IP to be sure.
>>
>>61932634
IP is not really easy to read. Don't confuse the poor guy already.
>>
File: 1502800113051.jpg (30KB, 540x540px) Image search: [Google]
1502800113051.jpg
30KB, 540x540px
https://medium.com/the-mission/im-an-ex-google-woman-tech-leader-and-i-m-sick-of-our-approach-to-diversity-17008c5fe999


>This summer, we got into beginner Python. The boy can’t stop taking on problems while the girl has declared that she hates it. She’s very ready to take on Photoshop and create filters and stickers for UrbanAMA though!
>>
>>61920225
>requires nightly compiler
>always starts from 1
>only usize is supported
>heap allocation
noob detected. i have ~3 years of rust experience. see how a real pro solves fizzbuzz in rust:
https://play.rust-lang.org/?gist=7078b14389ab201ffd0c86a6f6c28f20&version=stable

use std::fmt::{self, Formatter, Display};

macro_rules! impl_from_fizzbuzz {
($ty:ty) => {
impl From<$ty> for FizzBuzz<$ty> {
fn from(t: $ty) -> Self {
match (t % 3, t % 5) {
(0, 0) => { FizzBuzz::FizzBuzz }
(0, _) => { FizzBuzz::Fizz }
(_, 0) => { FizzBuzz::Buzz }
_ => { FizzBuzz::Number(t) }
}
}
}
}
}

enum FizzBuzz<T> {
FizzBuzz,
Fizz,
Buzz,
Number(T)
}

trait IterExt<I, T> {
fn fizz_buzz(self) -> std::iter::Map<I, fn(T) -> FizzBuzz<T>>;
}

impl<I, T> IterExt<I, T> for I where I: Iterator<Item=T>, FizzBuzz<T>: From<T> {
fn fizz_buzz(self) -> std::iter::Map<I, fn(T) -> FizzBuzz<T>> {
self.map(From::from)
}
}

impl_from_fizzbuzz!(i8);
impl_from_fizzbuzz!(u8);
impl_from_fizzbuzz!(i16);
impl_from_fizzbuzz!(u16);
impl_from_fizzbuzz!(i32);
impl_from_fizzbuzz!(u32);
impl_from_fizzbuzz!(i64);
impl_from_fizzbuzz!(u64);
impl_from_fizzbuzz!(isize);
impl_from_fizzbuzz!(usize);

impl<T> Display for FizzBuzz<T> where T: Display {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
match *self {
FizzBuzz::FizzBuzz => { write!(fmt, "FizzBuzz") }
FizzBuzz::Fizz => { write!(fmt, "Fizz") }
FizzBuzz::Buzz => { write!(fmt, "Buzz") }
FizzBuzz::Number(ref x) => { write!(fmt, "{}", x) }
}
}
}

fn main() {
for v in (1..101).fizz_buzz() {
println!("{}", v);
}
}
>>
>>61932510
Shit. You are right. The bios(legacy) loads the program at segment 0x07c0 not 0x7c00. It works now.
>>
>>61932676
Isn't it the address if the next instruction?
>>
Pointer a points to object A.
I set a point b = a.
What this means is b now points to object A.
So, if I do b = new Object B, then b -> B and a still -> A.

Noobs will think that a = b sets the pointers equal, meaning if b points to some other address than a follows suit. This is wrong, but is there a language concept for this?
>>
>>61933435
Traditionally, yes, as x86 CPUs fetch the instruction before incrementing the IP (since instruction size can vary). Still, it's pretty much a write-only register. You can only modify it in code through jumps or calls. Calling a subroutine will put the IP in AX, as the return address of the subroutine, so that's pretty much the only way to read it, and it does not actually correspond to the address of the call instruction, but the following one, which can be very misleading.

tl;dr don't try to read IP.
Thread posts: 325
Thread images: 39


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.