[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Dapper Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 39
Ancient thread: >>52572064

What are you working on, /g/?
>>
Looking for C compilers on Windows, I'm done with MinGW's bullshit. Do I really have to work on a VM?
>>
Second for type inference.
>>
Third for promoting D while having never used it
>>
>>52577189
What is wrong with MinGw?
>>
>>52577307
It's spitting out an error, I can't find any solutions, and I'm tired as all fuck.
>>
>>52577189
Just that free Visual Studio version.
>>
File: steve_jobs_by_rware-d3af4rz.jpg (168 KB, 487x740) Image search: [Google]
steve_jobs_by_rware-d3af4rz.jpg
168 KB, 487x740
>>52577313
>>52577307
I want something that just werks.
>>
>>52577313
What kind of erro?
>>
File: [email protected] (124 KB, 348x316) Image search: [Google]
tlc-logo@2x.png
124 KB, 348x316
>>52577325
>Visual Studio

>>52577327
It's rambling about nothing being in the E: drive.
Surprised that /g/'s actually helping, wow, thanks.
>>
File: brazil_bunda.jpg (63 KB, 530x600) Image search: [Google]
brazil_bunda.jpg
63 KB, 530x600
>>52577326
if you are working with c you will not hide forever, you will have to face your errors one day
>>
>>52577189
On Windows you are pretty much forced into using an IDE with a bundled compiler.
>>
>>52577336
Visual Studio is much better than any IDE that works with MinGW
>>
>>52577359
>>52577356
>>52577353
Sheeeeiiiiit, should I just VM Debian then?
>>
File: DogBro.jpg (50 KB, 600x651) Image search: [Google]
DogBro.jpg
50 KB, 600x651
>>52577336
You should post screenshot of your error
>>
>>52577369
IDEs with GCC are shit in general.

Thanks rms.
>>
>>52577369
I simply work on Linux, but if you need to stay on Windows, look into Vagrant or similar.
>>
File: screenshot_00006720160123090612.png (227 KB, 1920x1080) Image search: [Google]
screenshot_00006720160123090612.png
227 KB, 1920x1080
>>52577379
>>
>>52577398
Did you put your g++ disk in the drive? Windows needs that.
>>
>>52577454
g++... disk?
>>
>>52577189
PellesC

>>52577189
>MinGW's bullshit
why bullshit ?
>>
>>52577454
what are your environment variables like?
>>
>>52577459
Windows doesn't support dynamic loading and unloading so g++ does it on a disk in the drive.
>>
>>52577462
meant for
>>52577398
>>
File: fen.jpg (34 KB, 736x256) Image search: [Google]
fen.jpg
34 KB, 736x256
>>52577398
try in cmd write
set path=%path%;l:\Software\MinGW\bin
>>
>>52577530
That just lets my call g++ outside of the folder.
>>
>>52577530
do not close cmd after that and type g++ or gcc
>>
In case you didn't get the reply:

>Can anybody explain to me why this is return 0??
uint32_t disk_usage = (part_size / disk_sizemb) * 100;

>I've tried using ceil as well to no avail.

You should always multiply before diving with ints.
Still won't give you the accuracy of floating point, but if you plan on rounding later anyway then it's just as good.

int a = 3;
int b = 4;
int res;
res = (a / b) * 100; /* If a < b, (a / b) will always evaluate to 0 */
res = (a * 100) / b; /* Evaluates to 75 */


This method is used in old real-time embedded systems that lack hardware floating point support, because software fp is fucking slow as shit.
>>
>>52577189
Don't use ming, use mingw-w64. mingw32 is old, doesn't get updated, only supports 32 bit, and as you can see, is broken. http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download
>>
>>52577693
*don't use mingw32, use mingw-w64...
>>
>>52577660
Fuck, forgot to link to your post: >>52573666
>>
>What are you working on, /g/?

painting my nails :3
>>
>>52577721
What color??
>>
>>52577730
black like my soul
>>
>>52577730
silver
>>
OCaml: the real way to program!
>>
File: fuck_you_trap.jpg (100 KB, 500x500) Image search: [Google]
fuck_you_trap.jpg
100 KB, 500x500
>>52577767
>>
I started writing/designing a 4chan archiver, written in C/C++, using libcurl and libjson. Still have to decide the output (.sql file, sqlite, mysql or postgres).

>>52577767
ALL SHINY AND CHROME
>>
def bubble_sort (l):
n = len (l)
i = n - 1
swapped = True
while swapped:
swapped = False
for j in range (0, i):
if l[j] > l[j + 1]:
t = l[j]
l[j] = l[j + 1]
l[j + 1] = t
swapped = True
i -= 1
>>
>>52577790
meh I'm not much of a fan either but it's part of a set someone got me for christmas so I decided to try it out

it looks way better irl and not as shiny as the pic

>>52577816
it is pretty chrome :3
>>
File: ABSOLUTELY DISGUSTING.jpg (131 KB, 500x375) Image search: [Google]
ABSOLUTELY DISGUSTING.jpg
131 KB, 500x375
>>52577828
>>
File: cp5X6vEh.jpg (32 KB, 500x281) Image search: [Google]
cp5X6vEh.jpg
32 KB, 500x281
>>52577767
WITNESSED!
>>
Can anyone recommend how I would read text from a running program into a script? For example if I type in notepad, the text will be picked up by my application.

I am not aware of any way to do this without first saving the data to a file. I mostly like to use c#/java in windows but i'm more interested in how the process itself is possible.
>>
>>52577854
Why?
>>
>>52577888
what you are looking for is called a keylogger.
>>
>>52577888
You would need to modify the program to output the data somewhere as it's being typed.

That or like >>52577898 says, basically just read directly from the keyboard. That won't be specific to just one program though.
>>
>>52577898
sounds more like reading out textfield widgets from a running application

SysExporter does that but unfortunately it's closed source
>>
>>52577936
Either a keylogger straight up or a formgrabber, either way it's exploitative so not much POC is out there for the latter, you should be able to find shit keylogger sources pretty much everywhere online though.
>>
>>52577898

I don't want to record keystrokes or anything, I mean to pick up the text periodically, like a backup kind of thing. If I open a text file i'd like my program to pick up all the text within the instance of notepad. Copy and paste it as a string pretty much.

Is this still considered keylogging?
>>
>>52577965
Well, yes, if it is being done without notepad doing it. If that is the case, it's no different from a keylogger/malware.
>>
>>52577965
if you have no target app it's pretty much keylogging, even though what you describe is much closer to form grabbing (input form grabbing to be precise) it's mostly use to steal info so as I said not much code to do this out there, unless you are targeting a specific application, in that case you can just read it's memory and hardcode the offsets to rad from and go from there.
>>
>>52577965
that's very easy to do with pywinauto
>>
>>52577993
read*
>>
File: changes.jpg (380 KB, 1280x776) Image search: [Google]
changes.jpg
380 KB, 1280x776
>>52577790
>whatWentWrong.jpg
>>
>>52578029
>the_girl_with_the_dragon_tattoo.jpg
>>
Haskell vs Idris?
>>
File: japan.webm (793 KB, 960x540) Image search: [Google]
japan.webm
793 KB, 960x540
Ask your much beloved programming literate anything.
>>
>>52578374
>garbage v.s. meme?
OCaml.
>>
haskellers: http://c2.com/cgi/wiki?PropellerBeanie
>>
>>52578401
>>garbage v.s. meme?
>trashcan.
C++
>>
I made key logger once that made an email address send the key strokes to itself.

The email address and password it used was in the source code.

I bet you can guess what happened.
>>
File: IMG_20151209_230220.jpg (35 KB, 469x527) Image search: [Google]
IMG_20151209_230220.jpg
35 KB, 469x527
So, why do we hate Rust again?
>>
>>52578421
did you store it plain text or did you at least do some attempts to hide it ? (xoring / other encryption methods )
>>
>>52578389
yeah i got one question for you


what the fuck
>>
>>52578412
>>>garbage v.s. meme?
>>trashcan.
>bigger meme
C
>>
>>52578421
Any success?
>>
>>52578434
I stored it as plain text.

I underestimated the average person.
>>
>>52578491
please tell me you wrote in in c# for additional hilarity.
>>
>>52578479
how c++ is a meme ?
>>
>>52578406
i'm curious what this page has to do with haskellers
>>
>>52578500
>how is a messy conglomeration of paradigms a meme?
>>
>>52578029
Why do so many army dudes turn out like this?
>>
>>52577353

She's not very good looking, but I would sex her for a go at that FAL.
>>
>>52578497
It was either C# or VB, I can't remember.
>>
File: 6787.jpg (897 KB, 2000x1012) Image search: [Google]
6787.jpg
897 KB, 2000x1012
>>52578521
>3dpd
>>
>>52578533
Omfg, why would you do that ? ever ?
Like you'd probably wouldn't have been found out if you used a non IL language...
>>
>>52578546

Is the best, because it's real.
>>
File: python.jpg (180 KB, 1280x1024) Image search: [Google]
python.jpg
180 KB, 1280x1024
>>52577186
I have a bad habit of going to bed late.
So I started logging the time I go to bed in google calendar.
I used python and win32 calls parse the calendar and display the times for the past week over my wallpaper. It really helps.
>>
File: fugg.png (361 KB, 536x538) Image search: [Google]
fugg.png
361 KB, 536x538
>>52578500
Open a .java file:
>I've seen this syntax and code structure before, I can work out what is going on

Open a .py file:
>I've seen this syntax and code structure before, I can work out what is going on

Open a .c file:
>I've seen this syntax and code structure before, I can work out what is going on

Open a .cpp file:
>I've seen this syntax and code structure before... wait what the fuck is that thing?
Pic related
>>
>>52578551
a picture is not real, just depicting something.
>>
>>52578546
Haha 2d lover.
>>
>>52578546
^
>>
>>52578517
For some reason, spending 9 months in the company of only other men tends to alter your preferences.
Who knew.
>>
>>52578563
yeah it depicts real girls
>>
>>52577398
Dude, just fucking install Msys2. Don't install an old version of mingw by itself.

The mingw installer needs to be removed from the internet. Why the fuck is it still up? No one works on it.
>>
>>52577398
don't use mingw from the windows command prompt
crosscompile from cygwin to mingw-w64
>>
File: 1450066497110.jpg (166 KB, 1280x1280) Image search: [Google]
1450066497110.jpg
166 KB, 1280x1280
>>52578563

Yeah, it depicts real women. I could go and really fuck the woman depicted in this photograph.. as long as she likes fat nerdy rednecks.
>>
>>52578796
>lowering your standards to a minimum just because something is "real"

people like you are the worst. but whatever makes you happy i guess, pleb.
>>
>>52578838
>3D means your standards are minimum
jesus christ, there are people this pathetic
>>
File: assBig1.webm (1006 KB, 1280x720) Image search: [Google]
assBig1.webm
1006 KB, 1280x720
>>52578838
>>
>>52578855
lowering your standards to a fat, black chick covered in tattoos is pretty sad though.
>>
File: 1451683583776.gif (2 MB, 400x600) Image search: [Google]
1451683583776.gif
2 MB, 400x600
>>52578895
some people like thick chocolate

and she has 1 tattoo

my only complaint is that she's not alexis ren
>>
I'm sick of seeing 3D in my /dpt/.
>>
>>52578796
I hope you get banned, you cunt.
>>
>>52578914
some people like diabetes
>>
>>52578932
I'm sick of not seeing code in my /dpt/
>>
>>52578947
worried kek
>>
>>52578479
>>>>garbage v.s. meme?
>>>trashcan.
>>bigger meme
>dogshit
Opendylan
>>
>>52578838
>low standards

What the hell are you talking about?

>>52578895
>fat, black chick

yummy. :)

