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] Thread: Turning off the LAMP stack for mood lighting

ecco the dolphinecco the dolphin Registered User regular
edited September 2013 in Moe's Stupid Technology Tavern
Welcome to the Programming Thread, where people gather to share stories, lend a shoulder to cry on, and discuss whether or not they really would sell C shells by the sea shore.

Where the arguments cycle over and over again!

padevnet.png

What is PAdev.net?

It 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


Some writeups on various languages from the pros and such:
Jasconius wrote: »
Language: Python
Framework: Django
Purpose: Developing web applications rapidly

Django was created by a couple of nerds working for the newspaper industry, and they needed to solve the problem of having two practically identical sites (representing two newspapers owned by the same company) that had the ability to share content and generally be controlled from a central location. Thus Django, a flexible web framework that is different enough from Rails to be worth talking about.

Django is a batteries included framework that spends a lot of time trying to solve little things that are typically left to the gem community with Rails. The end result is a uniformly styled and extremely well documented web framework that can get you rolling pretty fast and is still easy enough to extend.

I've been using it for my new job and I've had very few complaints overall.
ASimPerson wrote: »
Language: C
Framework: Aahahahaha
Purpose: My job

Summary: C and its descendants (C++/Java/C#/etc.) are the most popular programming languages in the world. (As co-inventor Dennis Ritchie supposedly said, "C is quirky, flawed, and an enormous success.") The web browser you're using, the OS, most of your applications, most embedded software, the software on your router, the software on your ISP's router, the software on your game console, etc., were all written in C (well, or in C++).

For my job, I write in straight C. No libraries, no frameworks, no C++, no nothin'. C is a programming language for Real Men (tm), which means that there's no memory management and you're free to crash your program in various horrific ways. The trade-off for this is speed and size, attributes which give C its staying power - though proper C is losing favor as an application development language to C++, C#, and the like, it has found a second life in embedded applications and other small devices. I also think there's a certain elegance to the syntax - it's a language from an era when you didn't have a lot of memory, so statements are terse and lack the cruft of some more modern languages (*cough*C++*cough*). And best of all, no right minded C programmer would use LongVariableNamesLikeThis.

There's no shortage of manuals and documentation for the various incarnations of C, but the best reference is still from the source: The C Programming Language, by Kernighan and Ritchie. This book is so ubiquitous and standard that it's known simply as K&R in the field.
Nightslyr wrote: »
Language: PHP
Framework: Symfony2
Purpose: Web Development

Symfony2 is a modular, component-based MVC framework for PHP. It comes with two flavors of ORM (Doctrine and Propel) out of the box, and uses the Twig view engine for its templates by default. Installation and updating is as easy as installing Composer, getting the framework's composer.json file from github, and running the following at the command prompt:
$ php composer.phar update

While Symfony2 suffers from being PHP, and its documentation can be spotty at times, it's one of the most professional and sound efforts the language has seen to date, borrowing liberally from Rails where it can. There are still some annoying kinks in it, but overall it's a good framework. Better than vanilla PHP, at least.
ecco wrote: »
Language: Verilog
Framework: None
Purpose: Low level development

If you thought assembly language was low level, try Verilog or any of the other HDL languages on for size. Verilog is designed to describe how bits change every clock cycle. And not just one bit either, but potentially every bit available in the device that you are developing for.

This allows for massive parallelism - the sheer number of calculations per clock cycle can easily exceed both general purpose processors and DSPs.

It can also drive men insane.

I see square waves everywhere.
Phyphor wrote: »
Language: Lua
Framework: Custom
Purpose: Embeddable scripting

Lua is a neat little language. It is a dynamic, prototype-based language with relatively simple syntax (LL(1) ho!). There are primitive types (bools, numbers, strings, functions, nil), but the only structure for composition is the table, an associative array. Primitive types (except functions) are coerced to other primitive types as needed for operations. Functions are first class objects and it has closures.

Objects are created through special tables known as metatables, which define common operations and allow tables to take on characteristics of a class of objects, in effect allowing single inheritance.

The language is implemented in C and is designed to integrate easily with a host application. The API allows the host application to perform any operation the language can (and more). Lua can freely call functions provided by the host identically to native Lua functions and the host can create special object types that act as any other Lua object.

I mostly use it as a way to get scripting support into C, not as a standalone language, so I don't really know of any frameworks. I use a custom one to provide limited visibility of C++ classes to the scripts.

Oh and someone wrote a JIT compiler
lazerbeard wrote: »
Language: C++
Framework: Proprietary
Purpose: Video game tools/graphics

If you want to make AAA games on a console. You're probably going to end up working with C++, if you like it or not. With 512 megs of shared memory, multiple fiddly "special processing units", people clamoring over sending 64 players' worth of data over a network at an even pace and other wonderful things, performance down to the bit really does matter. Not to mention that the API (and compiler) is written for C++, so you're not getting away from it if you want to work on console games unless you're using XNA. C++ is the tacticool gun of programming languages. If you can do it, you can probably find a way to do it in C++, then you can probably find a way to hack it so that it only uses 10 bits at a time to do it.

Honestly, I don't spend the entirety of my time in this nether realm of pure data as I'm a tools programmer by trade. In a day I'll go between C++, C#, python and back again. Each language has its own sets of advantages and disadvantages, of the three I'd honestly say C# is the most "fun" to work with. C++ still wins out for me, just for being extremely versatile, while keeping performance high. I think the other thing I like about C++ is that the performance cost of anything is laid bare much more in the other languages I work with. Because you are tasked with moving around the bits other languages abstract away, I always feel the performance cost of code I write is much more impressed upon me when I write it in C++. When looking at performance in other langages, I often consider how it would effect performance had I tried the same trick, as underneath the hood the process is most likely similar.
Tallus wrote: »
Language: PHP
Framework: Custom
Purpose: Web development

Although slightly outshone by the relatively new Ruby on Rails, PHP is still a solid choice for Web development. An engine is available for pretty much every web server (Apache and IIS being the major ones of course), it's easy to learn if you come from any kind of c type background and it offers some really neat features if you dig deep enough. Recent releases (5.3 I think) offer true namespacing to add to the plethora of object orientated features already present (if you like that kind of thing). One of the best things about PHP though is that, because it's so widely adopted there's literally tons of tutorials, documentation and samples out there to get you going.


Language: VB (classic)
Framework: Ha, I wish
Purpose: Legacy application development

Yeah I know. I use VB in my day job since I have to maintain a ton of applications written in it. It's slow as hell, the IDE sucks and I really have nothing good to say about it. For all its flaws .Net is a massive improvement on Microsoft's legacy development environments. I did manage to find a plugin for the VB IDE that allows tabbed documents, full screen editing and some other nifty features. I'll see if I can find it if anyone is interested.

Language: Javascript
Framework: jQuery (and jQuery mobile)
Purpose: Web application front end development

Javascript has been around for donkey's years and is pretty much universally supported in modern web browsers. It allows you to do a ton of useful / cool stuff with pages once they're pushed down to the client. jQuery is a briliant javascript framework that offers some amazing features. The core of jQuery revolves aorund 'selectors', basically filters you can use to select any element (or group of elements) on a page before applying code / styles to them. There's also some nifty binding functions, to add functionality to elements after they're rendered and ooooh, all sorts of other things. One of the best things about jQuery (and something that sets it apart from other frameworks) is its support for plugins. There's thousands of plugins available for just about anything you can think of, and they make jQuery into (in my opinion) the best tool in any web designers toolkit. jQuery mobile is an addition to jQuery to enable the building of mobile applications in a consistent manner across just about any mobile platform.

I also do C# and Android development, but can't really think of anything interesting to say about them right now.
Language: F#/C#
Framework: .Net 4.0 Runtime
Purpose: HFT/Non-HFT systems

With Visual Studio 2010, F#, an ML-variant functional language, is now part of the .Net language family. It has full interop capabilities with any existing .Net assemblies and any other .Net languages are capable of loading .Net assemblies written in F# (with a couple of minor issues to watch out for). It's a full functional language and is best when you program it like a functional language and not ML with classes. There's some good resources out there on F#. I've done a couple of larger scale server applications with it and starting to move on to version 2.0 on a few of them. I also mix in C# when needed for things like COM-interop and certain client APIs.

Language: Clojure
Framework: JVM
Purpose: Large-scale data spelunking

Clojure is a neat little functional language that runs in the JVM. Very LISPy, with a heavy emphasis on macros. I mainly use it with Cascading/Hadoop to slam through the massive data sets and extract the various data of interest.

I also putter around with the CUDA/CULA stuff and data parallel Haskell when I have time.
seabass wrote: »
Language: OCaml / C++ / Fortran
Framework: Lisp converted to Ocaml handed To grad students
Purpose: Combinatorial Optimization, Automated Planning, Robot Path finding, other research topics

OCaml is, like F#, an ML-variant with objects. It's particularly nice because it isn't terribly pedantic and lets you mix imperative programming with functional code wherever you feel it's expedient to do so. It's got a full object system which I've never extensively used, but I hear it's nice. You can run the code in an interactive interpreter, or you can compile native binaries which are relatively quick for a language which manages your memory for you.

The big drawback is that we don't have a concurrent garbage collector yet, so while we have threads, they don't behave the way you would want them to. You can work around it by doing any concurrency you'd like at the process level with pipes or something like MPI.
Language: Ruby
Framework: Rails
Purpose: Developing web applications

Ruby on Rails (RoR or often just called 'Rails') is a web application framework with a practical slant. While most frameworks present themselves as a sort of toolbox, Rails goes a step further by favoring convention over configuration. Instead of configuring how the tools interact with each other yourself, Rails infers what you mean to do from a few naming conventions in your class, method, table and path names. If it gets in the way, you can always define what name it should look for instead yourself.

Rails uses the model-view-controller (MVC) architectural pattern to separate the concerns in your code. On the controller side, it favors RESTful style url method coupling. On the model side, it provides an object oriented representation of your database tables. For the views, it provides a templating engine called ERB (I prefer HAML though).

One of the best things of Rails is the developer community. A lot of Rails developers blog about their experiences or post their problems on Stack Overflow. There also is a sort of package manager/repository for Ruby libraries called RubyGems that helps you install, update and resolve dependencies. For configuring what gems you use in your Rails project, you should use Bundler (which is baked into Rails 3). Most gems can be found on github for easy forking.

I can heartily recommend Rails to everyone looking for an easy to use web application framework. It's as easy as "sudo apt-get install rails && rails new ~/myproject".
Infidel wrote: »
Language: SQL
Framework: None
Purpose: Manipulating your datas

SQL is ubiquitous and often taken for granted. Whether you're a Java or C or Access or PHP or what-have-you developer, you'll often be dealing with another language, being SQL. Some might have frameworks that abstract and/or obscure the SQL, but it's almost always there. The complexity required of your SQL can vary, and for a lot of projects it is relatively simple. Understanding SQL at a non-trivial level however will help you understand how computers work with large datasets, which will aid you in how you design and interact with your data even if you don't actually write any SQL directly.

Relational algebra and key theory is useful stuff for "thinking about it right" when it comes to schemas and queries. Also keep in mind that while SQL is a standard, every database system has a point where it diverges from the standard. When you start dealing with very complex queries or procedural code and triggers etc., you'll see very different syntax and often different approaches altogether due to vendor support of features available. For example, Microsoft SQL Server uses Transact-SQL (T-SQL), Oracle uses PL/SQL, and while both are the common system found in the business world and accomplishing the same objectives they are very different beasts to the developer. Methods and tricks for one are not always the best or feasible for the other, and you often rely on tricks to attain the performance demanded by the project.

In a rather different scope, web sites and services tend to use other systems, such as MySQL and PostgreSQL. The focus here is usually less on procedural code and more on efficient SQL-standard queries. The scale of the project might be trivially small where any design works to massive commerce sites that sell a hojillion products and track customer trends. Most people here will not be dealing with that, but many of us will have some sort of SQL database backend which we need to write queries for. Non-standard SQL is avoided as much as possible typically, in order to avoid vendor lock-in. This is the dangerous realm of SQL injection attacks which are one of the most common mistakes made by novice developers who need to use a database for persisting their data on their web site but don't have much experience or exposure. Sanitize your inputs and use parameterized queries! :^:
an_alt wrote: »
Language: VFP
Framework: itself
Purpose: Desktop app with included DB

Visual FoxPro is old and end of life, but does have some interesting features. It came out of the xBase/Clipper world and is a Swiss army knife that packs a relational database and programming language into a tightly coupled package. The language is dynamic and very weakly typed. Along with the usual primitive data types and arrays of them, VFP has one real data structure - the table. SQL is supported as is VFP's own brand of table manipulation which is really easy to use. GUI design is like the VB style of drag-and-drop though larger applications tend to use a code-generated interface. There is OOP though it feels tacked on. The included report writer is fairly capable. It even goes as far as having COM support and I have a few heavily used web services running VFP DLLs under IIS.

VFPs tables don't handle really big data efficiently. Field names in a table are limited to 10 characters when not in a database container and 255 fields in a table regardless. Line lengths can't exceed 255 characters. While VFP can deal with ODBC data, these limitations can make it unwieldy. The IDE is terrible. It's not .NET comparable. Recursion, lambdas, decorators, and closures are foreign words. Even with all that, we can still use it for a cloud-integrated, multi-user desktop app that looks like it might have been designed last year.

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

Posts

  • gavindelgavindel The reason all your software is brokenRegistered User regular
    My C course is over.

    free ( knowledge );
    free ( facts );
    free ( recollection );

    Book - Royal road - Free! Seraphim === TTRPG - Wuxia - Free! Seln Alora
  • DelmainDelmain Registered User regular
    You probably should have recursively freed knowledge since it's probably a blob of differently-sized bits.

  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Next year you'll be able to delete things and the compiler will take care of it for you, but for now you must write a page of code

  • Jimmy KingJimmy King Registered User regular
    Fuck you, Django.
    >>> c_order.order 
    2
    >>> c_order.order = 0
    >>> c_order.full_clean()
    >>> c_order.save()
    >>> c_order.order
    2
    

    c_order.order is a PositiveIntegerField. Django docs say:
    Like an IntegerField, but must be either positive or zero (0). The value 0 is accepted for backward compatibility reasons.

  • bowenbowen How you doin'? Registered User regular
    Mmm new thread smell.

    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
  • MelksterMelkster Registered User regular
    edited May 2013
    Question: Do you guys make use of asserts in Python very often?

    I'm re-writing this one part of a web app that we put into production last week. It's an abstract base class that's intended to be subclassed, with specific class-level attributes overridden. As such, in my __init__ method, I'm doing something like this:
        def __init__(self, <... arguments ...>):
            assert self.CLASS_ATTRIBUTE_1 is not None
            assert issubclass(self.CLASS_ATTRIBUTE_1, ThingItNeedsToBeASubclassOf)
            assert self.CLASS_ATTRIBUTE_2 is not None
            assert self.CLASS_ATTRIBUTE_3 is not None
            assert self.CLASS_ATTRIBUTE_4 is not None
            assert self.CLASS_ATTRIBUTE_5 is not None
            <... normal init stuff ...>
    

    Basically I'm just ensuring that those class level attributes have been overridden with correct-ish values, and it also maybe gives the code a bit of documentation too? Dunno if this is good practice or not.

    Melkster on
  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    gavindel wrote: »
    My C course is over.

    free ( knowledge );
    free ( facts );
    free ( recollection );

    And in a few months it'll be:

    Knowledge* kn = new Knowledge();
    Facts* ft = new Facts();
    Recollection* rc = new Recollection();

    :)

  • Jimmy KingJimmy King Registered User regular
    edited May 2013
    I very rarely use asserts in real code, just test cases. I tend towards letting the developer using my library use it how they need. How do I know that None is not what they really wanted to pass? If that will cause a problem elsewhere, raise the exception where appropriate. I've very rarely seen them used in any other python code I've looked at as well.

    Plus asserts get stripped out if python is run with any level of optimization. That's rare for anyone to do, of course, but it's there, might as well handle it in a way that will always work.

    Your use of assert IS in line with what the python wiki says, though. http://wiki.python.org/moin/UsingAssertionsEffectively

    Jimmy King on
  • EtheaEthea Registered User regular
    gavindel wrote: »
    My C course is over.

    free ( knowledge );
    free ( facts );
    free ( recollection );

    And in a few months it'll be:

    Knowledge* kn = new Knowledge();
    Facts* ft = new Facts();
    Recollection* rc = new Recollection();

    :)

    Once you work for a company it will be:

    auto kn = LearningFactory< KnowledgeTag >::Learn(StandardKnowledgeTag() );
    auto ft = LearningFactory< FactsTag >::Learn(StandardFactsTag() );
    auto rc = LearningFactory< RecollectionTag >::Learn(StandardRecollectionTag() );

  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    And don't forget the correct auto pointer type to manage the memory!

  • amnesiasoftamnesiasoft Thick Creamy Furry Registered User regular
    From the previous thread, it makes me sad that people don't learn about bitmasks. In my algorithms class the professor asked us to come up with other algorithms for calculating a power set than the ones he gave us. I came up with the solution of incrementing a counter up to the power set size and using the bits in the counter as flags for what elements should be present in the next subset. Of course, this is limited to sets that don't have a length exceeding the number of bits the system can operate on. I also learned something new doing that, apparently you can't actually bit shift 64 bit values on x86_64 systems. The most significant 32 bits get truncated. I think I was the only person that wasn't the professor that understood what I was saying. I like to think I made the class more enjoyable for him by being the only person to use a language other than C, Java, or Python. Like D, C#, Common LISP, and Prolog.

    steam_sig.png
  • MadpoetMadpoet Registered User regular
    edited May 2013
    <div class="label medium">@Model.Label</div>
    
    Code I'm done a million times. This time? System.NullReferenceException
    So, wrap it in @if(Model != null && Model.Label != null){...}
    System.NullReferenceException
    Then I realize, it's failing on line 11. Line 6 is
    <div class="label medium">@Model.Label</div>
    
    W....T....F....
    No assignment of any kind between the two lines. And, of course, this only fails on the server - works fine on my PC.

    Edit: So, it turns out the error is actually on the next line, which is:
    <input name="@Model.FieldName" type="text" value="@Html.Raw(Model.Content)" id="@(Model.FieldName)Input" />
    
    Somehow there was some HTML in the content, and thus the value, which my local machine handled fine, but the server choked on. Yuck. Glad the error was in in the test data, though.
    Edit: Nope, that's not it. Seven days of mild incontinence to whomever insisted on HTML in the database.

    Madpoet on
  • InfidelInfidel Heretic Registered User regular
    P.S. It should be [Programming] Thread.

    OrokosPA.png
  • ecco the dolphinecco the dolphin Registered User regular
    Infidel wrote: »
    P.S. It should be [Programming] Thread.

    >_>

    <_<

    *cough*thanks*cough*

    Penny Arcade Developers at PADev.net.
  • gavindelgavindel The reason all your software is brokenRegistered User regular
    Ethea wrote: »
    gavindel wrote: »
    My C course is over.

    free ( knowledge );
    free ( facts );
    free ( recollection );

    And in a few months it'll be:

    Knowledge* kn = new Knowledge();
    Facts* ft = new Facts();
    Recollection* rc = new Recollection();

    :)

    Once you work for a company it will be:

    auto kn = LearningFactory< KnowledgeTag >::Learn(StandardKnowledgeTag() );
    auto ft = LearningFactory< FactsTag >::Learn(StandardFactsTag() );
    auto rc = LearningFactory< RecollectionTag >::Learn(StandardRecollectionTag() );

    Nah, its cool. I'm really more of a "concept guy". you know. "Big picture". "Generating deliverables in a product enhanced environment utilizing web 2.0 methodologies".

    Actually knowing how to do stuff is for my flunkies. Can't fail!

    Book - Royal road - Free! Seraphim === TTRPG - Wuxia - Free! Seln Alora
  • DehumanizedDehumanized Registered User regular
    Tales from XML

    (paraphrased to keep this post from being really damn long like whoa
    <xml>
        <node>
            <row>
                <column name="Name">val</column>
                <column name="Location">val</column>
                <column name="Address1">val</column>
                <column name="Address2">val</column>
                <column name="Address3">val</column>
                <column name="City">val</column>
                <column name="State">val</column>
                <column name="Zip">val</column>
                <column name="Pizza">val</column>
                <column name="etc1">val</column>
                <column name="etc2">val</column>
                <column name="etc3">val</column>
                <column name="etc4">val</column>
                <column name="etc5">val</column>
                <column name="etc6">val</column>
                <column name="etc7">val</column>
                (like 20 more "column" nodes)
            </row>
            <row>
                <column name="Name">val</column>
                <column name="Location">val</column>
                <column name="Address1">val</column>
                <column name="Address2">val</column>
                <column name="Address3">val</column>
                <column name="City">val</column>
                <column name="State">val</column>
                <column name="Zip">val</column>
                <column name="Pizza">val</column>
                <column name="etc1">val</column>
                <column name="etc2">val</column>
                <column name="etc3">val</column>
                <column name="etc4">val</column>
                <column name="etc5">val</column>
                <column name="etc6">val</column>
                <column name="etc7">val</column>
                (like 20 more "column" nodes)
            </row>
        </node>
    </xml>
    

  • TofystedethTofystedeth Registered User regular
    Phyphor wrote: »
    Next year you'll be able to delete things and the compiler will take care of it for you, but for now you must write a page of code

    In my first programming class back in my first iteration of college we used C++ our prof used the phrase "This would be easier to do with pointers, but we'll get to those later." so many times it became sort of a running gag among the several of us who were in the class and hung out together.
    trying to put together a puzzle: "This would be easier to do with pointers." "But we'll get to those later."

    steam_sig.png
  • electricitylikesmeelectricitylikesme Registered User regular
    Ok this is retarded.

    I have an interface like this in .NET:
        [ComVisible(true)]
        [Guid("DDEC6E98-AA67-447A-B09A-4DA922F0D3CE")]
        [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
        public interface IRMSErxMessage
        {
            IOperationErrorType[] OperationErrors { get; }
        }
    

    This is exported by com interop (and the type it uses is as well) to an application running VBA (MS Access).

    And I cannot find a way to access the members of that array from code. I can open it up in the Local variables viewer and see all the subtypes, but I've no idea what the syntax is to use it. Something like this:
        Dim msg As RMSErxMessage
        ' Do some stuff.
        print msg.OperationErrors(1).Description
    

    Doesn't work. I know it's there, I should be able to access it because the VBA debugger can see the contents of that array - but what the christ is the syntax supposed to be?

  • SporkAndrewSporkAndrew Registered User, ClubPA regular
    Tales from XML

    We have to deal with a huge XML file from, uh, Snational Snail, that contains information about every single train station in the country and the services it provides. It's obvious that they started out with great intentions, but it's now a giant clusterfuck of horribleness that means we have to have over 500 lines of XSL to parse it into something usable.

    Here's some choice bits:
       <Address>
          <PostalAddress>
            <add:A_5LineAddress>
              <add:Line>X ROAD</add:Line>
              <add:Line>-</add:Line>
              <add:PostCode>POST CODE</add:PostCode>
            </add:A_5LineAddress>
          </PostalAddress>
        </Address>
    
    Nice 5 line address there.
    <FartOffice>
            <com:Open>
              <com:DayAndTimeAvailability>
                <com:DayTypes>
                  <com:MondayToFriday />
                </com:DayTypes>
                <com:OpeningHours>
                  <com:OpenPeriod>
                    <com:StartTime>06:30:00.000Z</com:StartTime>
                    <com:EndTime>10:00:00.000Z</com:EndTime>
                  </com:OpenPeriod>
                </com:OpeningHours>
              </com:DayAndTimeAvailability>
              <com:DayAndTimeAvailability>
                <com:DayTypes>
                  <com:Saturday />
                </com:DayTypes>
                <com:OpeningHours>
                  <com:OpenPeriod>
                    <com:StartTime>08:00:00.000Z</com:StartTime>
                    <com:EndTime>12:00:00.000Z</com:EndTime>
                  </com:OpenPeriod>
                </com:OpeningHours>
              </com:DayAndTimeAvailability>
              <com:DayAndTimeAvailability>
                <com:DayTypes>
                  <com:Sunday />
                </com:DayTypes>
                <com:OpeningHours>
                  <com:Unavailable />
                </com:OpeningHours>
              </com:DayAndTimeAvailability>
            </com:Open>
          </FartOffice>
    
    100 lines of XSL to take into account every single permeation of this one block. There's MondayToFriday, TuesdayToFriday, WednesdayToFriday, ThursdayToFriday, TuesdayToThursday, etc..

    In the same section there's two different ways to say whether something is true or false:
          <PoopyButts>false</PoopyButts>
          <BumFlaps>
            <com:Available>false</com:Available>
          </BumFlaps>
    

    They also randomly update, rename and change the way fields behave without telling us. So suddenly our station information is wildly out of date and the only way to get it working again is trawl through this giant XML file, figure out what's changed since last time and update our XSL, import scripts and everything else.

    The one about the fucking space hairdresser and the cowboy. He's got a tinfoil pal and a pedal bin
  • bowenbowen How you doin'? Registered User regular
    Ok this is retarded.

    I have an interface like this in .NET:
        [ComVisible(true)]
        [Guid("DDEC6E98-AA67-447A-B09A-4DA922F0D3CE")]
        [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
        public interface IRMSErxMessage
        {
            IOperationErrorType[] OperationErrors { get; }
        }
    

    This is exported by com interop (and the type it uses is as well) to an application running VBA (MS Access).

    And I cannot find a way to access the members of that array from code. I can open it up in the Local variables viewer and see all the subtypes, but I've no idea what the syntax is to use it. Something like this:
        Dim msg As RMSErxMessage
        ' Do some stuff.
        print msg.OperationErrors(1).Description
    

    Doesn't work. I know it's there, I should be able to access it because the VBA debugger can see the contents of that array - but what the christ is the syntax supposed to be?

    Your get method needs to be public?
        [ComVisible(true)]
        [Guid("DDEC6E98-AA67-447A-B09A-4DA922F0D3CE")]
        [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
        public interface IRMSErxMessage
        {
            public IOperationErrorType[] OperationErrors { get; }
        }
    

    Aren't methods/variables private unless specified with classes in c#? Not sure how COM affects this, I assume it follows the same rules there.

    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
    Things feel a bit weird when I go from mostly Ruby knowledge to working with C-style languages. (haha, I called PHP "C-style". Well, at least syntactically.)

    Took me a bit to mentally adapt to Ruby's "private" not being like PHP's "private" when it comes to class inheritance. "protected" is what I want.

  • EchoEcho ski-bap ba-dapModerator mod
    Seen on StackOverflow: illustrating your code!
    while (x --\
                \
                 \
                  \
                   > 0) 
         printf("%d ", x);
    

  • bowenbowen How you doin'? Registered User regular
    Ain't no one got time for 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
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    when will someone redo my poorly thought out and woefully outdated OP???

  • EchoEcho ski-bap ba-dapModerator mod
    Too late! We need to support old legacy junk now.

  • DiannaoChongDiannaoChong Registered User regular
    Tales from XML

    We have to deal with a huge XML file from, uh, Snational Snail, that contains information about every single train station in the country and the services it provides. It's obvious that they started out with great intentions, but it's now a giant clusterfuck of horribleness that means we have to have over 500 lines of XSL to parse it into something usable.

    Here's some choice bits:
       <Address>
          <PostalAddress>
            <add:A_5LineAddress>
              <add:Line>X ROAD</add:Line>
              <add:Line>-</add:Line>
              <add:PostCode>POST CODE</add:PostCode>
            </add:A_5LineAddress>
          </PostalAddress>
        </Address>
    
    Nice 5 line address there.
    <FartOffice>
            <com:Open>
              <com:DayAndTimeAvailability>
                <com:DayTypes>
                  <com:MondayToFriday />
                </com:DayTypes>
                <com:OpeningHours>
                  <com:OpenPeriod>
                    <com:StartTime>06:30:00.000Z</com:StartTime>
                    <com:EndTime>10:00:00.000Z</com:EndTime>
                  </com:OpenPeriod>
                </com:OpeningHours>
              </com:DayAndTimeAvailability>
              <com:DayAndTimeAvailability>
                <com:DayTypes>
                  <com:Saturday />
                </com:DayTypes>
                <com:OpeningHours>
                  <com:OpenPeriod>
                    <com:StartTime>08:00:00.000Z</com:StartTime>
                    <com:EndTime>12:00:00.000Z</com:EndTime>
                  </com:OpenPeriod>
                </com:OpeningHours>
              </com:DayAndTimeAvailability>
              <com:DayAndTimeAvailability>
                <com:DayTypes>
                  <com:Sunday />
                </com:DayTypes>
                <com:OpeningHours>
                  <com:Unavailable />
                </com:OpeningHours>
              </com:DayAndTimeAvailability>
            </com:Open>
          </FartOffice>
    
    100 lines of XSL to take into account every single permeation of this one block. There's MondayToFriday, TuesdayToFriday, WednesdayToFriday, ThursdayToFriday, TuesdayToThursday, etc..

    In the same section there's two different ways to say whether something is true or false:
          <PoopyButts>false</PoopyButts>
          <BumFlaps>
            <com:Available>false</com:Available>
          </BumFlaps>
    

    They also randomly update, rename and change the way fields behave without telling us. So suddenly our station information is wildly out of date and the only way to get it working again is trawl through this giant XML file, figure out what's changed since last time and update our XSL, import scripts and everything else.

    The amount of arguments about storing data for addresses that would be used for official mailings... The phrase "but we've always done it this way" when I show them the USPS website and business standard they expect on an envelope. It's crazyness what people think goes in the address box.

    steam_sig.png
  • The AnonymousThe Anonymous Uh, uh, uhhhhhh... Uh, uh.Registered User regular
    Tales from XML

    We have to deal with a huge XML file from, uh, Snational Snail, that contains information about every single train station in the country and the services it provides. It's obvious that they started out with great intentions, but it's now a giant clusterfuck of horribleness that means we have to have over 500 lines of XSL to parse it into something usable.

    Here's some choice bits:
       <Address>
          <PostalAddress>
            <add:A_5LineAddress>
              <add:Line>X ROAD</add:Line>
              <add:Line>-</add:Line>
              <add:PostCode>POST CODE</add:PostCode>
            </add:A_5LineAddress>
          </PostalAddress>
        </Address>
    
    Nice 5 line address there.
    <FartOffice>
            <com:Open>
              <com:DayAndTimeAvailability>
                <com:DayTypes>
                  <com:MondayToFriday />
                </com:DayTypes>
                <com:OpeningHours>
                  <com:OpenPeriod>
                    <com:StartTime>06:30:00.000Z</com:StartTime>
                    <com:EndTime>10:00:00.000Z</com:EndTime>
                  </com:OpenPeriod>
                </com:OpeningHours>
              </com:DayAndTimeAvailability>
              <com:DayAndTimeAvailability>
                <com:DayTypes>
                  <com:Saturday />
                </com:DayTypes>
                <com:OpeningHours>
                  <com:OpenPeriod>
                    <com:StartTime>08:00:00.000Z</com:StartTime>
                    <com:EndTime>12:00:00.000Z</com:EndTime>
                  </com:OpenPeriod>
                </com:OpeningHours>
              </com:DayAndTimeAvailability>
              <com:DayAndTimeAvailability>
                <com:DayTypes>
                  <com:Sunday />
                </com:DayTypes>
                <com:OpeningHours>
                  <com:Unavailable />
                </com:OpeningHours>
              </com:DayAndTimeAvailability>
            </com:Open>
          </FartOffice>
    
    100 lines of XSL to take into account every single permeation of this one block. There's MondayToFriday, TuesdayToFriday, WednesdayToFriday, ThursdayToFriday, TuesdayToThursday, etc..

    In the same section there's two different ways to say whether something is true or false:
          <PoopyButts>false</PoopyButts>
          <BumFlaps>
            <com:Available>false</com:Available>
          </BumFlaps>
    

    They also randomly update, rename and change the way fields behave without telling us. So suddenly our station information is wildly out of date and the only way to get it working again is trawl through this giant XML file, figure out what's changed since last time and update our XSL, import scripts and everything else.
    I'm just gonna leave this knife I happen to be carrying, right here. I sure hope nobody stabs people with it!

  • bowenbowen How you doin'? Registered User regular
    I see you're all subscribing to the Bowen method of workplace relations.

    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
  • zeenyzeeny Registered User regular
    edited May 2013
    Tales from XML

    (paraphrased to keep this post from being really damn long like whoa
    <xml>
        <node>
            <row>
                <column name="Name">val</column>
                <column name="Location">val</column>
                <column name="Address1">val</column>
                <column name="Address2">val</column>
                <column name="Address3">val</column>
                <column name="City">val</column>
                <column name="State">val</column>
                <column name="Zip">val</column>
                <column name="Pizza">val</column>
                <column name="etc1">val</column>
                <column name="etc2">val</column>
                <column name="etc3">val</column>
                <column name="etc4">val</column>
                <column name="etc5">val</column>
                <column name="etc6">val</column>
                <column name="etc7">val</column>
                (like 20 more "column" nodes)
            </row>
            <row>
                <column name="Name">val</column>
                <column name="Location">val</column>
                <column name="Address1">val</column>
                <column name="Address2">val</column>
                <column name="Address3">val</column>
                <column name="City">val</column>
                <column name="State">val</column>
                <column name="Zip">val</column>
                <column name="Pizza">val</column>
                <column name="etc1">val</column>
                <column name="etc2">val</column>
                <column name="etc3">val</column>
                <column name="etc4">val</column>
                <column name="etc5">val</column>
                <column name="etc6">val</column>
                <column name="etc7">val</column>
                (like 20 more "column" nodes)
            </row>
        </node>
    </xml>
    

    Assuming that this is an export meant to map directly to something like row db data, the developer was on the right track, just messed up the implementation. Writing a valid XSD and export with a several field tags and multiple attribbutes is A LOT better than doing the retarded <zip>zip value</zip> <city>city value</city>, not having an XSD at all, but thinking that "Hey man, my names have like, < > around them so it must be all good!".
    I've seen multiple well known software packages export flattened XML, no xsd XML and other shit like this and I'd gladly stab let bowen stab every single person who's written something similar.
    "Let's export a bunch of tables with relations to "xml", but we'll call every field with the actual db columns' name and strip the attributes, how does that sound?" should be met with "Shoot yourself and never speak to me again.".

    zeeny on
  • InfidelInfidel Heretic Registered User regular
    Oh hey, bogo sort was actually referenced not long ago!

    ineffective_sorts.png

    OrokosPA.png
  • bowenbowen How you doin'? Registered User regular
    As always, relevant.

    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
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Always gotta be portable!

  • gavindelgavindel The reason all your software is brokenRegistered User regular
    Two letters from our CSE listserv yesterday night:
    Hi all,

    I repeatedly heard concerns (or complaints) from industry that many of our
    students do not know C++ so they cannot hire these students. I was told
    that <other local school> students do not share this - they know C++. I have not
    verify this information but I am sad to hear this.

    This message is to tell you that a change to good would not happen. So I suggest
    that you grasp a C++ book, such as the "C++ Primer" by Lipperman, which I think
    is a very good book, at least when I read it 20 years ago. The one by Stroustroop
    of course is good. I am not sure about "C++: How to Program." I believe if you know
    Java or C well, and you spend a couple of hours a day reading the C++ book, then
    in a couple of weeks, you will know C++. Then practice it and learn how to deal with
    core dump and segmentation fault, etc.
    "Thank you for letting me know. I hope students will correct the wrong
    thinking. Lacking C/C++ automatically cuts your opportunity to half.

    It's also a niche market - so specializing in C/C++ is an added advantage.
    The argument that most students make is that C/C++ is a dying language
    and used in companies involved with system level dev and high optimization.
    Just sharing my views.

    I...uh...what? Is this a guilt trip?

    Book - Royal road - Free! Seraphim === TTRPG - Wuxia - Free! Seln Alora
  • zeenyzeeny Registered User regular
    edited May 2013
    How do you complete a CS curriculum without a language with manual memory management?

    Edit: Oh, wait, is this not at university level?

    zeeny on
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    zeeny wrote: »
    How do you complete a CS curriculum without a language with manual memory management?

    Edit: Oh, wait, is this not at university level?

    there's non-university level CS curriculum?

  • zeenyzeeny Registered User regular
    edited May 2013
    admanb wrote: »
    zeeny wrote: »
    How do you complete a CS curriculum without a language with manual memory management?

    Edit: Oh, wait, is this not at university level?

    there's non-university level CS curriculum?

    Yeah, don't you have community colleges and stuff like this in the US? I'm not sure what exactly those are, but I always got the impression you don't get a university degree, do you?

    zeeny on
  • bowenbowen How you doin'? Registered User regular
    Even ITT Tech did that. Data structures was entirely C++.

    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
  • gavindelgavindel The reason all your software is brokenRegistered User regular
    Our university requires Python, C (1989), and Java. You dabble a bit in Assembly in computer organization, I'm told. Other than that, nothing else is officially required, unless some professor wants language X in his class only.

    Book - Royal road - Free! Seraphim === TTRPG - Wuxia - Free! Seln Alora
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    zeeny wrote: »
    admanb wrote: »
    zeeny wrote: »
    How do you complete a CS curriculum without a language with manual memory management?

    Edit: Oh, wait, is this not at university level?

    there's non-university level CS curriculum?

    Yeah, don't you have community colleges and stuff like this in the US? I'm not sure what exactly those are, but I always got the impression you don't get a university degree, do you?

    Ah. Sure. We have community colleges and "Associate Degrees" which are, in most cases, basically equivalent to the first two years of a Bachelor's.

  • bowenbowen How you doin'? Registered User regular
    Still, I'm wondering if job people in the area are massively inflating their problems.

    I still see a lot of C++ posts but are looking for people with weirdly specific skill sets.

    I don't typically see things like "experience in Qt" but more like "Experience building your own UI library from scratch, mathlab from 1988, cobol" instead.

    You know, the whole "Well shit it's easier to just import people because clearly we have a labor shortage since I can't find anyone with 8 years of experience willing to work for $4/hr".

    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
This discussion has been closed.