As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/

[Programming] Mirror, mirror, on the wall, show the git diff for them all

ecco the dolphinecco the dolphin Registered User regular
This is the PA programming thread, home to programmers everywhere. Here we talk about cats, ponies, synergised high-efficiency software cloud platforms, and occasionally programming. Apparently the old OP is, well, old, so we've constructed a revolutionary new cost-effective commercial-grade solution for all your enterprise needs.
padevnet.png
PADev.net is a project started up by this thread to support PA developers. A discussion about shared hosting turns into an idea to have hosting and a community to support those working on hobby programs and web services and what not.

Some things require a dedicated VPS but the bar of entry isn't that low. The cost is not extravagant but the know-how required to manage one is daunting for many. PAdev.net provides a share of hosting and support, a $5 monthly fee nets you a shell account on the hub server and the expertise of your peers.

Community members looking to help out can request an account for the website, where all members can create and maintain guides and share project updates. There is no cost to have a community account, just contact an administrator. Also available are you@padev.net email accounts or forwarders.

Current administrators: @Infidel

Languages
  • Python - One of the most popular scripting languages around, Python is the go-to language for...just about everything, actually. Its high scalability and widespread support through third-party libraries make it useful for many applications, from simple five-minute jobs to complex Web servers. Python can also be embedded or bound into lower-level languages such as C, letting you write performance-critical code as well as providing access to libraries written for those languages.
  • Ruby - Another popular scripting language, Ruby is best known as the basis for Ruby on Rails, a framework for Web development that competes with its Python equivalent, Django. While not quite as famous as the juggernaut that is Python, Ruby is nonetheless prolific - modern versions of RPG Maker use it as their scripting language, for instance. And, of course, it can be embedded into other applications, much like Python.
  • Lua - Yet another scripting language. Lua is built on two principles: simplicity and minimalism. Designed with embedding in mind, Lua's overhead is tiny (it can be counted in hundreds of kilobytes at most) and the language itself only provides a handful of constructs...until you master the black arts of tables and metatables. Those who have done so claim to have seen the face of God; these claims are as yet unsubstantiated. What we do know, however is that in recent years Lua has garnered much attention thanks to LuaJIT, a project that provides not only a just-in-time compiler for Lua (granting a massive speed boost - almost C-like performance, in fact), but also an FFI (foreign function interface) library, allowing Lua scripts to directly call C functions without the hassle of writing boilerplate C bindings.
  • C and C++ The Ones Who Came Before. C and C++ are old, clunky, archaic...and the most popular languages in existence. C was conceived in an era when memory was limited and programs were generally written in non-portable assembly languages. The underlying concept (which persists to this day) was that a compiler would take C code, turn it into assembly, and then turn that into an executable or library. Thus, programmers now only had to port most of the codebase instead of all of it! (the situation has improved considerably since then, of course - these days, only the really low-level stuff has a tough time being cross-platform). C++ came some time later, and shook things up significantly with the concepts of classes and generics. Modern C++ also includes the Standard Template Library, or STL, which provides all sorts of useful functionality to make life almost painless. These days most people will learn something simpler like Python before these guys, but make no mistake - everything from your operating system to your favourite video games to your microwave can trace its roots back to one of the two.
  • C# - The poster boy for Microsoft's .NET Framework, C# is a JIT-compiled language modelled after C++, but without any of the associated pain. Though initially developed as a robust alternative for Windows development, Microsoft makes the specifications available at no cost, which has led to other implementations popping up - the most well-known being the cross-platform Mono. The main draw of C# is its ease of use: with a ridiculous number of APIs available by default and the ability to call into native code, you'll have a tough time finding something higher-level that you can't do in C#. The fact that Visual Studio, one of the best IDEs around, also supports C#, is just icing on the cake.
  • Android - Directly responsible for bringing this OP into the 21st century, Android is a pseudo-operating system framework which runs on top of Linux. Android is primarily written in Java, though it also combines elements of C, C++ and sometimes even Python, and is designed for mobile devices. The Android application framework represents an almost entirely event-driven paradigm written primarily in Java which heavily utilises usage of background services, model-view-controller, and sub-classing as a method of changing behaviour of standard pieces. Also, it runs on your phone!
  • Java - :rotate:
  • PHP - :rotate:

(Credit: Original OP here)

Previous thread here.

Penny Arcade Developers at PADev.net.
ecco the dolphin on
«134567100