And I don't mind tattoos. A lot of people have a problem with them, but I don't see the problem.
>>
>>52578562
>I have never written a single line of C++ but I am a certified Meme PhD.
In actuality, it's in C that you can't understand what the fuck is going on. Almost every non-trivial piece of C code is riddled with complex macros that use obtuse pointer tricks that rely heavily on packing rules and the like. I mean, just look at the list implementation in the linux kernel. Meanwhile in C++ everything is clear at first sight in all but the most obfuscated-on-purpose pieces of code.
>>
File: 1451683513443.gif (2 MB, 400x225) Image search: [Google]
1451683513443.gif
2 MB, 400x225
>>52578948
r8

VD - x position of fruit
VE - y position of fruit
sDot - memory address of dot sprite


:Place fruit ensuring it's not on snake
RND VD 3F *Place-fruit
RND VE 1F
LD I sDot
DRW VD VE 1
SE VF 1
JP ->end-Place-fruit
DRW VD VE 1
JP ->Place-fruit
RET *end-Place-fruit
>>
File: 1452909465497.jpg (45 KB, 331x331) Image search: [Google]
1452909465497.jpg
45 KB, 331x331
I've read tons of tutorials on GitHub but I still lack confidence to post my projects there.
What should I know before starting? What should my first moves be?
>>
>>52579050
>I mean, just look at the list implementation in the linux kernel.

