[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: 329
Thread images: 36

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old Thread: >>57190109

What are you working on /g/?
>>
poop
>>
Arrows
>>
Working on a programming problem for my C class.

How would I find and count the frequencies of words in a given input? (lets assume the input is from a file)

Example input:

src
src
img
src
img
iframe


output would be:

src 3
img 2
iframe 1
>>
>>57200206
system("uniq -c");
>>
>>57200231
much nicer than the verbose haskell version

(head &&& length) . group . words
>>
File: disasm.jpg (133KB, 1278x529px) Image search: [Google]
disasm.jpg
133KB, 1278x529px
My very own disassembler. It can pretty print some intrsutctions now and print in RPN how to evaluate them
>>
>>57200206
Something like this.

#define _XOPEN_SOURCE 700

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


struct mapping {
char *word;
size_t count;
};


int main(void)
{
struct mapping *items = NULL;
size_t items_len = 0;

ssize_t ret;
char *line;
size_t line_len = 0;

/*
* Reading input
*/

while ((ret = getline(&line, &line_len, stdin)) != -1) {
// Strip newlines from line
strtok(line, "\n");

// Look for word. If it already exists in a mapping, increment
// the counter
bool found = false;
for (size_t i = 0; i < items_len; ++i) {
if (strcmp(items[i].word, line) == 0) {
found = true;
items[i].count += 1;
free(line); // Don't need it allocated
break;
}
}

// If the word was not yet found, add it to the array of
// mappings
if (! found) {
items_len += 1;
size_t new_size = sizeof(struct mapping) * items_len;

if ((items = realloc(items, new_size)) == NULL) {
perror("realloc");
exit(EXIT_FAILURE);
}

items[items_len - 1].word = line;
items[items_len - 1].count = 1;
}

// Reset variables for the next run
line = NULL;
line_len = 0;
}

// If getline encountered an error, don't continue
if (ferror(stdin)) {
perror("getline");
exit(EXIT_FAILURE);
}

/*
* Printing output
*/

for (size_t i = 0; i < items_len; ++i) {
fputs(items[i].word, stdout);
printf(" %lu\n", items[i].count);
}

/*
* Cleanup
*/

for (size_t i = 0; i < items_len; ++i) {
free(items[i].word);
}

free(items);
exit(EXIT_SUCCESS);
}


I hardly tested it though.
>>
>>57200389
import sys
C={}
for line in sys.stdin.readlines():
for word in line.split():
C[word] = C.get(word, 0)+1

for word, count in C.items():
print word, count


That's why Py > C
>>
>>57200407
They are for different things, Anon.
>>
>>57200420
this

C is for programmers, Python is for retards
>>
>>57200459
>computers and programming was invented to aid humans and speed shit up
>somehow spending more time than necessary on a task isn't retarded


realy makes you go hmm
>>
I have a list of rectangles in different (x,y) coordinates and when the user clicks an (x,y) coordinate I want to get the rectangle in that position (if the is one).
Currently I'm going through all that rectangles until I find one contains that coordinate (it works) but I feel there must be a better way to do this. Thoughts?
>>
>>57200206
void main(string[] args)
{
import std.stdio;
import std.algorithm;
import std.array;

auto input = "src\nsrc\nimg\nsrc\nimg\niframe";
uint[string] result;

input.split('\n').each!(n => result[n] += 1);
result.writeln;
}


Result:
["src":3, "iframe":1, "img":2]
>>
>>57200549
why would i use >>57200407
over >>57200239
>>
>>57200564
why do you ask me?
>>
>>57200570
you're right
you're a python programmer
what would you know?
>>
>>57200572
i'm not
and i'm still not sure why'd you ask me

i was merely pointing out that calling python retarded just because you can accomplish the same task much faster and in fewer lines of code while not sacrificing readability or anything is stupid

if you know haskell, and can accomplish the task in it even faster and in even fewer lines of code, then by all means, be me guest, good for you
>>
>>57200564
For one, the haskell version doesn't do what you intended

1) group only works for elements that are consecutive. You'll need to sort the list first or choose a different method.

2) (head &&& length) by itself won't return the # of occurrences of each word. Instead, it will return the first element of the list and the total number of elements in the list.

What you meant to write was something like
fmap (head &&& length) . group . sort . words
>>
File: ugh.png (417KB, 500x700px) Image search: [Google]
ugh.png
417KB, 500x700px
>Have to learn all these design process buzzwords and memes thanks to pajeets who like to pretend they're working
I just wanna program cool things mane
>>
>>57200593
>group only works for elements that are consecutive
Fucking prelude

And yes, I meant map, whoops
>>
First for Python.
>>
>>57200593
>>57200601

Incidentally, are people using TransformListComp aware of this?
>>
>>57200459
If I use both C and python what does that make me?
There is no reason to use C when performance doesn't matter
>>
>>57200549
>and speed shit up
Shit like development time?
>>
>>57200621
>>C is for programmers, Python is for retards
>If I use both C and python what does that make me?
A retarded programmer.
>>
>>57200627
Damn it, autistic monkey.
>>
>>57200623
yes
>>
>>57200190
I played porn games for 12 hours today

no process ever
>>
>i use c when i could just write a script
>I use c for io bound things

Yea nah you are a retarded programmer>>57200627
>>
File: shot0033.jpg (310KB, 1920x1080px) Image search: [Google]
shot0033.jpg
310KB, 1920x1080px
/dpt/-chan, daisuki~

>>57200557
depends on how many rectangles we are talking about but you could use a R-Tree or a Quadtree to avoid going through all of them.

https://en.wikipedia.org/wiki/R-tree
https://en.wikipedia.org/wiki/Quadtree

The trick is to sort the rectangles by screen regions into a tree.

>>57200382
Sugoii

>>57200206
Implement a dictionary, preferably with a hash map.

>>57200190
Thank your for using an anime image.
>>
>>57200806
how often do you use arrows
>>
>>57200809
~n/4
>>
>>57200822
what's that in miles per hour
>>
>>57200823
amount of replies
>>
>>57200833
oh i meant arrows
https://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Arrow.html
>>
>>57200840
i don't like haskell.
>>
a fuckin ;
>>
>>57200806
Should I kill myself?
>>
File: 1470671602288.gif (607KB, 250x249px) Image search: [Google]
1470671602288.gif
607KB, 250x249px
>>57200850
>>
>>57200806
can I be your s-special someone?
>>
>>57200557
>>57200806
Thanks anon, I'll look into that.
>>
File: 648.jpg (64KB, 1280x720px) Image search: [Google]
648.jpg
64KB, 1280x720px
>>57200868
>s-special
What does that mean?

