[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 22
File: a.jpg (147 KB, 1028x1221) Image search: [Google]
a.jpg
147 KB, 1028x1221
old thread >>54225619

What are you working on /dpt/?
>>
>>54231666
>What are you working on /dpt/?
>/dpt/?
This used to be "/g/"
>>
>>54231666
Shitting out a presentation due Thursday
I almost got the whole thing done, but goddamn is it awful
>>
>>54231712
You really want to include the consumerfags in this conversation?
>>
I want to write a simple interpreter in C.
How does one accept input?
Do I just take input from stdin and wait for the user to press enter?
>>
>>54231692
>Java jobs web dev
I'm sure there is also mobile.
It's because most jobs are web and mobile now. Desktop software is almost dead/oss (you could try applying to JetBrains I guess, they use java plenty), for internal enterprise apps windows+c# is usually preferred, a lot of java ecosystem (web frameworks, tooling) is open-source, so there aren't that many job openings to work on it. Videogames are c++/c# so there isn't much left. There are decent machine learning libraries as far as I'm aware, so I suppose it is used some in research, but python is more popular. So here you go
>>
>>54231812
input from a file and create a parser. This will work like a program interpreter. For a line parser like the one python has, you should do like you said.
>>
I wanna make a chat client/server in qt :D anyone want to help ?
>>
>>54232019

Sounds like an interesting enough idea. What kinds of features do you want to support?
>>
I'm currently learning to program in TCP/IP so far it's been easy in C with I've managed to create a connection and send strings, it works as expected, I imagine with Qt it would be easier.

>>5423211
I want to have an alternative to facebook chat, what features ? very basic like going back to old microsoft messenger but before being a bloated and unstable shit with aggressive ads
>>
>>54232019
protip: https://en.wikipedia.org/wiki/ZeroMQ
>>
>>54231666
How do I do this?

>Through this assignment, you will learn how to use multiple threads in you Java application programs. The assignment is to write a multithread Java program that performs matrix multiplication. In the program, you need to calculate each element in the result matrix in a separate thread. For the convenience of programming, two sample matrices could be included in your code. However, your code should be generic with regard to matrix size. The sizes of three matrices should be stored in variable and used. The two operand matrices and the result matrix should be printed.

I can make a multithreaded program that prints strings, and a program that multiplies matrices, but I'm not sure how to make a multithreaded matrix multiplication program.
>>
>>54232180
TYSFM anon hahaha I knew /g/ would help
>>
>>54232205
[A, B, C] X [E, F, G] -> [AE + BF + CG]
just let each thread do one of those calculations
redundant because its like 5 instructions and no wait
>>
>>54232205
when you matrix multiply, you do row times row = 1 value
because all the values of the matrix are independent, each index of the matrix can be calculated independently
i.e. if you're multiplying two 4x4 matrices, the resultant matrix does not have any shared data location for each multiplication, so it can all be done in parallel (i.e. each matrix index can get its own thread in a really naive solution)

sorry if that is somewhat confusing but that is the idea
>>
File: snibbidy snab.png (34 KB, 666x666) Image search: [Google]
snibbidy snab.png
34 KB, 666x666
>>54231666
Dumb question, but I'm having some cin trouble.

So, at the start of my small menu program, I need a cin.ignore() otherwise it skips the first thing where I ask if the user wants a short readme.

So then it jumps down to "what do you want to add?" This is where I'm having a bit of trouble, and I don't see any way around it. Let's assume I don't have a cin.ignore() The first time, it will go off without a hitch. It'll get some more input from the user in a class function, then hop back to main and continue doing menu shit. Second time around, it will just skip past it.

BUT, if I add a cin.ignore() to it, it will work all times after the first time, but fails the second time. The problem with the first time is it ignores the first character because I didn't enter a complex input.

I'm not sure how to really remedy this, save an if statement checking if I've already run this switch case once. Any advice, /g/? I can whip up a mock code real quick if it isn't really all that clear.
>>
>>54232295
try flushing stdin
post code too
>>
I'm making an RPN calculator!
> 32.2
5: 32.2
4: 32.2
3: 32.2
2: 32.2
1: 32.2
what you typed: 32.2


Now i just have to write the parser.
>>
>>54231666
https://github.com/Yetoo1/Fuck_You_Game
>>
>>54232311
Okay, I mocked up a menu code since what I have right now is kind of a hot mess. Problem still happens with it though.

#include <iostream>
using namespace std;

void printMenu()
{
cout << "1. This is the only option" << endl;
}
int main()
{
bool readme = false;
char choice = 0;
while(choice != 2){
printMenu();
cin >> choice;
switch (choice){
case '1':{
if(readme == false){
cout <<"Do you want to view the readme?" << endl;
cin.ignore();
string ans;
getline(cin,ans);
readme = true;
if(ans == "yes"){
//display the readme
}
}
cout << "Enter what you want to add" << endl;
string item;
cin.ignore();
getline(cin,item);
cout << item << endl;
//add item to class, gets some more inputs from user
break;
}
case '2':
cout << "bye" << endl;
break;
}
}
}


So same as before, first run through, when it asks for the user to enter an item after the readme, an input of "string" will be read as "ring".

Haven't seen anyway around it, so if anybody had a suggestion, I'd appreciate it.
>>
Anyone have somthing that can explain to me how heap allocations work.

I'm running into something called an "exponential heap" and seeing a program allocate one big 1gb chunk of ram and using its own allocator to pick at it. Never took the time to understand that stuff myself.
>>
>>54232434
now I just need an interpreter
> 32 16 4
3: 32
2: 16
1: 4
what you typed: 32
> q
>>
File: s3zkbEM.webm (1 MB, 640x640) Image search: [Google]
s3zkbEM.webm
1 MB, 640x640
Ask your elegant and much beloved programming literate anything (IAMA)

>>54232499
heap is memory allocated in the dynamic environment.

>>54231812
https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop
http://www.buildyourownlisp.com/

>>54231712
But /dpt/ is know as the best subreddit of /g/
>>
>>54232768
>heap is memory allocated in the dynamic environment.
i know what the heap is.
I'm talking about the strategies involved in allocation and deallocation from a chunk of continous memory.
>>
why python is the best language?
>>
File: yui does the cute thing.gif (802 KB, 500x545) Image search: [Google]
yui does the cute thing.gif
802 KB, 500x545
Rate my RPN calculator!

> 2.01
3: 37.2487
2: 1.71
1: 2.01
> /
2: 37.2487
1: 0.850746
> /
1: 43.7836
>
>>
>>54232456
>while(choice != 2){
>printMenu();
>cin >> choice;
>switch (choice){
>case '1':{
This isn't exactly related to your problem of the skipped input, but you are comparing choice as the integer value 2 in your while loop, and the ASCII value for the character '2' everywhere else.

Aside from that, I suspect your problem is due to the differing behavior of cin << and getline() when it comes to the newline. IIRC, cin extracts characters until the first whitespace character is reach, but leaves that character in there. getline extracts characters until a certain length or the newline, but extracts the newline as well. Double check the details of that - cin can be configured to extract whitespace, and getline can be configured to leave it.

You can try tinkering by putting the ignore after the cin, but I personally like to do all of my reading consistently (i.e. use cin and only cin, or getline and only getline) because it avoids weird surprises like this. I also tend to read user input into a string first, then deal with it from there, but I can understand wanting to avoid the complexity at this point.
>>
>>54232869
that very implementation defined. are you talking about how it's done by the vmm (kernel/server) or the allocator (eg: malloc)
>>
>>54232869
read alexandrescu, "modern" c++ design
>>
Looking to join a C++ open source project.. have plenty of experience. Don't want to get overwhelmed by something huge.

Anyone have any suggestions or any projects they need some help on?
>>
>>54232980
why this book 15 years old
>>
>>54233057
how are you with reverse engineering.

or at least appropriating reverse engineered into into a "trainer"(injected DLL).

i could just toss a git your way and you can crit/pull request even
>>
>>54233062
because it covers custom allocators in depth
>>
>>54233073
I've done some things of the sort anon. If I can't do it, I'm willing to learn.

Unfortunately, I won't be able to help until my schooling settles down. Do you have a preferred way to contact?
>>
>>54233073
what's the target game?
>>
fuck, I've been asking about this for a few days...
is it worth it for a linux guy to learn C# for android/mobile in general/desktop dev?
>>
File: kpkQOdegc-JYmYmA.webm (3 MB, 640x360) Image search: [Google]
kpkQOdegc-JYmYmA.webm
3 MB, 640x360
>>54233089
>>54233095
dark souls III

If you've heard of ElDorito that was me too.
>>
>>54233110
>desktop
it's a bit of a shaky bet right now, you will 100% depend on the success of .net core and whether it will even have support for any kind of cross-platform GUI frameworks in the future. Mono has GTK#, but .net core is the focus of the community now, I don't know what the future holds for mono.
>mobile
yet it should be fine
>>
>>54233143
I'm definitely interested, anon. Could we establish some form of contact?
>>
>>54232768
why do you wear the mask?

do you know of any good matrix maths libraries for D?
>>
Learned how to program in college, post-college now looking for a job. I spotted a github for a little project that used mac "say" command and got my own replacement (pttsx) to text to speech instead.

Thing is, while Python is pretty dirt easy to learn so far, I can't fucking figure out after installing this package/module with pip how I get it to be recognized by the .py script I'm running on my desktop. It fails/errors on the import for the package and usage of objects from it, because pip install wasn't enough.

How do I get access to this library from a random desktop script?
>>
>>54233193
Run it with a terminal, tard

pip should be tied to "python scriptname.py"
>>
>>54233193
Did you install the right version of the package?

ie the 2 version as opposed to the 3 version or vice versa
>>
RPN calculator!
now with unlimited stack!
./hpsh 
> 8.33 4 5.2 - *
1: -9.996
> 8.33 7.46 - 0.32 *
2: -9.996
1: 0.2784
> /
1: -35.9052
> 4.3 3.15 2.75 - *
2: -35.9052
1: 1.72
> 1.71 2.01 * - /
1: 20.9104
> sqrt
1. 4.572789
>>
>>54233149
thanks anon, guess I should learn it just for the sake of learning a new lang, but after that, I should get a java refresher... because I don't remember shit :/
>>
>>54233224
I'm running it both in command prompt locally and in Idle.

>>54233240
Sorry broski, I'm not sure how to tell the difference. The installer didn't give an option, and when I pip'd it over it didn't hiccup at all. It seems to be installed in 3.5 folders under "site-packages"
>>
File: tmnqmt.webm (3 MB, 750x344) Image search: [Google]
tmnqmt.webm
3 MB, 750x344
>>54233167
can I hear a bit more about your experience

the git's still got a lot of unpushed commits and research to be done but i'm porting over old ElDorito code and improving it as I go.
>>
>>54233257
What package was it. Import names can be different for each package depending on if you're using Py2 to Py3
>>
>>54233257
In the terminal, you're using
python3 script.py
, right?
>>
>>54233275
C:\Users\Computer\Desktop>python --version
Python 3.5.1

C:\Users\Computer\Desktop>python tsa.py
Traceback (most recent call last):
File "tsa.py", line 6, in <module>
import pyttsx
File "C:\Program Files (x86)\Python35-32\lib\site-packages\pyttsx\__init__.py", line 18, in <mod
e>
from engine import Engine
ImportError: No module named 'engine'
>>
>>54233246
you just gave me an idea
>instruction set simulator
>stack machine
>huffman encoded binaries
the filesizes man just imagine
>>
>>54233292
Was google too hard m8? http://stackoverflow.com/questions/29615235/pyttsx-no-module-named-engine
>>
>>54233082
this book old as fuck lmao
>>
>>54233314
>http://stackoverflow.com/questions/29615235/pyttsx-no-module-named-engine
I suppose it's easier than reading comprehension or basic debugging skills.

Asshat, it's not even finding the fucking module to import at all. That means it's not getting into those files to find those errors.

>modern programmers
>>
>>54233261
Sure.

Plenty of experience involving x86 assembly, not with floating point numbers or any of the more complicated instruction subsets. I use Immunity Debugger to debug programs, it's basically Ollydbg with some nicer features to get around a few things.

As far as trainers are concerned, I've done plenty of stuff with Cheat Engine... more than just modifying memory values. Sometimes it gets more complicated, you need to actually modify memory resident code.

As far as DLL injection is concerned, one project I did grabbed a password from an authentication login application (proof of concept.) Since the field was set as a password box, it was only readable by the parent process. i.e. I couldn't just read the memory from the process. I had to actually inject a DLL to read the field and transfer the information back to the injector process.

Decent amount of Windows API experience, sort of goes without saying since I did the DLL injection thing.

Most important thing is I'm willing to learn. I go to a pretty good university, but they don't teach things like this. I have a burning desire to learn new things like this (especially rev eng and security.)
>>
>>54233329
Retard it's the same error on SO
>>
>>54233375
No its not, and the fix they suggest doesn't change it at all. It CANNOT FIND ENGINE in the same folder for some reason. Can you not do debugging? Christ, I knew I left /g/ 7 years ago for a good reason, I'm just too crotchety and angry to deal with ANY other userbase, but now most of you can't fucking program let alone into tech.
>>
>>54233340
Sounds good. Kinda similar situation in terms of uni. email is my github name except gmail. I have a discord channel too for instant messaging if you're into that.

Never heard of immunity debugger.
I use IDA pro and sometimes radare.
>>
>>54233389
Does someone have to remind you to breathe every ten minutes or can you do that on your own?
>>
>>54233392
w*****[email protected]?
>>
>>54233412
yep
>>
>>54233301
>instruction set simulator
Do it in verilog.
>>
>>54233425
Verify you got the email please.
>>
>>54233405
10/10 response. Even with patches the pyttsx lib had issues, I found a half-assed updated one for 3.5
>>
>>54233438
I don't know shit about hardware desu
>>
>>54233460
replying now.
>>
>>54233477
you could easily learn
there are simulators, and learning it isn't that different than learning a programming language. It is a programming language after all.
>>
>>54233477
It'd be fun to do the real thing not just some simulator.
>>54233497
well, it's kinda hard to grasp for programmers at the beginning, as it's a completely different paradigm from what they are used to, but not so hard overall and you don't really need to know much about digital electronics.
>>
>>54232913
i don't know what that is but 10/10 for being cute desu
>>
>>54233301
    uint output = func(*cast(T*)&a, *cast(T*)&b)
stack.push(*cast(T*)&output);

there's something I love about low level programming where you just jump right off the deep end and throw away the type system altogether

>>54233497
>>54233594
I'm going to write up a prototype and hack around with it so I can figure out opcode frequencies to build the huffman tree
>>
>>54233599
https://en.wikipedia.org/wiki/Reverse_Polish_notation
https://en.wikipedia.org/wiki/Stack_machine

it's a really fun project to whip up desu
plus you can expand it to parse infix expressions like 1*4+2-7/2 into 1 4 * 2 + 7 2 / - and then evaluate them
it's a great learning experience
>>
>>54233599
it's a postfix, stack-based calculator, like you see on old hp calcs

it's actually quite easy to parse, and because of it, any decent interpreter will convert infix expressions to postfix (or RPN) before evaluating
>>
>>54230932
>>54231093
Oh, also, if you only use a const in a method should you put it in the at the top of the class, above the method, or in the method?
>>
whatta you listening to atm?
me: https://www.youtube.com/watch?v=K8ThbW2zTjU
>>
How come pascal(1970) has strings, but C(1972) doesn't?
>>
> consider the following
class Base
{
Base();
virtual smth(){};
};

class Child : public Base
{
Child();
};

class Foo : public Child
{
Foo();
};

Foo::Foo()
{
// How to call smth()
smth();
// clang error: non-static member 'main' found in multiple base-class subobjects of type 'Base'
// Explicit
Foo::smth();
// clang error: amiguous conversion from derived class 'Foo' to base class 'Base'
}
>>
>>54233778
Stop using such a shitty meme lang.
>>
>>54233769
C has strings. It just doesn't have a string type.
>>
>>54233778
Base::smth()

also don't make constructors private if you won't them to be inherited
>>
>>54233856
am i drunk or smth
>won't
*want
>them
not constructors, the classes, naturally
>>
>>54233843
Yeah, I meant string type. A secure one, not messing around with char arrays/pointers.
>>
>>54233769
typedef char* string;
>>
>>54233867
NULL

TERMINATED

BYTE

ARRAY
>>
>>54233856
Base::smth();
// clang error: ambigious conversion from derived class 'Foo' to base class 'Base'


> also don't make constructors private if you won't them to be inherited
yeah thanks, forgot to include the
public:
in the example
>>
>>54233864
char pointers are fine.
There are all sorts of arguments for/against null terminated strings, but pstrings or something similar doesn't really "fit in" with the rest of C.
>>
>>54233867
Wew lad. That's not how this work. You have to malloc n shit.
>>
do we have an irc?
>>
>>54233900
typedef char* string;
string str = "read your K&R this is legal";
>>
>>54233769
While Pascal's strings are far superior to C's "strings", they still fucking suck. Fucking 127 character limit.
>>
>>54233908
A char * doesn't guarantee that it's a sequence of (multibyte?) characters followed by a null terminator.
Since there is no type in C which guarantees this property, there is no "string type" in C.
>>
>>54233891
https://ideone.com/clkNss
>>
>>54233912
I didn't know about that. That sucks.

>>54233908
What you just did is a string literal. Why is it illegal?
>>
>>54233864
C isn't supposed to be secure (unfortunately enough)
>>
>>54233912
127? not 255?
>>
>>54233940
security and forced safety nets introduce overhead
enforcing program correctness should be left to the developer, not the compiler.
>>
>>54233940
Well yeah, I just wondered why? I mean, a proper string type would've gotten C more market share.
>>
>>54233951
No. The first byte is used as the length indicator.
>>
>>54233956
typedef struct {
char *str;
int len;
} proper_string_typeTM;
>>
>>54233955
>opinion
>opinion
A sufficient type system can enforce quite a lot of program correctness at run time. C is nearly bare minimum, and history should be more than enough evidence to show that it hasn't always been a good thing.

>>54233956
Do you really think C needed more market share?
Apparently simplicity over safety worked well enough for people to not notice how much better the alternative could have been.
>>
>>54233951
>>54233972
Nvm, for some reason I thouht that Pascal used a signed byte for the length. My excuse is that I just woke up.
>>
>>54233978
*correctness at compile time
>>
>>54233930
> cheers anon. have a good day
>>
>tfw scared of growing old and becoming a shitter programmer
this is kind of all i have right now
>>
>>54233973
I didn't ask you to make a type for me. I just wondered why C doesn't have one by default.

>>54233978
I guess you are right, but seeing how overly complicated and verbose compiled languages are now, I'd rather have it that C influenced more devs.
>>
>>54233908
>k&r meme c
kek
still have to malloc or somehow get a pointer to the data, can't just simply pass a value into it
>>
>web hosting service doesn't list the pricing for if you exceed the allotted traffic/storage
>send email to their support
>email doesn't arrive because something is wrong on their end
fucking amateur web fag normies REEEEEEEEEEEEEEE
>>
>>54234053
>I just wondered why C doesn't have one by default.

because then C would become a bloated mess like C++
>>
>>54233928

Who says it has to be null terminated? That's just a convention for the standard library. It's ultimately up to the programmer to decide how they want to handle strings. If they want to construct a struct that'll hold a pointer and a length field, and maybe a capacity field, that's their choice. Indeed, in many language interpreters -- written in C -- a custom struct is used for strings.

>>54233973

Length field should be a size_t, not an int.
>>
>>54234056
that string literal compiles down a pointer to a read-only section of the executable that holds the string literal.

since it gets replaced with a dereferenced pointer at compile-time, you can also do weird shit like calling specific characters using array subscripts
"ABCDEF"[3]
will access D
>>
File: rust fizzbuzz.png (7 KB, 247x160) Image search: [Google]
rust fizzbuzz.png
7 KB, 247x160
>>
File: keksimus.png (280 KB, 596x628) Image search: [Google]
keksimus.png
280 KB, 596x628
>>54233973
>proper_string_typeTM
>>
>>54233973
At least define something that doesn't completely suck:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef struct {
size_t len;
char *str;
char _str[];
} string;

#define string_auto(lit) (string){ .len = strlen(lit), .str = lit }

#ifdef __GNUC__
/* Non-standard garbage, but is stack-allocated and modifiable */
#define string_auto_GCC(lit) ({ \
size_t len = strlen(lit); \
string *s = alloca(sizeof *s + len + 1); \
s->len = len; \
s->str = s->_str; \
strcpy(s->_str, lit); \
s; \
})
#endif

string *string_heap(const char *lit)
{
size_t len = strlen(lit);
string *s = malloc(sizeof *s + len + 1);
if (!s)
return NULL;

s->len = len;
s->str = s->_str;
strcpy(s->_str, lit);

return s;
}

int main()
{
string s1 = string_auto("test1");
string *s2 = string_heap("test2");
string *s3 = string_auto_GCC("test3");

printf("%s\n", s1.str);
printf("%s\n", s2->str);

s3->str[0] = 'f';

printf("%s\n", s3->str);

free(s2);
}

Although something like this would need a lot of utility functions with it to be useful.

>>54234100
>Who says it has to be null terminated?
That's just how the standard currently defines strings. I figured anyone wanting to do it today wants compatibility with the vast amount of C libraries that already exist..
>>
>>54234151
>backwards indentation
I'm angry

so very angry
>>
>>54234029
https://youtu.be/Le3lUGAA0hQ?t=20m30s
>>
>>54234151
This looks real nice anon.
What's the best way to go about learning Rust?
>>
>>54233057
Not me personally, but I know there's an ongoing project that is open sourcing the original RollerCoaster Tycoon games
>>
Anyone thoughts on using an ORM for your database? I've worked with it some time ago and didnt really like it but it seems like it could save me a lot of time right now.
>>
>>54234329
https://www.youtube.com/watch?v=lKwiqO8Nnms
>>
>>54234246
Never mind, I just googled it and found the official tutorial.
>>
can anyone point me in the right direction as to why i keep getting this error?
...INFO3220_A1G/container.cpp:8: error: redefinition of 'Container::Container(std::string, std::vector<Container>)'
Container::Container(string name, vector<Container> containerObjects)
^


container.h
#ifndef CONTAINER_H
#define CONTAINER_H

#include "body.h"

#include <string>
#include <vector> //std::vector

using namespace std;

class Container
{
public:
Container(string name,
vector<Container> containerObjects) :
m_name(name),
m_containerObjects(containerObjects) { }

~Container();

virtual void addChildren(vector<Container> &containerObjects) = 0;
virtual vector<Container> getChildren() = 0;

void setName(string name){ m_name = name; }
string getName() { return m_name; }
private:
string m_name;
vector<Container> m_containerObjects; //used to store objects in container

};

#endif // CONTAINER_H


container.cpp/home/edmund/
#include "container.h"
#include "body.h"

#include <string>
#include <vector> //std::vector

Container::Container(string name, vector<Container> containerObjects)
: m_name(name),
m_containerObjects(containerObjects)
{
}

Container::~Container()
{

}

void addChildren(vector<Container> &containerObjects)
{

}

vector<Container> Container::getChildren(){
return m_containerObjects;
}

>>
File: fizzbuzz.hs.png (97 KB, 1012x728) Image search: [Google]
fizzbuzz.hs.png
97 KB, 1012x728
I think I nailed it right here
>>
>>54234441
Why don't you try reading the error message?
>>
>>54234576
>i read the book but i didn't understand it
>Why don't you try reading the book?
>>
>>54231666

So I've got the creativity of a bag of sand.

Can anyone throw some suggestions at me of an intermediate desktop project I can make.

Really want to program something but struggling to think of something that isn't trivial.
>>
>>54234590
>redefinition
There's your hint.
>>
>>54234605
i mean why even respond if it's going to be some snarky, belittling little comment?

obviously i read the error message but i'm still not sure. i got rid of it since i suspected that it was a redefiniton (due to the error message) however now it's saying that
invalid new-expression of abstract class type 'Container'
>>
>>54234602
program a gf ai
>>
>only viable cross-platform build tools are cmake and autoconf
>they're both awful
how?
there has to be a huge demand for it, and yet there arent any better alternatives
>>
>>54234620

>tfw no reference to base it off
>>
>>54234602
HP 35s emulator
>>
>>54234613
>i mean why even respond if it's going to be some snarky, belittling little comment?
Because it's not my job to spoonfeed you, especially when it's shit that the compiler is already telling you.
>>
>>54234645
>Because it's not my job
>my job

oh god it must be so damn hard carrying the entirety of this general on your back! how do you do it?
>>
>>54234634

cool idea thanks
>>
Currently testing C with.. Compcert. Yes.. my shit still works.
>>
>>54234441
To fix the redefinition, remove the {} from the declaration of Container in the header, you're providing an empty definition in the header and then trying to add another definition in your source file.

To fix your instantiation error, remove the virtual from addChildren and getChildren or make a class to extend Container, keeping the virtual modifier and provide a definition for your function there.
>>
>>54234653
you declared these methods as abstract
and now you're defining them
why? how do you guys get to this code? Do you read nothing at all and just throw random syntax constructs until it works/someone on the internet fixes everything for you?
>>
>>54234628
    return "we're just friends, right anon?";
>>
>>54233474
nigga you're too fucking stupid to install a python module
how does it feel to be dumb as shit?
>>
>>54234663
>remove the virtual
he needs to remove "= 0" that doesn't let him define the methods, virtual is fine.
>>
If I wanted to program my own Window manager, what do I need to get familiar with?

I heard X.org is terrible, any truth to that?
>>
>>54234724
sorry anon, reading my reply I should have specified a little more, I'm on the way out the door so it was just a quick response to point him in the right direction since others weren't being particularly helpful.
>>
>>54234737
study https://github.com/SirCmpwn/sway for example. It's for wayland. Xorg is terrible, it's 100% truth
>>
>>54234737
anything that's not the native window manager to the OS you're using is going to be inferior
>>
>>54234737
>I heard X.org is terrible, any truth to that?
X11 is VERY old, and has all sorts of legacy cruft with it. Also, security with X11 is a complete joke.
I've never done any significant programming with it though, but I don't think it takes a huge amount of code to write a window manager (dwm is less than 2000 lines).

If you want to write something modern without all of the X11 cruft, write a Wayland compositor, but that is significantly harder to do.
>>
>>54234757
Isn't Wayland still WIP and unstable?
>>
>>54234782
writing a wm for xorg is a waste of time imo, this way you'd at least learn something that may be of use later
>>
>>54234782
Wayland is already at version 1.3. I think there is still a little tweaking going on with xdg-shells and other desktop stuff, but overall, it's pretty stable.
What's really needed at this point is good wayland compositors.
>>
>>54234782
Wayland itself isn't unstable, but most DE's that try to use Wayland are unstable.
>>
>>54234775
>dwm is less than 2000 lines
That does sound impressive, and I just checked out its Makefile, it's genuinely readable.
>>54234792
I'm still exploring my options for now, I may take a look at both.
>>54234802
I may try it out then.
>>54234866
I guess that's why everyone's still on X.

What's with Canonical's project though? Are we going to have both Wayland and Mir in the future?
>>
>>54234931
>I may try it out then.
I've looked into it myself before. It's pretty damn involved.
There is a whole lot of shit you have to do yourself which used to be handled by the X server.
>>
What would be the best way to produce a ceasar cipher in C?
>>
File: question-girl.jpg (18 KB, 320x308) Image search: [Google]
question-girl.jpg
18 KB, 320x308
Hey /dpt/, what is the best and most simple way to do C with Windows?
>>
https://ideone.com/Sr25NY

Why does it display 2 DEL characters and not 16 of them?
>>
>>54235000
a for loop
>>
>>54235017
install gentoo
>>
>>54235017
PellesC
>>
>>54235034
I can download it, but it it a free solution?
>>
>>54235017
CLion
>>
>>54235000
void caesar(char *str, int n)
{
int i;
for (i = 0; str[i] != '\0'; ++i)
str[i] = (str[i] - 'a' + n) % 26 + 'a';
}

r8
>>
>>54235044
free as free beer.
>>
>>54235022
it treats initializer list as a list of characters (2 chars with value = 16). Use a constructor.
>>
>>54235062
OK.

>>54235045
I have to pay after 30 days?
>>
>>54235030
I hesitate to install a vm with Arch.
>>
>>54234602
I've been reading about something fun yesterday. Have you ever heard of a MOVE architecture? It's like an extreme version of a RISC processor.
So in this architecture your processor can only handle one instruction - MOVE. You do different operations by moving data to specialized registers, which produce side effects which are results of your operations. So if you want to add two numbers, you move them into two special registers for adding which triggers operation of addition on them.

Here's one way of doing it: http://www.ht-lab.com/freecores/move/move.html

I don't know if you're into things like that, but you could do a simulator of such a processor, maybe implement it in some hdl, try to modify the architecture in some way (I have some ideas), try to write some fizzbuzz for it etc.
>>
>>54235064
You're a life saver, thanks a ton.
>>
>>54235050
Does interesting things if you pass a null string tho
>>
>>54235067
>I have to pay after 30 days?
Last time I tried it, you could download a dev build, and have the trial period reset each time, but I dunno now.

VS CE is gratis, and has pretty shit C support (C89 or something), but I think it supports clang too now.
>>
>>54235111
like what?

I didn't run it desu
>>
>>54235017
visual memio
>>
>>54234931
Check out catwm, it's just 500 lines.
>>
>>54235116
>VS CE is gratis
VIsual Studio?
>C89 or something
That's the only C I want to do. So it's perfection.
>>
>>54235199
>VIsual Studio?
Yes
>>
>>54235199
>That's the only C I want to do. So it's perfection.
Get with the fucking times, grandpa. C has evolved a lot since then.
>>
>>54235223
C has only introduce useless feature like bool,nested function, possibility to declare vars everywhere. Nothing that really change the way of coding.

When .net has evolved it has introduced
generic, then lambda. That changes everything.

Modern C just introduced cosmetic changes.
>>
>>54235034
>>54235045
>>54235116
>>54235133
Thank you for your help anons.
>>
>>54235246
>nested function
That's a GNU extension, not standard C.
>possibility to declare vars everywhere
That alone would be enough of a reason.
>Nothing that really change the way of coding
None of them fundamentally change the language, but still adds several nice features.
>Modern C just introduced cosmetic changes.
You've never taken a good look at what they have added to C, have you?
You're missing out on all sorts of shit like VLAs, designated initialisers, compound literals, stdint.h, variadic macros, etc. just to name a few from C99.
>>
What do you do when you've banged your head at a problem and can't seem to get anywhere?
>>
>>54235290
I would go to the hospital
>>
>>54235286
>You're missing out on all sorts of shit like VLAs, designated initialisers, compound literals, stdint.h, variadic macros, etc. just to name a few from C99.
Totally useless things that don't change the way of coding. You're a code monkey. Don't answer I will ignore you, I don't have time to lost with bad developers.
>>
Why is C++ so bloated and shitty? C is much better.
>>
>>54235246
>possibility to declare vars everywhere
Yes, let's hoist a dozen variables with no immediate context and expect the maintainer to keep track of every single one throughout the following control-flow-infested function.
>>
>>54235325
Sorry I don't work with code monkeys. I work with skilled developers who can maintain such code.
>>
>>54235310
>>54235338
>Totally useless things that don't change the way of coding
That's because you're retarded and stuck in your ways.
Also, you're some fuckwit with poor English who is asking about which C compiler to use. I highly doubt you're even remotely competent at programming, let alone C.
>>
>>54235349
>I highly doubt you're even remotely competent at programming, let alone C.
Here we are.
>>
>>54235349
>Also, you're some fuckwit with poor English who is asking about which C

kek, said by an angsty 15 year old Czechoslovakian fag who tries too hard yet fails at English more than those whom he criticizes

not even the person you're responding to btw
>>
>>54235246

>being too backward to use complex numbers from C99
>>
>>54235310
>liking stuff makes you a bad developer
Yeah, ignore and shut up, good riddance.
>>54235338
You 'work' in your mother's basement or have a job no one else would do, because no company who values getting stuff done hires princesses that bitch about people who learn to use modern language features.
>>
why is everyone such a cunt in these threads
>>
>>54235349
>>54235377
/int/ trolling now, srsly?
>>
>>54235437
Welcome to 4chan. Now fuck off.
>>
>>54235394
>about people who learn to use modern language features
Sorry for you. You're delusional.

Majority of C code is C89 (embedded). Only hipsters use modern C.
>>
>>54235444
>Welcome to 4chan. Now fuck off.

hello_reddit!
>>
>>54235437
Anonymity leads to a lack of accountability. Internet tough guys bragging about skills they don't have and lives they only dream of, basically.
>>
>>54235462
yeah but on all the other generals i visit outside of /g/ they're perfectly fine and not elitist fucking weeb cunts
>>
>>54231666

I got a question on hybrid vs native apps.

Why are people still writing native apps? It seems like with tools Like Cordova and phone gap the practical thing to do Would be write a hybrid app and ship everywhere at once.

So why do people still write native apps? (sorry if it's a newbie question, I'm new to programming for mobile)
>>
>>54235286
>>nested function
>That's a GNU extension, not standard C.
what the fuck are you serious? then why don't they have it for C++ as well?
>>
>>54235446
><quote related to employee attitudes>
><statement about the state of C>
I call non sequitur.
>>
>>54235508
Because C++ already has its own nested functions, if I'm not mistaken.
>>
>>54235473
results of years of telling people how precious snowflakes programmers are
>>
Hey /g/ how do I assess my code?
I've made some shitty AJAX website with 0 planning and I can only assume it's sloppy and inefficient as shit.
What should I be looking out for? Do I just go line by line closely investigating what it does & how I can optimize it?

Thanks
>>
>>54235473
Because the software field is young and many of us are self-taught, sometimes via shitty websites made by smartasses that dumb everyone down.
>>
>>54235579
why would that make people a cunt?
>>
>>54235524
Not really. Since C++11 it has lambdas, but not nested functions.
>>
File: 1374574508775.jpg (29 KB, 499x500) Image search: [Google]
1374574508775.jpg
29 KB, 499x500
>People complaining about people on 4chan being assholes
I think you should leave.
>>
>>54235613
this

i think conventional style nested functions would be neat for when you have some utility function that only gets used within another function, so you can stow it away in the top of that function
>>
>>54235586
When everyone is misinformed and thinks everyone who knows differently is wrong, egos and arguments are bound to appear.
>>
>>54235651
Interesting. It always frustrated me how everyone knows roughly the same thing but when they try to talk to each other it it looks as if they were talking about something completely different.
>>
>>54235017
Codeblocks, mingw version. Just werks.
>>
>>54235094
how the fuck is this different from normal CPU
>>
>>54235500
No lags
>>
>>54235646
I'm convinced this is an angry normie attempting a false flag.
>>
>>54235500
The "hybrid" technologies come with performance penalty.
>>
>>54235500
Because:
>better performance
>native API is always more mature, stable and complete
>one dependency less
>>
/dpt/ is it normal to think you 'can do nothing'?
Like, I got a project in uni, thought "holy fuck this is impossible I have no idea what to do" - and then I was done in under half the time we had for it.
Okay, as I'm studying EE it was electronics and programming, not just plain programming, but still.
I always get this hopeless feeling that I have no idea what to do, but then it easily works out - very fast even. Normal?
>>
>>54235730
xie xie

but I think I will try VS

in the past I used notepad and DJGPP
>>
>>54235742
> in this architecture your processor can only handle one instruction - MOVE
>>
>>54235765
instead of thinking "this looks complicated" when you get the project you should think "which of my knowledge does apply here? where do i look to learn about the missing parts?"
>>
>>54235765
Google 'software estimates'.

Yes, it's normal. Try breaking it down.
>>
>>54235500
because webshit like cordova and phone gap suck fucking ass, gives a low quality product with terrible performance and battery drain, and they tend to have bigger filesizes and have more bugs

especially for games and multimedia you need good performance
>>
>>54235500
>Why are people still writing native apps?
For the sake of simplicity, there's three development camps:
>'BFC' big fucking company (twitter, facebook, etc.)
>small to mid-size company, as well as internal applications
>individual fartbox devs

BFC has the resources to write a native application for each platform. Web, Android, iOS, WP(maybe), etc.

Individual fartbox only knows Swift or Java and so deploys to one of these two things, as they haven't had enough experience to play with hybrid tools, or their copy/pasted code from their college class doesn't fit the basic MVC layout.

Small/Mid companies, ESPECIALLY for internal applications, are using hybrid deployment. I personally maintain one for the company I work for, as well as a few clients. Xamarin makes it pretty damn easy, as I already was familiar with C#.
>>
>>54235500
>>54235795
and if you know what you're doing you can write "native" code that you can very easily port to any platform
>>
>>54235781
>>54235786
As I said, the solving's not the problem. It ends up going "ah, I can try this, oh, then this, then that" and suddenly everything's done, when I think I'm still far from the goal.
Suddenly this feeling of "lel it's done" sets in.

So I'll just take that as a "yes, it's normal".
>>
>>54235742
None of this:
http://ref.x86asm.net/geek.html
>>
>>54235500
Try writing anything more than a "Hello world" app in a hybrid framework of choice and you'll know.
>>
>>54235803
>small to mid-size company
You mean an SME, right?
>>
>>54235500
>>54235795
also dynamically typed shitter languages like javascript ARE COMPLETE FUCKING SHIT and you can only make very simple shitter apps with them
>>
>>54235837
Atom? VSCode? Duelyst?
>>
>>54235807
>As I said, the solving's not the problem.
Yes, hence 'break it down'. If you can't estimate the build time of a cathedral, start by estimating the build time of the walls, windows, tower etc.
>>
>>54235857
kill yourself
>>
>>54235837
Well, JS is shit, but it's certainly not only used for 'simple shitter apps' as you so eloquently put it.
>>
>>54235865
mad because I've proven you wrong?
>>
>>54235872
yes it is
>>
>>54235876
they are not mobile apps and they're shitty and irrelevant
>>
>>54235825
>SME
>small to mid-size enterprise

I fail to see the distinction, but yes. My company and clients range from 40 to ~200 end-users.
>>
>>54235899
certainly more relevant than your fizzbuzz in ansi c
>>
What's some good programming food?
>>
>>54235911
kill yourself and fuck off to >>>/g/wdg literal fag
>>
>>54235913
your mom
>>
>>54235913
Soup. No, seriously. It fills you with warmth, energy and water, yet at the same time you don't feel oversatiated.
>>
File: saltyfuck.png (175 KB, 650x400) Image search: [Google]
saltyfuck.png
175 KB, 650x400
>>54235915
>>
>>54235913
Quiche and coffee.

Strawberries and tomatoes with balsamic if you've got it.
>>
>>54235927
look at this poorfag
>>
>>54235837
>ARE COMPLETE FUCKING SHIT and you can only make very simple shitter apps with them
COBOL is shit, and yet our banking systems rely on it. C is unsafe, and yet it's the lingua franca of programming. CPAN has one of the most extensive collection of libraries, and Perl is so ubiquitous, it comes preinstalled on many popular Linux distros. Stop peddling this 'you need a perfect language to get anything done' nonsense.

>I need $10000 shoes to jog, otherwise I'm doing it wrong wahwahwah
>>
>>54235986
good luck with your js cordova flappy bird clone babby shit lmfao
>>
File: firefox_2016-01-20_14-29-12.png (21 KB, 258x88) Image search: [Google]
firefox_2016-01-20_14-29-12.png
21 KB, 258x88
FRIENDLY REMINDER!

Anon, your favorite language is probably really great for many different applications!

Keep learning it and become an expert!

There are great jobs in every programming language!

Don't give up!

Support your fellow anons' endeavors to gain currency with their favorite language!

Except Haskell fags. Fuck those guys.
>>
File: computation expression 1.png (12 KB, 510x312) Image search: [Google]
computation expression 1.png
12 KB, 510x312
>>
>>54236012
>lmfao
*sigh* Good luck reaching the 7th grade to you too.
>>
>>54235837
i can make a fucking app in 10 seconds with javascript on a computer that has zero coding tools installed
meanwhile, you suck dick
>>
>>54235667
>deleted

>>54235646
>not deleted

literally kill yourself trap fag/fuck off false flagger
>>
>>54236050
fucking idiot

>>54236053
cool app ahmed
>>
>>54236034
>There are great jobs in every programming language!
Where? Where can I find a job using, say, Nim or Clojure? C++, PHP, ASP.NET, Python, Java, these are what's sought. Employers are afraid that betting on an unpopular language will shrink their talent pool.
>>
>>54236121
There are nearly 600 jobs alone on LinkedIn for those languages!

And you're like one of 7 people that know those languages!

Free job!

Don't give up!
>>
>>54236085
So why are you so sad and angry? No friends? Laughed at by girls? Mom left you with an alcoholic dad? Ugly from birth? Cerebral palsy? Sole Trump voter of your entire slum?
>>
>>54236184
>projecting this hard
you're clearly the one who's angry lmfao
>>
>>54236147
Except they all expect relocation, working primarily with something other than what they advertise, are looking for seniors and leads, work in an area that is of no personal interest, expect 60h work weeks or just don't provide adequate pay.

Still, I appreciate the thought.
>>
>>54236279
Relocation is a good thing, from my standpoint.

I'm single with a cat, though. Nothing tying me down.

I get bored, so new scenery is fun.
Thread replies: 255
Thread images: 22

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.