Do you have a link to this particular bit of the source?
>>
>>52579083
Learn the basics of git.
>>
File: Triggered.jpg (44 KB, 720x599) Image search: [Google]
Triggered.jpg
44 KB, 720x599
>>52579050
>Meanwhile in C++ everything is clear at first sight in all but the most obfuscated-on-purpose pieces of code

Here's a question: what happens when the people who want to do everything in C++ always write obfuscated-on-purpose code?
You get people writing the fastest, most efficient bare metal shit in the world except it didn't really need to be like that, and now nobody else can maintain it.

I also mentioned two other languages that you ignored. If C triggers you that badly, you need to warn people in advance
>>
>>52579108
I've already done so. I'm still afraid that I will fuck up while starting and be ridiculed (because low confidence). What should my first moves be when just starting with GitHub and uploading my first project?
>>
File: 1451683650441.gif (1 MB, 500x281) Image search: [Google]
1451683650441.gif
1 MB, 500x281
>>52579053
just realized if I'm going to JP to 1 line of code, and that code just RET's out, I may as well just SE to RET rather than to a JP that jumps to RET. Man I'm a dolt
>>
>>52579153
negro, don't be a pussy, put your ideas out there
>>
>>52579153
Don't worry, if you fuck up you can just delete your account and start over.
>>
>>52579153
It's not like somebody is going to read your code you fucking retard.
>>
So, /dpt/, tell me about your obsession of reinventing the wheel
A bunch of threads ago, some retard even asked why asserts were shipped together with a language

