/dpt/ ‐ Daily Programming Thread

What are you working on, Jow Forums?

Old thread:

Attached: STEM.jpg (710x518, 34K)

Other urls found in this thread:

fabiensanglard.net/quake3/
github.com/id-Software/Quake-III-Arena
github.com/id-Software/Quake-III-Arena/tree/master/libs/jpeg6
mises.org/power-market/cup-coffee-venezuela-now-costs-1-million-bolivars
github.com/os-js/OS.js
twitter.com/SFWRedditImages

>I can't even imagine how that'd be possible.

You're kidding right? Do you realize that some of the greatest games out there were written in C?

fabiensanglard.net/quake3/
github.com/id-Software/Quake-III-Arena

It's probably even easier in C than coming up with abstract engines and object model crap for your game. Just specify your variables and have functions operate on them.

>personal image processor

?

Is Xamarin a meme?

Trying to come up with a way to generate the entire MULE character set in Postgres. Every other character set can be iterated using convert_from/convert_to and UTF-8, but PG doesn't support converting between UTF-8 and MULE. This means I can't even use the psql interactive mode (which runs in UTF-8 mode), I have to send it a script to run after setting the environment variable PGCLIENTENCODING=MULE_INTERNAL
This is for unit testing some other software in case anyone was wondering >fucking why

Attached: Screen Shot 2018-07-11 at 12.57.09 AM.png (1142x1470, 259K)

Calling it "impossible" was a hyperbole. I knew it was possible, just that it's rather difficult and not worth the effort.

>>personal image processor
>?
See, e.g., github.com/id-Software/Quake-III-Arena/tree/master/libs/jpeg6

C does not come with an easy set of tools to deal with images, whether that's images sent to the user or images received from the code. Unless you use an image processing library, you'll have to make your own processor from scratch, which (while not impossible) will be a pain in the ass.

C is nice, sure, but I can't imagine some random programmer will want to reinvent the wheel just to work with images.

Same person

How can I avoid overriding in a constructor?

I want to initialize
public class Foo extends JFrame implements ActionListener
{

Foo()
{

setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);


}


Then it throws me "Overridable method call in constructor" and I've learned this is very prone to errors. How can I avoid this overriding? I am unable to set EXIT_ON_CLOSE anywhere outside the constructor. Are there any workarounds this?

Attached: 1530986501968.png (164x251, 27K)

You don't need to implement a fool blown image format. If you're making a 2d side scroller just limit your color palette. small color palette should compress very well with huffman coding. Huffman might even be unnecessary, For instance if your pallette had 256 colors you could encode your assets in 1/3 the sizeof regular bimaps without even worrying about any compression.

make the method final?

It could only be modified as final by editing the JFrame class which is where the method setDefaultCloseOperation is inherited into Foo.

Override setDefaultCloseOperation yourself and have it just call the superclass implementation. Then you can make that final
Or heck, maybe it'll work if you just call the superclass implementation in your constructor.

holy moly, java is terrible
java programmers must be paid by the hour

>C does not come with an easy set of tools to deal with images

Why not use bitmaps? I once wrote a CPU based renderer and was blown away by how simple it was. Made OpenGL look bad

You can also directly store resources in whatever format your rendering system expects directly. This is how old systems did it, incidentally. I had to write tools to decode PS1 graphics.

>pain in the ass

I really wish people appreciated the idea of writing things from scratch more. People today are so helpless without a bunch of ready made code to do the hard work for them. They don't appreciate the effort it took to come up with the software stack they enjoy. They don't understand how it works or the price they're paying for the abstractions -- they just use it and act like its some god given system no mortal could possibly have come up with.

This is the reason why I see webdevs who cant tell me what a fucking cookie even is.

So let me get this straight. The method is overridable but you have no intention of doing so but regardless Java throws an error because you could in theory do something that you have no intention of doing?

Java doesn't stop you, it's a linter thing.

Well, the IDE (NetBeans) throws a warning* because yes i could end up doing something I might not do (Override the method) or in the future i could do without noticing.

In other words, this is what could happen:
From Effective Java 2nd Edition, Item 17: Design and document for inheritance, or else prohibit it:

There are a few more restrictions that a class must obey to allow inheritance. Constructors must not invoke overridable methods, directly or indirectly. If you violate this rule, program failure will result. The superclass constructor runs before the subclass constructor, so the overriding method in the subclass will be invoked before the subclass constructor has run. If the overriding method depends on any initialization performed by the subclass constructor, the method will not behave as expected.

Attached: 1530906615730.png (735x720, 430K)

what are some modern uses for tcl?

Sorry for quoting with code. Anyways, this is kinda my first serious programming project and I would like to learn the proper way and manners of writting code but hell, java is truly a shitfuck of a lang.

