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/

PA Programming Thread: Arguing, Cursing, and Recursing

ecco the dolphinecco the dolphin Registered User regular
edited September 2011 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 how many bits would a woodchuck chuck if a woodchuck could chuck bits.

Come on in - we deal with a wide variety of languages:

* Parts shamelessly stolen from previous OP
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: C#
Framework: ASP.NET MVC 2 (soon to jump up to 3)
Purpose: Web Development

ASP.NET MVC is Microsoft's answer to the slew of MVC frameworks already available for a variety of open source languages - Rails for Ruby, Django (is that actually a MVC framework?) for Python, and Zend, Code Igniter, and Kohana for PHP. It's a nice addition because, well, web forms suck for the web, and it follows the same basic overall design methodology as everyone else. It's now in its 3rd version, with a completely new view engine - Razor - which is actually pretty cool. I like where Microsoft is going with MVC.

There are a ton of free resources and tutorials available to get started. Like everything else, MVC is fairly simple to learn but difficult to master. It can be as complex as you want it to be.

Personally, I'm having some growing pains getting myself up to the next level/tier in my own skill development. Learning TDD, IoC, Domain Driven Design, etc. I understand the basics, but I'm still learning OOP in general and both C# and ASP.NET, so piling the more advanced (to me) stuff on top of it has been slow going.

Still, I like it more than PHP.
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".

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