What is it with this autistic "gotta do everything muhself!!!" attitude that most hobbyist coders seem to love so much?
>>
>>52579098
I'm refering to shit like
#define container_of(ptr, type, member) ({                      \ 
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})

#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)

Then you of course have a billion levels of indirection and since it's all macros you'll never be able to debug any error. For instance:
#define list_entry(ptr, type, member) \ 
container_of(ptr, type, member)

Literally just a synonym.

Now of course, you can sit down and work out what the defines do (provided you have a lot of C experience). But when dogshit like this litters the entire codebase, you simply can't claim that things are easier to understand in C than C++.
>>
>>52579215
didn't get involved in this asserts argument, but there's nothing wrong with programming of any sort in a daily programming thread
>>
>>52579223
>#define container_of(ptr, type, member) ({ \
> const typeof( ((type *)0)->member ) *__mptr = (ptr); \
> (type *)( (char *)__mptr - offsetof(type,member) );})

Lord have mercy
>>
>>52579146
By definition, nobody writes obfuscated-on-purpose code if it's not to submit shit to a code obfuscation competition. Fuck off with your what-ifs. What if C was readable in practice? Well it fucking isn't.
>>
>>52579215
>some retard even asked why asserts were shipped together with a language
Maybe he asked to know if asserts do some special magic that isn't obvious?
Sounds like a legitimate beginner question to me.
>>
>>52579098
http://lxr.free-electrons.com/source/include/linux/list.h
There is also a red-black tree implementation in the same directory.
>>
>>52579215
Why make an apple pie of you can just buy one?
>>
>>52579247
>nobody writes obfuscated-on-purpose code if it's not to submit shit to a code obfuscation competition
this nigga never seen enough source codes lmao
>>
>>52579274
>I don't know what a purpose is
LMAO
Also I have seen plenty of obfuscated source. See the linux kernel for instance.
Most real obfuscated source is produced by a tool after writing legible code during development.
>>
>>52579215
Because of people pulling shit like this: https://sourceware.org/bugzilla/show_bug.cgi?id=12518

You either use an existing library, but never update it so things don't break later down the line, and live with whatever bugs it has forever.
Or you make your own fork of the library.
Once you've made that jump, may as well just make the whole thing yourself.
>>
>>52579223
You can do even more complex shit like that in C++
>>
>>52579304
>he thinks everyone has a unified purpose because humans surely all think the same
LMAO
>>
>>52579315
The difference is that in C, you HAVE to do bullshit like that. In C++, you are strongly encouraged not to because you have a shitload of tools at your disposal to achieve a goal without resorting to such hacks.
>>
>>52579311
>dependence on ""undefined"" behavior

Oh man, I chuckled sensibly. What a classic C technique.
>>
>>52579247
So is your point that a language shouldn't allow it's users to do things in bizarre ways?
Because you can still do all of that, and more in C++.

That's kind of the point. The absolute worst C is never going to be as bad as the absolute worst C++ because of the extra dozen ways you can do everything.

We're not talking about existing code examples here, yes people have done terrible things with C. People have done terrible things with C++ too.
The point is, how much damage are you going to make it possible to make?
>>
>>52579252
This is actually quite sane.

>>52579223
www.lua.org/source/5.3/lua.h.html
lua_Unsigned -> LUA_UNSIGNED -> unsigned LUAI_UACINT -> LUA_INTEGER -> __int64
>>
>>52579370
Instead you have a vast number of tools you misuse because they all suit different paradigms and workflows. Both languages compile to the same bytecode, C at least has more freedom and clear structure so you can make the macros that count, even if others abuse it to hell and back
>>
>>52579370
>you have a shitload of tools at your disposal to achieve a goal without resorting to such hacks.

Unless everyone is well versed in the particular tools you decide to use, what makes you think that's any better?
If something is hard to understand, but at least consistent across the board then the people who know what they are doing can work it out at least.

If something is easy to understand, assuming you already know the entire language (one as large as C++) inside out, its not actually easy to understand.
>>
>>52579375
My point is that a language should be powerful enough that the user doesn't need to use contrived hacks to circumvent its limitations. That's why I put a lot of weight on whether or not a language has a solid macro system (scheme, or common lisp in a pickle - NOT C), module system, generic programming facilities, static typing (inference, refinement, linearity, composability) when I consider using a language.

The least powerful a language is, the more hacks are needed to do basic constructs. The more powerful a language is, no matter how much you allow hacks, the less they'll appear.
>>
>>52579392
Typical /dpt/ cmen who don't know shit about what they're saying.
>>
>>52579223
offsetof is actually standard, you can use it in C++ too.
struct mystruct {
uint32_t foo;
uint32_t bar;
uint32_t baz : 6;
uint32_t reee;
};