>>57200861
i simply don't like the syntax but i still follow the haskell scenes which is one of the most active on PLT.

>>57200855
no? why would you want that?
>>
Is there anything that teaches OpenGL/WebGL which doesn't require you to poorly do everything from the ground up, but instead makes you carefully fill in sections of mostly-completed code?
>>
>>57200905
If you don't want to do everything from the ground up then stop trying to learn OpenGL/WebGL and learn SDL/three.js instead.
>>
>>57200885
I don't want to but I would have done so if you asked
>>
>>57200861
Haskell is a typical mathematician's language. "Computers are so limited, I want to be FRRRRRRREEEEEEEEE".
>>
>>57200922
I do want to do everything from the ground up, and already have some pretty decent initialisation code.
But the problem is that every tutorial is made to get it up and running quickly and carelessly, and it's hard to handle trying to combine knowledge from several tutorials.
>>
File: 026.jpg (2MB, 1754x1240px) Image search: [Google]
026.jpg
2MB, 1754x1240px
>>57200905
opengl is at first a low level api for driving an gpu. if what you want is graphic programming, logic wise,then have a look at

https://processing.org/
http://p5js.org/

otherwise, an good opengl tutorial is https://capnramses.github.io//opengl/
>>
>>57200953
Well, what I wanted was more a WebGL tutorial than anything else.
I don't actually have as much use for OpenGL right now.

I see that page does have a WebGL tutorial, but for the part of WebGL I'm struggling with it just fills in with a library.
>>
>>57200885
>i simply don't like the syntax
what's wrong with it?
>>
File: 1389022013617.jpg (15KB, 362x276px) Image search: [Google]
1389022013617.jpg
15KB, 362x276px
>>57200206
Rate my version: http://pastebin.com/zHyKJp0p

It even sorts the output, too.
>>
C stands for Cute?
>>
>>57201068
cunt
>>
>>57201068
C++ stands for Cuter
>>
>>57201068
Cuck
>>
>>57201003
i prefer to not answer to avoid controversy/dispute.
>>
>>57201124
ok

there are a few things i dont like with indentation and such

i hope they add ArgumentDo soon as well
>>
File: 1432323884812-0.png (26KB, 431x499px) Image search: [Google]
1432323884812-0.png
26KB, 431x499px
>>57200206
>>57200389
Do it like this:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv)
{
if (argc < 2)
return 0;

char lookup_table[argc][512];
memset(lookup_table, '\0', 512 * argc);
int n = 0, indices[argc];
memset(indices, 0, sizeof(int) * argc);

for (int i = 1; i < argc; ++i)
{
for (int j = 0; j < argc; ++j)
if (strcmp(argv[i], lookup_table[j]) == 0)
goto SKIP;

strcpy(lookup_table[n++], argv[i]);

for (int j = i + 1; j < argc; ++j)
if (strcmp(argv[i], argv[j]) == 0)
++indices[n];
SKIP:;
}

for (int i = 0; i < n; ++i)
printf("%s: %d\n", lookup_table[i], indices[i + 1] + 1);

return 0;
}
>>
>>57201266
>lookup_table
>Requires a linear search
That's not what a lookup table is.
Also, he said he was reading from a file, not the command line arguments.
>>
DISCORD LINK PLZ

you really need to get a permanent link up in the OPs
>>
>>57201425
fuck off, discord is antithetical to 4chan

also >you
why not do it yourself faggot
>>
>>57201425
https://discord.gg/EeeWk
>>
>>57201425
bloatware
>>
>>57201425
>>57201464
Fuck off with that shit.
>>
>>57201347
What linear search?
>>
>>57201518
>for (int j = 0; j < argc; ++j)
> if (strcmp(argv[i], lookup_table[j]) == 0)
>>
File: 372.png (144KB, 392x324px) Image search: [Google]
372.png
144KB, 392x324px
>implemented dumping my buffers to PGM format so I could easily visualize them
>the colors were all wrong despite correct byte order
>takes a full hour to investigate what could cause this
>eventually zoom in on an area and see that they have that 3d-effect with overlapping colors on the edges
>turns out the PGM had an empty comment in it,causing two consecutive newlines which made the pixel color values misaligned


damn freetard formats
>>
File: 1453306116180.png (58KB, 313x196px) Image search: [Google]
1453306116180.png
58KB, 313x196px
>>57201587
>You fucked up
>It's somebody else's fault
>>
>>57201464
>This invite link is invalid or has expired
Make a permanent one or one that latss longer than 5sec

>>57201502
>>57201489
>>57201430
Lick my tits faggot
>>
>>57201741
I'd rather you posted them.
>>
>>57201686
Technically, it's not his fault to be born.
>>
File: 123931675539.jpg (60KB, 1024x574px) Image search: [Google]
123931675539.jpg
60KB, 1024x574px
>>57201031

> ==12662== in use at exit: 0 bytes in 0 blocks
> ==12662== total heap usage: 280 allocs, 280 frees, 12,302 bytes allocated

Noice. Valgrind approves. All memory is freed, not jumps on uninted memory.
And it actually counts words, not lines.
>>
>>57201870
why is this screencap so badly drawn
>>
>>57198739
check out the network communication in firefox's request logger, a web debuggign proxy or wireshark
>>
>>57201031
>input-file
Wunderbar
>>
File: 1462666217717.png (235KB, 506x658px) Image search: [Google]
1462666217717.png
235KB, 506x658px
>>57201870
>freeing memory
>>
>>57201913
Haruhi is badly drawn in general.
>>
File: qixscz[1].png (129KB, 1594x1109px) Image search: [Google]
qixscz[1].png
129KB, 1594x1109px
currently working on a country wide company workforce hub, building it in Lua bit by bit with 1 other guy.

Lua is such a fun language.
>>
>>57200885
what's PLT?
>>
>>57201983
programming language theory
>>
>>57201535
That's not in the lookup.
>>
>>57200735
which ones?
>>
>>57200905
you can do GLSL at shadertoy.com
>>
File: 1439648511159.jpg (116KB, 469x469px) Image search: [Google]
1439648511159.jpg
116KB, 469x469px
>>57201870
>>57201941
I always make it a point to have all of my programs run though valgrind without any errors.
>>
File: 122.jpg (2MB, 2400x1500px) Image search: [Google]
122.jpg
2MB, 2400x1500px
>>57201983
something the c creators/users never heard about, sadly.

