/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

youtube.com/watch?v=rop0W4QDOUI
youtube.com/watch?v=17WoOqgXsRM
twitter.com/SFWRedditImages

Lisp is the most powerful programming language.

capture the flag for middle schoolers

python and jinja2 for my free programming class im taking

>tfw learning 68k asm

Daily reminder Java is the language of Sup Forums

>what is unironically voting

Job applications... hate how I have to reduce myself a product with a sales pitch to get hired.

Thank you for using an animge image.

Lain agrees!

...

Be a NEET.

Hey Sup Forums I'm wondering if what I'm doing is okay. It works but I was wondering if there's a better way.
I need a random String ( From "00" to "99" ). So I generate an int then add the "0".


String spaceLocation;
Random r = new Random();

int randomNum = r.nextInt((99 - 0) + 1) + 0;
if(randomNum < 10){
spaceLocation = "0" + randomNum;
}
else{
spaceLocation = "" + randomNum;
}

You're asking another company to give you money.
I think they have the right to be picky.

With the amount of shilling going on I always thought there would be more Rust fags

This anime is actually really cute I'm about 5 episodes in

Picky sure, but I have to hand myself to them on a plate. Working is fine, I just hate the application process. It's degrading.

I'd like a Rust programmer to show me a function that correlates it's how trendy it is vs. how much it's actually used for anything at scale

>Complains but gives no better alternative to the process.

Doesn't surprise me that 40% of the people here only know Java.

how do you give an alternative to trying to get hired some place? you mean like live off welfare and drink 40's all day and smoke muh blunt?

Find work that needs to be done. Do work on it subject to the review of others. Get paid. Like a more structured version of what occurs in open source development.

turns out the majority of people are mediocre. who knew

Also this whole sentiment is bullshit
>whatcha gunna do about it, you aren't in charge!
>hahaha I'm a prick!

...

No, I'm not trying to be harsh.
I'm saying if (You) think the whole 'selling yourself in an interview' process is "degrading"
at least try to come up with an alternative to the current interview process to which you dislike so much
otherwise it must be the only option so why complain?

tl;dr :
Why complain about things without any idea of a better alternative?

> be me
> be getting interviewed
> lean over to interviewer
> "you know, I think I've got a better way to do this interview".
> interviewer shows me the door.
don't show up to a place and try to change process. especially not at your own interview you dipwad

Reposting I need to store an int in a char array which will later be printed as a string, and I want to make sure I have enough space to store it, I found this macro and it works fine but I'm having trouble figuring out why it works.
#define ENOUGH ((CHAR_BIT * sizeof(int) - 1) / 3 + 2)
The size of an int in bytes * how many bits per char, gives us the amount of bits we need to store any int in a char array, -1bit for the sign bit. Now the /3 part confuses me, why 3? I'm assuming the +2 is for the null terminator + the sign as a character (not a bit). Why are they dividing bits by 3?

I know I could use sprintf to do this instead but I still want to know why this works.

How do I get hired for programming work?
I went to a bunch of job fairs and they're all for entry level scrub work and the IT openings all wanted certs in plugging in routers, and not software dev.

The better alternative is to compare dick length. That isn't going to work now is it moron?

my advice would be to build a portfolio of things you are proud of, and if possible some copyrights. I don't need to degrade myself for interviewers--I've got enough work to show that it speaks for itself and they want it.