offsetof(struct mystruct, reee) == 14
>>
File: little_bugs.jpg (40 KB, 656x337) Image search: [Google]
little_bugs.jpg
40 KB, 656x337
I'm living the meme.
>mfw
>>
>>52579380
>This is actually quite sane.

I was about to say that. It's long, but all the function names seem appropriate and descriptive, as are the variable names. It's not fantastic, but it's also not IOCCC-tier.
>>
>>52579441
Not in the linux kernel :^)
>>
>>52579411
Just because you've found a way to do something without abusing language semantics, doesn't mean anyone else would do it the same or be able to follow it as easily as you do.

Hacks are difficult for everyone to work through, including the author, but they'll tend to be quite similar.
Obscure language methods are difficult for everyone to understand, except the author, but they'll tend to be inconsistent with what most people associate to that language.
>>
>>52579456
>what is decoupling
>>
>>52579463
Duh, not in the kernel.

But it is in any modern stddef.h so unless they are still building linux with gcc 3.x then it's not really necessary to have there.
>>
File: 1453567311049.png (376 KB, 628x1000) Image search: [Google]
1453567311049.png
376 KB, 628x1000
What Linux distro does /dpt/ use?
>>
>>52579547
Fedora.
>>
>>52579372
I'm not suggesting you should write code that bad on purpose, but what if you have a closed source library that depends on undefined behaviour in an open standard library?
What, bad things never happen to good people?

There are often very good reasons why people have to resort to rewriting or forking their own basic tools because some chucklefuck decided to be lazy one afternoon.
>>
File: what-do-you-mean.jpg (79 KB, 600x600) Image search: [Google]
what-do-you-mean.jpg
79 KB, 600x600
>>52579494
>>
>>52579547
Debian.
>>
>>52579547

Debian & Ubuntu-MATE. Also, not Linux, but I enjoy using [spoiler]FreeBSD[/spoiler]
>>
>>52579562
*tip

>>52579605
kill yourself
>>
>>52579615
>using stable distros
>>
Is there any way I can plug a second keyboard into my computer and use it as a piano keyboard?
>>
Bootstrap question: is the javascript programming for their various plugins developed in-house, or do they just include existing popular libraries in the framework files?
>>
>>52579547
Ubuntu.

I wish I was autistic enough to learn how to install Arch.
>>
>>52579563

I'm not saying it's the user's fault, I'm just saying it made me laugh. The whole "fairly well-defined undefined behavior" thing is C in a nutshell.
>>
I'm back from shopping. the silver nail polish I tried chipped on my thumb already ;_;

>>52579547
gentoo :3
>>
>>52579654
>these are the "people" that use gentoo
smdh
>>
File: download.png (3 KB, 225x225) Image search: [Google]
download.png
3 KB, 225x225
what's your username on Codeforces.com anon ?
what's your excuse for not having an account?
>>
>>52579714
no virtual machine/big project challenges
>>
>>52579699
say what you want but gentoo is top tier distro
>>
>>52579547
GUI-less Gentoo
>2016
>installing unnecessary bloat
>>
File: Gentoo.png (7 KB, 720x400) Image search: [Google]
Gentoo.png
7 KB, 720x400
>>52579547
>>52579739
Forgot pick
>>
File: wut.jpg (19 KB, 336x434) Image search: [Google]
wut.jpg
19 KB, 336x434
>>52579651
Well it's bad C in a nutshell, which I guess is most C in a nutshell too.

It doesn't have to be like this.
>>
>>52577186
What's this fancy new Dapper Programming Thread?
>>
I'm supposed to write a 'bare-bones' C++ function to translate strings to usable numbers. Is there anything glaringly wrong with this?

double pwr (double base, int exponent)
{
double output = 1;

if (exponent > 0) for (int counter = 0; counter < exponent; counter++) output *= base;
else if (exponent < 0) return 1/pwr(base, -exponent);

return output;
}

double stringToDouble (std::string input)
{
double output = 0;
int decPos;

std::string::iterator decimalPositionIterator = std::find(input.begin(), input.end(), '.');
decPos = decimalPositionIterator - input.begin();
if (decimalPositionIterator != input.end()) input.erase(decimalPositionIterator);

for (int counter = 0; counter < input.size(); counter++)
output += (input[counter]-48)*pwr(10, decPos-counter-1);

return output;
}
>>
>>52579714
Fuck Polylines
>>
>>52579766
}
>>
>>52579547
Lubuntu. Though I've installed so much shit it's probably more bloated than regular Ubuntu by now.
>>
>>52579758
>It doesn't have to be like this.

It's too late.

https://www.youtube.com/watch?v=KJ38jTQcO1k
>>
please help /dpt/

Why is this giving a segmentation fault?

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

#define BUF_MAX (81)
#define NAME_MAX (21)

typedef struct {
char name[NAME_MAX];
int lifetime;
} pcb_t;

