What are you working on, Jow Forums?
Last thread:
What are you working on, Jow Forums?
Last thread:
Other urls found in this thread:
suckless.org
talks.golang.org
pastebin.com
youtube.com
github.com
developer.github.com
yodaiken.com
example.com
twitter.com
on my fifth day of Android coding straight in java-ide on my phone, pretty challenging without a full featured ide but damn if I'm not learning a lot more diving into the code.
Any resources/examples user had would be welcome
I said functions not variables you stupid monkey. You can tell the difference between a function and a variable can't you?
ok we're going to go around the room and have everyone stand up and say a little about themselves then we'll have everyone choose their groups
just say your name and other generic shit ...
>dysfunctional programmers
There are almost no use cases where the benefits outweigh the potential risks.
exe(cute you)
I'm gonna write a device driver for linux. Should be fairly straightforward.
see you next year
Nice which device?
int u_closed (int n, int N)
{
int output = (1-n)*(n-2*N+2)-4;
output = output;
return output;
}
Am I being paranoid here? I need to halve a number but I don't trust floating points not to mess up with a rounding error somewhere. IIRC if an operation uses both int and float the int is automatically converted to a float.
i think this is cool
#include
int main(void)
{
int x=0xA;
int y=0xA;
switch(!(x^y))
{
case 0:
printf("not equal");
break;
case 1:
printf("equal");
break;
}
}
It's just for the UART on a raspberry pi, but customized for my needs. So it's mostly for fun.
>I need to halve a number
n = n/2
Th-thanks
isn't halving a float just decrementing the exponent? doesn't sound like there would be much that could go wrong there. One problem might be if your int can't be represented by a float
you should have paid attention in elementary school
stop using printf, and stop using .h stdlib header files
I was asked to write a python script for Blender. I've never used python before, just C/C++ /C#. How fucked am I?
If you can't write a mandelbrot set visualizer in J then you don't belong on this board
youre gonna have no idea whether or not your code is even syntactically valid
It's the language people suggest to absolute beginners with no programming experience. I think you'll be fine.
if a language's syntax takes an experienced programmer longer than an afternoon to learn, it's a failure of a language
SQL?
C++?
forget afternoon, literally half an hour
if you already know a C and OOP (aka experienced programmer) you can easily learn all the necessary syntax to be writing useful C++ programs in an afternoon
But you don't know all of C++.
ah yes, both paradigms of great languahes
tell me the alternative
>doesn't compile
>spend more than 2 hours trying to figure out why
>change header file order
>it compiles
>bullying
English?
This looks like C.
If it is, an integer devided by another integer will always be an integer, rounding down.
Shifting is pointless, any optimising compiler will replace by bitshifts if possible. And it lowers readability
Made a wire bending simulator
github.com/Mark-Weston/wbmsim
>vertical x-axis
Disgusting
>not using appropriate header guards
Working on porting binutils and GCC to my operating system.
Once I get those two working, I'll be able to work on the OS inside the OS. A new paradigm!
>using header guards
suckless.org
talks.golang.org
I'm back shilling the suckmore collective. I'm accepting project proposals and submissions in any language, as long as they're actually useful.
The goal is to be an anti-suckless: usable software, reasonable construction, and no particular design constraints. I'm just as willing to accept Haskell, Python, Dlang, Nim, etc.. projects.
>suckless coding style
>headers depending on headers
This is why header guards exist. If header A requires header B than include header B inside header A with
#ifndef FOO_HEADER_B
#define FOO_HEADER_B
...
#endif
Now order of headers doesn't matter and you won't include the same code twice.
>suckless.org
This is basically a guide on how to lower your productivity and finish nothing.
this doesn't work.. i looked at a python script the first time today. Is the regex wrong?
All i want is getting the latest commit sha to be used as version number
pastebin.com
Is programming the cure to depression?
You literally don't give an example of what the fuck you're trying to do.
That's cool
>Is programming the cure to depression?
No it's the cause
but can it do this?
youtube.com
any tensorflow pros here
so i have implemented ML algorithms from scratch, using the simplest forms - for example sigmoid as activation etc., so i have read up on the math and example usage
do i really need to learn ALL the options that the module provides to be able to say i know how to use it
it seems for 90% of the shit all i need is the keras module, build an NN and then feed it the data and the labels as numpy arrays
what else is there, that's a must-know
They're not even my own header files so I don't know what they're doing. I'm trying to use the Microsoft Detours library in an empty VS project and my headers looked like this:
#include
#include "stdafx.h"
#include "detours.h"
Whenever it ran it complained about "unknown architecture". Swapping stdafx.h and detours.h around fixed it.
it's a script that downloads WoW addons from various websites (e.g. wowinterface.com, curseforge) i've extended the script to lookup for github urls, it also downloads them (problem remaining that the folders are named -master, which is something i have to fix later through os.rename i think.
However all it should do now it using requests to look up the repo url, looking through the page source and finding the latest commit sha using it as an version number.
unmodified version can be found here github.com
sick beat, cant wait for the remix
I'm not going to dig into what you're doing I'd just like to mention that whenever there's an API you should prefer using it to manually parsing the HTML.
developer.github.com
Given design is at its best.
Is threading the first option for performance?
Are there any other options apart from threading?
no need to, thanks for the pointer.
I just used the existing code for reference, hence i'm basically clueless. Looking through that link now.
Dumb umaruposter
I'm trying to display in a table the data from the sql table above, into a html table, but i can't manage to put in the date and time in the table without giving me errors, how can i fix this?
depends on the task. sometimes coroutines or multiprocess is better
this is no less than the 3000th time you've bullied me
you deserve it
think of game engine with multiplayer support. Do you think multiprocess is better option than threading?
no
Depends on your application. Is it IO heavy? Then you probably want to spawn a lot of cheap threads (green threads).
Is it number crunching on a known set of data? You can use parallel techniques like SIMD, or if possible split the data into equal sets and deliver each to a thread which is affine to a CPU core.
yodaiken.com
Daily reminder it's impossible to use C correctly, even Linus doesn't understand the standard and advocates for ignoring it, basically inviting UBs and subtle bugs:
> Don't tell me "the C standard is unclear". The C standard is _clearly_ bogus shit (see above on strict aliasing rules), and when it is bogus garbage, it needs to be explicitly ignored
> The standard simply is not *important*, when it is in direct conflict with reality and reliable code generation.
> I've said this before, and I'll say it again: a standards paper is just so much toilet paper when it conflicts with reality. It has absolutely _zero_ relevance. In fact, I'll take real toilet paper over standards any day, because at least that way I won't have splinters and ink up my arse.
No, you can either support him, basically turning gcc with a set of the compiler options into the de-facto C standard, but then it's no better than other languages without a standard and you're a hostage of the horribly maintained project gcc is. Or you can argue against him, but then you have to somehow show that competent C programmers even exist, because the most famous C programmer in the world is clearly incompetent.
cool
Is programming experience relative?
>1 year exp. at Google
vs
>5 years exp. at fly-over startup
hurr durr
shup up retard
make a better language or fuck off
nobody cares nerd
Not in alphabetical order.
Difficult to say. You need to be smart enough to pass interviews at Google, but that says nothing about the actual quality of your work. On the other hand, startups are quite demanding, and can expose you to develop things from scratch, instead of just fixing a small corner of an internal application.
Can someone explain why the scope of this is fucked? Is it even the scope?
It's like headers is a reference to the "transmission" dictionary instead of a copy.
I'm truly clueless.
base = {
'Accept-Encoding': 'gzip',
'Connection': 'close',
'User-Agent': '',
'Host': ''
}
tracker_headers=dict()
tracker_headers['transmission']=dict(base, **{'User-Agent': 'Transmission/2.94', 'peer_id':'-TR2940-test12345678'})
def bug(client,url):
headers=tracker_headers[client]
headers['Host']=url.split('/')[2]
del headers['peer_id']
peer_id=tracker_headers[client]
bug('transmission','example.com
bug('transmission','example.com
Here's a revolutionary concept: Companies shouldn't just tell you which languages they use, but also give you some samples of the code that they write and what you will end up working with.
I realize that it's actually like minesweeper: You might have to work with a horrible piece of shit.
>python
>dpt
I think you're in the wrong thread, champ.
>think Google is somehow more intensive than a start-up with fresh software
More than half their staff is pajeet.
>possibility for editing data in the same pointer without any guards
Are you seriously this retarded? If you're programming and run into undefined behavior, you are programming wrong. Even Linus says aliasing is retarded, and unions work fine.
not really, queer.
>It's like headers is a reference to the "transmission" dictionary instead of a copy
might very well be, imo python can be weird about that. if you want a copy try using deepcopy()
>More than half their staff is pajeet.
don't know about that, but google is huge.
>Here's a revolutionary concept
Dropped
>Can someone explain why the scope of this is fucked?
It's because headers is a reference to the "transmission" dictionary instead of a copy.
Seriously though, what do you think about it?
>want to organize my project
>now have to maintain reams of .h and .c files
Why can't I just include .c files in the correct order in my main.c?
It shouldn't be though? Or am I missing something?
Is it documented somewhere? I don't ever remember reading about references like this in python.
the peer_id line it should be something else entirely but it's not important to the bug, I messed up simplifying the code
just because guido doesn't tell you doesn't mean it's not there
recently came across this one:
>>> l = [0,1,2]
>>> m = map(lambda x:x*2, l)
>>> l[0] = 3
>>> list(m)
[6, 2, 4]
#include
#include
struct ptrs {void *p1; void *p2;};
struct foo {
int a;
char b[256];
int c;
struct ptrs ptrs;
};
int main()
{
struct foo *S = malloc(sizeof(*S));
//normal initialization
S->b[127] = 127;
S->ptrs.p1 = (void *) 1;
S->ptrs.p2 = (void *) 2;
printf("%d, %p, %p\n", S->b[127], S->ptrs.p1, S->ptrs.p2);
//dynamic zeroing
*S = (struct foo) {0};
printf("%d, %p, %p\n", S->b[127], S->ptrs.p1, S->ptrs.p2);
//dynamic assignment
*S = (struct foo) {
.b[127] = 127,
.ptrs.p1 = (void *) 1,
.ptrs.p2 = (void *) 2
};
printf("%d, %p, %p\n", S->b[127], S->ptrs.p1, S->ptrs.p2);
}
How the fuck does the compiler do this? Does the data for (struct foo) during the cast actually get pushed onto the stack and then is memcpyed over the original struct?
yes, but the compiler can and will optimize out pushing all that shit to the stack
check the assembly
you'll probably not find out anything applicable to a real situation because the program is too simple
Just wondering, why does a language like python have such terrible syntax for lambda? I mean that enormous keyword lambda
I don't understand what the question is. Your code is just a bunch of assignments.
>wake up
>suddenly feel like working at Google
wtf, should I apply now
It's bad organization. Headers are your index, C files are your content. You'll go through a bunch of phases as you learn more C. First is "all in the source file", then "header with some functions in it" then "basic source separation from headers", then "a local header for a sub-system and another header which other stuff can access) to full on "finding some workaround to give yourself easier functions/autocomplete with available headers, structures look like built-in types, data allocation is per what style you like".
One of the first things for my sake was noun_adjective or verb_adverb attributes, since I group similar things by what they take/act on. It's backwards English but it groups things so much better. Lately I've been writing tools to auto-fill headers, and I'm getting echos from a company I worked at that had more than a dozen code sections and massive configuration ability for different platforms/architectures/features.
Guido is openly hostile to functional programming. He tried to remove lambda, map, filter etc. from the entire language.
how do I program myself into a cute girl
Functional programming is a notably poor fit for python.
Certainly, it allows terse syntax and uses familiar things like set-builder notation that makes math autists happy, but it provides none of the safety or guarantees of functional programming.
A sick dose of pure helium
probably because they are halfbaked garbage?
ebin
I didn't know this about python.
Feature or bug?
>function and data are different
You can't hide memory addresses. In Python, everything is an object, unless it's a primitive.
Lists and dictionaries are not primitives.
It's not a feature nor a bug. It just is.