/dpt/ - Daily Programming Thread

qt programming girls edition

old

Other urls found in this thread:

wiki.haskell.org/Mutually_recursive_modules
doc.cat-v.org/plan_9/programming/c_programming_in_plan_9,
twitter.com/NSFWRedditVideo

First for NO TRAPS

>14 posts early
no

First for Berkeley DB

Reported this transphobic post

wanted to post this

>man face
>name is Isis
It's trap and this thread is fucked...

Call her man faced once more

Post some quality Perl program :
&p(qw(Ju));$x=
$/;$|=$$;$,=$/;$\=$!;
sub T{eval$_[0]};sub su{T
q%sel%.q +ect *a,*
a,*+.'a, .06';}sub
p{T(q;p;. q 5ri5.q
qntq)for @_}map{p
('u');& su;}(1..
17);sub s{+$_[0]
};&s(&su );$a='rl'
;$\=$x;&s(&p("st"));$\=$!;&s
(&su);sub r($;){+p($_[0]
)};p(q-A-);sub z{$\=$/?$;:
$,;$,=$;;su();map{&s(p('a'));&
s(su);}@_};z((1..7));$,=$x;$\=$,
;$"=$\;$,=$/; $_=q!!;s;;;;
p(q qnoq.q rthe\rr);$\
=$/?$;:$,;$ ,=$;;;;su();
r "P";map{r "e";&s||&su;
}(1..42);$\ =$;;&s(p($a)
);T(T(su())); r $/;r "H";$\
=$/?$;:$,;$/=$,;z(1..12);$,=$\;$\
=$/;$a=~s/(.)l//;p(q tcket.$1
);&s(p($"));$e='Felicien';
#MYFIRSTJAPH

>man face
LMFAO LAD

>tfw Java doesn't even have unions

First for C is functional

Never met a good programmer that is a woman, sure they can exist, but i have yet to find one that isn't retarded.

how do i close my terminal after my script finishes running?

example:
i have this script
#!/usr/bin/env bash

HELLO="Hello"
WORLD="World"

echo $HELLO $WORLD

how do i do that?

Anyone ever wrote a code formatting program followning their own coding practices for whatever reason? Just curious

>man face

maybe if you leave your basement every once in a while

I have yet to find any non retarded programmers at all

>omg calculus was so hard when will I ever need this

exit, pkill?

...

what has leaving my fictional basement to do with meeting non retarded woman programmers? The amount of retarded male programmers is staggering, yet you expect that good woman programmers are so abundant that they can be easily found?

I think you have never met a good female programmer in you life either, and if you think that everyone in your vicinity is a good programmer than there are 2 options, you are extreamly lucky or you are just bad at programming.

...

exit would only exit the script itself, not the terminal

you would have to kill the terminal's process, you can pass the terminal's PID to the script and kill that when the script is finished although that isn't very "pretty"... you should probably do something like "script.sh && exit" instead.

>isis

General answer: you can't. No terminal user wants their terminal closed by some program on a whim, especially if their "terminal" is a console-mode terminal or a remote shell, not everybody uses a graphical terminal emulator. (Also what if the graphical terminal is part of the window of an app?)

You can do
kill -9 $(ps -p $$ -o ppid=) inside a script
But it's ugly, contrived, contrary to all rules and such. It unhygenically kill your shell, assuming you have one running, and the parent process of the script is that shell, and that the window will close when that shell dies. If you don't understand then you're not qualified to close a window from within a script.

man ly

...

i have a script that downloads images from websites. after all images are downloaded i wanted my terminal to close automatically, simple as that

Holy shit everyone, get a load of this guy

Here it is with your shitty example:
#/usr/bin/env bash

echo "hello world!"
echo -n "this program is going to forcibly close your terminal in 3..."
sleep 1
echo -n " 2..."
sleep 1
echo -n " 1..."
sleep 1
echo " bye!"
kill -9 $(ps -p $$ -o ppid=)

>getting loads from guys
No thanks faggot

...

How are you invoking it exactly?

Do what I said here: use an alias or manually run your_script.sh && exit

Also closing down the terminal is, again, stupid: it is where error messages go by default, so you don't have any indication that something went wrong, at least in some cases.

./download_images

From a shell then. So the kill -9 thing will work, but your shell obviously doesn't exactly like it, since it's the equivalent of getting stabbed. But it doesn't matter.

> (You)
>Do what I said here:
>use an alias or manually run your_script.sh && exit

i tried using exit but it doesn't work , because i have that script in an alias like

in my .bashrc

alias dw='./download_images "$@" '


so if i tried

alias dw='./download_images "$@" && exit '

it doesn't work

Does the script return an exit code of 0 (no errors)?

If not do alias dw='./download_images "$@"; exit'

>codemonkey
>engineer

I wish people were fucking fined or sent to jail for giving themselves a title they do not fucking own, like people who pretend to be doctors.

>Does the script return an exit code of 0 (no errors)?
no

>If not do alias dw='./download_images "$@"; exit'

this closes the terminal automatically and the script doesn't run

Java doesn't even have real enums, it's a class instead

>#isis
Off with her head

So your script forks itself into the background??? Poaste script

>using Java instead of glorious C#
Why?

>So your script forks itself into the background??? Poaste script

can't post sorry. nevermind then

>I'm so special because I have a B.Eng.
Calculus sure was hard eh? :^)

>Does the script return an exit code of 0 (no errors)?
>no

Why not? If the script never returns an exit code of 0 you can use || instead of && but that isn't a good idea.

you need a function not an alias if you want to pass arguments like that.

dw = function() {
/path/to/script/download_images $@ && exit
}

Wait no you both suck at "alias":
$alias echo='echo "$@" && echo lol'
$ echo a

lol a


See what's happening? your script gets called with non argument an therefore does nothing, since alias doesn't set the $@ variable. If you try $./download_images something.com && exit it will be different than before. Do that, come back, and if it's a success, it means you can write this as a shell function.

>javascript syntax
bitch please
>>>/wdg/
function dw {
/path/to/script/download_images "$@" && exit
}

I've never written javascript in my life so calm your titties retard

As a web developer that only knows php, javascript, jquery, html and css, am I missing something? What should be the next step? I am thinking about python DJango or Ruby.

well this works! thanks kind stranger

but i did
function dw() {
# code here
}


...
thanks everyone! its working now

Do you like it if people who have been on codeacademy for 5 minutes start calling themselves computer scientists?

The same applies for any earned title or qualification, it's just misused a lot more with "engineer".

>Calculus sure was hard eh? :^)
Yeah, so hard it's a requirement for any decent Eng course. Math isn't your sekrit club anymore.