int
main( int argc, char **argv )
{
int error_code = 0; /* In unix, a program returns 0 if all is ok. */
List_t processes;
char inputbuffer[BUF_MAX];
char name[BUF_MAX];
int lifetime;
pcb_t *pcb;

/* Initialize my data structures. */

if (List_init( &processes )) {

/* This creates an infinite loop from which you will need to do a
^C to stop the program. This may not be the most elegant solution
for you. */

while (1) {
if (fgets( inputbuffer, BUF_MAX-1, stdin )) {
/* Put the parameters into a PCB and store it in the list of processes. */
if (sscanf( inputbuffer, "%s %d", name, &lifetime) == 2) {
/* We have all the input that is required. */

pcb = (pcb_t *) malloc( sizeof( pcb_t ) );
if (pcb != NULL) {
strncpy( pcb->name, name, NAME_MAX-1 );
pcb->name[NAME_MAX] = '\0'; /* Make sure that it is null-terminated. */
pcb->lifetime = lifetime;
printf ("Read and stored process %s with lifetime %d\n", pcb->name, pcb->lifetime);

if (List_add_tail( &processes, (void *)pcb ) == 0) {
printf ("Error in inserting the process into the list.\n");
}
} else {
printf( "Unable to allocate enough memory.\n");
}
} else {
printf ("Incorrect number of parameters read.\n");
}
} else {
printf ("Nothing read in.\n");
}

while ( List_next_node( &processes, NULL, (void *)pcb ) && (pcb != NULL)){
printf("test\n");
}

}

} else {
printf ("Unable to initialize the list of processes.\n");
error_code = 1;
}

return error_code;
}


I don't have much experience with pointers but the prof gave us a prebuilt linked list to work with, I'll post it in the next post
>>
>>52579756
How do you get a text mode only Emacs? No matter what I try (on Debian), it always wants to pull the whole X with it and that's not what I want.
>>
>>52579845
here's the function giving me trouble

int
List_next_node ( List_t *list, void **context, void **data )
{
int all_ok = 1;
List_node_t **current_node = (List_node_t **) context;

/* Determine the next node to report in the list. */

if (*current_node == NULL) {
*current_node = list->head;
} else {
*current_node = (*current_node)->next;
}

/* If we haven't hit the end of the list, report the data at that node. */

*data = NULL;
if (*current_node != NULL) {
*data = (*current_node)->data;
}

return all_ok;
}
>>
>>52579848
cflags prob
>>
>>52579547
I legit might get arrested if you post these images. Please refrain.
>>
>>52579766
>decimalPositionIterator

You know how integers are called "int" and not "integer"?
You know how standard namespace is called "std" and not "standard"?

Yeah.
>>
>>52579848
I have a minimum install of Gentoo in a VM, with absolutely no X. Everything is done from the command line. I have no idea how you could get that with Debian though
>>
>>52579907
decimalPositionIterator looks better than decPosIt
>>
>>52579848
>emacs -nw

or you can compile your own emacs
>./configure --without-x --prefix=INSERTPREFIXHERE
>make
>make install
>>
>>52579920
dotPosIter you melt
>>
>>52579941
Go suck off your chip-8 you faggot
>>
>>52579926
>>52579889
Okay, so I have to compile it myself. Got it, going to give it a try some day.
>>
>>52579920
Just call it dotPos.

It's of type std::string::iterator. Putting full type names in identifiers is pants on head retarded.

Would you use "int forLoopIntCounter" too?
>>
File: alexis ren.jpg (162 KB, 750x747) Image search: [Google]
alexis ren.jpg
162 KB, 750x747
>>52579971
fuck off, it's a sound suggestion
>>
>>52579907
Sure, why not use DecPosIt and DecPosInt? I don't see any readability issues here.
>>
File: 1431782708705.png (12 KB, 530x492) Image search: [Google]
1431782708705.png
12 KB, 530x492
What stops one from writing a program to connect to many different proxies at the same time, and making them send a shit ton of HTTP requests to the target to open the connection, while not allowing the open connection to send any data back to you?

In other words, why can't a proxy list be turned into a botnet?
>>
>>52579977
You can, but "emacs -nw" should work. It doesn't work?
>>
>>52579986
hnng so cute
>>
>>52579996
Why would you put "Int" in an identifier in the first place?

dotPos and dotPosIter are perfect.
>>
File: alexis01.jpg (160 KB, 1000x667) Image search: [Google]
alexis01.jpg
160 KB, 1000x667
>>52580043
Someone has good taste
>>
>>52580007
>while not allowing the open connection to send any data back to you?
That's not up to you. If someone wants to send you packets, they are going to send you packets.
If you firewall off the proxies incoming connection you won't get any ACKs so good lucking forwarding more than a few bytes from any of them.
>>
The short scale system is retarded.