Posts

  • ecco the dolphinecco the dolphin Registered User regular
    Phyphor wrote: »
    a5ehren wrote: »
    class BaseCls
    {
    	public:
    	virtual void Cleanup() {};
    	SIGNAL *ReleaseSignal() {
    		//stuff
    		Cleanup(); //SIGSEGV, code 1 "address not mapped to object"
    		//stuff
    	};
    }
    
    class derivedCls : public BaseCls
    {
    	public:
    	void Cleanup() {};
    }
    
    class ddCls : public derivedCls
    {
    	//nothing useful
    }
    
    void Function (void){
    	ddCls thing;
    	//this goes straight to the base class because the intermediates do not overload it...
    	//  so it calls the virtual in the base class?
    	thing.ReleaseSignal();
    }
    

    This is obviously greatly simplfied, but the general flow is the same.

    Only change is going from GCC 4.6/C++03 to GCC 4.9/C++11. I assume it is something to do with calling the virtual function, but I really have no idea.

    Cleanup() is an empty function everywhere I've seen it, so I don't know why they bothered making it virtual (or making it in the first place).

    So the call order here would be base::releasesignal -> derived::cleanup. Everything should be fine here unless something interesting happens in those stuff blocks
    a5ehren wrote: »
    bowen wrote: »
    Actually it should be going into derivedCls' cleanup shouldn't it?

    Why is it attempting to use the BaseCls? Sounds like there might be a compiler option or some such that's fucking with this?

    Only compiler options are -O0 and -std=gnu++11, with -Wall and -Wextra for good measure. Static analysis on the two classes doesn't come up with anything, either.

    My next thing to try is either Address Sanitizer or Valgrind.

    I'd try Valgrind.

    Do you accidentally delete the pointer prior to using it?

    Penny Arcade Developers at PADev.net.
  • EtheaEthea Registered User regular
    I was about to ask if you are double freeing ( or never allocating ).

  • a5ehrena5ehren AtlantaRegistered User regular
    I hope not, because this has been our production code for a few years now. :P

    The thing is that the Cleanup function does exactly nothing, so the only thing I can really think is that something bad is happening when the 'this' pointer is getting copied for the cleanup() call?

  • ecco the dolphinecco the dolphin Registered User regular
    The trouble with undefined behaviour is that "undefined" also includes "works for several years, and then one day, another thread/process uses a bit more memory at the wrong time, which then causes the pointers to break." =P

    It's getting to become my personal pet hate about C and C++. =( I really do like C++ - I enjoy templates, the flexibility etc, but having to consistently code defensively because it always felt like undefined behaviour is right around the corner got tiring.

    Penny Arcade Developers at PADev.net.
  • DelmainDelmain Registered User regular
    New thread smell is the best.

  • AngelHedgieAngelHedgie Registered User regular
    The trouble with undefined behaviour is that "undefined" also includes "works for several years, and then one day, another thread/process uses a bit more memory at the wrong time, which then causes the pointers to break." =P

    It's getting to become my personal pet hate about C and C++. =( I really do like C++ - I enjoy templates, the flexibility etc, but having to consistently code defensively because it always felt like undefined behaviour is right around the corner got tiring.

    C lets you shoot yourself in the foot. C++ lets you reuse the bullet.

    C gives you enough rope to hang yourself with. C++ provides the tree object to tie it to.

    C gives you enough rope to hang yourself with. C++ gives you enough rope to tie your neighbors up, rig a schooner, and hang yourself from the yardarm.

    XBL: Nox Aeternum / PSN: NoxAeternum / NN:NoxAeternum / Steam: noxaeternum
  • bowenbowen How you doin'? Registered User regular
    Java slowly saps your soul so you want to kill yourself.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • TofystedethTofystedeth Registered User regular
    I had a ticket created by one of our vendors that a report I'd just recently put into place failed and failed again after rerunning.
    Worked with the guy who'd helped me schedule it. Fixed it by having it just always report success.
    Seriously though. Basically, when a report is run as a scheduled ops job in this system, it expects certain return values that you have get from extracting some values from a record structure and blah blah blah. A bunch of stuff that they never talked about in our report writing training for this system, just assumed someone would tell you when you tried to set up one as an ops job.
    But because of the way this report ran, it would never report success because by the time it reaches the part of the code where it can check for any records returned, all the records have been processed and it no longer thinks it has any.

    steam_sig.png
  • hippofanthippofant ティンク Registered User regular
    bowen wrote: »
    Java slowly saps your soul so you want to kill yourself.

    I use Java. I find it's fine. So long as I never have to touch anybody else's Java and they never have to touch mine.

    As soon as I'm asked to install somebody else's package or git something and configure its deployment, lo it is revealed that I know nothing about computers.

  • urahonkyurahonky Registered User regular
    Oh man our Internet has been out most of the day. It's been a pain not to be able to look things up!

  • MNC DoverMNC Dover Full-time Voice Actor Kirkland, WARegistered User regular
    Praise Honky!

    No reason...but do you ever need one?

    Need a voice actor? Hire me at bengrayVO.com
    Legends of Runeterra: MNCdover #moc
    Switch ID: MNC Dover SW-1154-3107-1051
    Steam ID
    Twitch Page
  • GrobianGrobian What's on sale? Pliers!Registered User regular
    edited August 2015
    hippofant wrote: »
    bowen wrote: »
    Java slowly saps your soul so you want to kill yourself.

    I use Java. I find it's fine. So long as I never have to touch anybody else's Java and they never have to touch mine.

    As soon as I'm asked to install somebody else's package or git something and configure its deployment, lo it is revealed that I know nothing about computers.

    This so much. Also moving back to C++ from Java is as terrible as moving from C++ to Java was (I used Java for just one project, usually we're a C++ shop).

    Stuff like "Why doesn't the compiler accept
    if (randomPtr != null) doStuff()
    
    ?"

    Grobian on
  • TraceTrace GNU Terry Pratchett; GNU Gus; GNU Carrie Fisher; GNU Adam We Registered User regular
    public int countOccurrences(final Term t) {
    +        final AtomicInteger o = new AtomicInteger(0);
    +
    +        if (equals(t)) return 1;
    +
    +        recurseTerms((n, p) -> {
    +            if (n.equals(t))
    +                o.incrementAndGet();
    +        });
    +
    +        return o.get();
    +    }
    +
    

  • DynagripDynagrip Break me a million hearts HoustonRegistered User, ClubPA regular
    i'm finally learning to program and really enjoying it using python. went through the code academy course quickly and am now practicing in codewars, will also do some OCW comp sci 600 assignments. Tomorrow the Introduction to Interactive programming in python course starts up in Coursera, and I'm really excited about that.

    coding, whooo

  • urahonkyurahonky Registered User regular
    Python is so much fun to use.

  • EvigilantEvigilant VARegistered User regular
    edited August 2015
    Python is great and everything but I find looking at it an exercise in frustration: the white spacing drives me insane. It's very much just my opinion on Python. When I've had to code in it, it was pretty swell. Still would rather code in C# (or god forbid, Java), though.

    C# is for cheaters and lazy people, which is exactly the kind of developer I am.

    Evigilant on
    XBL\PSN\Steam\Origin: Evigilant
  • a5ehrena5ehren AtlantaRegistered User regular
    Python drives me insane.

    Also valgrind didn't work because we strip glibc, lolllllllll

  • bowenbowen How you doin'? Registered User regular
    edited August 2015
    White space controlled languages are as enjoyable as pulling your hair out.

    Especially if you've got someone who mixes tabs and spaces.

    bowen on
    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • RendRend Registered User regular
    bowen wrote: »
    White space controlled languages are as enjoyable as pulling your hair out.

    EspeciallyOnly if you've got someone who mixes tabs and spaces.

    And can we agree that nothing is fun with those people around?

  • bowenbowen How you doin'? Registered User regular
    Rend wrote: »
    bowen wrote: »
    White space controlled languages are as enjoyable as pulling your hair out.

    EspeciallyOnly if you've got someone who mixes tabs and spaces.

    And can we agree that nothing is fun with those people around?

    SPACES ARE BETTER THAN TABS MIRITE?!

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • urahonkyurahonky Registered User regular
    Python is awesome because it's pretty to look at. White space controlled languages make it so much more pleasant to read, in my opinion. All of the haters here are savages.

  • IncindiumIncindium Registered User regular
    Has anyone tried connecting to carbon.padev.net sftp with FileZilla in windows? It doesn't seem to work anymore for me. PSFTP(Putty) command line worked fine though.

    steam_sig.png
    Nintendo ID: Incindium
    PSN: IncindiumX
  • bowenbowen How you doin'? Registered User regular
    urahonky wrote: »
    Python is awesome because it's pretty to look at. White space controlled languages make it so much more pleasant to read, in my opinion. All of the haters here are savages.

    I'll stab you!

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • urahonkyurahonky Registered User regular
    bowen wrote: »
    urahonky wrote: »
    Python is awesome because it's pretty to look at. White space controlled languages make it so much more pleasant to read, in my opinion. All of the haters here are savages.

    I'll stab you!

    This would be a welcome end to my week!

    I'm at 46 hours and it looks like it won't be ending any time soon.

  • TomantaTomanta Registered User regular
    urahonky wrote: »
    Python is awesome because it's pretty to look at. White space controlled languages make it so much more pleasant to read, in my opinion. All of the haters here are savages.

    I'm with you on this one.

  • RendRend Registered User regular
    Tomanta wrote: »
    urahonky wrote: »
    Python is awesome because it's pretty to look at. White space controlled languages make it so much more pleasant to read, in my opinion. All of the haters here are savages.

    I'm with you on this one.

    "I hate whitespace controlled languages! All forcing me to indent everything consistently."

    Don't you already indent stuff consistently?

    "Yes. But it doesn't even use brackets."

    Why do you need brackets when things are indented consistently?

    "Because brackets make me feel safe."

  • jaziekjaziek Bad at everything And mad about it.Registered User regular
    I'm on Bowen's team for this one.

    Steam ||| SC2 - Jaziek.377 on EU & NA. ||| Twitch Stream
  • bowenbowen How you doin'? Registered User regular
    Rend wrote: »
    Tomanta wrote: »
    urahonky wrote: »
    Python is awesome because it's pretty to look at. White space controlled languages make it so much more pleasant to read, in my opinion. All of the haters here are savages.

    I'm with you on this one.

    "I hate whitespace controlled languages! All forcing me to indent everything consistently."

    Don't you already indent stuff consistently?

    "Yes. But it doesn't even use brackets."

    Why do you need brackets when things are indented consistently?

    "Because brackets make me feel safe."

    I indent stuff randomly because fuck the man.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • RendRend Registered User regular
    I've never heard an argument against controlled whitespace that is both legitimate and not easily solvable by a basic text editor.

  • bowenbowen How you doin'? Registered User regular
    Sometimes I do stuff like this:
    for(int i = 0, j = 11; i < 10 && j >0; printf("%d  ",++i), printf("%d\r\n",--j));
    

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • urahonkyurahonky Registered User regular
    So readable! Such clarity!

  • EvigilantEvigilant VARegistered User regular
    bowen wrote: »
    Sometimes I do stuff like this:
    for(int i = 0, j = 11; i < 10 && j >0; printf("%d  ",++i), printf("%d\r\n",--j));
    

    I hope you pay for that.

    XBL\PSN\Steam\Origin: Evigilant
  • bowenbowen How you doin'? Registered User regular
    Evigilant wrote: »
    bowen wrote: »
    Sometimes I do stuff like this:
    for(int i = 0, j = 11; i < 10 && j >0; printf("%d  ",++i), printf("%d\r\n",--j));
    

    I hope you pay for that.

    I remember writing fizzbuzz like that once.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • TofystedethTofystedeth Registered User regular
    edited August 2015
    In case you were wondering, it's about 4.48 million minutes until December 31st, 2100. Don't ask me how I know, it's embarrassing.

    Tofystedeth on
    steam_sig.png
  • djmitchelladjmitchella Registered User regular
    For you React folks, this looks pretty nifty - live editing of code in the browser which then gets re-run, while preserving state. (in the real world, it's when you save files, but still pretty handy).

    video here. It's not quite the same as the existing livereload you get with grunt/ember-cli/etc, this one preserves the state of your app and changes the code under it, rather than just automatically hitting "refresh".

  • bowenbowen How you doin'? Registered User regular
    What is with videos for programming lately?

    I really don't have the time and sit and rewind a video over and over and sometimes don't even have sound. Sometimes I get up to take a shit or go make dinner and come bang out another 10-15 minutes. That's annoying to deal with.

    Written tutorials are far better.

    Unity in particular has a nasty habit of having video tutorials.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • EchoEcho ski-bap ba-dapModerator mod
    bowen wrote: »
    Unity in particular has a nasty habit of having video tutorials.

    And anything Minecraft-related. Seriously annoying.

  • RendRend Registered User regular
    edited August 2015
    bowen wrote: »
    Sometimes I do stuff like this:
    for(int i = 0, j = 11; i < 10 && j >0; printf("%d  ",++i), printf("%d\r\n",--j));
    

    This is the strongest argument for controlled whitespace that I have seen to date.

    Rend on
  • bowenbowen How you doin'? Registered User regular
    Rend wrote: »
    bowen wrote: »
    Sometimes I do stuff like this:
    for(int i = 0, j = 11; i < 10 && j >0; printf("%d  ",++i), printf("%d\r\n",--j));
    

    This is the strongest argument for controlled whitespace that I have seen to date.

    I bet there's still a legal move in python that does something like that.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • electricitylikesmeelectricitylikesme Registered User regular
    bowen wrote: »
    Rend wrote: »
    bowen wrote: »
    Sometimes I do stuff like this:
    for(int i = 0, j = 11; i < 10 && j >0; printf("%d  ",++i), printf("%d\r\n",--j));
    

    This is the strongest argument for controlled whitespace that I have seen to date.

    I bet there's still a legal move in python that does something like that.
    
    
    ...

    No on second thought fuck trying to parse whats going on there I'm just going to stab you.

This discussion has been closed.