invert me a binary tree.

Go on, i'll wait

>implying calculus is even real math
it's basically just glorified arithmetic

see you in real analysis bitch

>implying real analysis is even real math
it's basically just glorified math

see you in triple integrals bitch

It wouldn't be much more cringe-worthy than the majority of BS Computer Science folks calling themselves computer scientists desu

>studying things that are completely useless to your career makes you more important

Please tell me more about how your attitude towards education perfectly matches that of the liberal arts?

>real analysis is useless
okay

>tfw developing my language in Rust
Who else /absolute madman/ here?

Why did you ditch Holy C?

>useless to your career

At least people doing liberal arts can actually read.

Why wouldn't I?

See you in complex analysis.

So because qualified dumbshits using a title is bad, we can improve the situation by just letting anyone use it and diluting the name even further?

Great solution, guy. Enjoy the average salary for your career plummet because you don't give a single shit about protecting qualifications and titles.

>problem solving and rigorous thinking, which real analysis teaches, is useless in my career
okay

>I need protectionism to save me from the competition

Who is this semen demon?

real as in R or real as in genuine? I much prefer complex systems

Something (anything) that runs code on a computer.

You fucking socialist. Not letting people who can't into a job get a paper saying they can into it is about saving everyone's time realizing they're impostors. Dummass

>I need to be taught how to think because I can't do it on my own
>Pls hold my hand

It's not about the competition, it's about stopping HR and recruitment from hiring people wholly unqualified for their jobs, and then punishing everyone else for their fucking mistakes.

>free markets and ccompetition is socialism now

You know there are "teach homeless how to code" and "no prior experience required" programs all over the place right? And, to clarify, this doesn't run contrary to free market quite the opposite. But titles delivered by established institutions, just like money, can undergo inflation and lose their value if they get printed too much, their value being the trust people put in them when they recruit their holders. Socialist governments and bad business owners are the ones that cause this kind of situation, and free market tends to squash their merchandise when it gets a chance to. Diplomas having requirements isn't protectionnism, it's just that if they don't, they lose their raison d'ĂȘtre. Forcibly lowering the requirements is something an interventionnist government tends to do more often than not, hence you're a commie.

I think basically due to ownership and borrow semantics the compiler knows when to insert free()'s (or drop() in Rust case).

e.g.:

fn main() {
let v = vec![1,2,3,4,5];
println!("{:?}", v);
//v is now not used anymore, so can be safely free'd
drop(v); //Usually inserted by the compiler
}

