[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: 321
Thread images: 25

File: Gang_of_Four.jpg (284KB, 1352x1701px) Image search: [Google]
Gang_of_Four.jpg
284KB, 1352x1701px
Old thread: >>58538187

What are you working on /g/?
>>
File: nimlang.png (34KB, 220x110px) Image search: [Google]
nimlang.png
34KB, 220x110px
First for Nim!
>>
2nd for please help me find a babby project I can do.
>>
>>58542486

if ( !std::is_integral<bool>::a )
{
a = rand();
}
if (a == true)
{
// do work
}


Why is this not valid C++?
>>
>>58542499
write a script that generates a list of babby projects that you are capable of programming.
>>
Preparing on a job interview
>>
File: 1483387092666.jpg (32KB, 189x189px) Image search: [Google]
1483387092666.jpg
32KB, 189x189px
>>58542523
>>
>>58542495
I'm sorry I'm a beginner and I don't think I understand what you're saying. Do you mean that I'm not actually jumping into the GOT but directly at the address of my main function? If so, why isn't the program jumping to 7d0 (that's the address of my main)?
>>
>>58542503
This post is hate speech.
>>
>>58542535
Write a program that allows you to rate the negativity value of text from 1 to 10. 1 being the least mean and 10 being SAVAGE.

is that better?
>>
>>58542586
https://www.youtube.com/watch?v=icqPHsNumuU
>>
What keeps python popular? Is it because of the memes or are there really a use for it?
>>
>>58542705
Because it's already popular

Same reason as Java
>>
>>58542705
It's easy to learn and has a ton of libraries. Its FFI mechanism is also easier to use than the one of other languages, from what I read.
>>
File: 1483916193167.webm (3MB, 1612x892px) Image search: [Google]
1483916193167.webm
3MB, 1612x892px
>>
>>58542705
It's only popular because it pulled of a 'gimmick' of whitespace retardation and people fall for that
>>
>>58542732
>GUI builder
dropped
>>
Reposting here because I don't understand the answer I was given in the other thread:
I'm looking at the disassembly of a very simple program (
void main() {}
) and trying to understand stuff. The libc is compiled as a shared library. Now in my binary I have the following piece of code:
0000000000000680 <__gmon_start__@plt>:
680: ff 25 42 09 20 00 jmpq *0x200942(%rip) # 200fc8 <_GLOBAL_OFFSET_TABLE_+0x28>
686: 68 02 00 00 00 pushq $0x2
68b: e9 c0 ff ff ff jmpq 650 <_init+0x20>

From what I understand I am jumping somewhere in the global offset table. How can I find out where exactly in the libc I am jumping? I tried looking at various addresses in a disassembly of my libc.so but I can't find anything that seems right.
>>
to the javafags out there, what do you think of Lambdas and the Streams API?
do you use it? at work?
>>
>>58542785
That looks interesting. What tools are you using?
>>
>>58542785
It's Probably jumping for a print command or some other library functionality.

Visual studio can follow code into libraries you don't have source code to by showing you the assembly code and you can step through it in the debugger. So if linux has that type of debugging use that, otherwise give up because debugging massive libraries in ASM won't be useful or good for your sanity.
>>
>>58542810
not a javafag but you should use lambdas
>>
>>58542857
Why is that?
>>
>>58542864
they're fundamental to programming
>>
>>58542825
Objdump, readelf and neovim. I'm a newbie really. I know I could use GDB instead of objdump but I feel like I'd learn more things with plain old objdump.

>>58542844
>Probably jumping for a print command
Highly doubt it since the source code is just
void main() {}
. I think it's a libc setup function but I can't find which one exactly.

Thanks Anon but I'm not trying to debug massive libraries, I just want to learn what's happening behind the scenes.
>>
>>58542868
I don't understand. I can do the same thing iteratively and it is more readable.
>>
>>58542882
no it isn't
>>
>>58542785
This looks like objdump to me. Have you tried looking at the assembly output generated by your C compiler? It usually has proper function names.

https://stackoverflow.com/questions/9685699/what-is-global-offset-table
https://en.wikipedia.org/wiki/Position-independent_code#Technical_details
http://grantcurell.com/2015/09/21/what-is-the-symbol-table-and-what-is-the-global-offset-table/
http://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_zSeries/x2251.html

You should find the GOT, from the last link:
>The Global Offset Table resides in the ELF .got section.
After that you can just find out where that entry points, etc. There might be an easier way, probably there is some kind of tool which does this for you.

I haven't done shit like this for a long time, especially on a unix-like system though.
>>
>>58542892
[citation needed]
>>
>>58542892
Thanks for the explanation.
>>
>>58542482
>What are you working on /g/?

 #include<stdio.h>

main()
{
int numero, i = 1;
for (i = 1; i <= 100; i++)
{

if ( i % 3 == 0 && i % 5 == 0 )
printf("FizzBuzz\n");
else if (i % 3 == 0)
printf ("Fizz\n");
else if (i % 5 == 0)
printf ("Buzz\n");
else
printf("%d\n", i);
}
}
>>
>>58542920
Use Allman style bracing.
Use braces even for single line conditionals/loops

if (condition) {
process();
}
>>
>>58542901
>The Global Offset Table resides in the ELF .got section.
Thanks a lot Anon, objdump -d doesn't seem to show the content of the .got but objdump -D does, that's why I couldn't find anything. I've been stuck on this thing for something like an hour now, thanks again!
>>
>>58542925
I mean use K&R and not Allman.
K&R:
if (condition) {
process();
}


Allman:
if (condition)
{
process();
}


makes you less retarded.
>>
>>58542925
>Use three lines for something that can be done in one
disgusting.

if (condition) process();


Asymmetrical braces are an abomination.
>>
>>58542873
m8 void main() {} isn't going to teach you much of anything useful.

write some actual code in your program and that dissemble that.
if you use gcc you can use the flag -S to output disassembled code and take a look.

That shit is probably just bookkeeping. Your program has to be allocated some stack memory and spawned by a task scheduler process. I couldn't tell you what that ASM was actually for, and I don't think it's incredibly useful to know. Might be an interesting question for an expert but I fear the answer may be underwhelming and boring.
>>
>>58542945
It's almost as if everyone had a different taste.
>>
>>58542933
You're welcome.
As far as I know gcc can produce an assembly file with the -S switch. There is also a switch for producing Intel style assembly too (this applies to objdump as well).
>>
>>58542945
that's even more retarded especially if you have complex conditions
>>
I'm using Allman and there's nothing you can do about it!
>>
>>58542959
[code{
}
[/code]

vs
{

}


is taste.

bloat vs not bloat is objective.
>>58542965
If it's something relatively simple as that, it's fine.
>>
>>58542945
enjoy your 100% wider codes
>>58542975
enjoy your 100% taller codes
>>
>>58542956
Something as simple as
void main () {}
already taught me about the Global Offset Table (I didn't even know it existed). I'm sure there's plenty more to learn.
I'll try using a real program once I understand what an empty program does.

>>58542956
>>58542964
Thanks for the advice, I'll make sure to check out what gcc -S does if I even get stuck again.
>>
>>58542981
Except of course complex progress require complex conditions and by your logic, consistency is bad.
Consistency == Readability
>>
>>58542983
enjoy your non-problems
>>
>>58542983
It may be marginally taller but at least I can tell where the damn things open and close.
If operated a 24x80 terminal I might be more inclined to conserve rows.
>>
>>58542938
why?
>>
>Javafags doesn't indent switch statements
switch (value) {
case 1:
processOne();
break;
case 2:
processTwo();
break;
default:
doDefault();
break;
}
>>
>>58542992
If it's simple, no braces.
If it's not simple, braces.

Quit being so dense, /g/.
>>
File: 1413775162315.webm (3MB, 1372x756px) Image search: [Google]
1413775162315.webm
3MB, 1372x756px
>>
>>58543016
That's how you goto fail though.
>>
>>58543015
switch (value) 
{
case 1: processOne(); break;
case 2: processTwo(); break;
default: doDefault(); break;
}

2bh
>>
>>58543033
'no'
not 2bh

1TBS
https://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS_.28OTBS.29
>>
>>58543023
Neat.
>>
>>58543043
>
if (x < 0) {
puts("Negative");
} else {
nonnegative(x);
}


non-readable garbage.
>>
>>58542981
except that you do

if(condition) {
thing();
}

Even if it is just one line and one thing.
The block is there so that you are explicit about what is inside and outside the scope of the if statement.
That way you can be half-asleep and slightly drunk at 02.00 and still not fuck up.
>>
>>58543056
>indenting the closing brace
jesus christ how horrifying
>>
>>58543059
>That way you can be half-asleep and slightly drunk at 02.00 and still not fuck up.

I can already do that just fine.
/g/ really needs to stop worshiping old and busted styles.
>>
>>58542945
Let me guess. You name your variables
int a, int b;
too right?
>>
>>58543069
Why, so we can make the same mistakes all over again and reinvent them?
>>
>>58543084
Obviously
 int i; int j; 
is superior.
>>
>>58543084
>
int a, int b;

Is this even possible? I thought it was
int a, b;
>>
>>58543104
Obvious typo. Reflex had me declaring it separately.
>>
>>58543084
int smthng,smthng2;

If my no-vowels variable stops being explicit, i change it.
>>
>>58543097
>not logical
int p, q;
>>
>>58543116
Preposterous! The naming convention of I and J have been used in a PLETHORA of code examples and are therefore superior and standard.

I would be bewildered by the use of a for loop defined with p as a counter, followed by a subsequent but equally confusing loop using the counter q.

I and J vastly show more intent than the arbitrary values of p and q.
>>
>>58543013
he's just shilling javascript culture properties. It's a regional manager thing but in dealing with the time constraints over the regional ones. It's supposed to be more "meaningful". You know these totalitarian governments wearing sombreros. It's ridiculous.
>>
>>58543147
Wait, people still unironically use loops with counters in them?

I bet you even make the loop check that the counter is less than the length of an array, Mr. 1995.
>>
>>58543147
Only retards use j. It's i and k for obvious reasons.
>>
>>58543176
and what's next? l?
Inconceivable!
>>
>>58543168
tell me what replaces loops? looping is the basis for any program to run. If your program does not loop it dies.
>>
File: 1484576314915.jpg (48KB, 616x600px) Image search: [Google]
1484576314915.jpg
48KB, 616x600px
Is there an emerging new fad like ruby was that I can jump into?

I'm tired of the same bullshit.
>>
>>58543186
Fuck no. It's m.
>>
I'm trying to do thread synchronization inside a function, kind of with a parallel for. Its for a game simulation loop, that's why its synchronized.

First, I create a boolean for each thread I'm about to launch - they are initialized to 0, meaning that thread's job is not done yet.
Then I pass a pointer of the boolean to each one of the threads. When the thread's job ends, they turn theyr boolean to true.

Lastly, inside the function, after launching each one of the threads, there's a while loop (spinlock, so to speak) that tests all those boolean values. If they're false, it won't exit the function.

The problem is that the other threads set those booleans to true, but the main thread that launched the threads never seems to receive this update. It always reads the booleans as 0. I've tried the win32 API InterlockedCompareExchange, setting the bools to volatile and whatnot, but the spinlock always stays in an infinite loop.

Oh, and by the way, the language is C, and the threads are not actually created inside this function, but they're from a thread pool (I add a job for each job to the pool, after which they go back to sleep.)

Any ideas what could be wrong? And if I didn't explain it well, I can write up a code example.
>>
>>58543187
Syntax sugar.
>>
>>58543191
ikm
i kno m80
pottery
>>
>>58543176
What obvious reason would that be?
I typeically use l i and j as my standard variable names. It's called the programmers arch because of the shape it makes on a QWERTY keyboard.
>>
>>58543187
Recursion with unlimited stack
>>
>>58543188
Rust if you're a tranny.

>>58543200
:^)
>>
>>58543188
Google is releasing a new meme language called Dart.
I think node.js is pretty trendy too.

I don't know much about ruby, why was it a fad and was it good/easy to learn or just a new popular language?
>>
objdump -D > name.asm


the > pipes the output to a file called name.asm, which you can open with any editor. linux/unix tip
>>
here's my
int void main(){return 0;}


compiles into this with gcc

how do i optimize?

a.out: file format Mach-O 64-bit x86-64

Disassembly of section __TEXT,__text:
__text:
100000fa0: 55 pushq %rbp
100000fa1: 48 89 e5 movq %rsp, %rbp
100000fa4: 31 c0 xorl %eax, %eax
100000fa6: c7 45 fc 00 00 00 00 movl $0, -4(%rbp)
100000fad: 5d popq %rbp
100000fae: c3 retq

_main:
100000fa0: 55 pushq %rbp
100000fa1: 48 89 e5 movq %rsp, %rbp
100000fa4: 31 c0 xorl %eax, %eax
100000fa6: c7 45 fc 00 00 00 00 movl $0, -4(%rbp)
100000fad: 5d popq %rbp
100000fae: c3 retq
Disassembly of section __TEXT,__unwind_info:
__unwind_info:
100000fb0: 01 00 addl %eax, (%rax)
100000fb2: 00 00 addb %al, (%rax)
100000fb4: 1c 00 sbbb $0, %al
100000fb6: 00 00 addb %al, (%rax)
100000fb8: 00 00 addb %al, (%rax)
100000fba: 00 00 addb %al, (%rax)
100000fbc: 1c 00 sbbb $0, %al
100000fbe: 00 00 addb %al, (%rax)
100000fc0: 00 00 addb %al, (%rax)
100000fc2: 00 00 addb %al, (%rax)
100000fc4: 1c 00 sbbb $0, %al
100000fc6: 00 00 addb %al, (%rax)
100000fc8: 02 00 addb (%rax), %al
100000fca: 00 00 addb %al, (%rax)
100000fcc: a0 0f 00 00 34 00 00 00 34 movabsb 3746994890844667919, %al
100000fd5: 00 00 addb %al, (%rax)
100000fd7: 00 b0 0f 00 00 00 addb %dh, 15(%rax)
100000fdd: 00 00 addb %al, (%rax)
100000fdf: 00 34 00 addb %dh, (%rax,%rax)
100000fe2: 00 00 addb %al, (%rax)
100000fe4: 03 00 addl (%rax), %eax
100000fe6: 00 00 addb %al, (%rax)
100000fe8: 0c 00 orb $0, %al
100000fea: 01 00 addl %eax, (%rax)
100000fec: 10 00 adcb %al, (%rax)
100000fee: 01 00 addl %eax, (%rax)
100000ff0: 00 00 addb %al, (%rax)
100000ff2: 00 00 addb %al, (%rax)
100000ff4: 00 00 addb %al, (%rax)
100000ff6: 00 01 addb %al, (%rcx)
>>
>>58543254
>how do i optimize?
-O3
>>
>>58543254
>int void main
nigga you gone fullretard. don't ever go full retard.
>>
>>58543232
>was it good/easy to learn or just a new popular language?
all of the above

https://www.quora.com/Why-is-the-popularity-of-Ruby-falling
>>
Does anyone have a hint for me or can tell me if my thought is correct?

If I want to search for all divisors of a number, I just have to check if it is divisable for which numbers from 2 to 10 and then just get the multiples of those which are also sammler then the triangle number, right?
Or is there a way faster way?
>>
File: pc.jpg (35KB, 350x464px) Image search: [Google]
pc.jpg
35KB, 350x464px
I do full stack web dev shit now, but I used to be into writing binary software in C/C++. Working on a web-based SaaS startup with a friend with domain knowledge of the industry we're targeting. I hate having to make money. I just want to try my hand at writing a Gameboy emulator for fun -.-
>>
>>58543293
>sammler
smaller*
top kek
>>
>>58543305
>binary software
stopped reading there
the fuck does that mean?
>>
>>58543254

Just write an ASM program directly with:

HLT

and compile
>>
>>58543293
Oh damn, I am an idiot. I haven't thought about multiples of primes. Fuck me.
>>
>>58543310
software that compiles into a binary obviously.
fucking skids these days do not even know what a binary is. do you know what JIT is?
>>
>>58543310

You've never heard of writing compiled software as developing binary software? You're creating binaries directly with languages like C/C++. You a first year CS student?
>>
How hard is Java to learn if you already know a few other OOP languages?
>>
>>58543359
Define 'know'. If you really know another language then it won't be hard at all to start using Java
>>
>>58543359
Not very.
The language itself isn't very hard, but you have to learn toolchains on top of it.
>>
>>58543359
Not at all. It's one of the easiest and cleanest language out there to learn. Very consistent.
>>
>>58542650
LMAO, your little hateful fit >>58542503 was DELETED
>>
>>58543200
well while I use i j k imperatively as such, just do, I just realized that i and k does indeed make more sense as the index and gyration. But then that means it's a laser, right? Or since it's gyration they just comp sci and imply it by doing some value balancing?
>>
>>58543359

Stupid easy, especially if you know C++. Java is a C++ ripoff. They wanted to create a portable C++, essentially. The biggest thing is to learn about all their libraries. They have an extensive and mature suite of libs to do everything under the sun.

Prob is, the Java runtime is a fucking annoying POS that needs constant updating because a new flaw is found daily. I refuse to install Java JRE on any Windows platform.
>>
>>58543392
it could be the kinetic energy, meaning that while the pointer is held at i, add k as kinetic energy, and thus increase the pointers value to an immutable version of i+k
>>
Writing a faster Hydrus replacement in Go/C. Backend only. Currently it can only import files and generate thumbnails. Will work on pulling tags from boorus next.
>>
>>58542482
>What are you working on /g/?
Still looking for a universe in which the Qt event model makes sense.
>>
finished my poker engine

its like 260 lines of code kek

['10s', '6h']
['3s', '3h']
['5c', '4s']

['7h', 'Js', '5d', '6s', '10c']

['10s', '6h']
two pair
>>
>>58543399
Is there a "recommended" Linux IDE for Java?

I want to get into Java basics just to improve my job prospects.
>>
>>58543874
How did you handle the Ace-low and Ace-high scenarios?
>>
>>58543399
> He thinks the JRE is critically flawed
Dude, what.
The only security holes that people find are the old Java Web Applet shits. Those are deprecated and will no longer work come Java 9. The JRE is in fact rather safe, and can be constrained to such a minute level that even Stallman is comfortable, using end user tools that come with the distribution.
>>
>>58543652
Qt event model only makes sense in hell.

You're welcome.
>>
>>58543895

For Java, it's the same as Windows: Eclipse, IntelliJ or NetBeans. Whichever you think you'll like the best.

And in general it would depend on language. SLIME for Lisps, for example.

C++ would probably be Code::Blocks, or a sufficiently extended Emacs to get semantic autocompletion, incremental compilation, etc.

Again, just like on Windows. Unless you're one of those people who only use XCode or MSVS of course. There isn't an MSVS equivalent for Linux.
>>
>>58543905
Powerful JRE
>>
>>58543901
what do you mean?
>>
>>58543963
for straights, A 2 3 4 5 and 10 J Q K A
>>
>>58543906
Fuck.
>>
>>58543971
oh it just checks a list of [14, 2, 3, 4, 5]

to see if its in the hand data

   for i in low:
if i in hand:
check = True
else:
check = False
>>
>>58543652
What about it is problematic to you?
>>
>>58544002
What is that code doing? Also learn about sets and multisets. I bet you could shrink that LoC down to ~60
>>
>>58543195
Use a barrier.

>>58543206
The y combinator is difficult to reason about. I prefer for loops.
>>
>>58542482
any decent resources for trying to build anything using webassembly?
>>
idea for python 4: remove list and set literals from python. replace list/set comprehensions with generator expressions inside list/set constructors
>>
>>58544568
webassembly is a target for other programming languages. you can crosscompile C to wasm using emscripten and Rust has a wasm target.

however no browser yet fully supports wasm and only firefox supports its predecessor asmjs
>>
>>58544623
>only firefox supports its predecessor asmjs
Chrome and Edge both support asm.js, but only FF does AoT compilation.
>>
>>58544613
better idea for python: remove python
>>
>>58544864
this
>>
>>58544864
Or add brackets.
>>
>>58544994
this
and then remove python
>>
Draw or render, lads?

What do you name your render/draw functions?
>>
>>58544994
>>58545030
~ $ python
Python 3.6.0 (default, Jan 16 2017, 12:12:55)
[GCC 6.3.1 20170109] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import braces
File "<stdin>", line 1
SyntaxError: not a chance
>>
@58545048
epic ribbit meme
it seems like you're lost. here, follow this link. it'll take you back home
www.reddit.com/r/programming
>>
Is HTML5 Canvas comfy to use? Never used it before desu.
>>
>>58545048
is that an easteregg? that's pretty funny.
>>
>>58545117
yeah...
"lol" as we say on plebbit
hehe
>>
>>58545034
parse
>>
>>58545116
eh processing.js is easier for just drawling to a canvas.
>>
>>58545130
why are you screeching "reeeeeeee" at me? Are you attempting to communicate?
people code in languages you dislike. The world goes on.
>>
>>58545144
>needing a library for a browser API
>>
File: 1409957513828.gif (513KB, 254x212px) Image search: [Google]
1409957513828.gif
513KB, 254x212px
If I had zero (0) coding experience and wanted to learn how to code in C# what would be the absolute best place to start?
>>
File: 4321.png (378KB, 1024x1399px) Image search: [Google]
4321.png
378KB, 1024x1399px
>tfw too autistic to use frameworks, I have to make everything from scratch
>>
>>58545184
Downloading visual studio.
>>
>>58545169
what?! i'm a fellow ribbitor just like yourself
>>
>>58545178
Nobody needs libraries like opengl or directx either but using libraries is usually the sane option.
>>
>>58545184
http://www.robmiles.com/c-yellow-book/

Free book + code samples, assumes you basically don't know how to program at all.
>>
>>58545259
ironic shitposting is still shitposting you insufferable autistic edgelord.
>>
File: Filzhut.jpg (74KB, 640x640px) Image search: [Google]
Filzhut.jpg
74KB, 640x640px
>"In some years, the software industry will finally recognize that OOP created more problems than it solved."
>"If you use classes - you have no class."
>"Your programming language can either be functional ... or dysfunctional."
>>
>>58545439
Is pic related an OOPfag?
>>
>>58545292
b-but i go to Reddit too? what's the fucken problem lol
>>
>>58545448
Judging by the apparel and environment, I can almost guarantee that person would gravitate to something like Haskell.
>>
>>58545448
yes, wasn't that clear from ribbit on his monitor?
>>
File: 1472955982251.jpg (390KB, 686x1024px) Image search: [Google]
1472955982251.jpg
390KB, 686x1024px
>>58545489
>I can almost guarantee that person would gravitate to
>>
This seems like the most appropriate thread to ask. I'm on a real conference talk binge recently, any recommended personal favourite conference talks on programming?
>>
>>58545540
yeah, DelhiConf is a good one lol
they discuss OOp a lot!
>>
Alright, so my slackware is good. I also downloaded Qemu on to it so I'll be working out getting templeos running on this thing. YES!
>>
 Typically, operating systems can be queried to obtain the value of various state variables.  For example, every valid user on a UNIX system has a specific identification, stored internally as the real user ID.  It is a numeric value that identifies a user to the system.

User information is also stored in the password file, which is a flat file containing information about each user in a colon-delimited field. A library of routines has been created to make accessing this database more convenient. For example, there is a function that parses a password entry and returns the information in a structure for easy access. The password file (or user database) contains information which is mapped to a corresponding field in the structure.


 entry 0: root
entry 1: bin
entry 2: daemon
entry 3: adm
entry 4: lp



does anyone know what function this is referring to? i cant find anything. i can manually parse it but that isnt what it's asking me to do
>>
>>58545540
https://github.com/hzlmn/haskell-must-watch
>>
>>58545561
idk? something about india?
>>
>>58543392
i,j,k are used in quaternions as well, such as
> a + bi + cj + dk
where a,b,c,d are real numbers and i,j,k are quaternion units where a is the scalar part and bi+cj+dk is the vector part and the vector part is pure imaginary
>>
>>58544994
Such a simple idea fixes so much.
>>
>>58545561
getpwent
>>
>>58545587
It's almost as if semantic whitespace was a fucking mistake.
>>
>>58545561
that sounds like a simple hashing function. Maybe you could look for something like that? Also, maybe try to add code or some kind of context. lp might actually have an option to it that utilizes an md5 hash. Try reading the man entry for it.
>>
>>58545561
are you asking about the C function?
getpwent(3) and/or getpwnam(3). also refer to passwd(5)
>>
>>58543111
I prefer no-consonant variables.
>>
There is nothing wrong with Go's error handling

https://anvaka.github.io/common-words/#?lang=go
>>
>>58545672
passwd(5) was the one i needed, thanks!

also another noob question, how do i actually man for passwd(5) in my terminal? when i do man passwd it goes to passwd(1) which is just a command for changing my password, but it wont let me do man passwd(5)
>>
>>58545726
man 5 passwd
>>
>>58545726
man 5 passwd

man section_number keyword
>>
there is literally nothing wrong with object oriented programming, or as i have recently taken to calling it, structs with methods
>>
>>58545748
Method syntax is not the definition OOP
>>
>>58542482
literally one of the worst books of all time. caused more pain then the Quran
>>
>>58545561
Use pam instead. You want `pam_get_user`.
>>
>>58545748
C had structs with methods, but no Liskov Substitution. You don't know what OOP is.
>>
Who /Visual Studio 2017 RC/ here?
>>
>>58545852
Will switch as soon as it goes GA, if only for tuples and inline functions.
>>
File: fractal.png (894KB, 1080x1080px) Image search: [Google]
fractal.png
894KB, 1080x1080px
Trying to make my fractals less ugly.
>>
>>58545852
the new installer, and side-by-side profiles are a fucking relief.
it took them forever to make it possible to uninstall VS cleanly, then 2 releases later they made it so you can have multiple environments set up. and it seems they are catching up to resharper with the codelens, automated testing, better snippets, better refactor, peeking at code, etc. once it can handle the automated refactoring that R# does it'll finally be time to get rid of that slow POS.

curry ceo seems to be doing some good.
>>
>>58544397
>Use a barrier.
Well thanks, I'll try that. Not home now and don't have access to a Windows PC so can't try it yet. However, on GNU/Linux it works just fine without involving any atomics at all.
>>
>>58545711
IF ERR NOT EQUALS NIL LOG ERROR RETURN
IF ERR NOT EQUALS NIL LOG ERROR RETURN
IF ERR NOT EQUALS NIL LOG ERROR RETURN
>>
>>58545280
Do I have to pay for this shit? I'm looking for a free resource.
>>
>>58546009
It's literally free.
>>
>>58545748
>>58545570
>haskell
>>58545448

Stay in your containment thread from now on, please
>>58546016
>>58546016
>>58546016
>>
File: cute anime pic 0050.jpg (50KB, 611x393px) Image search: [Google]
cute anime pic 0050.jpg
50KB, 611x393px
>>58546030
Why are you outside your own thread?
>>
File: seggfjsra.jpg (136KB, 718x302px) Image search: [Google]
seggfjsra.jpg
136KB, 718x302px
Does /dpt/ remember of the good old triq equatios?
This was a pretty important step to learn before Calculus.

Your daily exercise:
sin2x+cos2x+sinx-cosx=1

Yes, as you can already see, there will be 3 solutions to this equation on [0,2Б]
>>
>>58545984
It's really a shame because go would be a pretty beautiful language otherwise.
>>
File: fucking_liberals.png (58KB, 768x216px) Image search: [Google]
fucking_liberals.png
58KB, 768x216px
Where were you when liberal brainwashing snuck itself inside programming?
>>
>>58542482
def display(wordbank, word):
output = str()
space = ' _ '
for i in word:
if i in wordbank:
output += i.upper()
else:
output += space
return output

def hangman(number):
dictionary = {5: ' o', 4: ' o\n |', 3: ' o\n -|', 2: ' o\n -|-', 1: ' o\n -|-\n /', 0: ' o\n -|-\n / \\'}
return dictionary[number]


Made hangman pretty good.
>>
>>58546080
>triq
How black are you?
>>
What is this retarded shit? No matter what directory I use, it spits out System.UnauthorizedAccessException
Sub Main()
Dim CSVPathLog As String = "" 'Stores the directory of the CSV file output
Dim Name As String = "" 'Stores the name of the person
Dim Tutor As String = "" 'Stores the tutor
Dim Status As String = "" 'Stores the IN/OUT status
Dim Time As String = "" 'Stores the time logged

Dim lines() As String = {Name & ",", Tutor & ",", Status & ",", Time & ","}
Dim filePath As String = "E:\Test"

If Not System.IO.File.Exists(filePath) Then
System.IO.File.Create(filePath).Dispose()
End If

Using outputFile As New StreamWriter(filePath & Convert.ToString("\Log - " & Date.Today & ".csv"), True)
For Each line As String In lines
outputFile.Write(line)
Next
outputFile.WriteLine()
End Using
Using outputFile As New StreamWriter(filePath & Convert.ToString("Log - " & Date.Today & ".csv"), False)
outputFile.Write(lines)
End Using


End Sub
>>
>>58546100
I am identified as nu-C-toodler.
>>
>>58546089
>>>/pol/
you have to go back
>>
>>58546114
Stop using VB, even if someone works with it cause muh legacy code, please ditch it.
>>
File: removeminority.png (32KB, 863x267px) Image search: [Google]
removeminority.png
32KB, 863x267px
>>58546089
>not being a redpilled mathematician
>>
>>58546137
You're just jealous because VB isn't littered with ugly semicolons and curly braces.
>>
>>58546137
I have to use VB because this is for coursework, and my retarded exam board has a pre-approved language list.

Can someone just help me? This shit is due tomorrow and I need to fix this
>>
>>58546163
But it still becomes an unreadable POS and you cannot control that. Just like XAML
>>
File: anal beads.png (58KB, 679x747px) Image search: [Google]
anal beads.png
58KB, 679x747px
>>58546114
>>58546137
>being jealous that your language doesn't have the "ain't" keyword
>>
>>58546184
Reformat the code and we will help you.
>>
>>58546185
>>58546163
Oh my god who the fuck cares, stop being so autistic about languages and just move on
>>
>>58546185
>unreadable
Yeah, because C++, Java, etc are known for being SO much more readable than VB.
>>
>>58546114
ignoring VBs atrocious syntax: assuming E:\Test is a directory then File.Create will throw that exception because it creates files, not directories..

try Directory.CreateDirectory (and Path.Combine)
>>
>>58546209
Well they are.
>>
>>58546209
Yes they are?
>>
>>58546201
You sound upset. Is your language of choice bringing you down?
Looks matter.
>>
I wanna make my own programming language. Would /dpt/ use it
>>
>>58546246
No
>>
>>58546200
>Reformat the code
What, as in re-write it in another language? This is due tomorrow, I don't have time to learn another language

>Re-write the code that meets my standards of formatting
I'm rushing to get this done, formatting comes later when I actually get the damn thing to work

>>58546225
Trying to create a file in a given directory - I don't want to make a folder, I just want to make a file in that folder/directory.

>>58546241
I have to learn and use this language for my course, I don't have a choice in whether I get to use it or not.
>>
>>58546246
FP?
>>
>>58546017
I can't figure out where the free stuff is. I see a link to a book that costs $40
>>
>>58546246
No
>>
>>58546269
Just make it readable.
>>
>>58546246
Of course not.
>>
>>58546246
4u bby
>>
File: 1409688611017.jpg (65KB, 604x453px) Image search: [Google]
1409688611017.jpg
65KB, 604x453px
>>58546273
nvm i'm a faggot, i found it
>>
File: anal beads.png (99KB, 681x571px) Image search: [Google]
anal beads.png
99KB, 681x571px
>>58546273
Anon...
>>
>>58546273
>>58546288
Also, look at the Course Slides and Labs section for lecture slides and projects.

Download the projects in the Sample Code section, too.
>>
>>58546269
well, where does it say where the exception is thrown at? I assumed:
System.IO.File.Create(filePath).Dispose()

because this'll throw

StreamWriter shouldn't throw unless you don't have write permissions for E:\Test which you can find out with.. (in C# because..)
var perm = new FileIOPermission(FileIOPermissionAccess.Write, foo);
if (!SecurityManager.IsGranted(perm)) {
// no permission here
// you can do something like, if your ACL allows changing modes of directories:
var info= new DirectoryInfo(somePath);
info.Attributes &= ~FileAttributes.ReadOnly;
// somePath is writable
}

>>
>>58546279
Sub Main()
'Block of variables pertaining to data
Dim CSVPathLog As String = "" 'Stores the directory of the CSV file output
Dim Name As String = "" 'Stores the name of the person
Dim Tutor As String = "" 'Stores the tutor
Dim Status As String = "" 'Stores the IN/OUT status
Dim Time As String = "" 'Stores the time logged

'Block of variables pertaining to file-writing
Dim lines() As String = {Name & ",", Tutor & ",", Status & ",", Time & ","} 'Array that combines above variable
Dim filePath As String = "E:\Test" 'Variable that stores the directory


'Currently throws an UnauthorizedAccessException on launch
'If the file doesn't exist in the given directory, it will be created
If Not System.IO.File.Exists(filePath) Then
System.IO.File.Create(filePath).Dispose()
End If

'If the file already contains data, it will write data and store it in the next line
Using outputFile As New StreamWriter(filePath & Convert.ToString("\Log - " & Date.Today & ".csv"), True)
For Each line As String In lines
outputFile.Write(line)
Next
outputFile.WriteLine()
End Using

'If the file doesn't contain data, it will write to the file
Using outputFile As New StreamWriter(filePath & Convert.ToString("Log - " & Date.Today & ".csv"), False)
outputFile.Write(lines)
End Using

End Sub
End Module
>>
>>58542487
it's shit
>>
>>58546358
>
        'Currently throws an UnauthorizedAccessException on launch

HMM I WONDER WHAT THE ISSUE IS
>>
>>58546353
I've tried different directories, different drives - fucking retarded. I also tried running the program as Admin, to no avail.

This was fine when I worked on this at school, yet it hates it on my home PC.
Structure at home:
>VS 2017 RC Enterprise installed on C:\ (have R/W access to everything as it's my PC)
>Documents and save data for projects in E:\ (C:\128GB boot SSD with VS on it, E:\ 1TB HDD with all documents, photos etc.)

Structure at school:
>VS 2013 Express installed on C:\ (no R/W access at all)
>Documents and save data for projects and data in N:\ (network drive that's persistent across all PC's on the network - R/W access)
>>
>>58546379
You got autistic about formatting, figured I'd leave no stone unturned

>Not leaving comments for other programmers unaware of problems to see
Gee whiz
>>
>>58546358
>Dispose
Can anyone else double-click to select that word?

For me it's:
>Dis
>pose
>>
>>58546425
Look at your goddamn filePath variable.

It's pointing to a path, not a file.

You're trying to create the directory "E:\Test" with a file create method.

When it hits your File.Create() method, it should be something like "E:\Test\mybutt.csv"
>>
>>58546472
.Dispose() just releases all resources
Also, it's just you.
>>
>>58546472
Same

Weird
>>
These are the people who will be stealing our jobs...

https://www.youtube.com/watch?v=BcmUOmvl1N8
>>
I've written a simple website using PHP. The site is really simple, almost a standard first "record collection website".

Every page is structured like this:
<?php
require_once 'db_config.php';

$db = new mysqli($db_host, $db_user, $db_pass, $db_database);
if($db->connect_error)
die('NOPE: ' . $db->connect_error);

require 'header.php';
?>

[PAGE SPECIFIC HTML AND PHP]

<?php
require 'footer.php';

$db->close();
?>


Would I benefit from rewriting it accordingly to MVC? Had I written it today, I'd to it as an MVC, but I was lazy (even though I clearly know how to do it in MVC).

tl;dr: convince me to convert my website to MVC
>>
>>58546472
page source shows it as
Dis<wbr>pose
>>
>>58546494
MVC allows you to unit test it in an /almost/ sane fashion.

next
>>
>>58546482
Holy shit, I'm retarded - thank you
However, when I run it, it complains about:
System.IO.DirectoryNotFoundException: 'Could not find a part of the path 'E:\Test\Log - 18\01\2017.csv'.'

Dim filePath As String = "E:\Test\" & "Log - " & Date.Today & ".csv" 'Variable that stores the directory

'If the file doesn't exist in the given directory, it will be created
If Not System.IO.File.Exists(filePath) Then
System.IO.File.Create(filePath).Dispose()
End If
>>
>>58546529
THE '\' CHARACTER ISN'T VALID IN A FILENAME REEEEEEEEEEEEEEEE
>>
>>58546494

you dont need to connect to the db every page. Put that in the config fle or something then just require_once it.
>>
>>58546529
literally what I said here:
>>58546225

also, use Path.Combine
>>
>>58546513
Fair point.

>>58546542
I know.
>>
>>58546552
Like this?
Dim filePath As String = "E:\Test" 'Variable that stores the directory
Dim fileName As String = "Log - " & Date.Today & ".csv" 'Stores the filename

'If the file doesn't exist in the given directory, it will be created
If Not System.IO.File.Exists(filePath) Then
Directory.CreateDirectory(filePath)
Path.Combine(filePath, fileName)
'File.Create(filePath).Dispose()
End If

Sorry in advance if I'm being retarded, I'm just stressing to get this done as its due tomorrow - all of these problems are coming out of nowhere
>>
>>58546630
>>58546552
Forgot to mention - the next line complains that the file doesn't exist, so it doesn't seem to actually create the file
>>
>>58546630
SLASH IS NOT VALID IN A FILENAME

YOU MUST CONVERT YOUR DATE.TODAY VALUE TO A STRING THAT DOES NOT UTILIZE A SLASH
>>
>>58546630
>E:\Test
VB has escape sequences, right? It's been a while since I learned it but I'm pretty sure it should have them.
>>
>>58546710
This guy is right >>58546677
It's the Date.Today function that seems to be tripping up runtime. Despite Convert.ToString, it doesn't like it.
>>
>>58546246
Is it webscale? I won't use it if it's not webscale.
>>
>>58546630
since you're still not really following..
    var path = Path.Combine("E:", "test");
Directory.CreateDirectory(path); // will create directory if it doesn't exist, otherwise it does nothing
using (var sw = new StreamWriter(Path.Combine(path, "foo.txt"), false)) // false means StreamWriter will create "foo.txt" but not append to it (overwrites it)
{
sw.WriteLine("test");
}


you don't have to check if a directory exists if you're just going to make it if it doesn't.
StreamWriter can create the file for you by using the String,Bool constructor. the Bool = false means that it'll overwrite the file, true means it'll append to the file.

and using something like
        public static string SanitizePath(string input)
{
var bad = Path.GetInvalidFileNameChars().ToString() + Path.GetInvalidPathChars();
foreach (var c in bad)
{
input = input.Replace(c.ToString(), "");
}
return input;

// or linq:
// return bad.Aggregate(input, (current, c) => current.Replace(c.ToString(), ""));
}

will "clean" up the paths so it won't have nay invalid filenames or characters (by replacing them with nothing)
>>
>>58546758
What exactly is 'web scale'
>>
>>58546359
no u
>>
>>58546791
/dev/null
>>
>>58546791

"Web scale" means it redirects all your data straight to
/dev/null
for maximum performance.

http://www.mongodb-is-web-scale.com/
>>
>>58546811
>>58546802

No really what must a virtual machine implementation do in order to have good performance?

From what I know, its a multitasking problem.
>>
>>58546785
Don't worry, I fixed it - the issue actually was in me using Date.Today in the filename - that creates slashes, which Windows doesn't like.

Instead of using Date.Today, I created a variable that calls on Date.Today, then formatted it to use dashes instead of slashes; see for yourself:
Dim filePath As String = "E:\Test" 'Variable that stores the directory
Dim getDate As String = Format(Date.Today, "dd-mm-yyyy")
Dim fileName As String = Convert.ToString("Log - " & getDate & ".csv") 'Stores the filename

'If the file doesn't exist in the given directory, it will be created
If Not System.IO.File.Exists(filePath) Then
'Directory.CreateDirectory(filePath)
'Path.Combine(filePath, fileName)
File.Create(fileName).Dispose()
End If

I get what you said, and I took it on board. I just don't need to create directories necessarily - just to make the file. I still have the two lines commented, if need be.

But thanks very much for your help man, you saved me. All that's left is to process a string, e.g. "John Smith 13.2 IN - 12:34:56" into
>John Smith
>13.2
>IN
>12:34:56
and place them into individual variables.
>>
>>58545814

Oh no I ordered that and it's shipping.... Why is it bad anon, do you have a better recommendation?
>>
>>58546901
>System.IO.File.Exists
You should avoid to use that function.
>>
>>58547394
Why?
>>
>>58547413
Because it's fucking useless.
>>
>>58545200
Doing the same for my image board. Fuck the bloat!
>>
>>58542523
working on this
>>
>>58546849
To have good performance a VM must not be a VM.
>>
>>58543305
>try my hand at writing a Gameboy emulator for fun -.-
I've done that and always recommend either that or a SNES emulator as projects for people, as it's a good size solo project and the result is fun to use. So you should do it too.
>>
>>58545602
How else do you suggest that we get you faggots to indent properly though?
>>
>>58546089
But that's a /pol/ approved algorithm.

> yfw you realize that a subtree must be either REDPILLED or BLACKENED.
>>
Tkinter

yes or no?
>>
>>58547659
gofmt and derivatives
>>
This query works flawlessly if I run it directly from the MySQL terminal:
SELECT Card.cardNumber, Card.name, AVG(Purchase.price) FROM Card LEFT JOIN Purchase ON Card.cardNumber = Purchase.cardNumber AND Card.cardSet = Purchase.cardSet WHERE Card.cardSet = 'Base Set' GROUP BY Card.cardNumber ORDER BY Card.name;

but when I try to run it from PHP (
$stmt = $db->prepare('SELECT Card.cardNumber, Card.name, AVG(Purchase.price) FROM Card LEFT JOIN Purchase ON Card.cardNumber = Purchase.cardNumber AND Card.cardSet = Purchase.cardSet WHERE Card.cardSet = ? GROUP BY Card.cardNumber ORDER BY Card.name');
it won't run:
Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'mydb.Card.name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
>>
>>58547752
Question is why, obviously.
>>
>>58547752
GROUP BY Card.cardNumber, Card.name


MySQL gives you implicit group bys, but you should know better. Any time you have an aggregate, you must group by anything that ISN'T an aggregate.
>>
>>58547787
Oh yeah, I forgot about that. Thanks!
>>
>>58547687
If you're serious about memesnek, sure why not
>>
File: 1456176683365.jpg (810KB, 1625x1117px) Image search: [Google]
1456176683365.jpg
810KB, 1625x1117px
Not sure where else to post.

I have an impressive enough alpha build of software/hardware and want to push it onto kickstarter.

My concern is the video, because I'm no expert in that. Has anyone on /g/ done something like this?
Where to find someone to help produce/edit the video? It has to be local too (NYC) which makes it a pain in the ass.
I'll pay them of course, just want to avoid the bullshitters. Any insight is appreciated.
>>
>>58548058
This is probably not a question for 4chan. Certainly not a question for /dpt/.

Google freelance video production.
>>
How do I keep my main subroutine calling a function until the program closes? Here's how it is at the moment:
Sub Main()
SerialLogger()
Console.ReadLine()
End Sub

The Console.ReadLine() is just in place so the program doesn't terminate immediately. I was thinking of doing a Do Until Program.Close() or some shit like that. What would be the syntax for this?
>>
>>58548130
What are you doing?
>>
I tried to install the PyQt4 package in PyCharm but I get

Collecting PyQt4

Could not find a version that satisfies the requirement PyQt4 (from versions: )
No matching distribution found for PyQt4


why does this happen?
>>
>>58548194
Writing a program that reads data from a Serial Port, separates the incoming string, and writes the data to a csv file. For example:
>Incoming string is "John Smith 13.2 IN 12:53:49"
>I want to split the string into John Smith, 13.2, IN, and 12:53:49
>Write each individual string to a CSV
I have everything done, except for the string manipulation. What you see me attempting in Main() is to continuously call SerialLogger() (Function that listens on a given COM port and returns a captured string) until the program closes, as opposed to calling it only once. Program flow is as follows:

SerialLogger() (returns string) --> ProcessName() (returns formatted string) --> SaveToFile() (uses return value from ProcessName() in order to write to a file, paired with 3 other functions doing the same thing) --> Sub Main() Calls on SaveToFile() Which calls all others in the process. tl;dr Capture --> Format --> Save to file

However, that is the least of my worries. I have a problem where I can't have another function call on SerialLogger() because SerialLogger() then complains that COM3 (the listening port) is occupied.

Source code: http://pastebin.com/aKEPSvhP
>>
>>58546504
4chan includes this shit in their API responses too
>>
>>58548338
>use awaitable Tasks
>wait for Task to complete and then fire another Task
>repeat
>????
>PROFIT

Alternatively, just do a 1-second loop forever and check the port before you let anything else happen.
>>
>>58548347
>HTML in JSON responses
Wew
>>
>>58542482
Did they know they'd be causing PersonFactoryFactorySingletonFactory when they wrote that book?
>>
>>58548390
Yes, it's fucking annoying, but at the end of the day, it's the only way to pick up things like code tags, spoilers, and when a mod/admin does redtext and custom formatting on their post.

All it takes is a single method to do the HTML strip/comprehension and Bob is your uncle.
>>
>>58548412
They probably thought it was a good idea
>>
>>58548368
Are we talking about just looping SerialLogger() in the main subroutine? If so, thanks.

What about my problem where SerialLogger() complains that the COM port is in use?
I could see a workaround, but only if it's possible to return multiple items from a function
>>
>>58548434
Or you could actually provide the relevant information in the JSON itself.
>>
>>58548412
Pretty sure the book is a catalogue of patterns they've noticed as a result of Java (especially older versions) being so terrible at actual abstraction. Unfortunately, most people saw it as a cookbook to replicate these patterns as much as they could.
>>
>>58548338
Why dont you just put all of it in a kinesis stream?
>>
>>58548449
>but only if it's possible to return multiple items from a function
I wonder if there's some sort of language feature that allows me to group a series of types together and give it a sensible name.
>>
>>58548476
What do you mean?

HTML markup provides that relevant information.

What's your alternative?
>>
I'm making some fucking scones.
>>
File: Nonogram.png (153KB, 959x1052px) Image search: [Google]
Nonogram.png
153KB, 959x1052px
>>58542482
Continuing my work on my Nonogram game.
>>
>>58548390
Its actually kind of nice. It lets me parse crosslinks, greentexts, quotes and whatnot without having to resort to unpredicatable pattern matching. It also gives color highlights for /s4s/ fortunes.

The <wbr> shit is just dumb and I strip it out before passing it to the html renderer.

>>58548476
I guess it depends on your tools. I think its handy because I can add my own handling for each html tag using emacs' built in html renderer.
>>
>>58548515
>using a closed-source IDE

How much did you pay for it, cuck?
>>
I hate myself so I'm learning Perl
>>
>>58548490
Arrays, right? I was thinking of that. But in order for the array to be useful and call what I need, I need to split the single string into its respective data - which is a catch 22 for me.

I need to make the function callable by sorting the data, but in order to sort the data - I need to call the function.
>>
>>58548557
No, you fucking cunt, either a struct or an object.
>>
>>58548545
you dont have to pay for vscode :^)

I'm not sure if its Stallman free though. At least its open source.
>>
>>58548545
VS Code is free and also not an IDE but a source code editor
>>
>>58547724
Only if we can make it a pre-commit hook, as I don't trust my colleagues.
>>
Im the best programmer here.
>>
>>58548592
>Visual Studio Code collects usage data and sends it to Microsoft, although this telemetry reporting can be disabled.[18] The data is shared among Microsoft-controlled affiliates and subsidiaries and with law enforcement per the privacy statement.[19]
>>
I really really really wish Rust had HKTs.
>>
>>58548494
What I am saying is JSON should not contain HTML. You are forcing any consumer of the API to also include some sort of HTML parser. You should not need to parse HTML in a JSON API.

HTML does provide that information, but not in a structured way. The alternative is providing the data as fields in the post object itself. Consider the difference between providing information as
"there are 10 posts"
and
"post_count": 10
.

>>58548540
You should not need to parse anything in a sane JSON API. Consider how much that complicates programing against those APIs.
>>
>>58548638
>can be disabled
so disable it, anon
>>
>>58548568
I don't want to group the data into a single item - I want to do the exact opposite.
I have a single item that I want to split into different items and return them from the function that captures the single item.
>>
>>58548646
The content of the post is literally best described as HTML, dumb faggot.

What is your alternative?

How would you prefer to convey that
"there are 10 posts"
is in code tags?

What about when a mod redtexts, or has custom formatting in their post (bold/italics/underline)?

There's literally nothing inherently wrong with putting HTML content in a JSON object, particularly when that object is best described as HTML.
>>
>>58548646
4chan comments have markup and formatting though. Would you rather json parameters that have string indexes for each element? Then you would have to parse this too, at least HTML is a standard.
>>
>>58548592
It also happens to be the only electron-based editor that isn't a catastrophic heap of horse shit.

Not the highest bar to pass, but still. I find it nice to use, and MS's intellisense is a gift straight from G-d.
>>
>>58548686
>I have a single item that I want to split into different items and return them from the function that captures the single item.
Holy fuck, you're really having trouble with this.

Let's take your line:
ohn Smith 13.2 IN 12:53:49

Let's say it's a collection of the following things:
>Name
>Duration
>IN/OUT
>Timestamp

How about we make a struct
LogEntry
that can hold each of these elements, and then have an array of
LogEntry
s?

Now, we can pass around these separate things that are logically grouped together.
>>
>>58548730
Yes, but the struct LogEntry already takes the 4 variables with their containing data as if the line has already been processed into the 4 variables.

I still haven't processed the line into the variables.
>>
>>58548688
>>58548707
>The content of the post is literally best described as HTML, dumb faggot.
HTML is generally specific to web browsers. The consumer of the API is likely to not be one. It could be anything from a native application to a text analysis tool.

>What is your alternative?
code_tags: [[start,finish]]
With that you can simply apply the formatting native to your platform at string positions without parsing HTML.

>What about when a mod redtexts, or has custom formatting in their post (bold/italics/underline)?
Document that shit and include in the post object same as above.

>There's literally nothing inherently wrong with putting HTML content in a JSON object, particularly when that object is best described as HTML.
It complicates consumption and even introduces overhead.
>>
>>58548792
Then do that.

Use string.Split to get an array of strings.

Assign the strings to variables appropriately, and store those variables as a LogEntry.
>>
>>58548688
I agree with >>58548831. It's better if parsing is already done and stored using JSon instead of HTML.
>>
>>58548831
>complains about complication
>wants to LITERALLY introduce another JSON property to each post for every fucking possible formatting markup
>>
File: browser_.png (3MB, 1920x1080px) Image search: [Google]
browser_.png
3MB, 1920x1080px
>>58548847
I'll just stick with skipping json and parsing the html myself. :^)
>>
>>58548730
>>58548843
I'm thinking of something along these lines:
Public Sub DataCapture(ByVal SampleData() As String)
Dim CapturedString As String = "John Smith 13.2 IN 12:53:49"

'String manipulation code goes here - turns above into below

SampleData(0) = "John Smith"
SampleData(1) = "13.2"
SampleData(2) = "IN"
SampleData(3) = "12:53:49"
End Sub

Public Function WriteToFile()
Dim Name As String = DataCapture(SampleData(0))
'etc. for other 3 variables
End Function
I know the syntax is wrong - that's just so you get an idea of what I'm trying to do or what I'm thinking of.
>>
>>58548859
A well defined, documented and typed property. Please explain to me how string[5:10] is more complicated than an HTML parser.
>>
>>58548843
Say I manage to get the strings into my given variables. How would I call from the function they were processed in, and place them into a variable in another sub or function? Could you give me a code example?
>>
>>58548861
Have you released this thing?
>>
>>58548955
yes
>>
Can someone explain why I would use interpreted languages? If I wanted to run a snippet of code, Id just compile and run it. Are interpreted languages just a meme?
>>
>>58549015
Can someone explain why I would use compiler languages? If I wanted to run a snippet of code, I'd just run it. Are compiled languages just a meme?
>>
>>58549015
Lazy devs.
>>
>not using a language that can be both compiled and interpreted
Fags
>>
>>58549156
Examples other than Holy C and not JIT compiled?
>>
>>58549086
Faster
>>
>>58549156
: forth-master-race [ 100 2 * ] literal + ;
>>
>>58542775
Well if you want to be inefficient, do it like the nigger that you are.
>>
>browsing programming jobs
>see nice job opening
>look at requirements
>must be skilled in python
>>
New thread: >>58549352
>New thread: >>58549352
New thread: >>58549352
>New thread: >>58549352

New thread: >>58549352
>New thread: >>58549352
Thread posts: 321
Thread images: 25


[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.