[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Maintenance is complete! We got more disk space.
Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 1.07 MB, 1280x720, hime c.png [View same] [iqdb] [saucenao] [google] [report]
54042677 No.54042677 [Reply] [Original] [archived.moe] [rbt]

old thread: >>54037315

You have been visited by the 3 star programmer of Shimoshina Academy!

Good performance, triple indirection, and tail call optimization will come to you, but only if you post "Keep overflowing the stack, Hime!".

Also, what are you working on, /g/?

>> No.54042686


>> No.54042703

Genuine question here
Is it really a good idea to cast the return value of malloc()?

>> No.54042753
File: 53 KB, 600x900, Karlie-Kloss-Height-Weight-Body-Statistics.jpg [View same] [iqdb] [saucenao] [google] [report]

Would you attend her coding class?

Full tuition + tip

>> No.54042755
File: 132 KB, 507x325, 1452861416362.png [View same] [iqdb] [saucenao] [google] [report]


>> No.54042756
File: 546 KB, 900x1440, Screen Shot 2016-04-15 at 02.17.26 (2).jpg [View same] [iqdb] [saucenao] [google] [report]

I'm trying to compile some firmware following this tutorial


and I'm getting the error message as in

Please send help, I have no idea what I'm doing. I don't know jack shit about coding.

Thanks, but I'm just getting a different error message now.

>> No.54042757

You should ask if it's a good idea to still code in C when C++11/14 exists

>> No.54042767


It will have no impact on the generated code whatsoever, but some people may think it'll look shitty. On the other hand, if you're using malloc in C++ (for whatever reason), you HAVE to cast the result.

>> No.54042772

keep overflowing the stack hime!

>> No.54042806

Jesus christ those cheekbones.

>> No.54042841

i'll give her just the tip.

>> No.54042857

use this thread. fucking trap cancer in here >>54037326

>> No.54042867

Why is she casting return value of malloc()? Is she using C++?

>> No.54042872

I'd probably go into the class, talk shit for 5 minutes and get asked to leave

>> No.54042877
File: 696 KB, 3320x1920, Untitled-123.png [View same] [iqdb] [saucenao] [google] [report]

Mocking up my app in Photoshop because I want to know what the UI will look like before making it. Lay out the features and such.
It will fetch a JSON from UPCItemDB (based on the search query) and display the results, as shown on pic related.

>> No.54042885

m8, nobody cares

>> No.54042899

Keep overflowing the stack, Hime!

Also still porting this MATLAB shit. I'm 99% sure the sequence I'm searching is hidden in a fig file.
I don't understand why or how but I can't find it anywhere else. And I can't view the fig file, MATLAB freezes when I want to.

>> No.54042932

looks neat anon

>> No.54042937


>> No.54043015
File: 45 KB, 343x547, clipscreen-BK33.png [View same] [iqdb] [saucenao] [google] [report]

Yes, she, you foul newfag.

>> No.54043038

The only newfag here is you.
Hime is a boy, you fucking retard, did you even watch the anime?

>> No.54043054

No. Sorry oldfag-kun. Which anime? Let us be nice.

>> No.54043244
File: 420 KB, 500x282, i am dead inside.gif [View same] [iqdb] [saucenao] [google] [report]

Can anyone stop an error in this query?


The LastPostIndexed seems to be fine but LastPostIndexedAuthor is always wrong

>> No.54043510

This might be off topic, but I truly trust you homosexuals to know this: is there such a thing as a hardware volume equalizer? I'm in dire need of one.

>> No.54043564

Malloc exists in C++ too.

>> No.54043610

If she's a boy, why doesn't she look like a boy?

>> No.54043625

You must be new to anime.
most boys in anime can easily look exactly like girls if they only put on a wig and wear girl clothes.

>> No.54043653

Kill yourself.

>> No.54043713

Is that you delores?

>> No.54043763


Very rude, family.

>> No.54043800

Did you notice the trap image features something relating to programming? Did you notice that image does not?

>> No.54043803

and it is always wrong to use malloc in C++

>> No.54043814

Then why is it included?

>> No.54043826

because C++ has to be a superset of C

>> No.54043836

I've been curious for a while but what kind of programming challenges do they tackle in that show?

>> No.54043852

Fucking Google it, you lazy asshole.

>> No.54043873

Then by definition, if there is an appropriate use for malloc in C, then there must be an appropriate use for it in C++. Because almost every C program is also a C++ program.

>> No.54043944


Couldn't find anything.

>> No.54043991

what is c# used for? can you get jobs for it?

>> No.54044003

So this is sort of an abstract question.

But whats the sort of algorithm to detect how many new results on a page.

My thoughts are as follows:

Original Follow on Page saves the original timestamp and original title of the most recent result.

Then update checks if the first result's timestamp is the same as the cached one, and if so it returns 0 results.

If the first result is not the same timestamp then it checks title, if that is not the same then it checks the second result, adding 1 to a counter, and so on until the cached on. Then it does in reverse the amount of the counter and prints the list of new updates.

I just feel as if this could be made easier though.

Anyone have any comments on this?

>> No.54044004

Web development and enterprise shit primary. Yes, there's shitloads of jobs for it.

>> No.54044022

C# is pretty much Java, only better (and little less cross-platform)

>> No.54044150

You are so fucking retarded.

>> No.54044161

fuck off microshit shill

>> No.54044185

fuck off oracle cuck

>> No.54044198


rate my fizzbuzz

String out;
for(int i = 1; i<=100;i++){

>> No.54044246

GTP btfo of pol
another day in the life of GTP

>> No.54044278

In java I originally had:
function scr_EntityUpdate ( ID )
if entity[ID] ~=nil and entity[ID].ID == ID then
if entity[ID].upd then
print( "ENT: unable to update entity ", ID )

Now I have:
void ent_UpdateAll ( void )
unsigned int i;
for ( i=0; i<G_ent->length; i++ )
/* grab the entity table */
lua_getglobal( gVM, "entity" );

/* grab the array that correlates to the G_ent's ID no. */
EntArr *e = array_get ( G_ent, i );
lua_rawgeti( gVM, -1, e->ID );

/* grab the update (upd) function and call it */
lua_getfield( gVM, -1, "upd" );
if ( lua_isfunction(gVM, -1) ) {
lua_pushvalue(gVM, -2); /* so the self variable works */
if( lua_pcall ( gVM, 1, 0, 0 ) != 0 )
lua_error( gVM );

Which runs alot better and uses less memory I might add (as far as I know).

I'm trying to internalize this:
function EntityAdd ( objtype, ID, x, y )
if _G[objtype] then
if entity[ID] == nil then
entity[ID] = entityMT:import( objtype )

entity[ID].ID = ID

if entity[ID].new then

entity[ID].offset.x = x
entity[ID].offset.y = y

print( "ENT: added entity at ", ID )
print( "ENT: unable to add entity ", ID )
print( "ENT: unable to find objtype: ", objtype )

but i'm having a hard time, given I have to call a metatable function. Any ideas?

>> No.54044289

lol it autocorrected to java from lua

>> No.54044292


I didn't get blown out anywhere. The thread is still alive.

>> No.54044415

back to /o/ turd

>> No.54044427

I was watching house MD and there was this patient with aphasia(you can't spell or write the correct words that come to your mind, you just say and write gibberish) but he could answer with a yes or no when asked such a question. What would be the most efficient algorithm if you tried to build words letter by letter to understand him? Worst I can think of is a linear algorithm(the trivial is it a, is it b etc solution), the best I can think of is a binary search algorithm that runs at O(log(N)). Is there any faster one?

>> No.54044511


a hardware volume equalizer is usually either a graphic equalizer or a parametric equalizer

or do you mean something just to turn down the volume?

google rackmount passive attenuator

>> No.54044528


I think this is where the rub lies, I guess I'm looking for a volume normalizer, rather than an equalizer. I need loudness equalization.

>> No.54044614
File: 28 KB, 486x316, allheads.png [View same] [iqdb] [saucenao] [google] [report]

what's a good way to scale a random number distribution?
>inb4 mod

Also xorshift generators are generally the fastest right?

>> No.54044628

Reading a book on C# right now. I'm a little confused about enums. Is the primary benefit that they're basically limited versions of Python's dictionary? That is, it's a way of accessing a member that has a value by name instead of using an array and getting values by numbers which aren't very descriptive of the content?

>> No.54044674


>> No.54044685

give him a pen and paper and get him to draw what he wants to say instead?

>> No.54044699

this isn't how you're supposed to use embedded scripting languages
you need simple, clear boundaries between your engine and your scripts
if you're in the position where you're rewriting script functions in your engine, you're wasting time and effort and haven't drawn the boundaries between script and engine in the right place

>> No.54044718


I can't believe you ruined it. You son of a bitch.

>> No.54044731

He can't draw, that's how aphasia works.

>> No.54044738


This is actually something people have already worked on. The general idea is that you start with the most frequently used letters and move to the least frequently used ones.

You could also use a row column situation where you say "Is it a letter in row A? Is it a letter in row E?" etc. using vowels to split it into 5 rows. You can see an example of this in Breaking Bad when the nurse is helping Hector Salamanca write out what he wants to say. He indicates his choice by ringing a bell.

>> No.54044745

I plan to leave the entity calling functions non-user changeable, with free range on being able to do whatever (within engine boundaries) for the entity

>> No.54044750

As an audio engineer I think you're just saying words that sound like audio terms. Loudness has to do with dynamic range, which is controlled with a compressor or limiter. Equalization refers to controlling the volumes at different frequencies. Buying a USB eq (if that exists lol) would do what you want. If you just want a hardware volume knob, just get a rotary encoder and hook it to Window's volume knob through USB or whatever.

>> No.54044752

euthanasia then

>> No.54044759

It's usually not a permanent condition you thick fuck.

>> No.54044777

then wait it out m8

>> No.54044828

are your entities lua side objects or engine side objects? because they appear to be lua-side objects yet you're rewriting the functions for them in the engine. this defeats the point of using a scripting language in the first place. if you need more performance, make your entities engine-side objects. Writing engine-side functions that manipulate script-side objects defeats the point and should be done sparingly

>> No.54044832

>As an audio engineer I think you're just saying words that sound like audio terms.

It's called 'loudness equalization' in pretty much every audio card driver I can think of. I just need a hardware version of it. The reason I can't google it that I don't know what the hardware equivalent is ACTUALLY called.

Please use your audio engineering mastery to redirect me to a piece of affordable consumer equipment that will make low volume scenes louder, and high volume scenes quieter.

All the best,

>> No.54044848

im not rewriting the entities functions, just internalizing the function that calls the entities function (in other words, removing the middle man).

internally just the ID no. is stored, but the rest of the object is/should be external

>> No.54044882


Enums are not hash tables. They do not map keys to values. They simply are a set of typed integer constants. That their name is stored in assembly information does not really effect runtime performance, as the symbols should be resolved at compile time.

>> No.54044906

awfully cheeky for someone who is looking for help.

>> No.54044911

The problem with getting a piece of hardware is the need for a proper interface and a mixing board to get it working... which is expensive. The advantage of compressors is with consumer audio, they just torque the ratio really high (hence limiter) and leave the threshold engaged. My suggestion, get something like AULab and get a VST limiter. A lot of engineers use software over hardware because software is actually surpassing the feasibility of hardware. There's this big bullshit debate, but I won't go into it. In short, go with a VST limiter that can apply to your computer's audio output, set the threshold to where the signal is hitting it, and let it be. I don't know why you need it, but this is the best solution.

>> No.54044917

>build words letter by letter
Is that one of the requirements, or would an auto-complete style approach also be acceptable? If so, there are tables that have the most used words, and it wouldn't be hard to adapt that into a sort of smart auto-complete.

>Is there any faster one?
Honestly? The algorithm efficiency doesn't matter too much, only the interface convenience. Comparing the time it takes a modern machine to do a linear search across 26 letters vs the time it takes to press a button or say yes or no, the application would spend almost all of its time waiting.

>> No.54044950

encapsulation is a meme
pretty much every other OOP rule is valid, except for this one
inb4 CS graduate
prove me wrong

>> No.54044977
File: 13 KB, 175x230, 4.jpg [View same] [iqdb] [saucenao] [google] [report]

>Here you can insert any custom CSS to the theme using the ACE Editor, which offers the ability to edit back-end

>> No.54044978

functional programming is a meme
pretty much every other functional rule is valid, except for this one
inb4 NEET
prove me wrong

>> No.54044986

Hello /g/
first time posting here. I have an MD but after a while in general practice i decided this is not for me. I wanted to learn some programming, didnt actually know anything about it. So i started with what i found was the easiest language to learn (html and css). But my real goal is to make videogames, so i recently started learning python, its actually a lot of fun.

The question that brings me here is this, what language should i learn to start making my own game? also, i tried to find a site like code academy that teaches me c language, but haven't been able to find anything similar.
Please excuse me if my english is not perfect.

>> No.54044996

Obviously there could be an auto-complete approach but I'm trying to make this as simple as possible.

The algorithm efficiency matters because the person with aphasia has to answer less yes or no questions with a more efficient algorithm.

>> No.54044999


I need to be used with an otherwise analog system, though. It's part of my home theater setup.

>> No.54045019

writing engine functions that deal entirely with script objects just because they run faster negates all the ease-of-use benefits you get from using scripts in the first place. if you're having performance problems, move the entity system entirely to the engine side. but it looks like you're just doing premature optimization so you should probably put the script functions where they belong, on the script side

>> No.54045052

Implementing linked lists on c++ how do i do it?
How does it work

>> No.54045061


>> No.54045069

Oh ok. You'd need to intercept the output of your amplifier, which can be tricky because consumer amps use banana plugs while hardware studio gear use TRS or XLR. You can get a converter cable I guess. So, onto a cheap compressor. I don't know the price range or whatever but, take a look http://www.sweetwater.com/c790--Compressors_Limiters

Keep in mind, Behringer isn't terrible at the price point, but it's pretty shit compared to anything else. Any compressors at a lower price point are going to be unreliable poo-in-loo noise bags.

>> No.54045070

template <typename T>
struct LLNode {
T value;
LLNode<T>* next;

>> No.54045095

How and why does it work? I'm googling but i'm finding old stuff, did you type this just now? where can i read more about it

>> No.54045152

think of a box. The top of the box stores your school notes, the bottom of the box points to another box that holds more of your school notes. The "advantage" of this is it allows a data structure to exist without the data having to be right next to each other like in an array. This makes it easy to slip in data where ever you want without a huge hassle of shifting everything out of the way. It's retarded to do in actual practice, Stroustrup rightly points out it's retardedness.

>> No.54045184


I've actually got all the audio running over TRS. Did that early on since I had some things going optical->analog

>> No.54045202

he was probably asking what the template did, not the general theory of linked lists

>> No.54045209

Does anyone have an example of two equivalent programs, one object-oriented and the other functional, on hand? I have serious trouble "rethinking" OOP code for anything non-trivial.

>> No.54045217

Ah that's pretty good. A lot of gear nowadays use a XLR/TRS combo jack so you should be fine there. Do you have a price range in mind?

>> No.54045259

Oh well theory behind a template is pretty simple.
template<typename T>

This tells the struct that there is a type named T now. This type is variable based on how it's defined in a struct declaration. For example,
LLNode<int> blah;

This tells the newly declared struct that all the times it sees T, it means int. Your struct will become

struct LLNode{
int value;
LLNode<int>* next;

You can use any type at any time. I don't think I need to explain the usefulness of this.

>> No.54045269
File: 12 KB, 454x286, CPP functional 2.png [View same] [iqdb] [saucenao] [google] [report]

Currying and composition

>> No.54045277


I was hoping to spend around $100, but it looks like that's right out.

>> No.54045296

How important is discrete math? My final exam is in 7 days, and my pre-exam mark is 55%. How much is this going to hurt my chances of getting a job after graduation? I have like a B average otherwise.

>> No.54045302

Apparently the Really Nice Compressor by FMR is a favored consumer device. It's also rather small, which is nice.

>> No.54045337

Closest you can get is a Behringer, check this video out


>> No.54045355


malloc and free have been replaced in C++ by other tools, such as new and delete. Smart pointers in C++11 can even give you reference-counted pointers that automatically free when no longer needed. Using malloc in idiomatic C++ would be fucking retarded and completely counterproductive. The only exception is when you're writing C style code and using C++ for a few useful features

>> No.54045378

Friendly reminder that there is nothing wrong with linked list stacks.
struct _llist_node {
unsigned data;
struct _llist_node *next;

struct _llist_head {
struct _llist_node *head;
unsigned size;

typedef _llist_node lnode_t;
typedef _llist_head llist_t;

llist_t stack;
llist_push(&stack, data);
unsigned *val = llist_pop(&stack);

>> No.54045384

That doesn't look too bad actually. It uses DSP but that's not necessarily a bad thing.

>> No.54045395

For fuck sake why would you use a linked list stack if you're just going to do LIFO operations, it makes no sense.

>> No.54045414

what if it's FIFO?

void llist_push(llist_t *stack, unsigned data)
lnode_t *node = (lnode_t *) malloc(sizeof(lnode_t));
node->data = data;
node->next = stack->head;
stack->head = node;

>> No.54045425

Literally why would you not just use a ringbuffered array

ringbuffers are the most efficient solution for a finite stack and you're retarded for doing anything else unless you REALLY need theoretical infinity

>> No.54045437


>> No.54045458

Then it would a queue. There a data structure for that too.

>> No.54045469


/ (max / n)

>> No.54045472

in my design you can only pop values in the reverse order that you pushed them.
that's a stack

>> No.54045482

how is it distributed? there's usually a scale parameter in your typical distribution...

>> No.54045484

that's [0, n] btw where % is [0, n)

>> No.54045503

Then that would be LIFO you retard.

>> No.54045533

I'd LIFO you too, if you catch my drift. ;)

>> No.54045548

[0, 2^32) or [0, 2^64), uniformly

it'd be something like this (nicked from wikipedia)
#include <stdint.h>

uint64_t x; /* The state must be seeded with a nonzero value. */

uint64_t xorshift64star(void) {
x ^= x >> 12; // a
x ^= x << 25; // b
x ^= x >> 27; // c
return x * UINT64_C(2685821657736338717);

I wouldn't want to touch that big constant
it looks important

>> No.54045565
File: 1.15 MB, 1688x2535, stoolworthblessed.jpg [View same] [iqdb] [saucenao] [google] [report]

>daily reminder that the Son will not restore our souls to Heaven until we program away the evils of this world

>> No.54045581


I saw that one coming

>> No.54045587

If you don't know or practice what you learned in school, first it's an utter waste of time, second you'll be unhirable. For your test in 7 days get into damage control mode and study now. Get the fuck off of this site.

>> No.54045608

>If you don't know or practice what you learned in school, first it's an utter waste of time, second you'll be unhirable.

This makes no sense. I thought it was kind of implied that I was doing a CS degree.

>> No.54045611

if the Son of God was Jesus he wouldn't have died. The Son is yet to come, but only after we've made a world where he can survive.

Stallman indeed does God's work and if we were all more like him the world would be a much better place, overly strict free doctrine or not.

>> No.54045623

I got asked if I know any discrete math in a sophomore internship interview and didn't get the position when I said I didn't, so I guess it's important.

>> No.54045633

Yeah but I would be able to answer yes to that question.

>> No.54045636

is the C++ programming language 4th edition pdf actually badly formatted? Code samples are blue in color and typesetting in general looks shit

Or is it because it is a pirated copy, dl'd like 4 different versions and all the same

anybody have a legit one to compare? Or the hardcopy

>> No.54045640

Yeah, and we know your kind.
>"i wanna get a job in computers"
>doesn't program outside of class
>doesn't have any drive to write software outside of class or outside of the language he learned in class
>act confused and glare at people who actually like programming as a hobby because "wow who the fuck actually likes this shit???"
>go on /g/ and make a shitfit about being "forced" to have an open source portfolio

>> No.54045650

Ok then don't worry about it

>> No.54045659

I have projects and a GitHub profile where I have my own stuff from outside of class, and no I'm not posting it here.

>> No.54045670

ok so what's your question

>> No.54045678

sorry I don't know what the fuck that function does. I never use XOR operators and I don't know how the >> and << works with it.

why not just use rand()?

>> No.54045679


>> No.54045702

you have 7 days. that's 28 hours of study time at a completely reasonable rate. go read your fucking book and work through problems. math is not hard and we don't need more ignorant tards in the working world.

>> No.54045711

rand() is actually really fucking slow
you're better off scrambling your own numbers with something less random if it means less processor cycles per call

if you're working with multiple threads, don't even try to use rand() because they will all grab identical random values unless you use rand_r

>> No.54045764

how do I get a 4chan post ip address?

>> No.54045827

you have to be a janitor like me for those privileges.

>> No.54045836

Check your privilege you cis scum.

>> No.54045861

I really want to learn Perl or Python. What are the best resources available at the current time?

>> No.54045864

can you give me an ip adress?

I need to bully an /int/ mexican piece of shit who is shittalking me since weeks ago.

>> No.54045865

I do my janitor work in my dress like a dirty polish maid.

>> No.54045937

I too, also do my programming work in skirt. :3

>> No.54046050

not sure if retarded or retarded

>> No.54046051


>> No.54046059

>why not just use rand()?
you're a python programmer, aren't you?

>> No.54046063

I need to know his city so I can mock the faggot.

>> No.54046073
File: 590 KB, 1240x1550, maki.jpg [View same] [iqdb] [saucenao] [google] [report]

what programming language should i learn for maki?

>> No.54046093

F# for Machi

>> No.54046105


It depends on how you learn. Pluralsight and Team Treehouse are both good if you like videos. Learn Python the Hard Way, Think Python, Learning Python and Real Python are all good books (with very different styles and tones that may suit you).

It might be worth looking through a few of them and finding out which one speaks to you the most. They'll all be excellent choices for a beginner and none of them should really lead you astray (except Learn Python The Hard Way does have a big bias against Python 3 which isn't really deserved).

Also check out /r/learnpython. They'll be helpful and nice to you.

>> No.54046248

i don't even like idol anime but maki fills me with warm happiness every time I look at her

you should learn javascript

>> No.54046434

Will someone explain the controversy around linked lists to me? I've seen people say (with experiments to prove it) both that linked lists are far faster and far slower than arrays.

>> No.54046481

linked lists usually work best in conjunction with other data structures

since they require no additional work to resize them, they're great for vector implementations

they're also good for handling hash collisions in hashmap implementations
instead of worrying about allocating more space for a collision, the colliding element just gets added as a node to the hash bucket

>> No.54046527
File: 396 KB, 849x1200, 1410846695838.jpg [View same] [iqdb] [saucenao] [google] [report]

Python. Maybe you can satisfy her with it.

>> No.54046531

In C/C++? Yes. In higher level languages? You can't tell unless you know the implementation. Some just put your "linked list" into a large dynamic array.
Reason that linked lists are so slow is because operating systems allocate memory where it is optimal for the OS to not run out of usable memory. That leads to the allocated memory usually landing in different memory pages which you can only hold a certain amount of in the CPU for fast access. So with large linked lists (that are not actually arrays in the background) there's a good chance that a lot of the list elements are all over the god damn place and you constantly have to wait for page-swapping. Of course arrays can get so big that they don't fit in a single page, but the pages-per-element ratio is a lot higher.

>> No.54046541

>pages-per-element ratio
I obviously meant the "elements-per-page ratio". Fuck.

>> No.54046545


Someone earlier made the analogy that a linked list is like a set of numbered boxes with labels telling you which box to pick next, while arrays would be contiguous boxes.

The theory goes like this:
You've got 4 boxes. If you're using a linked list, all you need to do is change two labels - the box before the target position (to the new box), and the new box's label (to the box after the target position). If you've got an array, you need to move at least two boxes out of the way to make room for the next one - if there isn't room on the line, you need to move all of them to somewhere with room.

In practice, because of the relative speed of cache and memory, and because of things like prefetching, parellisation and prediction, it's more like this:
The boxes in the linked list version are all in different buildings.

>> No.54046583

>rand() is actually really fucking slow

Isn't it more or less:
int rand()
static unsigned int seed = 1;

seed = (seed * 1103515245) + 12345;
return (seed >> 16) % 32768;

>> No.54046616
File: 42 KB, 512x512, walter bright's nearest neighbour.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.54046617

Additionally, arrays are extremely cheap to copy as they're a continuous range of memory. So even inserting data into an array can be faster than using a linked list, depending on a variety of factors (list/array length, position where the element is being inserted into, ...).

>> No.54046628

srand() sets the random seed value, so it must static global variable inside rand.c

>> No.54046666
File: 236 KB, 1737x662, TheProdigy.jpg [View same] [iqdb] [saucenao] [google] [report]

>"You're a mug, that's why I had to cut you down. You run with the wolves while I hunt like a hound." - Santiago Gonzalez, 2015
What did he mean by this?

>> No.54046679

puberty hit him like a ton of bricks

>> No.54046692


Advantages of a linked list:
1. O(1) insertion at center when one has an iterator to do so (otherwise it's O(n) to seek to the center).
2. O(1) insertion at front or end. While this may not seem particularly special, given that a vector can do at least the latter in O(1) amortized time, there is an advantage here in that linked lists will never invalidate pointers when doing so. This makes them more suitable for functional languages that need a good, immutable data type.

1. O(n) random access. This hurts a lot for most practical use cases.
2. Requires an allocation on the heap for each node. By comparison, only log(n) allocations are used in a vector, less if you can get at least a ballpark estimate of how much memory you'll need from the start. Although the vector does require everything be moved over when you make a new allocation.
3. No guarantee of nodes being in contiguous memory, and many implementations, this is highly unlikely to occur. Most CPUs are optimized for accessing memory addresses in sequential order. Using a load or store operation on some address n tends to get n+1, n+2, n+3... up to the size of a cache line. Accessing elements by dereferencing pointers to completely different sections of memory is likely to generate a lot of cache misses, which are not cheap. For some datasets that are not particularly large, the O(n) cost of inserting at the middle of a vector may beat out the cost of the cache misses in a linked list.

Linked lists should be used where appropriate, but one should recognize that they do have some rather real flaws that make them not really the best choice for everyday data structures.

>> No.54046729

Just finished converting dlink pin generator from python to android.

>> No.54046768

Well, yeah; does that somehow slow it down?

>> No.54046811

no, your example runs pretty fast

glibc's rand() is supposedly more "random" because it scrambles your number much further than necessary, but this kills performance, especially if you're calling it 3 million times per second

>> No.54046820

Every single programmer should be required to understand low level concepts.

>> No.54046826

what are low level concepts to you?
and please don't say C.

>> No.54046860

You should be able to write a program to run on bare metal, without an underlying kernel.
C is not low level.

>> No.54046887

news flash grampa, compilers write better assembler than you ever will

write C and port it to any architecture
it'll run plenty fast

>> No.54046962

When the fuck did I say to write only in assembler?
All I said was that C is not low level, because it's true, that doesn't mean not to use it in a kernel, of course you can, and should.
but assembler is unavoidable, if you plan on writing your own bootloader (which you should be able to do) or install interrupt handlers, you don't really have a choice but to write them in x86 assembly.
The point is that you SHOULD be able to write a program, in any language (provided it has no runtime), that runs on bare metal without a kernel.
If you can't, then you should learn to do it, otherwise, you're not a programmer, and you should refrain from writing any more code.

>> No.54046983

t. unemployed neet

>> No.54047038

Good rebuttal.

>> No.54047071


> you don't really have a choice but to write them in x86 assembly.
x86 is not the only ISA on the block, and given how cheap ARM computers are (and how they don't have a billion different gotchas like the fucking A20 line), it would be better for a beginner to develop an ARM kernel than an x86 kernel.

>> No.54047081

>he point is that you SHOULD be able to write a program, in any language (provided it has no runtime), that runs on bare metal without a kernel.
If you can't, then you should learn to do it, otherwise, you're not a programmer, and you should refrain from writing any more code.

>You SHOULD be able to play Bach's Fugas, on any instrument (provided it has no electronic parts) that has keys or at least strings. If you can't, then you should learn to do it, otherwise, you're not a musician, and you should refrain from playing any more music.

>> No.54047091

Sure, x86 was just an example, whatever arch you develop for doesn't have to be an intel arch.

>> No.54047107

Fuck off retard, music is not in any way comparable to programming.

>> No.54047116

// example about structures
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

struct movies_t {
string title;
int year;
} mine, yours;

void printmovie (movies_t movie);

int main ()
string mystr;

mine.title = "2001 A Space Odyssey";
mine.year = 1968;

cout << "Enter title: ";
getline (cin,yours.title);
cout << "Enter year: ";
getline (cin,mystr);
stringstream(mystr) >> yours.year;

cout << "My favorite movie is:\n ";
printmovie (mine);
cout << "And yours is:\n ";
printmovie (yours);
return 0;

void printmovie (movies_t movie)
cout << movie.title;
cout << " (" << movie.year << ")\n";

Going over some basic coding stuff, had a quick question about
void printmovie (movies_t movie)
Why is "movie" in there? I don't understand what it's referring to. Why wouldn't you just do void printmovie (movies_t) ?

>> No.54047133

don't deprecate music senpai

>> No.54047144

Do you even know what deprecate means?

>> No.54047150

Yeah, it means shit on it

like when a cow deprecates in a field

>> No.54047155

>Why wouldn't you just do void printmovie (movies_t) ?
Read chapter 1 again.

>> No.54047157

in the forward declaration

>> No.54047178

Oh, I understand now. The movies_t is the type.

thanks anon

>> No.54047182

I don't really do C++ but it looks like movie is the variable you're passing in referring to the specific movie, whereas the movies_t is telling it that movies isa movies_t structure. Since a structure is essentially defining a new type, you're letting the function know what the type of the variable is.

I dunno though I do lisp lol. Also I'm bad at explaining shit.

>> No.54047246

why do you use a deprecated language family, family?

>> No.54047289

cause lisp is the balls famalam

>> No.54047298

Just for fun, that could have been "movies_t asblarghfarg" and the code would run fine. Variable names in function prototypes are for clarity and nothing else.

>> No.54047299

why do you suck balls anon

>> No.54047328

It's good practice to make your code as readable by others as possible. If someone is just glancing over your header, it'd make more sense seeing something like

int foo(int input, int output);

instead of this
void bar(int, int);

>> No.54047417

What's the easiest way to implement an inline assembler on Windows?

>> No.54047422

I got a phone interview for a coop job in San Jose (I'm from Canada). It is for a job called "embedded system software, integration and hardware intern" where I'm supposed to do stuff with FPGAs. I'm in second year and I put C and verilog on my resume which is what they were looking for, but I am a little rusty on both since I learned them last semester. My interview is next Tuesday. What should I do? What should I expect? Are they gonna grill my ass

>> No.54047434

I don't know any C++ but am forced to use it for school, thus I write C, cast my mallocs, and change the file extension.

>> No.54047519

bullshit. A class doing something with C++ doesn't touch the memory with malloc.

>> No.54047543

C/C++ have inline asm

Call a C/C++ compiler

>> No.54047634
File: 174 KB, 500x503, scumbag-security.jpg [View same] [iqdb] [saucenao] [google] [report]

The big theme for this year at my job is security. A security team was formed and they started talking away access to a lot of things.

Developers who need to fix production issues are now locked out of production. Instead, they setup a special production support team. The problem is that production support is made up of interns and contractors. They're mostly black or Indian women and they've never used a command line shell in their lives. Nearly all the bugs they report are actually typos they made trying to run a command.

One of the dumbest things that happened recently though is that the security team wants me to have read-only access to the database in DEV! So not only do I get blamed for production issues that I'm no longer able to solve or even diagnose, but I can't freaking modify anything in DEV? Meanwhile single-mom Shaniqua and barely speaks English Sanji Patel are able to fuck around in Prod.

>> No.54047673

That's probably a good sign to start looking for a new job.

>> No.54047750

expect embedded questions obviously
and maybe bit shit and what not

>> No.54047870

If you have a phone interview with one of their engineers, then you're fucked. They love dick slapping you with their knowledge. Very easy to feel intimidated. If you can withstand that you're good. Study the fuck up on FPGAs and C.

>> No.54047871

Hey guys, I am looking for a solution on something, Sometimes while I am coding at home, I have some free time in between my college classes, and sometimes I would like to test out some code on existing project. But don't have access to it, anyone use anything cloud base to sync between desktop, and laptop?

I was thinking of using google drive to achieve that, any other suggestions?

>> No.54047933

what is this even
setup a git repo with bitbucket then work like, with copies on your laptop and desktop and pushing/fetching changes
or if you mean to ssh in your desktop with your laptop

>> No.54047996

>replaced in C++
you don't know what you're talking about

>> No.54048009

replaced for adoption yes, but not underlying obviously

>> No.54048048


>> No.54048058

tell that to openbsd

>> No.54048103

Can anyone help me out?
I am trying to compile OpenSSL on windows with perl, native c++(visual studio 2008) and nmake. It finishes fine but is reliant on the MSVC90.dll which I do not like. Is there any way to bypass that dependency?

>> No.54048112

that's not fast enough

>> No.54048124


>> No.54048128

yeah I guessed so much, but in which step should I insert that?

>> No.54048150

it's a compiler switch, so, the compilation step?

>> No.54048166

that's not helping at all but i might have found its place in the makefile so... thx i guess

>> No.54048191

it is replaced
they just can't remove it due to old codebases

>> No.54048222


they're mono, though, he needs stereo. you can link two RNCs but it may be a bit fiddly for a home stereo system.

actually what he wants is a _limiter_

look for stereo limiters where the channels can be linked and which have 1/4" io

dbx 1066 for instance

>> No.54048270

Bittorrent sync

>> No.54048297

what makes a good programmer?

how do i transition from being an alright programmer to being a good programmer?

>> No.54048303


>> No.54048340

No it isn't, it's stereo. http://www.fmraudio.com/rnc.html

The ratio goes up to 25:1 which is above what is considered a limiter (20:1)

>> No.54048344

Why would you want that? Being alright programmer is enough to get you paid, being a good programmer is overrated.

>> No.54048369

Recursive Fibonacci sequences

>> No.54048406

How do I want to do things? I never feel like doing anything and it makes work and fun hard.

>> No.54048414

write reusable and well structured code
knowing a bunch of algorithms doesn't make you a good programmer

>> No.54048547

Its not included. It comes from C. Probably lays in <cstdlib>. As printf does in <cstdio>.

>> No.54048558

But C++ isn't a superset of C.

>> No.54048566

>Its not included

>> No.54048665


read and try to fix shitty code

read and fix good code

study what makes the good code good

takes time

>> No.54048740

Suggest to me a smallish sized project as well as a language to complete it in.

>> No.54048745
File: 36 KB, 1024x768, Untitled.png [View same] [iqdb] [saucenao] [google] [report]

Finally got my old shit compiling and running on old shit. :o

>> No.54048829

Holy shit, is that Ubuntu 16? It looks fantastic

>> No.54048844

It's actually ReactOS.

>> No.54048853

Space invaders




>> No.54048863

>Icons from 9x
>Task Manager from XP
What is this abomination? NT 4.0?

>> No.54048886

NT 4.0 m8.
Totally, I just used it to test compatibility since I couldn't find a way to virtualize a 95 machine and have OpenGL 1.2 support. Funny thing is that's it running in 32-bit color yet a ton of icons are still using low color mode.

>> No.54048892

fizzbuzz took me about 3 minutes

am i a genius?

>> No.54048905

Yes, that is really impressive.

>> No.54048925

You probably did it wrong.

>> No.54048944

post proof

>> No.54048962

Post expected results and what you're getting now.

>> No.54048972

Does someone have the picture with the D FizzBuzz snippet and the incredible smug Walter (or Andrei)?

>> No.54048975

//current time: 6:21AM
static void FuzzBizz(int max) { int l = 1, i, O = 1; string c = "zz", a = "fi", b = "bu"; l += 2; i = l; i += 2; for (; O < max + 1; O++) WriteLine(((O % l) > 0 && 1 > (O % i)) ? a + c : (1 > (O % l) && (O % i) > 0) ? b + c : (1 > (O % l) && 1 > (O % i)) ? a + c + b + c : O + ""); }
//current time: 6:24AM

>> No.54049001

>tfw high digit ratio
>tfw doomed to suck at programming

>> No.54049069


>> No.54049110


>> No.54049139


>> No.54049193
File: 14 KB, 480x360, shocking_trick.jpg [View same] [iqdb] [saucenao] [google] [report]

>> No.54049203


>> No.54049296

>universities in my country teaches Computer Engineering but not CS
i dont want tolearn physics and mechanics, i want to program

>> No.54049320

How do I make java hang for a few seconds rather than immediately moving on to the next statement

>> No.54049322

>want to program
>go to college instead of programming

>> No.54049358

im writing this from my dev computer at work, i already know HOW to program
i want a masters degree to make applying for international jobs easier, and figured i might as well learn something i WANT to learn

>> No.54049360

for (int i = 1; i < 8000000; i++)
int ayy = 0;

>> No.54049376

For undergrad, do a business degree related to tech, like MIS or Supply Chain.

Get your master's in something specific to what you want to work in.

Boom, hirable as fuck.

>> No.54049742

In the GL shading language, what happens if you add a float to a vec3?

float f = 0.1;
vec3 v1 = vec3(1.0, 1.0, 1.0);
vec3 v2 = f + v1;

Does the float add to all components of the vector?

>> No.54049896

Expected results is LastPostIndexedAuthor being correct instead of being the date of the author post

>> No.54049910


>One operand is a scalar, and the other is a vector or matrix. In this case, the scalar operation is applied independently to each component of the vector or matrix, resulting in the same size vector or matrix.

>> No.54049928

Your query as written won't return a date as LastPostIndexedAuthor unless your tables are fucked up.

The only possible values in that field are UName and p.PAuthorId.

>> No.54049956

What I'm trying to do is get the last post max(PDate) and then query forum_database_users with PAuthorId comparing it to UId to get the UName

LastPostIndexedAuthor is supposed to be the nickname of the last post inside the thread

>> No.54050042

All those ifnull() are making me die inside. It just screams horrible table design.

Interestingly enough, some DBMS wouldn't even let you use that query as-is.

You're performing aggregates within coalesces and only grouping by one field, where other fields are available, which leads to arbitrary selection in your case, I guess.

It's pretty difficult to help you out given the clusterfuck of a database design you're working with and a lack of example tables for me to test on locally.

>> No.54050100

malloc is from C.
It's a good practice and makes the code readable also it suppress some warnings if im not mistaken.

>> No.54050114
File: 69 KB, 500x669, 1454356009160.jpg [View same] [iqdb] [saucenao] [google] [report]

All the iffnull( is because I'm indexing shit, not an actual forum so sometimes I won't have data for a user yet.

Here's the structure

>> No.54050117

so you have a variable to refer to
makes it easier to understand than perl and shit

>> No.54050132
File: 1.16 MB, 640x360, umaruic.webm [View same] [iqdb] [saucenao] [google] [report]

Ask your much beloved programming literate anything (IAMA)


One operand is a scalar, and the other is a vector or matrix. In this case, the scalar operation is
applied independently to each component of the vector or matrix, resulting in the same size vector
or matrix.


4.50 now






maybe it's a function pointer.


no except if it's a function pointer.

>malloc is from C.
malloc is a procedure that is part of both c and c++ standards.

>> No.54050160

>4.50 now
I'm pretty sure that the statement still holds true though.

>> No.54050170

Red pill me on the Android NDK.

>> No.54050179

Any chance you could just upload a backup and let me host it up with data?

Not sure if you're mirroring something online or if it's your own system.

>> No.54050217

pretty goode

>> No.54050278

My current backup is too big, like 2GB but even if I started a new one and crawl just a little bit you wouldn't have many users so it would not help

>> No.54050303

That's it? No disadvantages?

>> No.54050309

>My current backup is too big, like 2GB
What third world country do you live in?

Google filedropper.

Upload that hot mess, lemme help.

>> No.54050339

C++ question
void function (int x = 3){do stuff}
x defaults to 0 if not specified on thefunction call, but lets say x was a class
void function (MyClass x){do stuff}
if I don't specify x in the function call is there a way to just keep x the way it is constructed or do I have to assign some default value to it and do it like
void function (MyClass x = 3){do stuff}

>> No.54050341

he agrees with me
> Thus, C++ is as much a superset of ANSI C as ANSI C is a superset of K&R

>> No.54050408


It really needn't be a consideration at all, considering that C++ deprecated C.

>> No.54050434


You mean like that?

>> No.54050444

malloc is part of the C standard that is included in C++, thus it isn't a C++ procedure

here are some references to it in the C++14 Standard

> Data races [new.delete.dataraces]
> For purposes of determining the existence of data races, the library versions of operator new, user replace- ment versions of global operator new, the C standard library functions calloc and malloc, the library versions of operator delete, user replacement versions of operator delete, the C standard library function free, and the C standard library function realloc shall not introduce a data race ( Calls to these functions that allocate or deallocate a particular unit of storage shall occur in a single total order, and each such deallocation call shall happen before (1.10) the next allocation (if any) in this order.

>20.7.13 C library [c.malloc]
>Table 45 describes the header <cstdlib>.
>Table 45 — Header <cstdlib> synopsis
>Type Name(s)
>Functions: calloc malloc
>free realloc

>The contents are the same as the Standard C library header <stdlib.h>, with the following changes:

>The functions calloc(), malloc(), and realloc() do not attempt to allocate storage by calling ::operator new() (18.6).

>> No.54050505


>> No.54050563

Are pointers the same thing as referencing?

>> No.54050568

Yes, thanks.

>> No.54050936

are you talking about c++?


>> No.54050966

It's true
don't know why anyone is still using C

>> No.54051238

I'm crawling some basic shit to upload because 2GB would take hours

hang in there

>> No.54051262

Where can I learn about virtual memory, specifically in a Linux operating system? I'm interested in learning how to read and manipulate variables in memory, and to a lesser extent how the OS manages memory.

>> No.54051568
File: 380 KB, 720x404, katy.webm [View same] [iqdb] [saucenao] [google] [report]

Here's a backup for you

From what I've checked from this little data, thread 22 should have user 26 as the last user who posted
I don't know if you're a DB administrator but I would appreciate if you could take a look at the indexes/views and if they're right, considering it's indexed shit and some stuff will always be missing.
Thanks in advance.

>> No.54051775

Is Leaning C the Hard Way a good place to start? I somewhat already know super basic concepts like arrays from high school classes.

>> No.54051909
File: 42 KB, 541x666, qMg2a5B.png [View same] [iqdb] [saucenao] [google] [report]


I noticed that your crazy in-line select is unnecessary.

I cleaned out the coalesces for now to make it readable.

If you're grouping by the Thread, then the Name of Thread, then the Author, you just need to ask for the Max Date of the post.

Now, you've got a table fucked up. For some reason, `PDate` is full of what appears to be...not dates. Not sure what's going on there.

What's up with `PDate`? You have it storing as BigInt.

>> No.54051927
File: 12 KB, 311x400, c_primer.jpg [View same] [iqdb] [saucenao] [google] [report]

>Leaning C the Hard Way
that's a really baaad book, start with pic related

>> No.54051966

PDate is the string I get from the crawled website and convert to unix date(???) by using javascript's Date.now()/new Date().getTime()

now() method returns the milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now as a Number.

>> No.54051981
File: 262 KB, 580x346, 1445285252820.png [View same] [iqdb] [saucenao] [google] [report]

How does one become more productive as a programmer?

>> No.54051983

FUCK, that girl with the pink hair is hot. What's her name?

>> No.54051996

spoiler: she's not real, and has the head/body proportions of a three year old

>> No.54052006

Are there any strongly typed languages where white space is important? I hate using brackets and love the way Python uses white space in place of brackets.

>> No.54052027

Thanks friend, I'll download it. Although I'm wondering what's wrong with it. Bad examples or code?

>> No.54052028


>> No.54052045

Python is strongly and dynamically typed.

>> No.54052047

Haskell and Nim. Haskell is not progressing anymore, nim is brand new. Your chose. Also probably 2-3 memelangs that no one uses.

>> No.54052058

If I send a struct through a pipe in C, will read() block until the whole struct is read? Or can it return before reading all the struct values?

>> No.54052078
File: 49 KB, 700x653, C4f03em.png [View same] [iqdb] [saucenao] [google] [report]

Oh, I should have seen that.


t.TId AS Id,
t.TName AS Name,
t.TAuthorId AS Author,
t.TLastPostDFake AS LastPostFake,
COUNT(p.PId) AS Posts,
MAX(p.PDate) AS LastPostIndexed,
FROM_UNIXTIME(MAX(p.PDate/1000)) AS LastPostIndexed
forum_database_threads t
LEFT JOIN forum_database_posts p ON (p.TId = t.TId)

Are these close to the results you're expecting?

>> No.54052079


You don't have to define types in Python.

>> No.54052084

Really depends on what's on the other side. Check the return value or use something like readall or fread if you want to be sure.

>> No.54052086

This doesn't contradict what I've said.

>> No.54052102

no it's weakly typed

var = "op is fag"
var = 3

is a valid operation.

>> No.54052137


Yes it does. A strongly typed language requires that you define a variables type before initializing it.

>> No.54052143

This is dynamic typing fag. Yet 1 + "a" will rightfully send an error because it's strongly typed, not fuzzy or weak.

>> No.54052149

Educate you are self idiot.

>> No.54052159

You mean static typing moron.

>> No.54052184

what happens if the return value is not the size of my struct?

will another call to read fill in the missing data, or will it overwrite the previous data with what it just read?

>> No.54052187

Start a project that you can be enthused about.

>> No.54052201

That's the firstpage view right? those results are faster and more organized for sure but I still needed the author's name and last post author name, I think that part of my query was super wrong.

Also pretty interesting trick with the FROM_UNIXTIME, didn't know that one

>> No.54052212


Static just means it's checked before compile time.


I am myself, indeed.

>> No.54052233

No. You have to offset it.
read(fd, buf + nread, size - nread)
Maybe googling readall will return some interesting code examples.

>> No.54052235

declare* a variables type.

>> No.54052264


You're right, I should've said declared.

>> No.54052288

Stupid terminology choice here. Is JITed code dynamically typed? Look it up. It describes the semantics of the language, not the implementation.

>> No.54052314

Ah okay, that makes sense, just offset the pointer and continue reading?

Thanks anon, all I could find when googling is C# method called readall or read all lines of a file; which used fseek and I'm pretty sure you can't fseek a pipe.

>> No.54052334



>> No.54052340


I'm just going by what the definition of statically typed was when I googled it. What I got when looking into it more is that the terms strongly and weakly typed are some of the murkier definitions of CS and that I'd be better off using other descriptors.

>> No.54052362

do you just wait with a new thread typed already, so you can wait for the "bump limit" and be the OP?

opfags seem to get touchy when someone else posts a thread before they can.

>> No.54052380

that's not strong typing.

>> No.54052453


not necessarily.
var a = 1;
var b = "foo";

is valid c#.
>C# supports strongly typed implicit variable declarations with the keyword var

>> No.54052542


As you said though, you have to use the var keyword when you're doing an implicit variable declaration. I find that pretty similar to not having to declare the length of an array when you're inserting all the values at declaration.

>> No.54052664
File: 24 KB, 354x461, y3YMO2p.png [View same] [iqdb] [saucenao] [google] [report]

Just join your users.

>> No.54052686

The distinction here is that the type is determined at compile time in C#, not runtime, and the variable's type will NOT change during runtime.

>> No.54053164

What language benefits the most from crossdressing?

>> No.54054634


Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.