https://en.wikipedia.org/wiki/Programming_language_theory
>>
>>57200806
why isn't erlang used more often? the fault tolerance, concurrency, hot-swap etc. seems really nice
>>
>>57202026
That's completely different though, and purely fragment shaders.
>>
>>57202046
because it's really hard to design algorithms for distributed computing.
>>
After programming in Pascal, C, Ada, C++ and some other more or less typed languages, I really struggle with languages that don't have any recognisable type system at all, like MATLAB.

This language just looks like either magic, chaos or/and the key to disaster to me.

"Everything is a vector". Yeah, except when it's not.
>>
>>57202051
just write your own software rasterizer in a shader :^)
>>
>>57202072
after using Haskell i struggle with other languages
>>
>>57202072

What part do you struggle with? Just ignore types unless it's a problem (generally with these languages it pops up in forms of concat)
>>
>>57202106
>Just ignore types
This is how Javascript was born
>>
File: Gin.Tama.full.1912378.jpg (845KB, 800x1500px) Image search: [Google]
Gin.Tama.full.1912378.jpg
845KB, 800x1500px
>>57202051
A pixel buffer is the only thing you need to do computer graphics.
>>
>>57202108

still valid advice.
>>
>>57202072
Try to understand how the magic is implemented and it'll make more sense.

In most dynamic languages you basically just pretend you're manipulating a void* that can be implicitly cast to practically anything you want.

>"Everything is a vector". Yeah, except when it's not.
Actually, everything's a matrix, except when it's not.
>>
File: 59393494_p0.png (732KB, 917x1100px) Image search: [Google]
59393494_p0.png
732KB, 917x1100px
>>57201942
Somewhat, the best story are usually made by lower tier artists.

>>57200190
What's the best way to benchmark an UDP server?
>>
>>57202106
Types cannot be ignored in any langugae.
>>
>>57202128
They can in x86 assembly.

Code is data is just a blob of bytes of unknown size.
>>
>>57202128

Except when they can :^)
>>
>>57202134
>They can in x86 assembly.
no, the processor needs to know if it's being asked to deal with ints, or floats or whatever. You have to tell it what type to treat the data as before it can do any work.
>>
When I see job posts for pen testers they ask for experience in a scripting language, mainly python.

Why is python considered a desirable language to script in as opposed to javascript or ruby?
>>
>>57202158
>Javascript
Hell no.

Ruby is actually quite common too.
>>
>>57202158
yes.

JavaScript is just used for web development.
>>
>>57202143
Nah you don't. Everything is just bytes, and you can pass them to anything you want.

Types are an abstraction you can maintain in your head if you want, but the CPU doesn't know or care.
You can do integer operations on floats or float operations on booleans, it's all legal, it's all bytes.

Just because I used an integer operation doesn't mean the type of my data is int, sometimes integer operations happen to do the right thing on packed floating point data.
>>
>>57202175
register size
>>
>>57202122
>In most dynamic languages you basically just pretend you're manipulating a void* that can be implicitly cast to practically anything you want.
no.
>>
>>57202167

but why though? there's thousands of NPM packages out there that serve a purpose?

>>57202174
but you can use it for scripting purposes
>>
>>57202179
Just because I'm putting some of my data in ah doesn't mean my data is 8bit wide.

There's no rule saying a register has to contain all the data I'm manipulating at once, in fact that's very often wrong.
>>
File: witch.jpg (331KB, 1061x1500px) Image search: [Google]
witch.jpg
331KB, 1061x1500px
>>57202128
You are wrong.

lambda calculus
turing machine
assembly languages

none of these have types.
>>
>>57202175
>Nah you don't
No, you have to pass OPcodes to the CPU that tell it what data type to treat the bytes as. If you don't what type you're telling the CPu to treat your data as, then you don't know what the code is going to do.

>sometimes integer operations happen to do the right thing on packed floating point data.
Yes, on floating point data. You still have to be deliberately treating the data as floating point data and using the integer operation with special knowledge that it will do what you want with the floating point data. You can't ignore what those types are.
>>
>>57202194
>but you can use it for scripting purposes
i know, but it's mostly used for web dev. Python is used more for general scripting.
>>
>>57202214
All of them do.
>>
>>57202122
How would I go about this? It unfortunately comes only with a reference, not with an "under the hood"
I especially hate that I don't see a possible error until I have the result. That's probably why MATLAB Programs are highly modular and short. Except for when they're not, like, when there's the GUI involved.

>Actually, everything's a matrix
yeah, my bad.

>>57202128
I sure as hell cannot ignore them.

>>57202143
Fuck the processor! _I_ have to know that.
>>
>>57202194
Simply because they're lots of libraries available doesn't mean you can find good ones.

Javascript was made by one idiot on his basement and the language never evolved.
>>
>>57202217
the cpu doesn't know any types, it only does work on bits.
>>
>>57202239
>and the language never evolved.
JS evolved quite a lot actually.
>>
>>57202251
Nope, still retarded.
>>
>>57202246
Yes it does, it knows integers of various sizes and floating point numbers of varying sizes.
>>
>>57202217
>No, you have to pass OPcodes to the CPU that tell it what data type to treat the bytes as. If you don't what type you're telling the CPu to treat your data as, then you don't know what the code is going to do.
The opcodes don't describe types, they describe operations, hence the name.

Types is an abstraction useful to human beings.

>Yes, on floating point data. You still have to be deliberately treating the data as floating point data and using the integer operation with special knowledge that it will do what you want with the floating point data. You can't ignore what those types are.
That's the model you'll be keeping in your head, but the cpu known none of that.
Using a VFIXUPIMMSS doesn't imply that the type of your data has to be floating point, the instruction is a tool that works on bytes and anything else is abstractions.
>>
>>57202254
no, all operations are on bits, the cpu never checks at any moment if data X is of type Y.
>>
>>57202265
By that logic you could argue types don't exist in any langugae, because everything is just bits.
>>
>>57202272
This is exactly what's happening though.
>>
>>57202272
no, languages have specific semantics for typing.
>>
>>57202272
Types do exist in many languages, and not all languages even have a concept of bits.
>>
>>57202272