How is this for basic front end jQuery stuff? I know it doesn't work, I tried to refactor it with the new ES6 syntax and that broke it. What my client wants is form inputs in a certain class of div to be cleared if you check a checkbox that is also in that div, and vice versa. My client is a 50 year old boomer who runs a hotel booking system online by assembling various pieces of HTML files together with the GNU m4 utility and then serving that. He refuses to go the MVC route. In order to update front end JavaScript, I have to email it to him and hope he copies and pastes it in right.

I'm currently homeless and code on my laptop and this is my only client and my only source of income besides panhandling. I think he has given up on me though, we have been through several revisions and I messed it up last time because I did a shot of meth and heroin in the same syringe and injected it into a vein in my foot, and then tried to rewrite this piece of JavaScript. It ended up clearing all of the input fields on the page, not just the ones we wanted.

Attached: screenshot_1.png (1360x507, 88K)

So could you set up a function to handle the problematic part of the constructor and then always make sure to invoke that after you've created your object? Perhaps make a function that does something like

Foo initFoo() {
Foo foo = new Foo();
foo.init();
return foo;
}

Thanks my dude. I'll try that

Errrrr, Seems to work on my machine. Are you sure you're not calling actionPerformed in the constructor?

import javax.swing.JFrame;
import javax.swing.WindowConstants;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Foo extends JFrame implements ActionListener
{
public Foo() {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}

@Override
public void actionPerformed(ActionEvent event){
}
}

Original before I fucked it up.

Attached: screenshot_2.png (1366x570, 96K)

Nothing, but thanks for asking. I appreciate the thought.

Yes, I have actionPerformed outside the constructor as the following:
public class Foo extends JFrame implements ActionListener
{

Foo()
{
super(); //maybe it has something to do with super (invoking the upper class constructor before the sub class constructor statement)?
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

}


@Override
public void actionPerformed(ActionEvent a)
{

}

}


I know its just a warning and maybe in this case leaving as it is wont make much of a trouble. But I want to stick to the good practice since the beginning and to not acquire bad habits.

This should work. Your mileage may vary.

Removing an object:
// Fix next objects previous link
if ( rem == lastobj )
lastobj = (object_t*)rem->prv;
else
rem->nxt->prv = rem->prv;

// Fix previous objects next link
if ( rem == frstobj )
frstobj = (object_t*)rem->nxt;
else
rem->prv->nxt = rem->nxt;

// Set the free spot
rem->prv = freeobj;
freeobj = rem;

Adding an object:
// New object will take the free spot
(*new) = freeobj;
freeobj = (*new)->prv;

// Clear the info of the new object
memset ( (*new), 0, sizeof( *(*new) ) );

// Set the next link of the previous object
if ( lastobj )
lastobj->nxt = (*new);

// Set the previous link of the new object
(*new)->prv = lastobj;

// New object is now the last object in the list
lastobj = (*new);

// Set as the first object in the list, if applicable
if ( !frstobj )
frstobj = (*new);

// End
(*new)->active = true;
COUNT_OBJECTS++;

Running objects:
object_t *obj = frstobj;
do
{
// If, by whatever reason, object is null, STOP
if ( !obj )
break;

// Do stuff

// Move to next object
obj = (object_t*)obj->nxt;
} while ( obj );

Ah, it's your linter.

However I have another suggestion. Depending on what you're trying to do, you could probably just instantiate the frame without extending it. So:
JFrame foo = new JFrame("Foo");
foo.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

Then create another class that implements actionListener. You separate your concerns and avoid calling setDefaultCloseOperation in a constructor.

Perhaps the issue is that you've replaced callbacks with arrow functions, where `this` is bound to the outer context. There's a difference in behaviour. This would prevent jquery from finding the right elements.

Hmm, I wanted to extend but in the end, i guess this is the only good practice to avoid method overriding. Thank you so much. I'm becoming to hate Java

Is it pointless to waste your time with irrelevant meme languages that will never have the support that larger ones do? Memelang 9001 has 12 contributors while Python has a million. The more people interested in and working with a language means more people to help develop it.

Go die, nigger loving faggot.

Attached: commielogic.png (900x600, 112K)

It compiles, but your IDE does the right thing by warning you.

See Joshua Bloch's Effective Java, item 17 for more. It explains why this is a bad idea, and why you shouldn't do it.

Hint: the language isn't the problem, it's people like you extending types because you "wanted to" not because you needed to.

Attached: 1479965014672.png (664x648, 313K)

