|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
On March 21 2016 11:23 Frudgey wrote: Hey does anyone know of a good place (online) to do some C++/Javascript programming practice?
I have a job interview next week so I want to brush up.
Also if anyone has some tips for a programming interview I'm all ears. They're going to have a practical set-up where I can demonstrate my coding abilities. Anyone know what I should expect? You can go to codefights and play with people in C++/javascript.
Make you demonstrate your coding abilities? Well, expect (at least) one of the two things: 1- They give you a green field and ask some question. I had one recently. They gave you a string with man repetitions of letters (let's call this str) and a number (let's call this int). Then I had to check the str for repetitions of letters and if there are repetitions for a number bigger than or equal to int, I would replace all of them with * (I solved this in Java btw)
Example: (aaaabbbcc, 3) -> (*******cc), (aaaabbbcc, 4) -> (****bbbcc) or such.
2- They give you a big fucking project and ask you for small fixes. I had this in a PHP interview (I don't even know PHP btw). The questions were like:
- remove autocomplete from this place - implement this table with this data on the controller side (well yeah, we have some SHIT that does not work at all, so good luck with that too) - there is this thing that sums up all the amounts in dollars, i don't want to sum them up in dollars, i want to sum them up in local currencies, implement that too
3- They give you a whole bunch of shit that they call requirements and ask for an implementation.
Also, a tip:
- ALWAYS write tests first.
On March 21 2016 09:42 WarSame wrote: Is that because you ran into callback hell? I can handle callback hell. What I can't handle is my test mqtt client subscribing into a whole bunch of different topics and my server client subscribing into a whole bunch of other topics and one of them publishing shit into a topic and the subscriber receives a message, sends another message into another topic and the recipients of the second topic send some other message in yet another topic and the whole fucking hell breaks loose on me. How the fuck are people supposed to write unit tests on this shit. Even worse, without unit tests, how the fuck are people supposed to write code on this shit.
|
On March 21 2016 16:28 Djagulingu wrote:Show nested quote +On March 21 2016 09:42 WarSame wrote: Is that because you ran into callback hell? I can handle callback hell. What I can't handle is my test mqtt client subscribing into a whole bunch of different topics and my server client subscribing into a whole bunch of other topics and one of them publishing shit into a topic and the subscriber receives a message, sends another message into another topic and the recipients of the second topic send some other message in yet another topic and the whole fucking hell breaks loose on me. How the fuck are people supposed to write unit tests on this shit. Even worse, without unit tests, how the fuck are people supposed to write code on this shit.
That's why I don't like message based architecture. It all sounds nice in theory, but in practice it ends up being a mess that requires a huge amount of documentation and diagrams that need to be constantly maintained so everyone who works with the code knows what happens when anything happens and can follow the (hopefully current) diagram instead of digging through the code. Since programmers are terrible about updating documentation or diagrams, it just results in a lot more code digging.
I think every IDE and syntax highlighting editor should have a big "Did you KISS?" confirmation dialog before you save any file. So many Architecture Astronauts invent (or in the case of message based architecture re-invent) stuff that is just unpractical.
|
On March 21 2016 17:26 Morfildur wrote:Show nested quote +On March 21 2016 16:28 Djagulingu wrote:On March 21 2016 09:42 WarSame wrote: Is that because you ran into callback hell? I can handle callback hell. What I can't handle is my test mqtt client subscribing into a whole bunch of different topics and my server client subscribing into a whole bunch of other topics and one of them publishing shit into a topic and the subscriber receives a message, sends another message into another topic and the recipients of the second topic send some other message in yet another topic and the whole fucking hell breaks loose on me. How the fuck are people supposed to write unit tests on this shit. Even worse, without unit tests, how the fuck are people supposed to write code on this shit. That's why I don't like message based architecture. It all sounds nice in theory, but in practice it ends up being a mess that requires a huge amount of documentation and diagrams that need to be constantly maintained so everyone who works with the code knows what happens when anything happens and can follow the (hopefully current) diagram instead of digging through the code. Since programmers are terrible about updating documentation or diagrams, it just results in a lot more code digging. I think every IDE and syntax highlighting editor should have a big "Did you KISS?" confirmation dialog before you save any file. So many Architecture Astronauts invent (or in the case of message based architecture re-invent) stuff that is just unpractical.
Well... in an IoT system you don't have any alternative to messaging. You can lament a poorly thought out architecture, but the messages are there to stay. And let's face it. Sometimes you can't unit test. Not everything can be neatly compartmentalized. Of course, I know nothing about the project, so maybe it's just a really shitty design, and a neater design would allow unit testing.
|
|
On March 21 2016 20:47 Acrofales wrote:Show nested quote +On March 21 2016 17:26 Morfildur wrote:On March 21 2016 16:28 Djagulingu wrote:On March 21 2016 09:42 WarSame wrote: Is that because you ran into callback hell? I can handle callback hell. What I can't handle is my test mqtt client subscribing into a whole bunch of different topics and my server client subscribing into a whole bunch of other topics and one of them publishing shit into a topic and the subscriber receives a message, sends another message into another topic and the recipients of the second topic send some other message in yet another topic and the whole fucking hell breaks loose on me. How the fuck are people supposed to write unit tests on this shit. Even worse, without unit tests, how the fuck are people supposed to write code on this shit. That's why I don't like message based architecture. It all sounds nice in theory, but in practice it ends up being a mess that requires a huge amount of documentation and diagrams that need to be constantly maintained so everyone who works with the code knows what happens when anything happens and can follow the (hopefully current) diagram instead of digging through the code. Since programmers are terrible about updating documentation or diagrams, it just results in a lot more code digging. I think every IDE and syntax highlighting editor should have a big "Did you KISS?" confirmation dialog before you save any file. So many Architecture Astronauts invent (or in the case of message based architecture re-invent) stuff that is just unpractical. Well... in an IoT system you don't have any alternative to messaging. You can lament a poorly thought out architecture, but the messages are there to stay. And let's face it. Sometimes you can't unit test. Not everything can be neatly compartmentalized. Of course, I know nothing about the project, so maybe it's just a really shitty design, and a neater design would allow unit testing. Well, for any future reference: NEVER test your nodejs MQTT client using mocha. You will fuck it. 100%. No other way. Use an external place to test your shit. Like... Write an angular client and run your test suite on it. Or something else. Just don't use mocha in your nodejs mqtt client.
On March 21 2016 21:18 Nesserev wrote:Show nested quote +On March 21 2016 20:47 Acrofales wrote:On March 21 2016 17:26 Morfildur wrote:On March 21 2016 16:28 Djagulingu wrote:On March 21 2016 09:42 WarSame wrote: Is that because you ran into callback hell? I can handle callback hell. What I can't handle is my test mqtt client subscribing into a whole bunch of different topics and my server client subscribing into a whole bunch of other topics and one of them publishing shit into a topic and the subscriber receives a message, sends another message into another topic and the recipients of the second topic send some other message in yet another topic and the whole fucking hell breaks loose on me. How the fuck are people supposed to write unit tests on this shit. Even worse, without unit tests, how the fuck are people supposed to write code on this shit. That's why I don't like message based architecture. It all sounds nice in theory, but in practice it ends up being a mess that requires a huge amount of documentation and diagrams that need to be constantly maintained so everyone who works with the code knows what happens when anything happens and can follow the (hopefully current) diagram instead of digging through the code. Since programmers are terrible about updating documentation or diagrams, it just results in a lot more code digging. I think every IDE and syntax highlighting editor should have a big "Did you KISS?" confirmation dialog before you save any file. So many Architecture Astronauts invent (or in the case of message based architecture re-invent) stuff that is just unpractical. Well... in an IoT system you don't have any alternative to messaging. You can lament a poorly thought out architecture, but the messages are there to stay. And let's face it. Sometimes you can't unit test. Not everything can be neatly compartmentalized. Of course, I know nothing about the project, so maybe it's just a really shitty design, and a neater design would allow unit testing. There's an alternative... just don't do it. Don't do IoT. It's bad for you and everyone. :3 Well, that's an alternative for sure, but it's as good of an alternative as "don't use fire because you can get burnt and shit" in any given winter in the stone age.
|
|
Zurich15313 Posts
Anyone know a good overview of HTML5/cross device UI frameworks?
Google gives me a thousand super superficial clickbait "the 20 most important HTML5 frameworks of 2015" results, but nothing that looks very good.
Things I am looking for in addition to the usual jazz are native device capabilities, offline capabilities, transactionality. Happy to include commercial frameworks.
|
Hyrule18969 Posts
Bootstrap is HTML5 compatible, and free. I've also heard good things about Foundation, but I've never used it.
|
On March 22 2016 21:31 tofucake wrote: Bootstrap is HTML5 compatible, and free. I've also heard good things about Foundation, but I've never used it.
Foundation is yet another grid-based framework. Very similar to Bootstrap. Didn't work long with that but from what I've glanced its major benefit is that you can achieve the same results as in Bootstrap but with less code.
Personally, I think you can never go wrong with Bootstrap and jQuery for front-end. They might not be the best thing around but there's a metric ton of online resources for them since they're so widely used. It's also easier to find help/replacement team members if you work with widespread technologies.
|
Can this code be refactored to use STL? words is std::vector<std::string>.
+ Show Spoiler + for (size_t i = 0; i < words.size(); ++i ) { for ( auto j = words.size() - 1; j > i; --j ) { auto & w1 = words.at(i); auto & w2 = words.at(j); if (w2.length() > w1.length() || (w2.length() == w1.length() && w2 > w1)) std::swap(w1, w2); } }
The only idea I have is std::sort with a predicate. Is that the best 'STL way'?
|
On March 23 2016 05:57 Shield wrote:Can this code be refactored to use STL? words is std::vector<std::string>. + Show Spoiler + for (size_t i = 0; i < words.size(); ++i ) { for ( auto j = words.size() - 1; j > i; --j ) { auto & w1 = words.at(i); auto & w2 = words.at(j); if (w2.length() > w1.length() || (w2.length() == w1.length() && w2 > w1)) std::swap(w1, w2); } }
The only idea I have is std::sort with a predicate. Is that the best 'STL way'? If you're trying to sort things, std::sort seems like an obvious choice. That would be trivial to understand, much unlike your code sample.
|
On March 23 2016 06:24 spinesheath wrote:Show nested quote +On March 23 2016 05:57 Shield wrote:Can this code be refactored to use STL? words is std::vector<std::string>. + Show Spoiler + for (size_t i = 0; i < words.size(); ++i ) { for ( auto j = words.size() - 1; j > i; --j ) { auto & w1 = words.at(i); auto & w2 = words.at(j); if (w2.length() > w1.length() || (w2.length() == w1.length() && w2 > w1)) std::swap(w1, w2); } }
The only idea I have is std::sort with a predicate. Is that the best 'STL way'? If you're trying to sort things, std::sort seems like an obvious choice. That would be trivial to understand, much unlike your code sample.
Oh yeah, I know. It's for a friend who has an assignment to use more STL. I had suggested sort but he said he was still going to solve that problem tomorrow. That's why I asked if there was a more STL way than sort with a predicate. Thanks.
|
Zurich15313 Posts
On March 23 2016 01:16 Manit0u wrote:Show nested quote +On March 22 2016 21:31 tofucake wrote: Bootstrap is HTML5 compatible, and free. I've also heard good things about Foundation, but I've never used it. Foundation is yet another grid-based framework. Very similar to Bootstrap. Didn't work long with that but from what I've glanced its major benefit is that you can achieve the same results as in Bootstrap but with less code. Personally, I think you can never go wrong with Bootstrap and jQuery for front-end. They might not be the best thing around but there's a metric ton of online resources for them since they're so widely used. It's also easier to find help/replacement team members if you work with widespread technologies. Yeah those are the obvious choices but don't offer any of the features I am looking for as far as I know.
|
And what features are you looking for?
Edit: never mind, I've re-read your original post 
Will look into it.
|
Zurich15313 Posts
|
Which algorithms of C++ <algorithm> do you guys use most of the time?
|
On March 24 2016 02:01 Shield wrote:Which algorithms of C++ <algorithm> do you guys use most of the time?  find, sort, swap, min and max mostly. Others are more niche like transform and copy. I have never used 80% of the algos but I assume they have their uses.
|
On March 24 2016 03:48 Biolunar wrote:Show nested quote +On March 24 2016 02:01 Shield wrote:Which algorithms of C++ <algorithm> do you guys use most of the time?  find, sort, swap, min and max mostly. Others are more niche like transform and copy. I have never used 80% of the algos but I assume they have their uses.
Yeah, I use and know them but I feel like I use too few.
Some guy parses data from the Fish server here: http://www.teamliquid.net/forum/brood-war/506307-fish-ladder-under-your-fingers Does anyone know what tools could be used to do the same in C# or C++? I don't need full code, just some quick guide and possible libraries to consider.
|
|
On March 24 2016 05:03 Shield wrote:Show nested quote +On March 24 2016 03:48 Biolunar wrote:On March 24 2016 02:01 Shield wrote:Which algorithms of C++ <algorithm> do you guys use most of the time?  find, sort, swap, min and max mostly. Others are more niche like transform and copy. I have never used 80% of the algos but I assume they have their uses. Yeah, I use and know them but I feel like I use too few. Some guy parses data from the Fish server here: http://www.teamliquid.net/forum/brood-war/506307-fish-ladder-under-your-fingersDoes anyone know what tools could be used to do the same in C# or C++? I don't need full code, just some quick guide and possible libraries to consider. 
Well, for sure you won't be able to match what python can do in 200 lines of code with C# or C++...
What you need to look for in libraries is more or less this: 1. ability to grab the DOM (or at least part of it) of an external web page 2. ability to parse said DOM 3. json support (I guess that could be exchanged for any other way of storing data for easy parsing later on, xml, yaml, csv, whatever)
You could do it with JavaScript, since its primary purpose is DOM parsing and manipulation.
I mean, all this script really does is: get external DOM -> parse DOM -> save parsed data to file -> parse file and display data. In theory you could bypass entire saving to file and then reading from it again parts by simply passing parsed DOM around as variable.
I'm drunk. I shouldn't post.
|
|
|
|