Why did it catch on, /dpt/?
>>
>>52579573
if you have loose coupling then if you fix one thing in one place it will not spawn bugs in other places
>>
>>52579547
Gentoo.
>>
>>52579573
guilty kek
>>
>>52580007
>In other words, why can't a proxy list be turned into a botnet?
Because of the way proxies work.
>>
>>52580133
i'm a swede and i still think the short scale system makes sense
>>
>>52580133
>people still using the long scale system
Say it ain't so
>>
>>52580133
Short and long scare are both retarded.

Long scale:
10^6 is million, and 10^9 is a milliard
10^12 is billion, and 10^15 is a billiard
10^18 is trillion, and 10^21 is a trilliard

So why the fuck is a milliard squared a trillion (10^18) and not a billiard?
Neither the short or long scale makes any fucking sense when they both skip other 10^3 like it doesn't exist.
>>
>>52578562
Open a .cl file:
>I've never seen this syntax and code structure before... wait what the fuck is that thing?
>>
>>52580230
There's no such thing as a billard (kek) or a billion in long scale.
>>
>>52580230
>So why the fuck is a milliard squared a trillion
because 1.5 x 2 = 3 not 2
>>
>>52580230
retiard
this is the problem
1000^
1 -> thousand
2 -> million
3 -> billion (bi -> 2)
4 -> trillion (tri -> 3)
>>
>>52580186
Long system:
million = 1,000,000 ^ 1
billion = 1,000,000 ^ 2
trillion = 1,000,000 ^ 3

Short system:
million = 1,000 ^ 2
billion = 1,000 ^ 3
trillion = 1,000 ^ 4

The short system is retard, makes no sense at all.
>>
>>52580252
>I've never actually looked it up, so it must not exist
https://en.wikipedia.org/wiki/Long_and_short_scales#Comparison
>>
>>52580273
>Long system:
>million = 1,000,000 ^ 1
>billion = 1,000,000 ^ 2
>trillion = 1,000,000 ^ 3
no
million 10^6
milliard 10^9
billion 10^12
trillion 10^15
quadrillion 10^18
...
It's the French system and French are always rights when it's about units.
>>
>>52580283
Thanks for proving me right.
>>
>>52580292
Billion and milliard are synonymous (milliard is the french word for billion). They don't exist at the same time.
>>
can we go back to talking about programming?
>>
Here is my new recommendation

million = thousand thousand
billion = million million
trillion = billion billion
quadrillion = trillion trillion
>>
>>52580325
what nail polish maximises programming productivity?
>>
Think how cool it would be if we called one hundred a biten, a thousand a triten, ten thousand a quadten, etc.

I wish we did that, that really pleases my autism.
>>
>>52580316
>Billion and milliard are synonymous
Not in the French system, which will be the norm, because French always impose their system to the world.
>>
nobody even uses the terms for numbers after a trillion anyway, they use 10^x, so who cares?
>>
>>52580351
Yes it is. Inform yourself. The value of a billion changes based on scale but the fact remains that milliard and billion are the translation of one another.
>>
>>52580270
It's not my fault you can't read.
Yes, the problem is that the milli- prefix starts at 10^6 and not 10^3.

>>52580296
Short Scale    Long Scale 
Name Name Alternative name

One One
Ten Ten
Hundred Hundred
Thousand Thousand
Million Million
Billion Thousand million Milliard
Trillion Billion
Quadrillion Thousand billion Billiard
Quintillion Trillion
Sextillion Thousand trillion Trilliard
Septillion Quadrillion
>>
pub fn read_from_file<T>() -> T {
let value = 0 as T;
value
}


how the hell do i make this work
rust complains about 'non-scalar cast' but then how the fuck am i supposed to declare int literals with non-i32 type
>>
>>52580373
Not in French system. Please I know my country. In English they're the same, yes, but not if we speak French.
So in future you'll do like us because we decide of the units used by the whole planet.
>>
>>52580374
By this logic, old English is still valid modern English.
>>
how about a program that turns your music into gangsta rap? would it be profitable?
>>
>>52580393
See >>52580374
And commit suicide.
If you actually knew any word of French you wouldn't spout your nonsense. Nice try though, ouiaboo.
>>
>>52580418
Ferme ta gueule sale con. Quand on est ignorant on apprend à se taire. C'est la seule route vers la sagesse.
>>
>>52580433
The googled canned phrases are hilarious. Also hilariously transparent.
>>
>>52580393
>Not in French system.

Soon enough it won't matter, anyway. You'll be using Muslim (arabic) units in the new Caliphate.
>>
>>52580401
So you think "thousand million" is an acceptable prefix?

>Sixteen thousand, two hundred and thirty-eight million, three hundred and fifty-two thousand, nine hundred and twelve

Rather than

>Sixteen billion, two hundred and thirty-eight million, three hundred and fifty-two thousand, nine hundred and twelve
>>
>>52580404
Writing a program to solve a problem you cant solve yourself is very hard.