Capitalism is the system in which one is "literally a slave, figuratively free". Your boss has the freedom to fire you for any reason he so chooses, especially not being willing to "bend over" for him. You would think that unfair treatment of employees would lead companies to failure, however politics more so dictates who buys what so he will get away with. Your future employers will ask you why you were fired and if you tell them the truth they won't hire you either because it shows you aren't willing to bend over. Not having money is the equivalent of dying - your car gets repossessed, you are evicted from your apartment, you have nowhere to go.

fuck off

Attached: back2pol.jpg (546x700, 136K)

suck it commie
no one is forcing you to work for that boss you brainlet

Now you see all those rich people, hear stories of people making 300k+ and other ridiculously high amounts. Surely there is a way even YOU can work for it to attain it too, right? Wrong, this is mostly a lie to delude people. In capitalism the worker has to be paid not too little such that no one else is willing to do the job, and not too much because if he has that much money then in the future he would be able to save up enough to not have to work.

no u, faggot

bunch of mental gymnastics just
I make more than you ever will and I have 2M in the bank, no debt whatsoever etc. Thinking in retiring in my 40s. You can keep spewing shit and being lazy all you want, but dont come for help when you end up on the street.

Do you own a gun? Do you believe in hierarchy? inequality? sorry but if you said no to any of those questions you lack the martial capacity to the the violence necessary for your fucked up envy based morality to exist. You will continue to beg men with faith, who have less fear of death then you, to do the fighting for you.

I say, I pray for the day the dogs turn on their masters. Pinkos deserve death camps and are not to be tolerated.

Attached: 1496033060759.gif (420x315, 1.91M)

You probably sucked dick for it then.

>In capitalism the worker has to be paid not too little such that no one else is willing to do the job, and not too much because if he has that much money then in the future he would be able to save up enough to not have to work.

Lie.
People do retire in capitalism. In every socialist system and communism is quite the contrary. The workers are paid just so they can live and go to work the next day. There is an inheritance tax, so no daddy money and property for you. Also no property at all, leaving you without any physical assets to help your net worth. And all this is adding to fact that people retire only with government-owned pension fond paid by taxes (so you are depending on the whole country to feed your ass). You are not able to save even a penny, even if its legal, most of the time its illegal to have more than 2-3 months salary saved.

I believe that there are important things in life where if one believes in it then one has to be willing to go to "nuclear war" over it. Are you willing to fight to the bitter end for what you believe in? No, because this is what sets apart a man from a dog, and a coward ends up getting shot like the dog he is anyways.
>People do retire in capitalism. In every socialist system and communism is quite the contrary.
This is only if people are willing to bend over. Even then, this is not until after a lifetime of slavery, then the government cuts your benefits anyways.

I am free to do so. Its capitalism, sweety. Then I invested in a studio and made gay porn venue. Unlike you, who suck dick for good-boi-points given by the party leaders.

mises.org/power-market/cup-coffee-venezuela-now-costs-1-million-bolivars

> Even then, this is not until after a lifetime of slavery, then the government cuts your benefits anyways.
>a brainlet
If the government controls your money its not free market or capitalist at all, this is the literal definition of socialism.
Also, slavery is the opposite of freedom, not allowed in free capitalist society.
Now fuck off to /leftypol/

Perhaps I should be clear, what I was originally referring to is not truly the capitalism you are thinking of.
>If the government controls your money its not free market or capitalist at all, this is the literal definition of socialism.
>what is the federal reserve bank

>then the government cuts your benefits anyways.

What is stock market
What is banks
What is savings
What is gold bars
What is property

yes. portability and cross-platform have always been memes

You don't even believe in an afterlife. Your faith is in a materialist ideal of envy and revenge. Whats even more funny, you don't even acknowledge the basis of martial ideals, that inequality is natural and good. Yet, at the end of the day, you think you can fight men of faith? who believe instinctively that inequality is real and natural, and have inherent love and respect for hierarchy and natural order.

We have seen how tankies from both the US and the USSR lost to men of faith both in the 80s and now. God is way more powerful then any communist or envious Christ denier who is pissed because he has genital warts, and also cheats on his wife(Karl Marx).

Communist don't have kids, they don't have wealth, they lack the spark and drive of even evil men, and lack spiritual strength that transcends material need. They are obsessed with materialism.

Attached: slaveclass.jpg (599x322, 37K)

>Whats even more funny, you don't even acknowledge the basis of martial ideals, that inequality is natural and good.
This is pretty much the opposite of what I said. Surely people who make 300k+ at places like Google do so because of their talent, skills and contributions, right? Right....
>Yet, at the end of the day, you think you can fight men of faith?
I believe that when dealing with delusional people who think they are gods, that truth will win out in the end.
>who believe instinctively that inequality is real and natural, and have inherent love and respect for hierarchy and natural order.
What natural order? That the most immoral rise to the top?

