• What Are You Working On? May 2015
    1,601 replies, posted
difficulty: insane
[QUOTE=Trumple;47713260]My housemate and I have had a long-running joking disagreement over which language is "better": C++ or C#. He's a wizard with C++ and uses it for most of his projects. While I'm strongly pro-C#, I've ended up writing a lot of C++ lately. I recently encountered a difficulty in C++: I couldn't find a way to get a formatted time/date string in just 1 line. So, without trying very hard to find a solution, I consulted him with my problem and gave him a seemingly simple challenge: write some code to print out a formatted date/time string to console in one line using only standard libraries. He spent a few minutes looking up the documentation in C++, and I left him to it. 30 minutes had passed, and he hadn't come back. I assumed he gave up, until he burst into my room with a big grin on his face about an hour later. Just for comparison, the C# equivalent is this: [code] Console.WriteLine(DateTime.Now.ToString("MMMM dd, yyyy")); [/code] He triumphantly showed me this fantastic monstrosity: [code] cout << std::put_time( localtime( [&](time_t t) -> time_t* { time_t *a = new time_t() ;; *a = t ;; return a;}(time(nullptr)) ), "%Y %b %d %H:%M:%S") << endl; [/code] Despite impressing me, I'd say it was a loss for his pro-C++ argument. :v:[/QUOTE] I gotta admit, I am a die-hard C++ fan and this triggers me :v: Here's shorter version: [code] puts([](char *b){time_t t; time(&t); strftime(b, 80, "%Y %b %d", localtime(&t)); return b; }(new char[80])); [/code]
[QUOTE=sarge997;47716409][url]http://a.pomf.se/jnxlpd.mp4[/url] [B]FUCK[/B][/QUOTE] my first thought: multi dimensional noodle in string universe
[QUOTE=sarge997;47716409][URL]http://a.pomf.se/jnxlpd.mp4[/URL] [B]FUCK[/B][/QUOTE] Ahh, I see. Asexual noodles reproducing caught on time-lapsed footage.
Got As in comp sci this semester. GPA went from 3.4 to 3.5. Making the climb to A-level GPA. [img]http://i.somethingawful.com/forumsystem/emoticons/emot-woop.gif[/img]
[QUOTE=hobothehero;47715426]Got a project for one of my second year IT courses today. Have to make a racing game (the basics of the game are detailed for us but we need to code those basics and then extend them) in 32 kilobytes of program memory and 2 kilobytes of ram with a 16x8 LED screen. Coding in c. I'm actually pretty excited for this.[/QUOTE] This sounds really fucking awesome! Do report back with more info if you can, especially how it gets implemented, because that is always some awesome shit. Embedded programming is one of my favorite things, because you get to play with so many sweet kinds machine-specific kinds of things, and doing so in C can be either incredibly horrible, or mysteriously beautiful.
[img]http://i.imgur.com/ZWQIDl6.png[/img] Picked up my logwindow project again. Completely reworked it too. Currently has the same functionality as previous (Log with different colors/custom styles) and watching variables. Biggest change however is the ability to add custom pages to the logwindow. Just create a WPF page, and use a method to add the page. Shows up in a new tab, everyone happy :D
[QUOTE=vombatus;47716441]I gotta admit, I am a die-hard C++ fan and this triggers me :v: Here's shorter version: [code] puts([](char *b){time_t t; time(&t); strftime(b, 80, "%Y %b %d", localtime(&t)); return b; }(new char[80])); [/code][/QUOTE] You know it's cheating to call something a one-lines when you have multiple semicolons on the same line.
the whole comparison is a ruse anyway, one uses .net and the other uses ctime [url=https://msdn.microsoft.com/en-us/library/aa326681(v=vs.71).aspx]you can do literally almost character for character what was done above in c# in c++[/url] [editline]13th May 2015[/editline] any time i see a "strength" of c# its almost always a strength of .net
.net is literally the c# equivalent of the c++ standard library [editline]13th May 2015[/editline] it just happens to be [del]better[/del] larger
so you're saying the above is a comparison of .net vs std but calling it c# vs c++ what a joke
[QUOTE=andrewmcwatters;47717935] any time i see a "strength" of c# its almost always a strength of .net[/QUOTE] But a language itself does not exist in a vacuum. Yes, it's true, .NET is one of the top reasons that C# is a pleasure to use, but that shouldn't mean that it's not a pro for C#. A language that's great in theory isn't necessarily better. It's also to do with the ecosystem, the tools available, the documentation, the popularity, online support, abundance of 3rd party libraries, and much more. The comparison highlights a distinct albeit trivial problem with C++ and its standard libraries: I really just wanted a way to do it in 1 line, but using 2 lines is a simple compromise. That's all there is to it. Neither my housemate or I truly believe that one language is superior to the other. Like I said, I've been working with C++ a lot lately because the stuff I'm doing with it is much more suited to it
[QUOTE=andrewmcwatters;47718107]so you're saying the above is a comparison of .net vs std but calling it c# vs c++ what a joke[/QUOTE] yes it's not technically correct but everyone knows what they meant usually when people refer to c# that also includes .net, and when people refer to c++ that could also include std
yes except c# can use ctime as well, and c++ can use .net. so i fail to see the comparison of c# to c++ here ctime is actually a part of the c standard library, which c++'s uses so if you really want to stretch it that way, you're comparing c# to c
I finally finished my sizing and manipulation tools! Behold! (my cursor sometimes gets really big in recorded videos, it doesn't look like that normally) [vid]https://dl.dropboxusercontent.com/u/95010979/ShareX/2015-05-13_14-54-31.mp4[/vid] Objects can now be scaled from any side, any vertex of any triangle on any mesh can be translated around in 3D space regardless of the viewport orientation, [B]OR [/B]the objects own orientation, position, or scale. There is only 2 things that I need to fix, and thats 1) scale should rotate as an object rotate, and 2) vertex points kind of scale weirdly with the object
[QUOTE=andrewmcwatters;47718156]yes except c# can use ctime as well, and c++ can use .net. so i fail to see the comparison of c# to c++ here ctime is actually a part of the c standard library, which c++'s uses so if you really want to stretch it that way, you're comparing c# to c[/QUOTE] i don't think you can use .net with regular c++ i did some digging and it seems that you need to specifically write your code using microsoft's own version of the language called c++/cli or either use deprecated compiler extensions on their compiler it's pretty hard to find any documentation on the subject though so i could be wrong
[QUOTE=andrewmcwatters;47718156]yes except c# can use ctime as well, and c++ can use .net. so i fail to see the comparison of c# to c++ here ctime is actually a part of the c standard library, which c++'s uses so if you really want to stretch it that way, you're comparing c# to c[/QUOTE] He was working on OSX which highlights the 3rd party stuff I mentioned before - correct me if I'm wrong but there is no .NET for C++ on Linux/OSX? The comparison just encompasses "ease of use" for a very particular scenario
[QUOTE=DarKSunrise;47718198]i don't think you can use .net with regular c++ i did some digging and it seems that you need to specifically write your code using microsoft's own version of the language called c++/cli or either use deprecated compiler extensions on their compiler it's pretty hard to find any documentation on the subject though so i could be wrong[/QUOTE] You can do it by hosting the runtime, but that requires some set-up that's a lot longer than that line. Same if you try to use ctime from C#: It's not pretty to add [I]extern[/I] definitions, possibly introduce the data structure and reduce the compatibility of the solution.
oh also i made it prettier look [code]auto&& t = time(nullptr); cout << put_time(localtime(&t), "%Y %b %d") << endl;[/code]
[QUOTE=DarKSunrise;47718198]i don't think you can use .net with regular c++ i did some digging and it seems that you need to specifically write your code using microsoft's own version of the language called c++/cli or either use deprecated compiler extensions on their compiler it's pretty hard to find any documentation on the subject though so i could be wrong[/QUOTE] It is for all intents another language, distinct from c++. The only reason it exists is for interfacing existing c++ code with .net applications.
[QUOTE=Trumple;47718261]He was working on OSX which highlights the 3rd party stuff I mentioned before - correct me if I'm wrong but there is no .NET for C++ on Linux/OSX? The comparison just encompasses "ease of use" for a very particular scenario[/QUOTE] I'm fairly sure you can still host Mono, and C++/CLI compiled "cleanly" (no P/Invoke) will run too. Mixed-mode assemblies are not supported by Mono though. Of course you need to add OS-dependent branching to support all three large PC platforms at the same time, if you go with the hosting solution.
Been working on a couple of projects since I got my paid internship at redWEB/redHOST, one of which was a migration system for Ubuntu 12.04[\.]?[0-9]? to 14.04.2, including configuration files for vhosts of Apache, php5.3 to php5.5, monit, and a bunch of other shit too. Then a VPS installation script for automatically installing everything you need in customer VPS's to decrease the amount of man-hours spent doing that fucking bullshit. Turns out that Ubuntu is fucking retarded in regards to dist-upgrade where automation of of distribution upgrades is handled in a really weird way that makes it only work from time to time, and requires automation of answers to wether you want to keep the existing configuration files, so I went ahead and fixed the shit out of that poop, and tested it using Docker. Turns out Ubuntu shits itself harder than a pregnant woman about to give birth to the prettiest baby, so I had to rewrite a bunch of stuff and revert to using DEBIAN standards, considering they worked. And apparently it didn't like that either, so [code]sed -i 's/precise/trusty/' /etc/apt/sources.list[/code] was in order as well. Holy shit it sucks balls, but I cannot imagine how much worse people having it in other companies having to deal with shitty fuckups like this. I'd also like to say to anyone lurking here like me, reading all those posts happening around here. Fuck those people. Fuck their projects. You guys have your shit going, and even if it isn't what is posted in these threads, it's what you make. It's what drives you. It's what makes you feel fucking fantastic at 2am, and like a fucking idiot at 4pm. It's what makes life worth living, so let people know about the shit that makes you get an erection and pump out the crazy fucking shit you guys do!
[QUOTE=mastersrp;47718459]I'd also like to say to anyone lurking here like me, reading all those posts happening around here. Fuck those people. Fuck their projects. You guys have your shit going, and even if it isn't what is posted in these threads, it's what you make. It's what drives you. It's what makes you feel fucking fantastic at 2am, and like a fucking idiot at 4pm. It's what makes life worth living, so let people know about the shit that makes you get an [B][I]erection [/I][/B]and pump out the crazy fucking shit you guys do![/QUOTE] This calls for a new programming language, time to make "BonerScript" :v:
[QUOTE=mastersrp;47718459]so let people know about the shit that makes you get an erection[/QUOTE] :unsmigghh: [editline]13th May 2015[/editline] apparently im late but fuccboiGDX was discontinued?
[QUOTE=mastersrp;47718459]Been working on a couple of projects since I got my paid internship at redWEB/redHOST, one of which was a migration system for Ubuntu 12.04[\.]?[0-9]? to 14.04.2, including configuration files for vhosts of Apache, php5.3 to php5.5, monit, and a bunch of other shit too. Then a VPS installation script for automatically installing everything you need in customer VPS's to decrease the amount of man-hours spent doing that fucking bullshit. Turns out that Ubuntu is fucking retarded in regards to dist-upgrade where automation of of distribution upgrades is handled in a really weird way that makes it only work from time to time, and requires automation of answers to wether you want to keep the existing configuration files, so I went ahead and fixed the shit out of that poop, and tested it using Docker. Turns out Ubuntu shits itself harder than a pregnant woman about to give birth to the prettiest baby, so I had to rewrite a bunch of stuff and revert to using DEBIAN standards, considering they worked. And apparently it didn't like that either, so [code]sed -i 's/precise/trusty/' /etc/apt/sources.list[/code] was in order as well. Holy shit it sucks balls, but I cannot imagine how much worse people having it in other companies having to deal with shitty fuckups like this. I'd also like to say to anyone lurking here like me, reading all those posts happening around here. Fuck those people. Fuck their projects. You guys have your shit going, and even if it isn't what is posted in these threads, it's what you make. It's what drives you. It's what makes you feel fucking fantastic at 2am, and like a fucking idiot at 4pm. It's what makes life worth living, so let people know about the shit that makes you get an erection and pump out the crazy fucking shit you guys do![/QUOTE] You should really really really look in to using chef or puppet. It will make your sysadmin stuff sooo much easier to deal with after you get past the learning curve.
[vid]https://dl.dropboxusercontent.com/u/35032740/ShareX/2015/05/2015-05-13_23-57-17.webm[/vid] This is actually SAFER than the .NET version because the first parameter in the handler isn't just some object, but has a known type (based on which control the click event belongs to).
haskell is funky lookin' yo
[QUOTE=Trumple;47718130]But a language itself does not exist in a vacuum. Yes, it's true, .NET is one of the top reasons that C# is a pleasure to use, but that shouldn't mean that it's not a pro for C#. A language that's great in theory isn't necessarily better. It's also to do with the ecosystem, the tools available, the documentation, the popularity, online support, abundance of 3rd party libraries, and much more. The comparison highlights a distinct albeit trivial problem with C++ and its standard libraries: I really just wanted a way to do it in 1 line, but using 2 lines is a simple compromise. That's all there is to it. Neither my housemate or I truly believe that one language is superior to the other. Like I said, I've been working with C++ a lot lately because the stuff I'm doing with it is much more suited to it[/QUOTE] Not to mention some .NET stuff (well, some basic interfaces / classes) is engrained into the language. Like Nullable and IEnumerable. Not sure if I'm looking at an older C# language spec or if the IEnumerable requirements are pretty low, but it only has 1 method to get an IEnumerator. That means that either all the LINQ methods were added later or Microsoft added them... which I hate. As much as I love C# and .NET I hate getting an IEnumerable back and not knowing if it is an actual collection or a lazy evaluated collection. They really should've separated out the interfaces more...
[QUOTE=andrewmcwatters;47719072]haskell is funky lookin' yo[/QUOTE] I try my best to keep the funk out of these posts. That's why I bind every result to a name instead of using fancy combinators to just pipe everything through. I'm open to requests for more funk though
[QUOTE=thrawn2787;47719138]Not to mention some .NET stuff (well, some basic interfaces / classes) is engrained into the language. Like Nullable and IEnumerable. Not sure if I'm looking at an older C# language spec or if the IEnumerable requirements are pretty low, but it only has 1 method to get an IEnumerator. That means that either all the LINQ methods were added later or Microsoft added them... which I hate. As much as I love C# and .NET [B]I hate getting an IEnumerable back and not knowing if it is an actual collection or a lazy evaluated collection.[/B] They really should've separated out the interfaces more...[/QUOTE] I don't think I've ever had any problems figuring out if an IEnumerable is lazy. At least in the BCL most if not all methods that return a IEnumerable are lazy (things like Directory.EnumerateFiles or the new reflection API), and that convention should be followed in user code too. [QUOTE]That means that either all the LINQ methods were added later or Microsoft added them... which I hate. [/QUOTE] The LINQ methods are extension methods, because C# doesn't (currently) support default method implementations in interfaces. Every class that implements IEnumerable (by having that one method) automatically supports LINQ.
Sorry, you need to Log In to post a reply to this thread.