Well, they don't.

Types are for humans.
>>
>>57202278
So types only exist in langugae semantics af far as you're concerned?
>>
>>57202272
Even if CPU instructions took typing into account (which is false), transistors and microcontrollers can only manipulate binary inputs.
>>
>>57202272
In terms of an abstract machine, types exist.
In terms of real hardware, types (sort of) don't exist.

Usually when you're programming though, you're working with the abstract machine, so types are an actual thing.
>>
>>57202265
>the cpu never checks at any moment if data X is of type Y.
Actually it does.
There are sometimes performance penalties if you mix float and int operations on the same operands on x86 simd for example.
>>
>>57202309
>types (sort of) don't exist.
implying the also sort of do?
>>
>>57202296

That's just a fact, not as far as he is concerned. Typing follows the idea of "humans first, machines second". There is no technical reason for it.
>>
>>57202317
Grasping at straws
>>
>>57202323
but what if I'm not human
>>
>>57202317
>implying the also sort of do?
Some architectures only allow memory accesses with certain alignments (64-bit integers on 8-byte boundaries etc.), so if you twist your thinking a bit, you can think of it having a "64 bit" type, "32 bit" type and so on.
>>
>>57202335
I don't see why I need to twist my thinking though. When there's special real hardware banked into the CPU for dealing specifically with 64-bit ints, 32-bit floats etc I don't see how one can't claim that the CPU is aware of types.
>>
>>57202344
>be a javascript webdev
>come to /dpt/
>bait
>???
>(you) (you) (you)
>>
are there invalid assembly programs
invalid for some reason other than syntax errors or unrecognised terms
>>
>>57202344
The fact that registers and operations deal can only deal with a certain number of bits at the same time is a necessity, there's no other way. It doesn't mean CPUs are aware of type.

Using a 32bit operation doesn't mean the type of your data is a 32bit int.
>>
>>57202359
I'm not a JS developer, though I do know it. I hardcore like static and strong typing.
>>
im having trouble for the logic for a function which checks a list for a certain value. If the value is in that list it returns true if it isn't it returns false

would a while loop work here?
>>
>>57202365
>Using a 32bit operation doesn't mean the type of your data is a 32bit int.
but doing a 32bit int operation would imply you want the CPU to treat your data as if it is a 32bit int.
>>
>>57202368
for each.
>>
>>57202360
Define invalid.

You can trivially cause a CPU exception by dividing by 0 for example, and you can trivially cause a compile error by using invalid operands (e.g. moving from memory to memory on a x86)
>>
>>57202368
A for loop would probably be slightly more appropriate, but yes, a while loop would work.
>>
File: 6489.jpg (497KB, 2560x1440px) Image search: [Google]
6489.jpg
497KB, 2560x1440px
>>57202368
f(list, value) ->
foreach element in list:
if element = value
return True

return False
>>
>>57202373

No, as there is no 32 bit int operation. There's a 32 bit operation.
>>
>>57202373
What you want is irrelevant to the CPU. If you want to think of types, you can do it in your head.
All the CPU does it take your 32 bits and pass them through a bunch of logic gates as defined by the specification.
>>
>>57202360
sure, if you put in OP codes that don't exist or whatever it's invalid.
>>
>>57202386
What if you want to add a 32bit int to another 32 bit int?
>>
>>57202368
Depends on the language.

C++:
return std::find_if(std::begin(list), std::end(list), [&value](const auto &item) {
return item == value;
}) != std::end(list);

Python:
return item in list
>>
>>57202377
>>57202380
>>57202383
I think I can't use a for loop because the way i get the next value in the list is by making the current value be equal to current->next

i could be wrong though
>>
>>57202390
>as defined by the specification.
exactly, and that specification almost always defines OP codes designed to treat data as certain types, like int and floats.
>>
>>57202378
>addressing modes

that's a type
>>
>>57202402
Your C++ is terrible. It should just be:

return std::find(list.begin(), list.end(), value) != end(list)
>>
>>57202392
>other than syntax errors or unrecognised terms
i'd count that as one of the two
>>
>>57202410

But it doesn't. As we're talking about the CPU specification, not your shitty language of choice.

How are you this stupid? Have you never taken any hardware classes?
>>
>>57202408
for(Node *node = head; node != null; node = node->next)
{
...
}
>>
>>57202402
item `elem` list

with base-unicode-symbols
item ∈ list
>>
>>57202428
I just had a brainfart, although find_if would have been valid had he had a list of structures.
>>
>>57202410
The specification define what the output bits will be depending on the input bits and the state of the CPU.
It may explain that in term of types and common operations, because that's useful to humans, but in x86 assembly, there are no types.

>>57202416
No, that's quite literally a way of addressing your data, which may be of any type in your mental model.
>>
>>57202442
oh alright cool thanks
>>
>>57202431
But the CPU spec defines the op codes, which are designed to treat data as specific types.

>Have you never taken any hardware classes?
I have, that's why I know I'm right.
>>
>>57202450
no, the addressing modes are types

certain instructions only accept certain modes
>>
>>57202457
>I know I'm right.
Dunning-Kruger.
>>
>>57202463
>Dunning-Kruger

I have no idea what you were talking about or who you were replying to, but fuck you, you're a retard who pretends to know what he doesn't just so he can appear intelligent.
>>
>>57202462
>no, the addressing modes are types
Denial is not an argument.
I told you why you're wrong, you told me "no".
I suggest you grow the fuck up.

>certain instructions only accept certain modes
Irrelevant.
If my data happens to represent a 2048-bit bitfield, whether I process it with 32bit or 64bit instructions implies nothing about the type of the data.
>>
>>57202482
>You could have just said he is a Redditor.
>>
File: types.png (117KB, 1234x651px) Image search: [Google]
types.png
117KB, 1234x651px
>>57202450
>but in x86 assembly, there are no types.
Official Intel docs disagree.
>>
>>57202457

But you're wrong. Very, very wrong.
>>
>>57202495
That's an abstraction, the doc is for humans.
The CPU doesn't care.
>>
>>57202495

>being a smart ass