List DoThing(int[] i)
{
return new List()
{
new int[] { 1, 2 },
new int[] { -1, 2 },
new int[] { 1, -2 },
new int[] { -1, -2 },
new int[] { -2, -1 },
new int[] { 2, 1 },
new int[] { -2, 1 },
new int[] { 2, -1 }
}
.Select(o => new int[]
{
o[0] + i[0], o[1] + i[1]
})
.Where(
o =>
(o[0] > 0 && o[1] > 0) &&
(o[0]

buf[floor(log(n) / log(10)) + 2];

>Why complain about things without any idea of a better alternative?
In hopes someone will present one.

There is a S2 later this year. Enjoy.

What is this Recursion? Trying to change the process from the process? I'm talking right now on this board; in this thread.

If you're going to complain about something give an alternative otherwise it goes nowhere and has no use.

or, just complain. It's an user image board not a self help seminar. none of this is going anywhere or has any use to begin with

>people aren't allowed to complain about things they don't like
You would be a terrible boyfriend.
Also you are replying to multiple people.

I'm willing to discuss the work I've done. They can poke and prod and I'm sure that my experience more than qualifies me for most of the positions I apply to. But the whole "write a grovelling cover letter", "edit your resume so that it's only one page. No one wants to spend more than 2 minutes looking at you", "put in plenty of buzzwords in them because more than likely it's going straight into a machine and no one will actually look at your cover letter because a probably poorly written algo graded your resume an 89", etc. puts us at the level of commodities.

>submit resume
>they don't even look at my github
>check my traffic stats, literally no visits in weeks
>"sorry user we've decided not to move forward with your resume"
>literally 274 resume submissions and this is the first time i've ever gotten ANY response

Had not thought of that, I retract what I had said :^)

274 resume submissions? what sort of meme language do you write in? I write Python, Lisp, C, Ruby and build infra for AWS and have recruiters begging to suck my dick daily

Am i hurting myself by using MATLAB for arrays? How much harder is array shit in other languages?

I appreciate the alternative but I'm still curious as to why the compile time constant macro works. Specifically why the magic number 3, how did they get that number, as in what does it represent? It's converting the bit count into a character count somehow, but why divide by 3?

I'm going to make the excuse that its 4AM where I am and I wasn't thinking straight.
I agree with user on the first post about job interviews. I don't know where I was going with my retort.
Although showed me the light.

Matlab is made to do arrays and is probably the best language available to do arrays

you should use numpy and scipy with Python. it's fucking great for arrays. really fast too (libs are written in C and Fortran I think?)

Yes but when i learn other languages how do arrays work differently? I mean syntactically speaking. Say C++

Most languages have different syntax, that's not an issue... Arrays are arrays and loops are loops, etc. If you know one, with little effort you know them all.

Every second spent on Matlab correspond to losing one IQ point.

Straw man argument.

Goddamn, my IQ is like -10000 then. It's a wonder I'm breathing...

I don't see you giving me a better alternative to my complain. Why you bitching?

Scratch that. It must be like -1000000. Yes, it took me that long to correct myself. It takes a while for MATLAB to load...

The better alternative to measuring dick length is
the regular interview process employers currently use.
Also stating fallacy in arguments isn't "bitching"; if anything is educating.
I don't if you do but I get nothing out of this 'online debate'. :^)

Wrong.

Random r = new Random();
String spaceLocation = String.format("%02d", r.nextInt(100));

Thank you user, I had forgot about formatting.

Picture this.

You're a NEET who wakes up and goes to sleep at different times everyday which makes your sleeping and awake patterns pretty much different day by day

I live like this and I have trouble knowing what time of the day it is for me compared to a normal persons day who woke up at at 10:00.

If a person wakes up at 10:00 then they would have lunch at around 13:00. This means if I wake up at 15:00 I would have lunch at 18:00.

This program would show me the relative time of my day compared to a normal person so I can create a schedule for studying, having meals at normal times and knowing when to sleep.

What do you guys think? Would it be useful to you?

you sound like a new grad looking for his first job

wouldn't this just be a counter starting from 0 at the moment you woke up?

Wow, stellar detective work.

I've had internships before. I've never been comfortable with them.

I find it pretty easy to wake up at the same time when I have non-negotiable obligations to show up at a certain time and place.
Stop being a fucking neet, people weren't meant to live this way.
Even your hunter gatherer ancestors would get up at dawn to forage for food or else they'd die of hunger.

Sounds like something you could make, but you shouldn't put on your resume...

I was thinking of matching the minutes too

fuck off normie

you can schedule events with alarms on your phone's calendar. it is indeed useful to me.

This sounds like it would further one's spiral into NEETdom.
Try making it in Excel/Calc first, and then implement in a program.

>Stop being a fucking neet
It's easy to say that, but bad habits die hard, user. This is especially hard for people who've become NEETs in the first place

>normie
Oh the ironing

To me; no.
But I think I understand your idea. You create a routine based off counting the amount of time passed since you woke up.
Not that I'm doctor or anything but I've lived liked you and I got nothing done, I'm more efficient when I'm awake/asleep at the same times everyday.

Maybe you should create a game out of living a healthful life.
E.G
Congrats you got up early now you can play a Video Game ( Or other positive stimuli )
Congrats you walked n meters you can now eat a slice of cake.

Train people to be better people.
This would be more beneficial to everyone not just NEETs.

Enjoy blowing your brains out at 29

Question: Why is Python's class system so fucking stupid?

idk about this guy but thats 1 year away for me

nice b8 m8. you havin' problems writing a python class?

More like killing innocents through resentment because they felt they were treated unfairly. They're Cain's Children.

Because it's not CLOS.

No, just curious why literally every single method within a class needs "self", why there's no private variables/encapsulation.

I like Python, just can't stand how much of a bandaid solution its class system looks like

>29
Why would someone kill themselves when they're one year removed from gaining magical powers?

Congratulations!

>they felt they were treated unfairly
Most of them were. I won't debate why because this is /dpt/, but go read some stories from wizards.

Guido doesn't know what he's doing. Everything was made kind of ad-hoc. It's the product of a "grown" language.

The mental illness that prevented them from approaching the opposite sex also leads them to suicide.

I've read a few, all I see are weak ineffective people with mental deformities being weeded from the gene pool.

I guess? I'm guessing you write Java. You can emulate Java's encapsulation using the __ prefix on your class methods. That's not to say it's perfect but neither is Java's.

also consider the following case where self makes a difference:
```
>>> def my_method():
... pass
...
>>> class MyClass():
... def __init__(self):
... self.first = my_method()
... self.second = self.my_method()
...
... def my_method(self):
... pass
...
...
>>>
```

Got damn that's ugly.

I fucked up that formatting bad but you get my point.

This is really cool
youtube.com/watch?v=rop0W4QDOUI

I'm not saying they weren't treated unfairly. I'm saying they're resentful either way.
The feeling of being treated unfairly is not bound by actually being treated unfairly is what I mean.
To keep it related to /dpt/ I wrote it in Java.
[spoiler][/spoiler]
boolean anonFeelsTreatedUnfairly;
boolean anonIsTreatedUnfairly;

if(anonFeelsTreatedUnfairly && anonIsTreatedUnfairly){
System.out.println("RESENTFUL");
}
else if(anonFeelsTreatedUnfairly && !anonIsTreatedUnfairly ){
System.out.println("RESENTFUL");
}

if(!anonFeelsTreatedUnfairly && anonIsTreatedUnfairly){
System.out.println("FINE");
}
else if(!anonFeelsTreatedUnfairly && !anonIsTreatedUnfairly ){
System.out.println("FINE");
}

the not fucked up version
>>> def my_method():
... pass
...
>>> class MyClass():
... def __init__(self):
... self.first = my_method()
... self.second = self.my_method()
...
... def my_method(self):
... pass
...
...

>tfw Umaru-chan season 2 has been confirmed

Thank you for the clarification (not trying to be sacastic by the way). Though more often than not, such individuals were treated unfairly due to the environment they grew up in and/or their mental state; as such their feelings are justified most of the time.
The current state of western society is such that wizards and similar fall through the cracks. Few are aware or care because the number doesn't justify any special action, the "victims" are hard to have empathy for. Whether this is wrong or not is up for debate. Regardless, I have no idea why I'm talking about this, and I'm going to stop.
/* /dpt/-related */
int wizard(unsigned age, int virgin) {
return age >= 30 && virgin ? 1 : 0;
}

return (age >= 30 && virgin);

Lisp is syntactic purity.

God damn I'm retarded.

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Numerics.Generic_Elementary_Functions;

procedure Wew is

package Float_Functions is new Ada.Numerics.Generic_Elementary_Functions(Long_Float);
use Float_Functions;

subtype Check_Range is Positive range 1 .. 40_000;

begin
for I in Check_Range loop
declare
Iterator : Natural := Positive(Long_Float'Ceiling(Long_Float(I)**(0.666)));
Goal : Positive := I**(2);
begin
while Iterator*(Iterator+1)*(Iterator+2) + 1 >= Goal loop
if Iterator*(Iterator+1)*(Iterator+2) + 1 = Goal then
Put_Line(
Integer'Image(I) & " because" &
Integer'Image(Goal) & " =" &
Integer'Image(Iterator) & " *" &
Integer'Image(Iterator+1) & " *" &
Integer'Image(Iterator+2) &
" + 1"
);
exit;
end if;
Iterator := Iterator - 1;
end loop;
end;
end loop;
end Wew;

I was gonna learn Common Lisp and my friend said "oh man thats not what Lisp used to be" wtf does he mean and should I go ahead and install SBCL?

...

PYTHON IS THE MOST POWERFUL PROGRAMMING LANGUAGE

...

youtube.com/watch?v=17WoOqgXsRM

*gets no users or useful libraries*
*decays into obscurity*

that was pretty cool, actually

Yeah the 50,000x50,0000 pixel maze was impressive

I can't believe it was taking him over an hour.
import math
num = 0
i = 1
j = 2
k = 3
while(num < 4):
sum = i*j*k + 1
if math.sqrt(sum) == math.floor(math.sqrt(sum)):
num += 1
print math.sqrt(sum), i, j, k
i = j
j = k
k += 1


As an aside, I keep seeing this Jupyter Notebooks with %%time at the top, and that allows them to output something like:
CPU times: user 26.7 s, sys: 1.21 s, total: 27.9 s
Wall time: 28.1 s

What module is that? There is nothing in time itself that formats that well.