• What are you working on? December 2011 Edition
    3,353 replies, posted
At our uni labs, the computers have multiboot - you can choose between Win 7 and Ubuntu. So students get the choice of either.
[QUOTE=Kamshak;33749371]It's a nice thing imo, when students start getting used to linux there's a chance that in the future the real world will be in linux as well :) Also the difference between win + linux is not so big anymore anyway, moving from word to openoffice is a nice thing too.[/QUOTE] We mainly used Win XP and 7 at school but also learned to work with Linux. We even had to setup our own Ubuntu Server Edition (only terminal, no X) and I'm very glad we did that. When you have to work with servers (which I assume every dev will have to do at some point) you'll have to be able to use a Linux terminal.
[QUOTE=garry;33748374]Lol that kid wasn't 3l33t like us right? Seems stupid to use some strain of Linux to teach kids about computers.. when in the real world they'll most likely be using Windows. I'm not saying that out of some kind of allegiance with Windows, that's just a fact.[/QUOTE] Back in the days we had those old iMacs that were all in one: [img]http://das.blogsport.de/images/imac10_1.jpg[/img] Our school finally got windows XP computers and netbooks in 2007. Until then we HAD to use the iMacs for our computer education stuff.
I know this isn't WIAWO and some of you are going to hate me for it but, what are your opinions on SOPA and how do you think it will turn out?
I fucking hate the C++ standard library, not because its bad, but because it massivly abuses operators I have lost count on how many people has gotten massivly confused when learning C++ because of it, it makes my blood boil
[QUOTE=Jookia;33748236]stuff[/QUOTE] There's still absolutely no need to bring a library into this though, you could create a cross-platform function to do this with a simple ifdef.
[QUOTE=dajoh;33750930]There's still absolutely no need to bring a library into this though, you could create a cross-platform function to do this with a simple ifdef.[/QUOTE] Or you could not reinvent the wheel and avoid future headaches by using something tested and verified externally and that is known to work in 99% of cases.
[QUOTE=Darwin226;33750630]I know this isn't WIAWO and some of you are going to hate me for it but, what are your opinions on SOPA and how do you think it will turn out?[/QUOTE] Opinions? Fuck SOPA If it gets through (which would be very, very unfortunate) I hope that Obama vetos it.
[QUOTE=Lexic;33750953]Or you could not reinvent the wheel and avoid future headaches by using something tested and verified externally and that is known to work in 99% of cases.[/QUOTE] Reinvent the wheel? It's 20 lines at most.
[QUOTE=dajoh;33751003]Reinvent the wheel? It's 20 lines at most.[/QUOTE] The wheel is a stone square with the corners chipped off. I'd rather use a Michelin tire on my car though.
[QUOTE=benji2015;33748760][img]http://puu.sh/aLOG[/img] Just screwing around with it now, no motivation [editline]16th December 2011[/editline] [img]http://puu.sh/aLQq[/img][/QUOTE] whoa ohmagawd dat art holy shit
Speaking of reinventing wheels... why cannot I not help but think this could be done with some fancy MySQL triggers? [url]http://codepad.org/3nDd5adG[/url] *sigh* Let's see if I can do this without following my typical project lifecycle. Idea -> Sleepless Nights -> Concept -> Dreaming -> Depression -> Half-assed Implementation -> Dead project.
[QUOTE=Lexic;33751010]The wheel is a stone square with the corners chipped off. I'd rather use a Michelin tire on my car though.[/QUOTE] Because that 20 line function for walking the filesystem has oh so much room for improvement?
LOL I fucked up my uni hw and [IMG]http://dl.dropbox.com/u/44710267/BATMAN.png[/IMG] it's BATMAAAAAAAN
[QUOTE=dajoh;33751081]Because that 20 line function for walking the filesystem has oh so much room for improvement?[/QUOTE] Does it support unicode? Does it support right to left languages? How about symlinks? Maybe you end up with a case where you want to iterate backwards through the directory structure instead of forwards. Recursive directory listings? Filtering things by file extension? All these things that MIGHT come up in the unknown future, all held together with your cludge of ifdefs written in C in a C++ application. There are libraries that handle all these cases, and more that I can't think of at the moment. They handle it well, with error detection and propagation and with a clean C++ interface. They are actively maintained and have any problems with them detected reported and fixed. Don't reinvent the wheel, there's an open source version out already.
[QUOTE=Tobba;33750643]I fucking hate the C++ standard library, not because its bad, but because it massivly abuses operators I have lost count on how many people has gotten massivly confused when learning C++ because of it, it makes my blood boil[/QUOTE] I have never had an issue with the STL's use of operator overloading, maybe I'm not abusing it right.
[QUOTE=Lexic;33751174]Don't reinvent the wheel, there's an open source version out already.[/QUOTE] To add to the discussion; C++11 (well, Technical Report 2 to be exact) has filesystem from Boost in the standard. Although so far only MSVC11 supports it, not g++ or others. It's cross-platform but other platforms just haven't implemented it yet :v:
Most of the time I feel like it's better to look for a library first, because I figure yeah I could do it myself but if I can do it, there's bound to be someone else who's done it more efficiently and with better support.
[QUOTE=Lexic;33751174]Does it support unicode?[/QUOTE] FindFirstFileW on Windows, opendir supports UTF-8. [QUOTE=Lexic;33751174]How about symlinks?[/QUOTE] Why would symlinks need special handling? [QUOTE=Lexic;33751174]Maybe you end up with a case where you want to iterate backwards through the directory structure instead of forwards.[/QUOTE] Ideally you'd save the results, and then you could iterate backwards with ease. [QUOTE=Lexic;33751174]Recursive directory listings?[/QUOTE] Just call the function recursively. [QUOTE=Lexic;33751174]Filtering things by file extension?[/QUOTE] FindFirstFile has inbuilt support for this, could easily be implemented on Linux. Does he really need support for all of this in the first place? I'm just saying that dragging in another library just for walking the FS shouldn't be his first choice.
[QUOTE=dajoh;33751376]I'm just saying that dragging in another library just for walking the FS shouldn't be his first choice.[/QUOTE] I disagree entirely and put forth my opinion that when writing clean cross-plaform code (which I also think you should always do), your first instinct should be to reach for a library when you find something you can't do without resorting to the preprocessor. Anyone who uses your code after you will thank you for it, and that person might even be you in two years time. You're using a high(ish) level language, so keep your code high level. [editline]16th December 2011[/editline] [QUOTE=dajoh;33751376]FindFirstFileW on Windows, opendir supports UTF-8. Why would symlinks need special handling? Ideally you'd save the results, and then you could iterate backwards with ease. Just call the function recursively. FindFirstFile has inbuilt support for this, could easily be implemented on Linux.[/QUOTE] I wasn't suggesting that these weren't possible incidentally, my point was that for each of those cases, you'd have to edit and enlarge your '20 line' function every time you ran into one of them, when the libraries already natively support them all.
I'm going to have to side with Dajoh on this one: 1. It's a learning experience 2. The API will match your naming/coding conventions 3. Dependencies. This is especially important to me, probably less so to non-purists. 4. Licenses. God damn licenses. However, there is no need to roll your own for everything. Except boost, because fuck boost.
Anyone know of any tool that will convert a binary file into a c++ structure. I understand that the c++ structure will be huge - but I don't care about that. Like how this is done.. [url]http://code.google.com/p/gwen/source/browse/trunk/trunk/gwen/Renderers/OpenGL/DebugFont/FontData.h[/url] I know it's easy to code it myself.. but I don't want to do that if I can avoid it.
You'd have to provide the structure in some way regardless, wouldn't you?
no it's just an array of bytes
Oh, you meant an array? Why'd you say structure?
I didn't put much thought into it [editline]16th December 2011[/editline] Fuck it I'm writing one
[img]http://dl.dropbox.com/u/99765/b884933.png[/img] ..fuck
[cpp]// Headers #include <iostream> #include <fstream> int main( int argc, const char* argv[] ) { // Show usage info if ( argc != 3 ) { std::cerr << "Usage: bin2array <input.bin> <output.hpp>" << std::endl; return 1; } // Read binary std::ifstream binFile ( argv[1], std::ios::binary | std::ios::ate ); if ( !binFile.is_open() ) { std::cerr << "Failed to open input binary!" << std::endl; return 1; } std::streamsize length = binFile.tellg(); binFile.seekg( 0, std::ios::beg ); char* data = new char[length]; binFile.read( data, length ); binFile.close(); // Write header with output array std::ofstream outFile( argv[2] ); if ( !outFile.is_open() ) { std::cerr << "Failed to open output file!" << std::endl; return 1; } outFile << "unsigned char data[] = {"; for ( unsigned long i = 0; i < length; i++ ) { if ( i % 5 == 0 ) outFile << "\n\t"; outFile << (int)data[i]; if ( i < length - 1 ) outFile << ", "; } outFile << "\n}"; return 0; }[/cpp] [url=http://hosting.overvprojects.nl/bin2array.exe]Binary[/url]
[QUOTE=layla;33752501][img]http://dl.dropbox.com/u/99765/b884933.png[/img] ..fuck[/QUOTE] One might say that he's a dickhead.
[QUOTE=layla;33752501][img]http://dl.dropbox.com/u/99765/b884933.png[/img] ..fuck[/QUOTE] YEP.
Sorry, you need to Log In to post a reply to this thread.