we're talking about the conventional data types used in strongly typed languages. You're literally just proving all it handles is bits.
>>
>>57202503
The cpu very much cares.
>>
>>57202503
>THE DOCUMENTATION IS WRONG!
see >>57202489
denial is not an argument
>>
>>57202499
oh, I'm wrong? Well now I'm convinced. Brb, killing myself out of shame.
>>
>>57202510
>we're talking about the conventional data types used in strongly typed languages.
no we're not. We're just talking about "types".
>>
>>57202512
>>57202514

The documentation doesn't actually talk about data types. It's talking about varying amount of bits.

All of them are bits. It's only handling bits. As the documentation there proves.
>>
>>57202516
>Brb, killing myself out of shame.
First good idea you had in your entire life.
>>
>>57202525
>The documentation doesn't actually talk about data types.
Do not breed
>>
>>57202514
It's not wrong. You don't understand what they mean:
>word (2 bytes)
>doubleword (4 bytes)
>...
Different names are used to make it easier for humans to distinguish between different numbers of bytes.
>>
>>57202512
The CPU cares about what each operations do, and on what size they operate.

That implies nothing about types. My data may be shorter, larger, or coincidentally the same size as the operation I'm using.

>>57202514
The documentation is correct, you're attacking a straw man.
But the documentation is for humans which do have a concept of types.
The hardware doesn't.
>>
File: csuzcp[1].png (27KB, 883x52px) Image search: [Google]
csuzcp[1].png
27KB, 883x52px
>>57202521

Okay let's talk about types of geese since apparently any use of the word type is relevant when talking about languages now.

>>57202529
Almost as if they're all bits... wow... the power of reading...
>>
>>57202495
the doc talks about type but there no definition of any type in x64 assembly.
>>
>>57202531
>>57202525
>The documentation doesn't actually talk about data types. It's talking about varying amount of bits.
>All of them are bits. It's only handling bits. As the documentation there proves.

I'm not talking about "int/float/whatever", the other anon who was is wrong. There ARE still types. Word vs Doubleword can be a type.
If some instructions only work with some addressing modes, this is a give away sign of types.

>>57202535
>the hardware doesn't
Types exist primarily to eliminate faulty programs, partially to annotate programs for humans, and in some occasions exist erased at runtime for dispatch.

To say "the CPU doesnt think about types therefore there are no types in x86" is just retarded, you may as well be saying there are no types in C.
>>
Basic question about JS objects.

I have variable A with two properties. Then I have variable B which is defined by a prompt.
Say the input of B's prompt is A. How do I access A's properties through var B? Do I need to write a function in which I specifically assign the properties to B itself?
>>
>>57202503
addps xmm0, xmm0
andps xmm0, xmm1

// vs
addps xmm0, xmm0
pand xmm0, xmm1


Even though andps and pand does identical things (a bitwise and on the whole register) the latter version will have a one cycle penalty on most intel cpus because of switching between integer and float pipes.
Registers does get 'tagged' with what type of data it contains.
>>
>>57202551

There is no type to the hardware, just amount of bits.

Why are you so desperately trying to damage control?
>>
>>57202544
>Almost as if they're all bits... wow... the power of reading...

>Humans don't exist, we are all just atoms. Universe doesn't care about humans. The term "human" just exists for us humans to understand what they atoms are better.
>>
File: call pepe.png (50KB, 366x377px) Image search: [Google]
call pepe.png
50KB, 366x377px
>>57202544
>Almost as if they're all bits
8 is NOT equal to 16

This might be hard for you to understand, but look
00000000

0000000000000000

See the difference?
>>
>>57202564
>8 is NOT equal to 16
a value and the type of that value are two different things
>>
File: FoxitReader_2016-10-23_14-52-02.png (117KB, 696x954px) Image search: [Google]
FoxitReader_2016-10-23_14-52-02.png
117KB, 696x954px
>>57202431
this is from official intel documentation.
>>
>>57202551
>To say "the CPU doesnt think about types therefore there are no types in x86" is just retarded, you may as well be saying there are no types in C.
If your types are not enforced at any level, it's a very big stretch to call them types.

On a x86 if I give you a DWORD, you don't know if it's an int, a float, an array of 4 bools, or all/none of the above.

In C, if your function expects an array of 4 bools and I pass it a float, it is a compile error.
If I bitcast a float into an integer naively, it is undefined behavior (partly because of trap representations).
>>
>>57202572
that's not a type

>>57202571
Look, you really need to put your thinking hat on for this

Word is a TYPE
Doubleword is a TYPE

Nobody cares about the hardware, we're talking about x86.
>>
>>57202572

Documentation for humans. You can do it on whatever bits you want. You just probably want to do it on floats.
>>
>>57202584
Every part of the computer is for humans
>>
>>57202551
>muh bytes are type
well... right
>>
>>57202579
>On a x86 if I give you a DWORD, you don't know if it's an int, a float, an array of 4 bools, or all/none of the above.

