/dpt/ - Daily Programming Thread

old thread: What are you working on, Jow Forums-chan?

Attached: ferris2981.png (1241x1071, 1.32M)

Other urls found in this thread:

leetcode.com/problems/reverse-integer/
en.cppreference.com/w/cpp/io/ios_base/sync_with_stdio
pastebin.com/bCNYK5q2
twitter.com/SFWRedditImages

nothing atm

Why the fuck do you have that gay motherfucker in this thread?

Jow Forums is full of gay motherfuckers who aren't even as hot as felix

I'm working on a compose function in python which handles tuples correctly

How do we solve the Anime problem in the programming community?

Attached: yvazf0ednwsz.png (656x654, 294K)

I need a good C++ IDE
any?

in haskell this is just compose f g x = f (g x)

i want to marry felix

good tips for a junior python position interview?

I never met any gay programmers irl, what is this nonsense? Is there programming board without many gays?

the problem being the lack of anime obviously
i vote we fire and reject all job applications from anyone over the age of 30 who isn't still living with their parents
and if their desktop wallpaper isn't a loli or trap we jail them

There is nothing to solve

gpu-accelerated software radio decoding

no its not

JavaScript rocks!

Attached: js-rocks.png (1000x494, 369K)

the SQLite forums

Who here only accepts pull requests and feature suggestions from users with anime profile pics?

Attached: burrito king.png (1011x764, 681K)

Same here. None of them seemed to enjoy me sucking their dicks at all.

I'm playing around with terminal games again now that I've discovered ncurses and I'm thinking through ways of timing. Is there a portable and simple timing mechanism in C, or do I have to use sleep and usleep and all that?

what is a compose funciton

i usually just completely ignore those people

visual studio

meant for

compose(f, g) returns a function f(g)

why programming is this hard?

Attached: untitled.png (1065x502, 271K)

>get hired as entry level dev
>senior says it is relaxed and he slacks off all the time
>take his word for it
>slack off most the day and work for the last two hours
>boss says I'm fast
>be assigned project
>scope is big, no set deadline
>spending entire weeks not working
>6 months later
>barely started it
I am so bad at doing this. I think I need to find a new job before my boss finds out I did nothing for the past 6 months

I enjoy both C++ and Python

sounds pretty based desu but jobs like that drain your soul
i've had a job like that I slacked off all day and got lots of "great work user" its super weird and made me feel really anxious and worried I'd get caught and laid I literally started feeling suicidal until I found a non-joke job

>get laid
I mean get laid off
I did eventually get laid we're all gonna make it user

How do you even manage to goof off this much for half a year and not draw suspicion from anyone?
Your project can't possibly be very important if nobody has checked on your progress.

Put your job on upwork or something and pay a pajeet 1/4 or your wage to do it for you.

which site?

Leetcode. here's mine. I wrote it in C. It says I beat 98%. I cant go on Jow Forums at work so heres a phone screenshot

Attached: IMG_20181023_153213.jpg (1149x2043, 473K)

leetcode.com/problems/reverse-integer/

i have improved mine and now beat 100% (4 ms)

static const void* ___ = []() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
return nullptr;
}();

class Solution {
public:
int reverse(int x)
{
if (x < 10 && x > -10)
return x;

const auto MAX = 2147483647 / 10;
const auto MIN = -2147483648 / 10;
int n = 0;

while(x)
{
if (n > MAX || n < MIN)
return 0;
n *= 10;
n += x % 10;
x /= 10;
}
return n;
}
};

>static const void* ___ = []() {
> ios::sync_with_stdio(false);
> cin.tie(nullptr);
> return nullptr;
>}();
Literally what the fuck syntax vomit does this do
This is why nobody likes C++

How can I output numbers to a list in python

And then check to see if those numbers are prime

I'm trying to make my first program in python rn

It statically creates a lambda and calls it. Basically just means that ios::sync_with_stdio and cin.tie are called once without using the main function.

it's a closure in the global scope and thus executed before main()

en.cppreference.com/w/cpp/io/ios_base/sync_with_stdio

"Sets whether the standard C++ streams are synchronized to the standard C streams after each input/output operation."

by turning off the synchronization, IO operations are much faster.

Isn't that kind of cheating? Sure, anyone can do it, but you're modifying the testing environment instead of improving the actual algorithm.

CLion

everyone does it

>Isn't that kind of cheating?
it's not, i am enabling true c++ performance by disabling legacy compatibility with C.

>everyone does it
Oh okay. Kind of weird that they wouldn't already have an optimal environment set up.

Or why they even test including I/O overhead in the first place instead of just profiling the actual function.

Upgrading scripts from python 2 to python 3, and trying to figure out if __init__.py files really are just shitty wrapper bandaids for the import implementation.

I use emacs
People say it's a text editor but with add-ons it can do extremely IDE-like shit like showing which line you are on while debugging, intelligent auto-complete, jump to definition, open man page for STD function, etc

Visual Studio
Visual Studio Code
Intelli J IDE
Eclipse

All of those are usable, just depends on what you're trying to do really. Big software will require more sophisticated tools.

If you're just a novice, just use Visual Studio Code. You dodn't even tell us what OS you're using..