A few friends and I wrote a program that turned your music into a death-metal Meshuggah mix. It worked by splitting the given song into 3 second increments, finding the most similar 3 second Meshuggah clip and laying it over. The results, while hilarious, were worse than having a human do the same.
>>
>>52580316
What are you talking about?
Milliard is French for thousand million (10^9)
And billion is French for million^2 (10^12)
>>
>>52580478
>French
Seize milliards, deux-cent trente-huit millions, trois-cent cinquante-deux milles, neuf-cent douze.

>English
>Sixteen billion, two hundred and thirty-eight million, three hundred and fifty-two thousand, nine hundred and twelve
>>
>>52580497
I love when people who couldn't tell a diamond from a cow dong try to talk about minerals on /g/.
>>
>>52580496
Tbh I was just thinking of adding more bass, some harder sounds and throwing in the occasional "gangsta rap nigga" every few seconds, nothing too complicated, but with the right effects/algorithms, seemingly impressive
>>
>>52580519
>and
>and
>and

Stop fucking doing that, god damn. It's "Two hundred thirty eight million" not "Two hundred AND thirty eight million"

Fuck me.
>>
>>52580374
Superior system:
one = 10 ^ 0
ten = 10 ^ 1
biten (hundred) = 10 ^ 2
triten (thousand) = 10 ^ 3
quadten (ten thousand) = 10 ^ 4
pentaten (hundred thousand) = 10 ^ 5
quinten (million) = 10 ^ 6
septen = 10 ^ 7
>>
the short scale is easier to reason with. nitpicking about the names is what a sperg would do. the names still make sense if you start with a thousand and then add n*3 zeros after thousand

what comes after million? billion. what comes after billion? trillion. what comes after trillion? quadrillion. etc.

1 000
1 000 000
1 000 000 000
1 000 000 000 000
1 000 000 000 000 000
etc.

>>52580404
absolutely.
>>
File: 0002.gif (18 KB, 128x128) Image search: [Google]
0002.gif
18 KB, 128x128
>>52580496
This kind of thing fascinates me. How did the program determine similarity?
>>
>>52580557
>Stop saying things correctly, it triggers me!
It's quicker and easier to say it without the ands, but it's not correct.

It's much quicker to just talk in slang too, good luck passing a job interview starting off with "yo dawg".
>>
>>52580603
Just use levenstein distance like a good goy.
>>
>>52580557
It's the British way, you autist.

No doubt we'll eventually dumb it down to your standards like we do with everything else.
>>
>>52579247
What about obfuscating code for job security?
>>
>>52580557
>niggerlover wants to nigger up numbers
As expected.
>>
>>52580558
SI prefixes use 10^3, you'll use them too or it will be extremely painful.
>>
>>52578374
Idris is a lot better but still lacks good library support and the compiler is still riddled with bugs.
>>
>>52580646
Good point. Well, linus seems to have that covered anyway.
>>
>>52580558
Why does "10 ^ 0" equal one?

That doesn't make any sense.
>>
>>52580651
For you?
>>
>>52580667
Because you're retarded.
>>
>>52580558
Now all you need to do is get everyone to start using it.
>>
>>52580667
How's middle school?
>>
How do I git gud at regex, /dpt/?
I went through http://regexone.com/, but this was stuff that I already knew.
I still feel like I know nothing, though.
>>
>>52577189
Use Visual Studio.
>>
>>52580558
Shit-tier desu senpai. Short-scale only requires you learn a new word for every three orders of magnitude.
>>
>>52580693
You don't, it's literally impossible to learn.
>>
>>52580693
what trouble are you having specifically?

>>52580702
shut up it's easy to learn
>>
File: alexis ren.png (263 KB, 500x666) Image search: [Google]
alexis ren.png
263 KB, 500x666
designing chip-8 zelda, I feel like this is a suitably daunting task. Storing map information shouldn't be too bad with the right optimization, but enemy ai is something I'm not a big fan of
>>
>>52580667
10 ^ 0
10 ^ (n - n)
(10 ^ n) * (10 ^ -n)
(10 ^ n) / (10 ^ n)
1
>>
>>52580651
They don't.
deka, hekto, kilo,
>>
>>52580693
Use regexr to make your regexps
>>
>>52580713
I've used regexes for years and the extent of the knowledge I retain is basically "google how to do thing"
>>
>>52580721
pls never stop posting her :3
>>
>>52580614
>>52580642
>>52580650
>correct
>british
>nigger

No, it is definitely incorrect. Indeed, it could even be British, but British & incorrect are two peas in a pod.
>>
>>52580723
But those are only ever used in very specific fields where a certain order of magnitude crops up frequently.
>>
>>52580713
>what trouble are you having specifically?
I feel like a complete fucking dumbass with no clue what I'm doing whenever I try to write one
>>52580724
already do, that and https://regex101.com/ for testing & explanation
>>
>>52580693
regex crosswords
Thread replies: 255
Thread images: 39

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.