Posts

  • ecco the dolphinecco the dolphin Registered User regular
    edited March 2011
    Phyphor wrote: »
    Smasher wrote: »
    Soooooooo, soliciting Language/Framework/Purpose for a new OP! I'll try and put it up in about 13 hours. If this gets locked, PM me!
    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.

    (hopefully this problem gets ported to the new thread)

    For a fun exercise, construct in hardware an instruction that determines whether a given 16-bit value has more ones than zeroes, that has less than twice the cycle time of a 16-bit carry-look ahead (CLA) adder. Naturally, the lower the cycle time the better.

    Well I'm not so good with verilog/vhdl, but I can do the logic. Whats the gate delay of a 16 bit CLA adder?

    edit: I can do it in 15 gates, counting and/or/not as 1 and xor as 2, but I really don't feel like expanding it to nand

    Curses - now I'll be thinking about this all day. =P

    Good thing my compile times are in the hours!

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • InfidelInfidel Heretic Registered User regular
    edited March 2011
    You didn't link to the new thread with your new thread post in the old one? For shame.

    Hrmm, I wonder what I could write an OP blurb for...

    Infidel on
    OrokosPA.png
  • ecco the dolphinecco the dolphin Registered User regular
    edited March 2011
    Infidel wrote: »
    You didn't link to the new thread with your new thread post in the old one? For shame.

    Darn it - it was on my list of things to do as well.

    All because I didn't have a proper issue tracking system!

    Or something.

    Edit: My only excuse is that this is RC1 - last minute bugs are expected to be found and ironed out. >_> <_<

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited March 2011
    I thought about writing a blurb on the Progress 4GL since my job involves looking at it at least once a day, but I think I'd end up too depressed.

    iTunesIsEvil on
  • NightslyrNightslyr Registered User regular
    edited March 2011
    I should probably update my little blurb:

    Language: C#
    Framework: ASP.NET MVC 2 (soon to jump up to 3)
    Purpose: Web Development

    ASP.NET MVC is Microsoft's answer to the slew of MVC frameworks already available for a variety of open source languages - Rails for Ruby, Django (is that actually a MVC framework?) for Python, and Zend, Code Igniter, and Kohana for PHP. It's a nice addition because, well, web forms suck for the web, and it follows the same basic overall design methodology as everyone else. It's now in its 3rd version, with a completely new view engine - Razor - which is actually pretty cool. I like where Microsoft is going with MVC.

    There are a ton of free resources and tutorials available to get started. Like everything else, MVC is fairly simple to learn but difficult to master. It can be as complex as you want it to be.

    Personally, I'm having some growing pains getting myself up to the next level/tier in my own skill development. Learning TDD, IoC, Domain Driven Design, etc. I understand the basics, but I'm still learning OOP in general and both C# and ASP.NET, so piling the more advanced (to me) stuff on top of it has been slow going.

    Still, I like it more than PHP.

    Nightslyr on
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited March 2011
    So since I got an iPad I am going to learn how to develop for it, which means learning Objective-C. I think I want to throw up right now.

    I am going to end up writing as much of my iPad code as I can in C++, but when it comes to interacting with the iPad itself, you have to use native hooks and Objective-C. Fun fun.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • WeretacoWeretaco Cubicle Gangster Registered User regular
    edited March 2011
    I'm tempted to write up an addition to the OP for pickBASIC

    There aren't many of us around :)

    Weretaco on
    Unofficial PA IRC chat: #paforums at irc.slashnet.org
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited March 2011
    Speaking of iPhone/iPad development. What kind of horse power do I need for XCode?

    Right now I am running OS X in a VMWare virtual machine, which is only so legal, and I want to get some actual hardware. I am looking at either a MacMini with 4GB of RAM, or the lowest end iMac. My other option is a 13" MacBook Pro, but I think that's too small and uncomfortable for serious development.

    Thoughts?

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • ecco the dolphinecco the dolphin Registered User regular
    edited March 2011
    I thought about writing a blurb on the Progress 4GL since my job involves looking at it at least once a day, but I think I'd end up too depressed.
    Weretaco wrote: »
    I'm tempted to write up an addition to the OP for pickBASIC

    There aren't many of us around :)

    Do eeeet, both of you. =P

    I've got the second post that can be used for more additions!

    Add to the weird and wonderful. =)

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    edited March 2011
    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

    Phyphor on
  • lazerbeardlazerbeard Registered User regular
    edited March 2011
    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.

    lazerbeard on
  • bowenbowen How you doin'? Registered User regular
    edited March 2011
    GnomeTank wrote: »
    Speaking of iPhone/iPad development. What kind of horse power do I need for XCode?

    Right now I am running OS X in a VMWare virtual machine, which is only so legal, and I want to get some actual hardware. I am looking at either a MacMini with 4GB of RAM, or the lowest end iMac. My other option is a 13" MacBook Pro, but I think that's too small and uncomfortable for serious development.

    Thoughts?

    That's what I'm going to be doing, and getting the monitor connector (2?) to hook monitors up to it.

    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
  • EtheaEthea Registered User regular
    edited March 2011
    If you have an existing spare monitor or a KVM I would go with a refurb mac mini to cut down on costs. Otherwise the 21 inch IMac offers alot more processing power.

    Ethea on
  • ASimPersonASimPerson Cold... and hard.Registered User regular
    edited March 2011
    Hrm, I'm pretty sure there's an "it's" in my blurb for the OP that should be an "it has".

    ASimPerson on
  • iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited March 2011
    Gnome, I'd just get the Mac Mini. It'll have plenty of hp with 4GB and a C2D to run Xcode. There are only Mini-DisplayPort and HDMI outs on the back, but the Mini comes with an HDMI => DVI converter, so you should easily be able to hook it up to an existing monitor.

    iTunesIsEvil on
  • DeicistDeicist Registered User regular
    edited March 2011
    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.

    Deicist on
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited March 2011
    Hey, does anyone have any tips for wrangling the trailing slashes on URLs with PHP and mod_rewrite?

    I'm using an index.php file with a container div for content pages. Currently, I'm getting from domain.com/thing to index.php?page=thing successfully using this:
    RewriteCond &#37;{REQUEST_FILENAME} -d
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule (.+)/? index.php?page=$1 [NC,L]
    

    Unfortunately, I can't quite grasp how to get a 301 to the canonical address and then the rewrite of the above rule using this:
    RewriteRule (.+)/ $1 [R=301]
    
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule (.+) index.php?page=$1 [NC,L]
    

    Any rewrite wizards want to take a whack at it? Bonus points if it's domain agnostic so I can use it without modification on my home server as well.

    Edit:
    I should mention that my rules are from memory, so they might not reflect my actual site or sane syntax.

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • bowenbowen How you doin'? Registered User regular
    edited March 2011
    Hmm, I don't quite understand what you're trying to do.

    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
  • InfidelInfidel Heretic Registered User regular
    edited March 2011
    templewulf wrote: »
    Hey, does anyone have any tips for wrangling the trailing slashes on URLs with PHP and mod_rewrite?

    I'm using an index.php file with a container div for content pages. Currently, I'm getting from domain.com/thing to index.php?page=thing successfully using this:
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule (.+)/? index.php?page=$1 [NC,L]
    

    Unfortunately, I can't quite grasp how to get a 301 to the canonical address and then the rewrite of the above rule using this:
    RewriteRule (.+)/ $1 [R=301]
    
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule (.+) index.php?page=$1 [NC,L]
    

    Any rewrite wizards want to take a whack at it? Bonus points if it's domain agnostic so I can use it without modification on my home server as well.

    Edit:
    I should mention that my rules are from memory, so they might not reflect my actual site or sane syntax.

    How do you mean, you're trying to mask that something is a directory?

    So if you have a script at /home/index.php, and you go to /home, it stays like /home instead of redirecting to /home/?

    Infidel on
    OrokosPA.png
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited March 2011
    bowen wrote: »
    Hmm, I don't quite understand what you're trying to do.

    I want my canonical URLs to be domain.com/thing with no trailing slash, and I want domain.com/thing/ to be redirected to the canonical version. From there, I want domain.com/thing to be internally translated to domain.com/index.php?page=thing, but I think I have that part in hand.

    Edit:
    I guess I didn't explain myself very well. I have a PHP file with a container div that serves content based on the $_GET parameter. Those PHP files are in a sub-directory called "/content". I prettied up my URLs by using mod_rewrite to change requests for "domain.com/about" into "domain.com/index.php?page=about". In PHP, that page is pulled from "/var/www/content/about.php" and inserted into the div inside "/var/www/index.php".

    What I want now is to get URLs to redirect from "domain.com/about/" into "domain.com/about". (Note the lack of trailing slash.)

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • InfidelInfidel Heretic Registered User regular
    edited March 2011
    templewulf wrote: »
    bowen wrote: »
    Hmm, I don't quite understand what you're trying to do.

    I want my canonical URLs to be domain.com/thing with no trailing slash, and I want domain.com/thing/ to be redirected to the canonical version.

    From there, I want domain.com/thing to be internally translated to domain.com/index.php?page=thing, but I think I have that part in hand.

    The auto redirect to add the trailing slash is a security / good practice feature. It can be turned off via mod_dir and the DirectorySlash directive, but really the easier solution is don't have directories that exist for your fake URLs?

    If thing isn't a directory, you won't have any issue.

    Don't support a trailing slash and you won't have issues with people trying to access them via slash. :P

    Infidel on
    OrokosPA.png
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited March 2011
    Infidel wrote: »
    templewulf wrote: »
    bowen wrote: »
    Hmm, I don't quite understand what you're trying to do.

    I want my canonical URLs to be domain.com/thing with no trailing slash, and I want domain.com/thing/ to be redirected to the canonical version.

    From there, I want domain.com/thing to be internally translated to domain.com/index.php?page=thing, but I think I have that part in hand.

    The auto redirect to add the trailing slash is a security / good practice feature. It can be turned off via mod_dir and the DirectorySlash directive, but really the easier solution is don't have directories that exist for your fake URLs?

    If thing isn't a directory, you won't have any issue.

    Don't support a trailing slash and you won't have issues with people trying to access them via slash. :P

    It's not about confusing directories for fake URLs so much as it is a usability issue. If a person enters domain.com/thing or domain.com/thing/, I still want them to get to thing.php. I'm trying to figure out how to get one to 301 redirect to the other, but I can't quite work out the Rewrite rules.

    Edit:
    All URLs which don't have a corresponding PHP file in /var/www/content are sent to my 404 page, so I'm not worried about directory access.

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • InfidelInfidel Heretic Registered User regular
    edited March 2011
    templewulf wrote: »
    Infidel wrote: »
    templewulf wrote: »
    bowen wrote: »
    Hmm, I don't quite understand what you're trying to do.

    I want my canonical URLs to be domain.com/thing with no trailing slash, and I want domain.com/thing/ to be redirected to the canonical version.

    From there, I want domain.com/thing to be internally translated to domain.com/index.php?page=thing, but I think I have that part in hand.

    The auto redirect to add the trailing slash is a security / good practice feature. It can be turned off via mod_dir and the DirectorySlash directive, but really the easier solution is don't have directories that exist for your fake URLs?

    If thing isn't a directory, you won't have any issue.

    Don't support a trailing slash and you won't have issues with people trying to access them via slash. :P

    It's not about confusing directories for fake URLs so much as it is a usability issue. If a person enters domain.com/thing or domain.com/thing/, I still want them to get to thing.php. I'm trying to figure out how to get one to 301 redirect to the other, but I can't quite work out the Rewrite rules.

    Edit:
    All URLs which don't have a corresponding PHP file in /var/www/content are sent to my 404 page, so I'm not worried about directory access.

    The good majority of URLs will cease to function if someone decides to put a slash on the end just cause. :P This is not a problem that needs fixing.

    You can do what you want with something like this:
    RewriteCond &#37;{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{HTTP_HOST} ^(.*)$ 
    RewriteRule ^(.+)/$ http://%1/$1 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ index.php?page=$1 [QSA,L]
    

    Infidel on
    OrokosPA.png
  • InfidelInfidel Heretic Registered User regular
    edited March 2011
    There, fixed it up a bit more and made it host generic. (I hope you don't have port numbers!)

    Infidel on
    OrokosPA.png
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited March 2011
    Gnome, I'd just get the Mac Mini. It'll have plenty of hp with 4GB and a C2D to run Xcode. There are only Mini-DisplayPort and HDMI outs on the back, but the Mini comes with an HDMI => DVI converter, so you should easily be able to hook it up to an existing monitor.

    Yah, I think that's the route I'm gonna go. The MacMini with the 4GB of RAM upgrade and just a cheap LCD. It's really only going to be used for iPad development, so that should be enough.

    e: My wife has overridden me. She wants the 21.5" iMac :P Oh darn, I just have to get a better one with a nicer monitor. What a shame.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • EtheaEthea Registered User regular
    edited March 2011
    GnomeTank wrote: »
    Gnome, I'd just get the Mac Mini. It'll have plenty of hp with 4GB and a C2D to run Xcode. There are only Mini-DisplayPort and HDMI outs on the back, but the Mini comes with an HDMI => DVI converter, so you should easily be able to hook it up to an existing monitor.

    Yah, I think that's the route I'm gonna go. The MacMini with the 4GB of RAM upgrade and just a cheap LCD. It's really only going to be used for iPad development, so that should be enough.

    The apple store is offering a refurb 4gb mac mini right now for 15% off the regular price.

    Ethea on
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited March 2011
    Ethea wrote: »
    GnomeTank wrote: »
    Gnome, I'd just get the Mac Mini. It'll have plenty of hp with 4GB and a C2D to run Xcode. There are only Mini-DisplayPort and HDMI outs on the back, but the Mini comes with an HDMI => DVI converter, so you should easily be able to hook it up to an existing monitor.

    Yah, I think that's the route I'm gonna go. The MacMini with the 4GB of RAM upgrade and just a cheap LCD. It's really only going to be used for iPad development, so that should be enough.

    The apple store is offering a refurb 4gb mac mini right now for 15% off the regular price.

    Hehe, I just edited my post. My wife has overridden me, she wants the iMac.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited March 2011
    The new iMac's are awfully nice. You'll enjoy it.

    Though, you may want to think about plugging in a different mouse while you're programming. Maybe. It'll depend. People either love or hate the Magic Mouse (which comes with the iMac).

    iTunesIsEvil on
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited March 2011
    Yah, I'd really like a quad core i5, but I'm not willing to pay for the 1500 or 1600 iMac that has it, so dual core i3 it is. At least it has 4GB of RAM standard, and the screen is gorgeous.

    I'm not going to use the stock mouse or keyboard. I use an ergo keyboard for programming, and I have a spare Razer I'll plugin.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited March 2011
    Infidel wrote: »
    The good majority of URLs will cease to function if someone decides to put a slash on the end just cause. :P This is not a problem that needs fixing.
    But, but, but...the nits! I must pick them! :lol:
    You can do what you want with something like this:
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{HTTP_HOST} ^(.*)$ 
    RewriteRule ^(.+)/$ http://%1/$1 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ index.php?page=$1 [QSA,L]
    

    I was afraid you'd use HTTP_HOST! I do actually use port numbers on my test server, so a universal file may be more difficult than I'd hoped. I'll play around with it and see what I can make of it.

    Thanks!

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • InfidelInfidel Heretic Registered User regular
    edited March 2011
    templewulf wrote: »
    Infidel wrote: »
    The good majority of URLs will cease to function if someone decides to put a slash on the end just cause. :P This is not a problem that needs fixing.
    But, but, but...the nits! I must pick them! :lol:
    You can do what you want with something like this:
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{HTTP_HOST} ^(.*)$ 
    RewriteRule ^(.+)/$ http://%1/$1 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ index.php?page=$1 [QSA,L]
    

    I was afraid you'd use HTTP_HOST! I do actually use port numbers on my test server, so a universal file may be more difficult than I'd hoped. I'll play around with it and see what I can make of it.

    Thanks!

    Yeah, you can't do a client redirect without building a full URL, you could probably work out a system that works for you by taking the pattern matching a step further in the Conds.

    Infidel on
    OrokosPA.png
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited March 2011
    GnomeTank wrote: »
    Speaking of iPhone/iPad development. What kind of horse power do I need for XCode?

    Right now I am running OS X in a VMWare virtual machine, which is only so legal, and I want to get some actual hardware. I am looking at either a MacMini with 4GB of RAM, or the lowest end iMac. My other option is a 13" MacBook Pro, but I think that's too small and uncomfortable for serious development.

    Thoughts?

    Late to the party here.

    But the Mac Mini and MBP '13 are practically identical computers.

    The only difference is that an MBP has a keyboard and monitor built in.


    To address the original question, you really don't need horsepower for Xcode. You can skate with 2 gigs of RAM and a laptop harddrive and never know the difference. And unless you are linking against like 30 huge libraries, your compilation will be reasonable. I spend more time transferring apps over the 30-pin than I do actually compiling in Xcode.

    With that being said, I believe the most important thing in developing with XCode is screenspace. Xcode 4 basically throws the baby out with the bathwater by implementing a single-screen solution which makes Spaces worthless so far as I can tell, so screen space is even more important.

    I was actually at the Apple store yesterday scouting laptops for mobile development, and the 13 is decent enough, but not for long-term use. It would be something I'd open up to poke around for an hour or two, but not for 4-6 hour development sessions.

    The important thing to remember though is that you can always plug that beast into a real monitor and buy an external keyboard.

    So.

    If you have the money, MBP '13 is basically just a mobile Mac Mini and I would recommend it.

    I've been using a last gen Mini for over a year now for iPhone development and the only problems I have are not Xcode related, they are photoshop related (hard disk chunking).

    There's nothing an iMac gives you that you need for development except for more real estate on the monitor.

    Jasconius on
  • bowenbowen How you doin'? Registered User regular
    edited March 2011
    Yeah so spare the extra $100 for the dual DVI cable thingies. That's what I'm doing per Jasc's advice.

    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
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited March 2011
    the new ones have that lightning bolt or whatever the hell it is that adapt to dual DVI or something

    I'm guessing for Apple's rates its 20-50 for the new wire and another 20-40 for the adapter

    But they probably also come with basic DisplayPort if you have an old Mac monitor laying around (most people dont)

    Jasconius on
  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    edited March 2011
    I'm definitely disappointed by the tyranny of imperative languages around here. :)

    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.

    Kakodaimonos on
  • seabassseabass Doctor MassachusettsRegistered User regular
    edited March 2011
    I'm definitely disappointed by the tyranny of imperative languages around here. :)

    I don't post much, but I'm a big OCaml hack. It was handed down to me by my Ph.D. advisor, who is a convert from the school of lisp. Speaking of, if I've understood what you guys are up to here:

    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.

    Kakodaimonos, how do you like haskell? I've always shied away from purely functional languages.

    seabass on
    Run you pigeons, it's Robert Frost!
  • lazerbeardlazerbeard Registered User regular
    edited March 2011
    I'll admit that I haven't really spent a lot of time with functional programming languages, but I'm kinda curious about em. Can you guys give me an example where a functional programming language is really handy over something like C#?

    Like what do you use F# for vs C#? What's the line where you're like "this should be handled in F#" and "This should be handled in C#"?

    lazerbeard on
  • seabassseabass Doctor MassachusettsRegistered User regular
    edited March 2011
    lazerbeard wrote: »
    I'll admit that I haven't really spent a lot of time with functional programming languages, but I'm kinda curious about em. Can you guys give me an example where a functional programming language is really handy over something like C#?

    Like what do you use F# for vs C#? What's the line where you're like "this should be handled in F#" and "This should be handled in C#"?

    Anytime I'm doing something relatively computationally intensive in a tight loop, I call out from ocaml to another more efficient library to handle it for me. If I'm doing something where I'm manipulating one state of the world into another, or converting one set of data into another set of data, or doing something where the changes being made to the state of the program are complicated for me, but not for the computer, I'll do the work in ocaml.

    So... let's say I'm writing a program that builds and then uses an artificial neural network to classify images on a hard drive as sfw / nsfw. I get someone to label a bunch of images for me, put them in the appropriate directories.

    I then write some ocaml code to load the images from disk, munge on them a bit to get a vector of numbers that represent the image and whether it was safe or not, and flush it back to disk. I did that in ocaml because it was a transformation of lists of files to lists of lists of numbers, then back to the disk.

    Then, I write some code to batch train the neural network in C. I'm gonna be manipulating values in arrays for a couple of hours, and C is pretty awesome at that. Once my C code has set up the network, it flushes it back to disk.

    Then, I write some ocaml code to construct a neural network from the data my C program dumped out, and I write some code that recursively lists all of the files in a directory, classifies each file in a directory as safe or not safe, and recurs down into the directories to classify those.

    seabass on
    Run you pigeons, it's Robert Frost!
  • KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    edited March 2011
    lazerbeard wrote: »
    I'll admit that I haven't really spent a lot of time with functional programming languages, but I'm kinda curious about em. Can you guys give me an example where a functional programming language is really handy over something like C#?

    Like what do you use F# for vs C#? What's the line where you're like "this should be handled in F#" and "This should be handled in C#"?

    We tend to do alot of the raw analytical code that our quants come up with in F#. It's a lot easier to take the specs and formulas and write them in a functional language rather than try to wedge them into an OO language. We've found that the performance in F# is fine for most stuff, except the ultra-low latency work.

    C# is good for doing some of the COM-visible assembly work. Also if we're working with a vendor library that's in C#, I'll usually do it in C# just to avoid some of the impedance issues.

    Kakodaimonos on
  • lazerbeardlazerbeard Registered User regular
    edited March 2011
    thats kinda the gist I got, that if the work you're doing largely resembles an actual math function, you a functional programming language pretty much has a 1:1 mapping between the function you worked out offline and what you program to make the function work. Seems cool and a lot more useful if you call *into* it from another language like C or C#, I always thought the idea of having stateless stuff to be kinda annoying if you're making a whole application out of that, but if you just shop out the pieces where it makes sense as sort of like a programmers' calculator it makes a whole lot more sense to me. Is that about right?

    lazerbeard on
This discussion has been closed.