old thread: What are you working on, Sup Forums?
/dpt/ - Daily Programming Thread
In the face of recent changes in Firefox, some anons were asking for a Sup Forums's perfect web browser, we have collected here the most wanted features:
Granular control over incomming traffic like Policeman (more control than uMatrix in this particular subject).
Granular control over outgoing traffic like Tamper Data or like Privacy Settings (the addon).
Easy switch to preset profiles for both like uBlock Origin for incomming traffic and Privacy Settings for outgoing traffic.
Random presets generator for things like "user-agent" and "canvas fingerprint".
Custom stylesheets like Stylish.
Userscript support like Greasemonkey.
Cookie management like Cookie Monster.
HTTPS with HTTP fallback and ports management like Smart HTTPS and HTTPS by default.
Proxy management like FoxyProxy.
"Open with" feature to use an external application, like for using a video player with youtube-dl and MPV, or for text input with a text editor, and for other protocols like ftp and gopher, and even as a file picker.
Local cache like Decentraleyes and Load from Cache.
All this in a per site basis.
URL Deobfuscation like "Google search link fix" and "Pure URL".
URI leak prevention like "No Resource URI Leak" and plugin enumeration prevention by returning "undefined".
Keyboard driven with dwb features like vi-like shortcuts, keyboard hints, quickmarks, custom commands and non-bloated smooth UI.
Configuration options from an integrated command-line or in configuration files like Lynx.
A way to import bookmarks from other browsers like Firefox.
Search customization like surfraw, dwb funtions or InstantFox Quick Search, and reverse image search like Google Reverse Image Search.
Writen in C.
Low on dependencies.
Framebuffer support like NetSurf for working in the virtual terminal (TTY).
Actual javascript support so we can lurk and post in Sup Forums.
Any devs up to the task and join a team?
(println (join " " (take n (reverse arr))))
>Sup Forums's perfect web browser
One more thing...
TREE
STYLE
TABS
>trees
>not generalized hypergraphs
one job
...
Yesterday's thread got me thinking about calloc. If you set size to 1 byte, does that mean you can only store a range of numbers -128 to 127?
I'm still in school, so definitely wet behind the ears in programming, sorry if this is a faget question.
What's your opinion on people who call themselves "programmers" and cannot write anything non-trivial without copying it from stack overflow?
Are you calling us all idiots?
Literal code monkey
>expose C API and support module loading.
>come with buildin interface for allowing js by host, the default would be no js.
Minimal you dumb fuck.
...
You can store 256 distinct values.
What those values mean is up to you.
The human brain is capable of many illusions.
Oh I understand. The array size would be limited to 256, not the range of the values stored. Thanks
No, they're unital values.
Can masturbating a lot hinder my programming abilities?
Yes.
>What are you working on, Sup Forums?
Making an image viewer from scratch in C with OpenGL. I've successfully rendered a baboon although it's rotated 90 degrees.
Only if you masturbate to niggers.
You don't experience lethargy and brain fog after a fap session?
i like stackoverflow and use it for reference. I don't copy and paste from it though
how would you do the function call?
It's usually the opposite. I can't focus if I haven't jerked off in a while.
A CS degree is supposed to prepare you to be able to solve new problems, and not become paralyzed when you cannot simply copy it off of Stack Overflow. I am going to have to be creative with my assignments when I become a professor.
>he fell for the nofap meme
Yes. Masturbation can easily make the time you have available for doing useful stuff disappear.
Who are you quoting?
>rationalizing your pornography addiction on an international cupcake baking conference forum
Stack Overflow is also great for theoretical/technical questions, it can be faster than looking it up in a textbook and I trust the answers there more than random people on Discord or IRC. For example I asked "are string literals stored on the stack or heap?" once on a Discord and I got the totally wrong answer (they said the stack), but I checked Stack Exchange and got the right answer (string literals are treated as static variables, and static variables are usually stored on the data segment).
It doesn't usually take long.
>Discord
That's your problem.
Is there risk of some kind of memory leak in C++14 with this?
while( reader.read_row( ... ) {
std::vector strs;
Date dt( ... );
...
}
>Gentoo/Arch Switch
Oh my...
Then either you have no stamina, or you are blueballing yourself.
why does this script save a blank image, but shows the correctly filtered image?
from PIL import Image, ImageFilter
import sys
fn = sys.argv[1]
try:
newfn = sys.argv[2]
except:
newfn = "output.png"
k = ImageFilter.Kernel((3,3), [-1,0,1,
-2,0,2,
-1,0,1])
im = Image.open(fn)
im = im.filter(k)
im.show()
im.save(newfn)
No, but you will end up doing lots of allocation and deallocation if you put the vector in the loop.
Some simple AI project made with Scheme.
In what context?
From stackoverflow:
int logical_shift_right(int x, int n)
{
return (int)((unsigned int)x >> n);
}
It seems like an elegant solution, and it works, but I'm not sure I understand it.
If you right shift on an unsigned type in C, the bits shifted in will be zero regardless of the MSB? Is this true on any machine or compiler?
Reading data in from CSV
What's the AI doing?
That's kind of the idea. On an unsigned type, an arithmetic shift and a logical shift are the same thing.
>On an unsigned type, an arithmetic shift and a logical shift are the same thing.
Is this defined by the language or dependent on the compiler?
I don't think it's formally defined anywhere, just that it works out that way in practice.
>Is this true on any machine or compiler?
Should be, but if you have doubts, test it!
Recommend me a portable IDE for C++, thx
i found this works on some images but not on others. anyone know why it could be?
Play Final Fantasy Tactics.
That sounds like a fun project.
My programmers always get stuck debugging things because they don't follow the flow of data.
Can anyone recommend a good article on what the thought process should be during debugging?
Not if you masturbate to anime girls (female).
why the fuck would you link a proprietary interface to an open source website
Because being constantly distracted while horny is better, right?
Do you have loops nested correctly?
No, but there's a certain risk of syntax error.
lel, if it is such a problem for you, maybe you should take the medication that they give to the pedophiles to stop them being horny.
>take pills
Or you could just jerk off
What's wrong with being horny?
It's completely natural you retard, and there's nothing wrong with relieving it.
Nofapfags are retarded.
Yes. But being horny all the time is not helpful as well. I managed to convince myself that solving programming problems gets me closer to pussies, so far it works and make me sex like a wild animal in the end of the week.
>baboon
good choice
Lenna would've worked too
I need a hint, pls. I don't know how to do this without using conditionals and loops:
/*
* bitCount - returns count of number of 1's in word
* Examples: bitCount(5) = 2, bitCount(7) = 3
* Legal ops: ! ~ & ^ | + >
* Max ops: 40
* Rating: 4
*/
int bitCount(int x) { // Not sure how to make this not iterative...
(unsigned) x;
int sum = 0;
for (int i = 0; i < 32; ++i)
{
sum += x & 1;
x >>= 1;
}
return sum;
}
>natural
>implying natural is good
does it have to be without loops? Your compiler will probably unroll it if it's faster that way
I guess you just hate fun then.
Or maybe you have problems, because fapping doesn't affect my ability to program.
Nevermind efficiency, you're invoking UB.
When I make
free(ptr);
how does free() know how much memory to free?
im running a command to copy a csv file and rename it. It works....kind of. The file is there but it's a blank csv file
what went wrong?
There is a header stored directly before the returned memory storing some information such as size.
There's no nested loops and I know why it's rotated, I just haven't bothered to fix it yet. It's a PGM image which is plain text and the pixels are laid out in such a way that it's not oriented correctly if you read them row by row. This was just to make sure I have OpenGL working correctly and understand texture data before I move on to more complex image types.
Your malloc implementation takes care of that. It'll keep a record of all the blocks of memory which have been allocated.
he said "being __constantly__ distracted while horny is better"
Better pack telemetry into it and make it closed source so no one knows. That way we can spy on any channer who uses it and make fun of them for what porn they watch.
I'm working on this, wasd to move, mouse to point and shoot.
The backend is written is C.
>104.200.138.151:8080
requires javascript, though.
>backend in c
the absolute madman
yeah, the front end is JS unfortunately.
What does echo actually do to print stuff to the terminal?
I'm going to make a script which strips off an option and passes the arguments onto a subfunction. Literally a setup program which calls other scripts, but can do so by specifying a number, this way I can keep all my references in one location, and just call that one script and a number.
Using bash, it utterly fucks up spaces and stuff, but it's pretty simple to substitute proper things. i.e:
IN="'"
IN+=${IN//\'/\'\"\'\"\'}
IN="'"
replaces something like abc'def with abc'|"|'|"|'def (emphasis mine), which lets me get through at least one layer of parsing.
I can verify this is the result by setting -x in the script. I can run an echo $IN at the end and it shows the expected output abc'123
HOWEVER if I run it in a command substation i.e. OUT=(echo $IN), it gives me back exactly the string I put in - literally not the same output it gives during normal command exit. Similarly, if I pipe the output from the existing echo (which prints on terminal as expected) I get the same overly formatted output. The echo literally isn't processing the commands unless the output goes to terminal, so I can only assume it's terminal fucking with my output.
Printf shits itself too.
Not generic enough.
#include
#include
#include
template
int bitcount(T x) {
int n = 0;
for (unsigned i = 0; i < sizeof(T) * 8; i++) {
if (x & (static_cast(1)
A language like PHP should not have an eval function
That won't work, you need a space between ::value> and >
Compiles fine in GCC.
>A scripting language should not have eval
uhh
hahaha, do you have the logo yet? :^)
constexpr edition:
#include
#include
#include
template
constexpr int bitcount(T x) {
int n = 0;
for (unsigned i = 0; i < sizeof(T) * 8; i++) {
if (x & (static_cast(1)
Rate my icon, /dpt/
>Making an image viewer from scratch in C with OpenGL.
kek
>OUT=(echo $IN)
Don't you mean OUT=$(echo $IN)?
Not just any scripting language. A scripting language specifically designed for authoring scripts to be invoked remotely with limited file i/o permissions by total strangers. It's a bad idea to include eval in a language like that, because noobs might be encouraged to use it in ways that could open their system to attack.
int bitCount(int x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
return ((x + (x >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
You do not. It has been fixed in C++ standard.
This is pretty wild, good job.
One of the other constraints, though, is no use of a constant greater than 0xFF.
>not procedurally generated
0/10
>he uses tabs not spaces
>He doesn't indent with tabs and align with spaces
>not both
uhh weeb brainlets?