Previous thread: What are you working on, Sup Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
microsoft.com
channel9.msdn.com
pastebin.com
mva.microsoft.com
robmiles.com
stackoverflow.com
instagram.com
issc.uj.ac.za
twitter.com
Learning Rust.
i too like to waste my time
3rd for C#
The cutest language.
Like I promised the grand reveal (turn on sound):
y-you too
Awesome
post source
That's actually moderately humorous.
class Foo
{
private:
void fooThing();
};
class Bar
{
private:
void barThing();
}
class Baz
{
private:
void bazThing();
}
template
class Derived : public T
{
}
Is there anything I could write in these classes so that you can freely call fooThing(); on an object of type Derived but not Foo, barThing() on Derived but not Bar, bazThing() on Derived but not Baz, and so on for any class?
Please don't ask why.
kek
>tfw no gf
I'm in love, user. Why aren't C and assembly developers this cute?
>she did a video showing off VS Code for macOS and dresses like a hipster to make fun of people that use macOS
channel9.msdn.com
lol
I don't think this is possible
>image search for said jizz wizz
W-whyyyy user. I didn't need these feels right now.
I was hoping you could do some magic with friend classes but I'm not familiar with those.
>she will never berate you for your bad programming practices
Here you go (code is probably pretty horrible but I don't write JS normally): pastebin.com
It's a userscript. Only tested it in Firefox but will probably also run in webkit browsers. It's utterly unoptimized, too (e.g. doesn't take care of the update function, you can't stop sound, etc.)
I'm learning Python via automate the boring stuff and I'm wondering if I should of learnt Python from a different resource.
>tfw no cpp gf
put fooThing in a friend class of Foo and derive from the friend class instead of Foo?
wtf I love microsoft now
>it's a fucking frog thread
guess this is fucking reddit now
Sometimes I don't even notice I wrote C-hash code instead of C code until I save the text file.
frogposting originated from Sup Forums, summerfriend
...
Then you're either writing horrible C, or writing horrible C#.
Unless you're using unsafe , in which case, carry on.
>ywn be a qt female programmer
>ywn have smelly virgin CS students salivating over your videos online
I'm not sure what exact behavior you want. It sounds like abstract classes. Something like this, perhaps?
struct Foo {
virtual void foo() = 0;
};
struct Bar {
virtual void bar() = 0;
};
template
struct Derived : public T {
virtual void foo() {}; // actual implementation
virtual void bar() {};
};
int main()
{
Derived d_foo;
d_foo.foo();
// Foo f; won't compile: foo is an abstract class
return 0;
}
I always live on the edge.
I know about abstract classes, that's not what I want.
I want to define the implementation in the base class but have it only be accessible on an instance of the derived template class
Since there appear to be come C# bros in here, can someone please recommend me a good video tutorial for it? Some kind of a quick rundown on the general structure of the language?
I've been tasked with making changes to a prexisting C# program and the structure seems to be a bit of a mindfuck at first glance.
can html and css alone be malicious?
you've been blue-pilled by Sup Forums for too long brother, welcome.
>Some kind of a quick rundown on the general structure of the language?
It's just java senpai.
no, unless there is an exploit in the parser (unlikely). also the site will be able to log your IP / UA via the webserver.
So did troll faces
>should of
you should have learned the english language from a different resource
Well I'm already half way through and it occurred to me if I should of used this book as a supplement material
The MVA tutorials are fine. These are the official video tutorials, and they're free:
mva.microsoft.com
Alternatively, the PluralSight videos are probably objectively the best. PluralSight isn't free, but you can get like 3 months free if you sign up for Dev Essentials, which gives you all sorts of other goodies.
Another alternative is the easiest free book to get into, but I wouldn't recommend it unless you're relatively new to programming:
robmiles.com
Go spend time on Channel9, and you're all set.
I don't know Java at all, my dude.
Regex is great, lads. Before I was writing 20-line snippets in python for preprocessing log files or whatever, now it's just a 5-seconds search and replace.
Do you at least know OOP principles?
Reminder to read a lot of books unironically.
You don't even have to know much about OOP to use C#.
I'm not sure if there is a way to get that. Here's a workaround:
struct Foo {
virtual void foo() = 0;
protected:
void imp() { } // foo's implementation
};
struct Bar {
virtual void bar() = 0;
protected:
void imp() {}
};
template
struct Derived : public T {
virtual void foo() {
T::imp();
};
virtual void bar() {
T::imp();
};
};
int main()
{
Derived d_foo;
d_foo.foo();
// Foo f; won't compile
// d_foo.imp(); won't compile: foo is a protected member
return 0;
}
I was hoping for something on Youtube that I could rip using deturl, but I'll check those out, thanks.
Yeah, I'm relatively proficient in Python and my first non-C foray into programming was Visual Basic about a decade ago. So I should be good then?
Ruby on Rails
Textbooks or novels?
>novels
>fiction
/lit/ please
Real /dpt/ men don't read fiction. I mean programming books
poems
how do y'all niggas draw state diagrams?
what software do you use?
Should be fine.
I can read CLRS and Camus simultaneously. AMA
I can recommending pic related. Really well written and you will learn pretty much everything there is about regex. What I used most are word boundaries and lazy quantifier which are very useful. And you learn about things like lookaheads and recursions which are neat
Tikz.
God, I really need to sit down and learn fucking regex it's been forever
hmm, maybe I can get what I want with template specializations
thanks anyway
thanks for the tip. i might try this:
stackoverflow.com
>500 page book
>on regex
is this really necessary? I just sorta "learned" it by tinkering with Nginx and regex101.com
This tbqh family.
It's literally something you learn in half an hour and then play with a little, and you've got it.
The main part are around 200 pages, the rest is different implementations. It goes into a lot of depth, i.e. how does the regex engine work. It obviously depends on your motivation:
If you want to drive a car, learn a bit of regex101 and use stackoverflow
If you want to understand how a car works, read the book
But that wasn't what I suggested.
top kek
true, but your image mentioned mathematica and i'm more comfortable with mathematica, and i'd imagine that i could get a similarly useful result with mathematica as with tikz
Template specialization was the missing part.
#include
struct Foo {
protected:
void foo() { printf("foo\n"); }
};
struct Bar {
protected:
void bar() { printf("bar\n"); }
};
template
struct Derived : public T {};
template
struct Derived : public Foo {
void foo() { Foo::foo(); }
};
template
struct Derived : public Bar {
void bar() { Bar::bar(); }
};
int main()
{
Derived d_foo;
d_foo.foo();
Foo f;
//f.foo(); // protected
return 0;
}
Now it does what you want.
...
Going to start a project that will exceed million lines of code. What language/IDE would you recommend?
is there anyway to write a script to download a random user instagram photo?
take this for example:
instagram.com
there is no button "save as" and i have to inspect the element to download the photo in the original resolution
can a bash or perl script do this?
seems impossible
That's almost perfect. There were a few extra things I wanted to stuff into Derived by default (it's a template for a reason) but this will do.
That explains why you're on Sup Forums
Depends, what's the project.
Also emacs
eh, fine. I think I'll skim through at least the main section to make sure I haven't missed out.
Alright, so i am learning C++ at the moment, since i got fed up with how slow Python and Matlab can be. It is all going fairly well, but i have encountered a problem i have no clue how to even approach.
I am writing a program which, given a couple of coordinates, can interpolate a polynomial which perfectly fits. I have already implemented it in python and Matlab but both have symbolic manipulation available. As far as i am aware, no such library exists for c++.
So, my question is: how can i program a symbolic variable into c++? How can i simplify an expression involving these variables? I.e, i am likely to end up with something like 12*x*(x-1)(x+1). How can i simplify this to 12x^3-12x? Any ideas? Or is C++ just not meant for such tasks?
How long did it take you guys to git gud at programming?
I'm 3 chapters in Automate the Boring Stuff with Python and I couldn't even manage to make a hangman program.
How do I improve?
Game engine. Emacs is unusable, it starts with GNU indentation.
>language
It's in C11.
C++ is not meant for these tasks. Enjoy writing a polynomial class, I guess.
You never git gud, you just gradually know more than most while knowing much less than others.
sure, just parse the html or use their API
Best C in memory nosql database that's cross platform and that supports saving it to file.
You should try to code something you are interested in. I like math, so my first programs were all testing the collatz conjecture, finding primes, etc. I learned python last summer, then matlab in winter, then c++ and java now. Once you get going, it will improve rapidly.
Practice is literally all that helps.
>symbolic calculations
>C++
Just buy Mathematica lmao
>Tfw got hired at a .NET factory
>Have started slowly gutting modules and replacing the massively overengineered OOP factories with unsafe C-style blocks
feels good doing gods work
> best nosql database
> good luck on that
A friend of mine managed to implement it in Java, but i have not talked to him in ages and it would be weird to ask. I think he just mapped coefficients to a list of strings like "x^3" and shit. Would that be viable? Otherwise i will just stick to higher level languages for math stuff
Well it could be sql database but I don't really intend to store relational data so wouldn't nosql database be simpler?
eh, I don't remember sage being extremely slow when using it a few years ago
developing a basic comp algebra system in c++ could be a good exercise though
Use Maple.
Guess so, might as well use csv then and add the first 2 rows say the type and name of the fields
>mapped coefficients to a list of strings
Fucking disgusting
I guess you could invent a set of classes for storing and transforming expressions, but it'd be some exercise
Like the others have said, C++ is not really meant for this task. However, there are libraries that can help, depending on the complexity of your needs.
This one is interesting, and there are books written about it:
issc.uj.ac.za
Why the fuck would I do that if there's efficient key value databases out there?
Horrible one liner:
curl "" | grep -oP '"display_url": "\K([^"]*?)"' | sed 's/"//' | xargs curl -O
Just use lisp
>Mathematica
nonfree
Use an intermediate class
#include
class Foo
{
protected:
void fooThing(){} //
Pretty much, it's less about getting gud and more about sucking less
c# but i got no idea wat im doing