What are you working on, Sup Forums?
Previous thread:
What are you working on, Sup Forums?
Previous thread:
If I have a table like this:
ID | Downloads
=============
A 1
B 2
B 2
A 1
C 5
What is an SQL query that will return
C, 5
B, 2
A, 2
(i.e. the ID and the sum of downloads, ordered by most downloaded)
I don't know what the IDs are, so I can't reference them directly. It seems like it should be easy, but I'm completely stumped.
first for anime is pleb
Why do you have copies in your database in the first place?
>is second
pottery
Cum in my bum
My grandmother found a bunch of her and my grandfather's writing from the vietnam war and before. In trying to get formattable versions of all of it, I've gotten really into OCR stuff.
I'm using other people's tools for the documents, but I've been working on a for fun project of using my phone's camera to recognize printed text and spit out a .txt file. It's not original, but it's interesting and I'm learning. And that's the whole point, right?
what's UoAAMC?
scared to actually go to the site because virus
Every fucking time I spend ages on a question, as soon as I ask for help I find the answer myself. Every fucking time.
The query I needed is:
select id, sum(downloads) as s from collections group by id order by s desc;
I'm writing an anime indexer. Each release that gets post has a ID referencing what anime series its from. I need this to create a banner at the top of the page with the most popular anime series for the last week.
Brandon? I knew you used Sup Forums, but i thought you only used Sup Forums?
Can you ask what the meaning of life is?
use group by and sum the downloads then sort?
My job is java.
I wanted it to not be as bad as I thought. It sucks.
We fucking told you so Pajeet
Is it because you're only payed 25 cents an hour, Pajeet?
First for php
Reposting from last thread, this time with more info.
Made a Sup Forums image downloader in C++ using the nlohmann json library found here: github.com
It works fine for most threads, but for some it throws an error:
terminate called after throwing an instance of 'std::invalid_argument'
what(): parse error - unexpected '"'
Aborted
The error is not always the same but it seems to happen in threads with code tags. The json is valid though, so I don't know why it's causing errors.
The code is here: ghostbin.com
Also, feel free to critique my bad C++ code since I'm still learning the language. Thanks Sup Forums.
Maybe you should learn basic SQL first?
Writing a 3D cheese pizza MMORPG in WebGL
It's just an internship (~15 euros per hour) during the summer, I will survive.
But never again. The one I had last summer was C.
At least you're getting paid.
working on a tmux guest project to let people watch my tmux sessions
github.com
Because asking the question forces you to write it out in detail.
The only unpaid internships are pink collar memes like fashion, marketing, and media.
what's so bad about it?
Just tried it on this thread though, and it works... Here's a thread that it throws the error on:
I wish.
Has anyone here been to a coding bootcamp to get into coding?
Thinking about biting the bullet and going to The Iron Yard.
You should use snprintf instead of sprintf.
Make the get_page function return an std::string rather than writing to a file, all that file I/O is not needed at all you can just pass whatever get_page returns to the parse function.
Use string overloaded += operator instead of strncpy.
Use more descriptive variable names instead of j, o, b (i.e. data, posts, post).
As for your actual error, idk, maybe it's a bug in the library. You could try jsoncpp, I've been using it for a while and it's alright.
>going to Meme Bootcamp™
No, that sounds stupid
Just about finished with the Iron Yard. It is what you make out of it.
Thanks for the tips, user. I'm starting to think it's a bug in the library since I've tried almost everything. I'll try jsoncpp and see if that fixes things.
Asking again here: any good material to learn from as a total beginner to Haskell?
What program were you in? And what were the hours like?
It would roughly look like this with jsoncpp and more C++-ish approach.
static std::size_t WriteCallback(void *data, std::size_t size, std::size_t msize, void *ptr)
{
std::string *str = reinterpret_cast(ptr);
str->append(reinterpret_cast(data), size);
return size * msize;
}
static std::string GetPage(const std::string &url)
{
std::unique_ptr(curl_easy_init());
std::string output{};
curl_easy_setopt(easyhandle, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &output);
return std::move(output);
}
int main(int n, const char **v)
{
if(n != 3)
{
fprintf(stderr, "Usage: %s \n", v[0]);
return 1;
}
std::string url{"
Obviously the unique ptr should be named curl and the first curl param shoulda been curl as well, kinda sloppy with the qr box.
>return std::move(output);
Unnecessary with return value optimization. It'll be moved by default.
I'm learning Javascript and spend at least 6-7 hours on the daily assignments, plus there is a 3 hour lecture Monday through Thursday. If you do it expect to have no life on the weekends.
Reminds me of a story posted on Sup Forums a few years back about an autist that literally pulled out a rubber ducky and explained the problem to it. It was 2014 I think.
"Learn you a haskell" is pretty good if I remember correctly.
I need to make a function on haskell that shows if x mod 3 == 0, but with cycle.
This is what I have so far
esMultiploDeTres x = 3 mod (take x (cycle +1)) == 0
but it doesn't Work. Why?
That's where the name comes from. It didn't originate on Sup Forums.
> cycle +1
surely you're just creating an infinite list consisting of the function "+1"
I have to iterate with the function cycle, x +1 times, but i don't know how to do that.
What do you mean?
What are you actually trying to do?
Thinking of doing a simple DSL interpreter in C, something like:
PEN-DOWN
UP 10
LEFT 10
Should I use a hashtable, or a lisp-like assoc list for variable lookup?
It'll only have 10-50 values most of the time, so even a simple hashtable might be overkill?
User enters a number
haskell tells you if it's muktipke of 3, with a boolean
instead of x mod 3 == 0
I have to use cycles, to produce that x that the user gives
you can use a tree as well, but 10-50 values isn't really much.
I'm working on a small AI that will hack shit for me.
Decrypting wireless traffic using wifi key ; fake AP ; WEP/WPS-PIN cracking ; payload generator (ty msfvenom) ; and some vuln i got for facebook and soundcloud.
The project work with an "actions" system (you add an action as a c file for example actions/wepcracking.c) Like that I can add as much stuff I want for the IA to do.
The whole thing is sync with a "human readable" database that way we can add AI response pretty fast.
thanks m8. I'm actually interested in the mobile dev course but I think I'm sold.
>If you do it expect to have no life on the weekends.
one step ahead of you.
I tried to implement a ring/circular buffer in Java. I want some comments/criticism on it. Is there a situation that I have not accounted for, or am I doing something in an inefficient way?
public class Ringbuffer {
static int[] buffer = new int[4];
static int read = 3;
static int write = 3;
public static void main(String[] args) {
push(1);
push(2);
pop();
pop();
push(3);
pop();
push(4);
pop();
print();
}
public static void print() {
for(int i = 0; i != buffer.length; i++) {
System.out.print(i + ":" + buffer[i]);
if(read == i) {
System.out.print("R");
}
if(write == i) {
System.out.print("W");
}
System.out.println("");
}
}
public static void push(int x) {
write++;
if(write == buffer.length) {
write = 0;
}
if(write == read) {
throw new UnsupportedOperationException("Cannot write there");
}
buffer[write] = x;
}
public static void pop() {
read++;
if(read == buffer.length) {
read = 0;
}
if(read > write) {
throw new UnsupportedOperationException("Cannot read there");
}
}
}
looks pretty stupid desu, doesn't java have Stack?
Thanks, I've reformatted my code using jsoncpp and your suggestions and it is running great.
do you guys do anything like listen to podcasts while programming? i think i would not really listen to the podcast and not really program if i tried this
If your going to print a full page image, at least have the decency to trim those white margins. Baka.
I listen to moosic cuz i'm too adhd to concentrate on programming alone. if i listen to radio or whatever i dont remember shit from it even tho i react to what they say etc
music podcasts? i do
What exactly is stupid here? Be more specific.
i'm starting my first real project and i have no idea what i'm doing
it's an API to manage Localized Strings, so it should be able to add strings to files for example, or modify certain attributes of some strings in some files (the strings have a certain defined structure)
my question is, should the program have an internal database of some sort to keep track of the strings that exist in the different files in different directories? i'm not sure what the structure of my code should be, if i should define an interface to access the files or what
No don't be a fucking retard
it's best if all the content is in memory and not read from disk, and if that's done it's better to fetch it from a certain memory region than to create a new region with similar data (for ex: a database) you can go nuts with the rest of the things tho
well first, the int[4], why make a limited buffer? that'll only limit the capabilities of the object. second, why recreate the Stack object from java? find something more complex to do lol
Anyone here worked as a software developer? Is it stressful? Did you feel like the demands of the job were fair?
Did anything of value ever originated from Sup Forums?
Serious question.
>want to implement an ADB host
>need to encode RSA keys in Android's custom format, fiddling with bignums and shit
welp
Why is there so much dogma and ideology in programming these days?
>this has to have C syntax
>this has to have Lisp syntax
>this has to look like Haskell
>muh macros
>muh monads
>muh closures
>this isn't good OOP
>this isn't good FP
What ever happened to using features and ideas that are good for writing a program that solves your problem?
People are afraid of wasting the time they invested in learning a technology that might disappear, which happens very often. That's why they defend them with such a zeal.
monads aren't dogma or ideology
that's like calling tuples an ideology
if(condition
{
}
else
{
}
or
if(condition){
}
else{
}
>What ever happened to using features and ideas that are good for writing a program that solves your problem?
Such as macros, monads and closures?
condition ? /**/ : /**/
It's mostly for others interacting with your code.
x if condition else y
if statements or switch statements. Which is better?
goto
it really doesn't matter, stupid. You obviously don't have anything thought provoking to post.
i++ or ++i
First of all, push and pop are stack operations.
Secondly, you're over complicating this.
public class Ringbuffer {
Integer[] buffer;
int tail, head;
public Ringbuffer(int size) {
buffer = new Integer[size];
tail = head = 0;
}
public boolean put(int element) {
if (tail - head >= buffer.length) {
return false;
}
buffer[tail++ % buffer.length] = element;
return true;
}
public Integer get() {
if (tail == head) {
return null;
}
int element = buffer[head++ % buffer.length];
return element;
}
public static void main(String[] args) {
Ringbuffer buffer = new Ringbuffer(4);
assert( buffer.put(1) == true );
assert( buffer.put(2) == true );
assert( buffer.put(3) == true );
assert( buffer.put(4) == true );
assert( buffer.put(3) == false );
assert( buffer.get() == 1 );
assert( buffer.get() == 2 );
assert( buffer.put(-1) == true );
assert( buffer.put(-1) == true );
assert( buffer.put(-1) == false );
assert( buffer.get() == 3 );
assert( buffer.get() == 4 );
assert( buffer.get() == -1 );
assert( buffer.get() == -1 );
assert( buffer.get() == null );
}
}
Friendly reminder that the IO monad is a stateful container and that it's inherently impure because it has side-effects.
Friendly reminder that Haskellfags will defend this, performing mental gymnastics such as "no, it is pure, it only returns impure code tainting the runtime, not Haskell".
>runtime
Runtime is not real.
(You)
Been working on my Sup Forums image downloader. Copied most of your code but made it work fully. Now it downloads images from any thread which is great. Still feel like I'm using a bunch of shitty programming practices.
Anybody good at C++ please take a look at my code and let me know what I can improve on: ghostbin.com
Thanks Sup Forums
>those tiny tits
muh dik
Hello there buddies.
I started learning C++ following some helpful advice and links found here, but due to university shit I didn't practice in about 6 months. Should I go back from the start with all my reading material or pick up where I left? Is there any article avaiable on how to improve the readability of my code? I remember someone referring to my style of writing code as newbie code. Pic provided is an example. Huge-ass comments are there so you know what it's supposed to be, as well.
you should learn java
please name your variables
also fucking ignore this guy:
It depends on the company pretty much.
Too many comments in damageCalc, rename your variables and do a quick blurb about the function above it
Reminder that C is the master programming language and if you don't know C, you cannot call yourself a programmer.
int damageCalc(int damage, int penetration, int armour, int toughness);
Java is much better
pedo
Just use Python :^)
BS4 and requests make this trivial user
>windows
>VS
>C++
Kill yourself
>I'm learning C so that people who masturbate to Chinese cartoons will let me call myself a programmer
There is literally nothing wrong with any of those things (provided you are beyond 3 years of age)
queer
Good joke user
There is literally nothing wrong with C.
You are an ignorant, a tool and probably a miserable shill as well.
What is a "wrapper"?
Something that disguises a program to operate with another language?
Help please.