/dpt/ - Daily Programming Thread

What have you been working on, Sup Forums?

Old thread:

Other urls found in this thread:

robmiles.com/c-yellow-book/
github.com/JadeMatrix/SHOW
packagecontrol.io/browse/labels/color scheme
youtube.com/watch?v=LIb3L4vKZ7U
youtube.com/watch?v=ea5DiCg8HOY
beacon.org/Transgender-Warriors-P463.aspx
twitter.com/AnonBabble

my yellowbook is 6.4 july 2015

Does anyone here know how to format JLabels?
new JLabel("" + String.format("%11c%s", ' ', "Cunt") + "" + String.format("%12c%s",' ', "Fag") + "");
%11c and %12c don't make any room.
I really don't want to make 3 JLabels for 3 lines that I need

think you can upload it?

Is it not real programming if I use SFML for my synthesizer? I would use PortAudio but I'm too much of a brainlet.

robmiles.com/c-yellow-book/

new JLabel("" + String.format("%s%s", " ", "Cunt");
Even this doesn't work, why is is so hard to make space in JLabels?

Oh nice

>mfw that guy bought it

user extra space doesn’t do anything in html usually. learn about styles or at least tables

for $1

I didn't know that but still I'm using it inside String,format so shouldn't string insert itself with fixed spaces?

>C#
been reading. but need some supplement.
in lack of teacher/class/tutor/mentor, probably youtube tutorials/talks.
Sup Forums approved recommendations?
anything like freecodecamp for C#?

This is so shit. If I remove formatting works but JLabel refuses to new line even with line separator

>x = 1[ptr]
Can someone please explain this one to me?

It's explained right there senpai. *(x + y), x[y] and y[x] are all equivalent in C.

i’m only saying that in html, outside of a , one space in the source will render the same as two spaces in the source

offset the address 1 by ptr and dereference it

Ah thanks so much

wrong

github.com/JadeMatrix/SHOW
>Does it support aio?
Async I/O? Yeah, you can use it pretty much any way you want, it's pretty low-level though.

>How do I make custom color scheme
I just looked at some of the default ones to see how they were build, then wrote my own. Sublime has a shortcut to show the syntax scope of where your cursor is, which is important for debugging schemes or making language-specific changes. You can also look up more schemes here packagecontrol.io/browse/labels/color scheme

youtube.com/watch?v=LIb3L4vKZ7U
Holy fuck Andrei's hilarious

i invested $80 in bitcoin back in the day.

now i have $1000.

how much was the profit?

The face of a man you can trust

I think I'm falling in love guys please send help quick

why must my life be so fucking awful

>shilling D
The hype's over. It's dead senpai.

wtf am i looking at?
video? link dat shit!

Hang on user

No idea haven't watched it. Google says here's the vid youtube.com/watch?v=ea5DiCg8HOY

why can't GNU fags just die ?

...

Anybody can recommend a good Rust book?

fucking C++?
BARF!

beacon.org/Transgender-Warriors-P463.aspx

Guys
A serious question to all programmers, especially long term programmer,
My work place is so crowded and have some noise all the time, i use music but it fucks my concentrate if i try to learn new things which i try to learn python. If i do not use music i cant even read a word without distracted from outside. What the fuck man, how you guys go with it without disracted ? I can not concentrate to read a single sentence.

>Grav-mass
>Hurr durr religion is dumb xd
>I'll make fun of it by celebrating a religious guy, that will show them!

is it possible to do recursive MACRO in C?
for example:
header.h:
#define IMPORT_IO #include
#define IMPORT_LIB #include
#define IMPORT_ALL IMPORT_IO IMPORT_LIB

main.c:
#include "header.h"
IMPORT_ALL
int main()
{
//some stuff;
}

Why don't you try it out faggot

only music with english lyrics distracts me; electronic or gook music is fine

electronic music is fine and i love it but if you listen all day after 2 hour, i find myself stop doing my job and listening music.

Bring a speaker to your workplace, and blast a looping caramell dansen with it to the whole room

this
do it faget

I drew a triangle with Haskell and openGL.

>Java course
>Professor says to use Eclipse for every project
>there are so many crutches in Eclipse that code pretty much writes itself
>exam coming up and I can't remember names of packages and lots of syntax

template
class Defer final
{
public:
Defer(T functor): functor(functor) {};
~Defer() { functor(); };
private:
T functor;
};

void some_fn()
{
FILE *fp = fopen("foo.txt", "r");
Defer d = [=](){ fclose(fp); };

/* ... */

return; // will free the FILE*
}
Does a class like this already exist in the C++ standard library?

I have exactly the same problem. I work in an open office and it's considered normal to make phone calls at your desk and talk with other coworkers. To make things worse, people move around on those chink segways.
I tried music, but most genres distract a lot. Any kind of metal is extremely distracting. J-Pop and K-pop are acceptable. So is some types of electronic music. What works best for me, call me a degenerate idgaf, is ASMR without talking.

r u doin VIDEOGAMEZ

You can use a standard smart pointer with custom deleter for this

std::shared_ptr fp(fopen("foo.txt"), [](void* fp){ fclose((FILE*) fp); });

Where the fuck do you work?
Over here you could file report to government organization that checks workplace for quality standards

Third world country, Turkey
Fuck open office, i can not say people to stfu because of office policy, i must be nice to others. they do not work and they dont let me work. I have 3 woman at my back in a line, they talk too much i will change my place. I can not fucking concantrate and it make me moist.
I heard some pills make you concentrate while in long term using them fucks your brain. It creates a addiction in order to concentrate and in long term you can not concentrate to any shit like alzheimer. Adhd pilss i guess, i have adhd too, fuck

dumb frogposter

open office is common here in america, too. tech workers are bad at organizing against crap like this

Maybe
I'm also thinking about generative arts, though.

>Third world country, Turkey
Cool, we are arch enemies (I'm Dutch) according to our governments.
>Fuck open office, i can not say people to stfu because of office policy, i must be nice to others. they do not work and they dont let me work. I have 3 woman at my back in a line, they talk too much i will change my place. I can not fucking concantrate and it make me moist. I heard some pills make you concentrate while in long term using them fucks your brain. It creates a addiction in order to concentrate and in long term you can not concentrate to any shit like alzheimer. Adhd pilss i guess, i have adhd too, fuck
You have to keep your sanity. Don't do drugs, medication or whatever you want to call them. It'll only make things worse in the long run. It sounds hard, but try to ignore them.
I usually put on my headphones after lunch otherwise I'll lose my sanity (you're turning moist instead?) until the end of my work day. If it's really that bad, I'll put on my headphones for the entire day. I try not to do that, otherwise you're considered to be anti social.

Saying that insertion sort in the worst case scenario has a running time of Θ(n^2) is correct. But saying that insertion sort has a running time of Θ(n^2) is wrong because depending on the input, insertion sort can have a running time of Θ(n). However, saying that insertion sort has a running time of O(n^2) is okay because regardless of the input, it is still bounded by O(n^2).

Is this correct?

Yes

you would expect that you could read your own code you wrote a few days ago like you would read a book but it's not like that. I actually have to put effort into understanding my own code from a few days ago.


Is this normal or am I retarded?

comment your code

are you a novice?

yes.

Yes, and you can exemplify that statement with posting average/best case vs. worst case scenarios.

lol
fuck government man, i like all decent people.
I know how to be considered anti social, i was off for a 6 month so i am very slow and want to get fast so fast. My colligues generally decent people but they want to talk too much and i do not want it. All people want to talk but i am not very talk people. I love coding more than talk.

It's normal, and you'll learn.

>I love coding more than talk.
Same. But remember, being social is equally important. Simply hook into an existing discussion or ask them what they did or will do in their weekend. That's sufficient to be considered a 'team player'.

what the heck is this case in a switch statement with ... in it
in C

i think what's strange here is that the O(n), Ω(n) and Θ(n) contain functions f(n). when you say "run time" without any modifier, what does f(n) mean?

it's not standard C it's an extension

that's another extension. just don't

Try closing the html tag, adding a \n and then opening a new one

.
.
.
;
.
.


Coupla hours at night, coupla hours at noon. So far the best method of keeping my sanity in check.

Gotta sleep twice though, at ~6000 - 1200 and ~1800-2400, and you can't do a fixed amount of hrs/day.
Speaking from a hobbyist/semi-freelance perspective though, so take it with a bit of salt.

How can I believe in my programming skills?

I got offered a potential job and a chance to interview for it. However I sabatoged myself because I have no confidence in my programming skills. I don't think I would have passed the coding part of the interview so I didn't bother even replying. I just don't feel I deserve to make it until I feel like a master programmer.

Lol you are right man, you are considered social IF YOU ask them personal questions. I personally exploit personal relations, it is like a coding, all people like that you care for them with asking personal questions and pretend you care them. I can even write a psudocode for exploit personal relations. I dont even feel anything, all seem nonsense to me at all. This is a spiritual topic now because it incapsulate the meaning of life and meaning of existance. Whatever, too much of topic.
I just dont care shit of anybody and nobody care shit of me because this is a two sided caring. If you dont care people, people dont care you.

which type use for really low floating numbers?
I wrote something to calculate 2 to the power of n
#include
#include
using namespace std;

int potegowanie(int n) {
double b; long long a;
if (n

Working with people suck very much dude, i guess freelance is better.
Do you suggest freelance over working in a company?

>2 to the power of n
You're doing it wrong.
int pow2(int n)
{
return 1

Not enough experience to give advice on that topic.

I'm not a master schemer like you, but I also have a game plan. I try to find topics my coworkers are interested in. If the conversation dies quickly, than you've picked a bad topic. It sounds very synthetic, but it helps me in talking to others.

how complicated would it be to implement this

>"Write number to the power of you want to make 2: "
What the fuck?

pow2(-1)

12-27 20:35:30.208 1447 1447 D vndksupport: Loading /vendor/lib/hw/camera.tegra.so from current namespace instead of sphal namespace.
12-27 20:35:30.232 1447 1447 E HAL : load: module=/vendor/lib/hw/camera.tegra.so
12-27 20:35:30.232 1447 1447 E HAL : dlopen failed: cannot locate symbol "_ZN6google8protobuf8internal21StringTypeHandlerBase3NewEv" referenced by "/system/vendor/lib/libscf.so"...
12-27 20:35:30.232 1447 1447 E [email protected]: Could not load camera HAL module: -22 (Invalid argument)
12-27 20:35:30.232 1447 1447 E [email protected]: HIDL_FETCH_ICameraProvider: camera provider init failed!

> i know jack shit about C, C++, shimming and how to debug that shit
>i just want android 8.1

dumb frogposter

Bah, yes, you're correct.

I just hate people with simple minds, i just dont like the things they want to talk about. I feel inferiority over them because they think very simple things. They are way more happy than i am. Maybe they are right.
Yes, they all love to talk in some topics, but listen, everyone loves to talk about themselves. if you ask simple personal questions about their current life situations, you got them from their balls. they feel like you CARE them even you are or not ^_^

Although, I would like to point out that it's nonsensical to do roots for integers.

int pow2(int n)
{
if (n < 0) return 0; // 2^n where n is < 0 will always be rounded down to 0
else return 1

Is there any rule of thumb of casting in C, to know whenever the value will be casted bitwisely or converted so it contain the same value?

Nope. Better learn the rules fag.

What if you shift more than 8 bits? This behaves differently in different languages so it's still not perfect

>What if you shift more than 8 bits
ints are at least 16 bits wide, so not a problem.

What do you mean?
#include
#include
using namespace std;

int pow2(int n)
{
return 1

You're right, but let's say you shift 100 bits. Still a problem

Because you're not telling it to output anything, genious

...

...

not true
i checked both
int pow2(int n)
{
cout

int pow2(int n) {
return 1

Make a boundary for sizeof(int) * CHAR_BIT then in order to prevent overflows.

Well, some people are harder to please than others. I feel like normies are easier to be content with themselves. Going out, watching stuff on Netflix etc. Others may find pleasure in achievements like learning a new skill or mastering an existing one.
Your advice on letting them talk about themselves sounds tempting. I'll give it a try once I'm back in the office. My biggest concern is losing my pokerface though.

wrong
>2 to the power of -2 equals 1073741824

You're doing it wrong. return 1