the problem is that leetcode use printf when testing C but cout when testing c++, giving a bias towards C. it shall use printf for both.

they probably wrote a generic test for every programming language based on text input and output

problem text input -> user program -> verify text output.

What does say the philosophy of UNIX, user? That you shall write programs to handle text streams, because text is a universal interface. never forget that.

Absolutely disgusting.

why?

Because when profiling an algorithm you don't include anything unnecessary?

you are confusing an algorithm with an actual program. you may measure the execution of a program in time and in memory consumption but an algorithm is analyzed for its complexity (big o notation).

The IO overhead is the same for everyone.

Hey look, buddy, I'm an Engineer. That means I solve problems. Not problems like 'what is beauty?', because that would fall within the purview of your conundrums of philosophy. I solve practical problems.

Attached: Screenshot_20181024-004917.png (1080x1920, 249K)

The implementation of the algorithm, I mean. Not the stuff around it like I/O.

>The IO overhead is the same for everyone.
Well apparently not if you don't add that hack.

if you're better than 54% you're better than average, stop crying

I wanna be the very best
That no one ever was

but /dpt/ and dailyprog only accept the finest.

Switch to python and use dictionaries for everything. You automatically come in better than 99.9% of the field every time

Seems like it fails for numbers that reverse to 2147483647 < x < 21474836479 (and similarly on the negative side) since the check passes but the final addition overflows.

leetcode's timer is complete crap anyway. Only 4 ms resolution and not even stable at that. If you don't like your first result, try just submitting again and see if it does better.

no test case failed, it's all that matter to me.

I want to learn C but I can't find the official website nor the official documentation, can you help me out Jow Forums?

I just used long ints and then truncated the results at the end.

There is none.

Man pages

The only "official" documentation is the standard itself.

fuck java

and fuck white ppl

no, fuck you indian shitskin

Powershell script to move exchange mailboxes from an archive mailbox db back to a database that has the most available space. Shits kicking my ass. I have all the error correction in. Just keep getting errors trying to store
$box = get-mailbox -database archivedb

Into for loop that basically says
Pulls the identity of each mailbox and transfer to volume with free space is Max. Getting datatype errors even though powershell is dynamically typed.

Making a command line torrent client. Using libtorrent-rasterbar for the backend.

Attached: 1538863851468.png (480x480, 292K)

Feel the same

Got hired as a "dev-ops" guy for this company. I came in and built a bunch of stuff to audit and automate some of our work but lately I have just been goofing off doing sys admin work to pass the time.

>C++

Attached: 1497214889403.jpg (475x530, 47K)

>it's another command line torrent client episode

>Let me just use a decent C bittorrent library with loads of features I need
In all seriousness, I like C++ and I am gonna be incorporating it into Qt later on anyway.
But mine will have cute anime girl names making it better

Attached: 1539150245570.jpg (1619x1725, 474K)

In bash it's just cat /dev/urandom > /dev/null

Are these good definitions for CL's push and pop?
(define-macro (push! x place)
`(set! ,place (cons ,x ,place)))

(define-macro (pop! place)
`(let ((pop (car ,place)))
(set! ,place (cdr ,place))
pop))

Kill all the dumb frogposter.

Copy pasting this solution is giving me 12ms. Just using std::to_string, std::reverse, std::stoll and check that the result is in bounds is giving me 8ms.

Wrote a Brainfuck interpreter in LSL. pastebin.com/bCNYK5q2

Kill all the "Kill all the dumb frogposter" posters

Attached: 1537960079223.png (427x576, 310K)

halfdelay and timeout

You're not welcome here, redditor.

4ms here.

Attached: untitled.png (1670x656, 123K)

>What are you working on, Jow Forums-chan?
a markov chain, going to feed it terry blogs so I can have my own shitposting terry. the initial stuff is done, I just have to add more states for punctuation and stuff.

Attached: 2018-10-24_02:12:25.png (997x67, 1K)

>tfw java
>tfw typescript
>tfw C
I hope you guys are just having fun out there and using comfy languages.

Attached: tobey-maguire-1.jpg (300x300, 22K)

fuck off

I once did a markov chain seeded of off Jow Forums, good times
couldnt tune it to create remotely sensible posts but I could seed it from different boards. Jow Forums's markov chain was very unique.

can you do it in emacs please

I was stuck on this one for a while because I didn't read that they wanted it to return zero if the reversed integer was greater than 2^31 - 1.

Attached: 2018-10-23-171345_948x471_scrot.png (948x471, 47K)

I feel like using long is cheating.

Jumps between 8 and 12 for me. I wonder if it's dependent on client hardware.

Keep hitting the frogposters with hammers until they die

Attached: pepe_anime_hammer.gif (432x498, 1.26M)

most of the other solutions involve reversing strings or using exponentiation which is way more wasteful than 8 bytes of memory
by your logic modulo is cheating too

Go try it

Attached: 1506259251710.jpg (938x821, 109K)

maybe the server running the code is not the same depending your geographic location.

Us redditors le need to stick together amitite :)

one of the fastest solution use a double.

To catch them is my real test
To train them is my cause!