>We have seen how tankies from both the US and the USSR lost to men of faith both in the 80s and now. God is way more powerful then any communist or envious Christ denier who is pissed because he has genital warts, and also cheats on his wife(Karl Marx).
And I suppose you think God is you?

Yes, dont you know about Ubermensch? You are kiddy.

Did Jow Forums get a /dpt/ or something?
Could have sworn this was Jow Forums.

MODS please move this shitfest to

for people who actually want to talk about programming

Is the OP image supposed to be a joke? A lot of degrees are scams, and they are NOT guaranteed to get you a job. People only correlate this due to the government brainwashing camps.

This thread belongs in the thrash.

What would be a good entry point if I wanted to learn how to work with databases?

How can I make a small GUI for a script?
I have a calibration / babbie tier troubleshooting helper script that runs in a terminal window. But ncurses is too scary for normie coworkers so I have to make a GUI for it. Something like those windows install wizards with some instructions, check boxes and "next"/"previous"/"cancel" buttons should be enough.
I'm starting to read qt tutorials. Am I on the good track?

Does anyone have an updated photo of that list of programming projects to flush out a portfolio?

really makes you think

Attached: hmmmm.png (256x345, 110K)

I swear JavaScriptBrainlets are too fucking stupid to learn another language. It's the only explanation for this kind of retardation.

For the builder pattern, when I want to pass some variable value to be used for the building process, is it passed into the concrete builder or the director?

>tfw to smart too learn any other language than c++

*blocks your path*
github.com/os-js/OS.js

encouraging people to enter the software industry was a mistake

I know and used professionally 8 other languages, but that's ok keep going I'm up for reading bullshit all day while in Jow Forums

low bars = low quality.
CS, EE, CE, and programming all need way higher requirements.

t. html, css, sass, xml, yaml, json, typescript ,and js

Comments extension for a forum system. Almost have a context button working. Need to get moving/deleting fully operational, and the admin panel done. Then make an ajax and non ajax show more button.

Then I guess I have to look at the post list on the posting page, check notifications, the mod cp, search results...

It's just one thing after another :/

>github.com/os-js/OS.js
>fil-håndtering

FFS, it's not even spelled that way.

FooBar/CMakeLists.txt : project FooBar
FooBar/module/Foo/CMakeLists.txt : project Foo
FooBar/module/Bar/CMakeLists.txt : project Bar

Is there any way to expose the FooBar/module/Foo/include and FooBar/module/Bar/include as include directories
by only using add_subdirectory() and without
include_directories(module/Foo/include)
include_directories(module/Bar/include)
??

os that runs inside the browser, the ultimate bloat

What would be the best to learn for creating top tier worms, trojans, spywares, viruses and whatnot?

ASM.
There's really no alternative.

Some of the most prolific malware was written in shit like VBA.
The language doesn't _really_ matter, but not having to drag around a runtime is generally good.
ASM is more for exploiting existing software and whatnot.

This strawman has a point. Too many people with worthless degrees like lesbian dance theory and underwater basket weaving these days.

>ASM is more for exploiting existing software and whatnot.
which is literally what black hatting is about.

lmao imagine being this retarded

Can you recommend some books for it, mate?

not really as i don't do much asm my self.
But you cold probably just search amazon for top asm books and pirate the pdfs.

Here's a challenge: determine how significant is the difference in cycles between reading a member of an unaligned, packed structure and an aligned, padded structure.
Of course you can just search Stack Overflow for the answer, but that's no fun!

Attached: LAND.png (1024x768, 475K)

>in cycles
but why

what is asm?

alternative secular medicine.

lying nigger

And what would be the best to learn for creating top tier online bots?

>top tier online bots?
for gamus?
doesn't really matter, any system langs will do.
but you should kill yourself first for even wanting to.

int width=0;
int heigth=0;
cin >> width;
cin >> heigth;

CField *field[width][heigth];
for(int x=0;x>width;x++)
{
for(int y=0;y>heigth;y++)
{
field[x][y] = new CField;
field[x][y] = {NULL};
}
}
What's wrong with this? It doesn't construct any instances...it complies and runs, but the constructor isn't called at all.

Not for games, mate. Let's say for other "things".
What system languages to be specific?

>field[x][y] = {NULL};
nigga wat

>What system languages to be specific?
whichever one you want, it literally does not matter.
C++ would probably have the most resources/examples though.

;)

Why is php so popular for imageboard software?

>What's wrong with this?
You wrote it in C++.

bump. what is asm?

Ok that might've been unnecessary, yet removing it doesn't make it work.

altering self's mind

come on, i thought this general is supposed to be helpful

Check your for loop conditions.