As I said, I'm not talking about ints/floats/whatever
I know it's a DWORD.
DWORD is a type.
(I'm fairly sure) there are instructions that can't work on DWORDs or can ONLY work on DWORDs or can only return DWORDs or can't ever return DWORDs
>>
>>57202572
does the operation do any type verification ?
>>
>>57202579
>If your types are not enforced at any level, it's a very big stretch to call them types.
mov [eax], [ebx]
would not assembly because both operands cannot have address type.
>>
>>57202596
no
>>
>>57202602
because x86 is untyped, if not then show where type verification is done.
>>
>>57202591
No, a length-encoded array of bytes.
The NUMBER of bytes is a type.

The types are
WORD/DWORD/QWORD

Plus there's addressing modes
>>
>>57202596
How would that work exactly? The operation is what defines the type of the data. The bytes don't have anything about them that can be verified.
>>
>>57202561
see the post above you.
>>
>>57202611
with a tag for example.
>>
>>57202591
>>57202610

for instance, in C, while arrays decay, uint8_t[8] is not uint8_t[16]
and in C++, std::array<uint8_t, 8> is not std::array<uint8_t, 16>

i agree with anon here >>57202611
that float/int/etc is not type related, they are just operations on bits, but they're operations only on certain amounts of bits, and only with certain addressing modes
>>
File: indent style tiers.png (8KB, 287x510px) Image search: [Google]
indent style tiers.png
8KB, 287x510px
>>
>>57202632
whileM (x == y) do
something
somethingelse


>tfw ArgumentDo never
>>
>>57202627
'eax' is strongly typed to be a dword, you can only use it with instructions expecting a dword register operand.
>>
>>57202632
>curly bracket langugaes
while x = y do
something()
somethingElse()


master rage.

When Trump wins, curly bracketed langugaes are going to be banned. Big League.
>>
>>57202596
it checks for example whether it's a denormalized floating point number and then uses different logic, but you can certainly use it on any arbitrary data, altough you might trigger a cpu exception
>>
>>57202648
yeah, this too
>>
>>57202632
Switch great tier with good tier. K&R style is a fucking bane to existence, and all programmers who use it should be thrown into the chasm.
>>
>>57202557
That's fair, I hadn't though of that one.

Although I could easily argue that it's an implementation detail not inherent to x86 assembly.
There's nothing saying that x86 CPUs have to internally implement different pipelines per data type.

>>57202593
>DWORD is a type.
DWORD is a number of bits, if you call that a type then you're arguing that because operations can only manipulate a finite number of bits at the same time (8, 16, 32, 64, ...), then that corresponds to the type of the data.

But that's a bad definition for what a type is.
Of course the hardware has to define operations that work on a finite number of bits, that doesn't mean that the semantic type of your data as humans understand it has anything to do with this.

I can process a 64bit integer with WORD operations if I please, the CPU doesn't care that the actual type of my data is 64bit integer, even if I ask for a WORD operation.

>>57202599
You're right that there's no encoding for this operation.
Some operands are invalid for some operations, it's only a limitation of the hardware, not a type system.

If the x86 suddendly decided to accept mov [eax], [ebx], would it then not have a type system anymore by your definition? That's obviously wrong
>>
This is the most autistic argument I've seen in a while guys, keep it up.
>>
File: yotsubaSureHopes.jpg (55KB, 263x237px) Image search: [Google]
yotsubaSureHopes.jpg
55KB, 263x237px
>>57202682
You must be new here.

Here's your complementary welcome card, please enjoy your stay.
>>
>>57202682
>>
>>57202682
>implying not 70% min of /g/ are autistic
>>
Can /g/ average two integers in x86 assembly?
>>
>>57202650
so pascal(start/end instead of opening/closing brace) is fine?
>>
>>57202599
is that a syntax error or a type error? because mov is a macro actually.
>>
>>57202708
>define integer
>>
>>57202662
>But that's a bad definition for what a type is.
Lookup dependent types.
>>
>>57202716
>mov is a macro actually.
What.

>is that a syntax error or a type error?
Syntax error, there's no encoding defined for this.
>>
>>57202708
Easier than C actually since you have access to the carry bit and you can actually check for over/underflow.
>>
>>57202733
But C can handle integers larger than 2^48, and x86_64 can't because of canonical addresses.
>>
>>57202662
>DWORD is a number of bits
Yes, a dword consists of 32 bits.

>but that's a bad definition for what a type is
No it isn't, a dword is a perfectly good type.

People use DWORD types in C and C++ apis.

>Of course the hardware has to define operations that work on a finite number of bits, that doesn't mean that the semantic type of your data as humans understand it has anything to do with this.
That's exactly one of the uses of types.

>integer
I'm not talking about integer vs float vs whatever.
as i said, i agree with the anon that these are all just bit manipulations as far as x86 is concerned. but x86 is concerned with the size of operands.

You can imagine that this language has the following types:

WORD | DWORD | QWORD

... and that's (mostly) it


>>57202724
completely unnecessary
>>
What is the opposite of toString() in JS?
>>
>>57200190
why is yuki wearing a fez?
>>
>>57202662
>Some operands are invalid for some operations
Isn't that the point of a type system?
>If the x86 suddendly decided to accept mov [eax], [ebx], would it then not have a type system anymore by your definition?
No?
It would just mean that type (addresses) gained more valid operations on them.
>>
>>57202746
x86 handles 64-bit integers just fine
>>
>>57202728
you know that there actually multiple mov instructions, right?

movb mem to reg
movb reg to mem
movb reg to reg
movw mem to reg
movw reg to mem
movw reg to reg
...

when you type something like mov eax, [...], the assembler select the correct instruction for you.
>>
>>57202753
>People use DWORD types in C and C++ apis.
Microsoft uses*

I can't think of anybody else who would want something so disgusting in their API.
>>
>>57202753
>completely unnecessary
I meant that distinguishing integer types based on the number of bits is perfectly reasonble.
>>
>>57202713
no, only whitespace is okay
>>
>>57202753
>as i said, i agree with the anon that these are all just bit manipulations as far as x86 is concerned. but x86 is concerned with the size of operands.
So what you call type I call operand size then.
We're just going to have a different definition of what a type is.

>WORD | DWORD | QWORD
>... and that's (mostly) it
Mostly is pushing it, you're forgetting BYTE, XMM, YMM, ZMM, whatever x87 registers take, etc.

>>57202773
>Isn't that the point of a type system?
Every language has a syntax. A syntax error doesn't imply a type system.

>>57202776
I meant 2^48 bits, not 2^48 the value.
>>
>>57202788
what the hell is wrong with writing functions to manipulate words and dwords?

do you just mean the lack of type information when it comes to using dwords over more meaningful types, e.g. int or a set of bits?

>>57202800
yeah, but that's overkill
we're talking not only about the context of languages with fixed array types, but also the fact that x86 only has like 3 of them

byte
word
dword
qword
>>
>>57202768
parseInt() probably
>>
>>57202782
That doesn't make it a macro, it's just syntactic sugar.

Most assemblers have actual macros, and mov is not one of them.

>when you type something like mov eax, [...], the assembler select the correct instruction for you.
Correct.
>>
>>57202812
>So what you call type I call operand size then.
>We're just going to have a different definition of what a type is.

Yeah, the idea is that the operand size is an annotation of the instruction, and a requirement for operands.

You can imagine writing functions that only work on certain sized numbers

uint8_t high8 (uint16_t);
Now if you ONLY had uintN_t (for certain N), why would it stop being types?
>>
>>57202782
>movb mem to reg
>movb reg to mem
>movb reg to reg
>movw mem to reg
>movw reg to mem
>movw reg to reg
Let me also point out that those are the same instruction (same opcode), only the ModRM and prefixes change here.
>>
>>57202815
>what the hell is wrong with writing functions to manipulate words and dwords?
People who aren't stupid just use the standard integer types, like int and long. WORD and DWORD is a concept that ties it to x86.
These days, if you're writing something where the exact number of bits are important, you would use <stdint.h>.
>>
>>57202845
I like word over uint16, but I get what you mean
My problem is I don't always want to be thinking of it as a uint16, I want to think about it as 16 bits
so perhaps

bits<n>
(which would be semi easily to implement in C++)
>>
>>57202812
>I meant 2^48 bits, not 2^48 the value.
and what does that have to do with the question of averaging two integers? assume that C integers are meant, meaning signed 32 bit values.
>>
>>57202874
Integers means arbitrary precision integers, of course.
>>
>>57202812
>I meant 2^48 bits, not 2^48 the value.
C only portably guarantees 2^16 bytes (min value for a size_t).
>>
>>57202841
bullshit

mov eax, [34] = 8b 04 25 22 00 00 00
mov al, [34] = 8a 04 25 22 00 00 00

encoding is <op> <rega> <regb> <imm>
>>
>>57202868
>My problem is I don't always want to be thinking of it as a uint16, I want to think about it as 16 bits
How is uint16_t not representative of 16 bits? It's completely unambiguous and right there in the type name.
"word" is nebulous and has no advantage over just using "short" or something.

>bits<n>
>(which would be semi easily to implement in C++)
It would be a trivial, but completely pointless typedef.
>>
>>57202904
>How is uint16_t not representative of 16 bits?

How is uint32_t not representative of float32?
>>
File: progress.png (48KB, 1488x772px) Image search: [Google]
progress.png
48KB, 1488x772px
I did a thing. It works sort of. I still have some bugs to fix. The point is I wrote a brainfuck compiler that seems to generate code that works... just as soon as I figure out where that segmentation fault came from. Maybe I clobbered my return address?

Bah. It's 6:26 AM. I'll fix it when I wake up later.
>>
>>57202912
It has "int" in the type name.
>>
>>57202913
post code
>>
>>57202917
How is float32 not representative of 32 bits?
How is uint32_t not representative of 32 btis?

How is uint32_t not representative of float32?
>>
>>57202913
But can it average two integers of arbitrary precision?
>>
File: 1441684460338.jpg (92KB, 1280x720px) Image search: [Google]
1441684460338.jpg
92KB, 1280x720px
>>57202913
>'i' (eye) and 'l' (ell) in that font
>>
File: umarusummer.jpg (56KB, 848x480px) Image search: [Google]
umarusummer.jpg
56KB, 848x480px
>>57202913
One of my first projects was that.
>>
>>57202928
32 bits is not a type in C and many other language
you usually have 32 bit signed/unsigned integers and 32 bit floats. There is no untyped 32 bit type in C, only void* which should be cast.
>>
>>57202942
L = Hell
Literally can't be unseen now. :^)
>>
>>57202950
yes, but my point is often you would like to be thinking about 32 bits, not about a 32 bit integer or float
>>
>>57202928
>float32
That is not a standard C type or typedef. There is no point discussing it.
>uint32_t
"Unsigned integer 32-bits type"
>How is uint32_t not representative of float32?
Integers and floating point numbers are separate in C. You don't seem to understand how types work.
>>
>>57202960
I don't understand how you don't understand

>>57202957
>>
>>57202922

Later, when it's fixed. I'm tired. Goodnight.

>>57202929

If you can write a brainfuck program to do it, then yes.

>>57202942

It's Nova Mono. Cool shit bro.

>>57202944

Sounds like a fun sort of project.
>>
>>57202960
But they both have the same number of bits.
>>
anyone mind helping me with this function?

it's supposed to search a list of nodes for a value and return true or false depending on if it's there or not

i feel like this is too simple of a solution and the terminal agrees with me because its not doing what it's supposed to do

bool containsOLS(OrderedListSet* ols, int v){

for(OLSNode *node = ols->head; node != NULL; node = node->next) {
if(node->data == v){
return true;
break;
} else {
return false;
break;
}
}


my other solution is some spaghetti code using while loop and if statements that gave me a segmentation fault whatever that is lmao
>>
>>57202957
>about 32 bits
32 bits of what? There is no untyped value in C.

>>57202966
So?
>>
>>57202957
And make it 'aliasable' to any type like char and it would be a nice thing to have instead of ugly union hacks when you actually want to do things like extract bits from floats or pointers.
Write a proposal for C++2x.
>>
>>57202971
you don't need to be break; after return;

break; will never be reached.
>>
>>57202982
32 bits!
32 bits of bits!
>>
>this indent style
Burn your computer and start your life over.
>>
>>57202983
>And make it 'aliasable' to any type like char
That would violate alignment requirements.

>>57202990
When would such a vague concept be useful?
>>
>>57203001
>When would such a vague concept be useful?
You seriously can't think of a use for 32 bits that doesn't involve integers or floating points?
>>
>>57202899
My bad, I should have said
>movb mem to reg
>movb reg to mem
>movb reg to reg
are all the same instruction, and
>movw mem to reg
>movw reg to mem
>movw reg to reg
are all the same instruction.

>mov eax, [34] = 8b 04 25 22 00 00 00
>mov al, [34] = 8a 04 25 22 00 00 00
>encoding is <op> <rega> <regb> <imm>
That's completely wrong, where did you get that from?
The encoding for these two instructions is just <Op1> <Mod/RM> <Imm32>
For reference mov eax, [34] is a1 22 00 00 00
>>
>>57203005
>You seriously can't think of a use for 32 bits that doesn't involve integers or floating points?
Right. There would be no operations defined on it, making it completely useless.
>>
>>57202899
>>57202841
>>57202782
whether or not different encodings for the same instruction(which do slightly different things) should be considered different instructions is debatable and depends heavily on your viewpoint. Note how the official documentation lists mov as one instruction with different encodings, and then lists two other instructions - move to control register and move to debug register, both of which are privileged instructions, and sufficiently different from regular mov in other aspects as well.
https://fgiesen.wordpress.com/2016/08/25/how-many-x86-instructions-are-there/
is a good treatise on the subject
>>
>>57203026
How about 32 flags?
>>
>>57203032
That's an integer.
>>
File: FoxitReader_2016-10-23_15-32-01.png (210KB, 701x1487px) Image search: [Google]
FoxitReader_2016-10-23_15-32-01.png
210KB, 701x1487px
>>57203027
forgot image
>>
I need to use C getline to read a string from a file but I really don't care about its length. Is there any way I can replace the &len with something else so I wouldn't need to declare it?

getline(&status, &len, sfile);
>>
>>57203036
Actually, it's a string of 3 characters.
>>
>>57202882
i disagree, you cannot do arbitrary precision in practice outside of high-level languages.
>>
>>57203049
If your language is turing-complete, you can do arbitrary precision.
>>
>>57203049
>/g/ is autistic today
>>
What kind of background things do you guys do while programming? I listen to music and play idle games (think cookie clicker). I've tried podcasts as well but they make it too hard to concentrate.
>>
File: 1424907883942.gif (181KB, 500x220px) Image search: [Google]
1424907883942.gif
181KB, 500x220px
>>57202971

Remove the else from inside the loop and return false outside the loop.

As it is, it just returns on the first iteration.
>>
>>57203043
The function itself needs to know about the length. When you call getline again, it needs to know how big the buffer it allocated was.
>so I wouldn't need to declare it
It's literally 1 line of code. What do you have against it?
There actually is 1 way around it, using designated initialisers:
getline(&status, &(size_t){0}, sFile);

I wouldn't say that looks any better than just declaring another variable.
>>
File: 2016-10-23-154606_878x764_scrot.png (122KB, 878x764px) Image search: [Google]
2016-10-23-154606_878x764_scrot.png
122KB, 878x764px
>>57203013
>That's completely wrong, where did you get that from?
intel documentation, fuck tard.
>>
>>57203049
You can only do it in low level languages because you need access to specific instructions like adc and sbb and recover double width results from mul.
Doing it in a high level language would be prohibitively slow.
>>
>>57203084
>designated initialisers
Wait, that's the wrong feature name.
That is a compound literal.
>>
>>57203086
There's literally no reason to use this instruction when 0xA1 does exactly what you want, unless you're assembling for x86_64 instead of x86
>>
>>57203109
0xa1 is for when you are using segmented memory, fuck tard. can you even read the fucking doc you fucking plebeian?
>>
>>57203122
And it's two bytes shorter, what are you even doing loading from address 0x34? Trying to read the 16bit IVT?
>>
what's the point of learning a lot of computer languages if you're forced to use java in order to find a job?
>>
>>57203158
>java
>job
more like internship
>>
>>57203047
A character is an integer.
>>
>>57203187
No, it's a quarter of a float
>>
>>57203122
Still works fine on flat address spaces (0 + offset obviously gives the same as just offset)
>>
>>57203158
Learn C#, the tools are better
>>
>>57203198
UTF-32 begs to disagree
>>
>>57203226
UTF-32 elements are integers, not characters.
>>
>>57203203
gcc, intel, clang, none of these use Ax
>>
File: explodingVan.gif (403KB, 240x184px) Image search: [Google]
explodingVan.gif
403KB, 240x184px
>>57203242
Why not both?
>>
File: th3LSX7JOP.jpg (12KB, 300x230px) Image search: [Google]
th3LSX7JOP.jpg
12KB, 300x230px
Hi, what are your thoughts about java?
Any good book advices?
>>
>>57203253
Compilers are shit, what else is new.
>>
>>57203290
Don't use Java. Use C# instead at the very least.
>>
>>57203324
Can you eleborate on why?
>>
>>57203369
Basically has all the advantages of Java and none of the stupid broken shit.

Better langugae, better tools.
>>
>>57203373
I am having a course right now where we use java, should I just learn what I need fore the course and skip to go in deeper?
>>
File: snap050.png (17KB, 704x245px) Image search: [Google]
snap050.png
17KB, 704x245px
>>57203253
Wrong, you're just compiling for x86_64 instead of x86
>>
>>57203406
32 bits x86 has been deprecated a long time ago.
>>
>>57203413
Sure, but we were talking about x86 assembly, not x86_64 in particular so you're still wrong.
>>
>>57203084
Thanks anon. I wanted a teeny tiny program to read two lines from two files but it turned out ugly long and I wanted to clean it up a bit. Here's the relevant bit which reads the files and saves the string from sf to
char * status
and the integer from cf to
int capacity
.

FILE *sf = fopen(STATUS_PATH, "r"), *cf = fopen(CAPACITY_PATH, "r");
char *status = NULL, *capacity_s = NULL;
int capacity=0;
getline(&status, &(size_t){0}, sf);
getline(&capacity_s, &(size_t){0}, cf);
strcpy(status, strtok(status, "\n"));
capacity = atoi(capacity_s);


It's probably really terrible, but I never learned C properly, plan on reading K&R soon.
>>
>>57203399
Yes. Learn C# in your spare time. Java and C# overlap massively. Once you know one it's easy to pick up the other.
>>
NEW THREAD

>>57203434
>>57203434
>>57203434
>>57203434
>>57203434
>>
>>57203426
Thx alot for the replies, really appreciated.
Any good advice on books etc on C#?
>>
>>57203454
There's lots of good books. I'd just search amazon for something highly rated that you feel represents your skill level.
>>
>>57203420
>but we were talking about x86 assembly, not x86_64

you are confusing x86 with ia-32

ia-32: x86 32 bits
amd64: x86 64 bits from amd
EM64T: x86 64 bits from intel
x86_64 (or x64): the common core between amd64 and EM64T
x86: the family regrouping all above.

you would use the term x86 as you would use Lisp.
>>
>>57203492
>you are confusing x86 with ia-32
I don't think I am.
>>
>>57203406
Is this French? Are you Canadian? French? Belgian? Swiss?
>>
>>57203513
I'm French.
>>
>>57203492
they renamed em64t to intel64
>>
>>57201347
Pls, it's a general term, could mean table with chairs, open your mind.
>>
>>57203421
Not readable. Reformat :)
>>
>>57203064
Spotify deep focus
>>
>>57203064
jerking off
>>
>>57203546
fuck off
>>
Currently writing a Haiku generator in Python
>>
I'm having tons of trouble with a stupid part.
I can't figure out the MySQL syntax I need to grab all rows with x value in 1 column in a descending order based on another column.

Can anyone help?

"SELECT * from " .. feed_data[1]['feedName'] .. " order by postID DESC"


I only need posts which have a certain value for userTier column though.

"SELECT * from " .. feed_data[1]['feedName'] .. " where userTier = 4 order by postID DESC"


this doesn't seem to work.
>>
>>57204081
what's wrong?
Thread posts: 329
Thread images: 36


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