The free market is largely responsible for the problem though.

It's fine if a company wants to hire an untrained monkey, but then when they give them the title of "software engineer" that fucker will happily go around thinking they are qualified.

Then they'll apply for other positions at companies that actually give a shit about qualifications, and be upset when they get told they're too fucking stupid for the job.
That's the best case, worst case is that HR doesn't check them out properly, they actually DO get hired, and then the company just assumes that all "software engineers" are just that fucking stupid and lower the pay grade.

>muh regulations are bad
Every time you visit a doctor without fear of them being a pleb with a knife who just wants to cut you open, you have standards and regulations to thank.

i dont get it
theres a huge demand for good build systems (make, cmake, etc) and yet theres like 3 to choose from and they're all pretty bad

>pattern synonyms can be part of type classes, thereby providing a mechanism for overloaded data constructors
I love GHC.

Actually, the problem is that C and C++ are horrible to compile. Sane languages with modules have great build systems.

cmake does a pretty good job to keep your C/C++ mess compiling on different platforms.

It's RAII, same as in C++.

You forgot language specific ones. And they suck even more. But even though we now know how a good build system should behave (isolate jobs, keep coherency, work from the bottom up) there is so much technical debt that, well...

>Actually, the problem is that C and C++ are horrible to compile. Sane languages with modules have great build systems.
? How are compilation units not on par with the rest?

>compilation units
It's was designed in the fucking 60s when RAM was not in abundance and you could only hold a small amount of data in memory at any giventime.

He'd rather compile java into .class files that take 20 times as long to complete, and are slower to execute.

Some people are just into self harm.

>We have more memory now, so we should just let everything bloat and not actually have any performance increase with new technologies

Yeah no.

Modules mean a) no headers and b) your source code describes how to build itself. Build systems with modules only end up being providers of compiler flags, more or less.

>implying I'm talking about fucking Java

Oh, so you want to compare C and C++ to languages that are even slower than java?

Please, continue.

Rust has modules and a good build system. So does Haskell.

>compile once modules = bloat
>having 1500 compilation and linking steps because you refuse to use more than 2k of memory at the time and would rather do 1500 disk accesses = not bloat

I need help senpai I'm writing a simple addition progof 2 integers program in assembly, when I print out the result I get letters instead of the integer value e.g 1+1=b

What am I doing wrong???

And how does that negatively affect the system? (Except for the fact that namespaces aren't coupled with units, or that badly written preprocessor code can leak, we're talking about compiling already proven correct programs) I'd argue programmers in this time and age were wise.

>no headers
Except when it requires them. See wiki.haskell.org/Mutually_recursive_modules
I personally find that it's a huge design fail for Haskell. C/C++ NEVER ran into this. Headers are there by default and why not? headers aren't bad, are they?

>your source code describes how to build itself
Mostly. You still have to add a list of dependencies in Cabal and Gem and whatever, but agreed, linking a C program requires a bit more work. Plan 9 had an interesting solution for this, meaning that if you've found the headers of a library, you don't need to search a second time to find the object files, their location is derived from the header's code. (doc.cat-v.org/plan_9/programming/c_programming_in_plan_9, see "an aside on linking") Assuming we have that, what else is wrong with the C toolchain?

Thanks for proving my point.

It's not about refusing to use more memory, it's about retaining the ability to compile on older systems that don't have it.
Even if it is technically inefficient, gcc is often STILL faster at going the "long" way around than other compilers taking their own shortcuts.

>Except when it requires them.
I've never run into a situation where I've needed mutually recursive modules. Even then, if headers solve that specific problem well, then why not? You don't have to use them for everything, thank god.

>headers aren't bad, are they?
Christ.

>what is cross-compilation

>And how does that negatively affect the system?
You prefer doing more disk writes/reads than using memory, which is horribly slow seeing as even state of the art NVRAM disks are still 150-200 times slower than RAM.

Doesn't the kernel cache files? Honest question, I'm not versed in C compiler speed studies

>>what is cross-compilation

A nice hack for getting around the fact your build system REQUIRES a powerful machine for a program that is meant to be run on a low-resources device.

Ignore this faggot, he does't even know what ccache is.

>cross-compilation is a hack
>this is what C programmers actually think

C# is actually decent but

>.NET

Protip: If you have to rely on OS functionality in order to speed up compilation times, then you are doing it wrong.

>Honest question, I'm not versed in C compiler speed studies
C compilation (and especially C++ because of templates) times are horribly slow, but it is generally viewed as acceptable because of the massive performance gains you get from compiler optimisations when you do multiple passes.