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/
Options

SELECT * FROM posts WHERE tid = 'PA PROGRAMMING THREAD'

InfidelInfidel HereticRegistered User regular
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.

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: 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".
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! :^:

OrokosPA.png
Infidel on
«134567100

Posts

  • Options
    admanbadmanb unionize your workplace Seattle, WARegistered User regular
    Is it worth me writing a bit for the OP on Javascript as its used now on the back-end with Node.js and to build complex dynamic front-end interfaces with Backbone.js and such?

  • Options
    InfidelInfidel Heretic Registered User regular
    GnomeTank wrote:
    Infidel wrote:
    GnomeTank wrote:
    I don't know that the industry is taking it more seriously. Maybe inside Java circles, people are less doom and gloom about it since Oracle took over, but outside Java circles it's not gaining any popularity. The Java language committees refusal to add really anything modern to the language has hurt it in the long run.

    Enterprise and large industry are fans of vendor packages. For new application projects, Microsoft can provide the main components and now so can Oracle. This isn't developer decisions, this is architect and executive decisions. Doesn't matter if the technical is the same as it used to be, the marketing and support contracts change things big time.

    You aren't going to have any primarily Microsoft shops changing to Java though, support contracts or otherwise. For UNIX shops, or shops that don't know what they are yet, perhaps Java is appealing, but it's not winning a ton of converts.

    The Oracle change has led to multi-billion$$-traded clients taking it more seriously and adopting the "Oracle stack" for new development projects my company is involved in. It is a very noticeable impact in many industries we work with.

    Basically, clients that spend a shitload on Oracle database licensing are looking at "protecting" that investment, I'm sure it makes sense to someone.

    OrokosPA.png
  • Options
    InfidelInfidel Heretic Registered User regular
    admanb wrote:
    Is it worth me writing a bit for the OP on Javascript as its used now on the back-end with Node.js and to build complex dynamic front-end interfaces with Backbone.js and such?

    I say go for it!

    OrokosPA.png
  • Options
    minor incidentminor incident expert in a dying field njRegistered User regular
    Question, kind Programmers:

    I've been an on-and-off web designer for ten years or so. Perfectly fluent in HTML and CSS. I can tinker with JavaScript snippets enough to suit my needs here and there, but I can not program. I've always meant to learn but never found the right place to start.

    So, my end goal is to be able to one day write an iOS app that interfaces with a web server. Plus, whatever other stuff comes up along the way. Probably Mac apps, too.

    Knowing not a single lick of code with no familiarty with programming, where do I start? Is there a book that I should go with? A resource online that will walk me through everything? I'm assuming I'm looking for something geared towards Xcode, but I have no clue where to start.

    Help a brother out?

    Ah, it stinks, it sucks, it's anthropologically unjust
  • Options
    GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited February 2012
    Well, I wouldn't dive right in to Objective-C or C++ if I were you (which is what you'd be using for iOS)...I'd grab something like Python or Ruby (Ruby being my favorite), and just learn the basics of object oriented programming first. I suggest those two languages because the developer cycle is super fast. Save a text file, point the Python or Ruby interpreter at that text file, profit. No compilation step, no need for a huge IDE...a simple text editor like Sublime Text or Notepad++ (or TextMate if you're on Mac) and a command line is all you need to start with those languages.

    Both languages also have tutorials coming out the behind, and both languages allow you to extend to your web server thing with Ruby on Rails for Ruby and Django for Python, so it's not "wasted" learning. Once you understand the basics of programming, learning the syntax of a new language like Objective-C or C++ becomes mostly semantic.

    Some resources:
    http://rubyinstaller.org/ <-- Windows Ruby installer
    http://www.ruby-lang.org/en/downloads/ <-- Ruby source code, if you are on Mac and just want to build it
    http://www.sublimetext.com/2 <-- Great Windows editor
    http://macromates.com/ <-- Great Mac editor
    http://notepad-plus-plus.org/ <-- Great FREE Windows editor (even though Sublime Text technically has an endless trial)

    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
  • Options
    FremFrem Registered User regular
    From old thread:
    Ethea wrote:
    Frem wrote:
    GnomeTank wrote:
    bowen wrote:
    That explains why GIT for windows is more like "meh." I felt better using SVN than git.

    Yeah, the Git team basically takes the "Only idiots use Windows" approach...which isn't shocking given who the project creator is.

    The Ruby community is largely the same way. Which is sad, given how fun and accessible a language it is. There are a few widely used (and supposedly cross-platform) gems which routinely are released in versions that don't even compile on Windows. JRuby is the most sane way to go.

    I have yet to have a single issue with GIT on Windows. The spec is good enough that people have written java and erlang versions of the original program. Plus people have ported it to frameworks like Hadoop.

    I have! This thing. The issue wasn't very well documented when I encountered it, and I wasted more time than I'd like to admit figuring out how to fix it.

    There was some other weird Git-breaking Windows-specific thing I ran into once (I think it had to do with file encodings?), but I don't appear to have dumped it into my Simplenote account.

    The Git project doesn't have a bug tracking system, by the way.

  • Options
    Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    GnomeTank wrote:
    Well, I wouldn't dive right in to Objective-C or C++ if I were you (which is what you'd be using for iOS)...I'd grab something like Python or Ruby (Ruby being my favorite), and just learn the basics of object oriented programming first. I suggest those two languages because the developer cycle is super fast. Save a text file, point the Python or Ruby interpreter at that text file, profit. No compilation step, no need for a huge IDE...a simple text editor like Sublime Text or Notepad++ (or TextMate if you're on Mac) and a command line is all you need to start with those languages.

    Both languages also have tutorials coming out the behind, and both languages allow you to extend to your web server thing with Ruby on Rails for Ruby and Django for Python, so it's not "wasted" learning. Once you understand the basics of programming, learning the syntax of a new language like Objective-C or C++ becomes mostly semantic.

    Some resources:
    http://rubyinstaller.org/ <-- Windows Ruby installer
    http://www.ruby-lang.org/en/downloads/ <-- Ruby source code, if you are on Mac and just want to build it
    http://www.sublimetext.com/2 <-- Great Windows editor
    http://macromates.com/ <-- Great Mac editor
    http://notepad-plus-plus.org/ <-- Great FREE Windows editor (even though Sublime Text technically has an endless trial)

    I worked my way through the first several ruby koans and thought it was a pretty cool way to learn a language. I don't believe it assumes you know how to code, but I'm not sure. I should really pick it back up at some point.

    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • Options
    GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Yeah, the ruby koans are good stuff.

    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
  • Options
    NightslyrNightslyr Registered User regular
    Man, I really need to change my opening blurb that's like two years old.

  • Options
    Alistair HuttonAlistair Hutton Dr EdinburghRegistered User regular
    Cygwin.

    I have a thoughtful and infrequently updated blog about games http://whatithinkaboutwhenithinkaboutgames.wordpress.com/

    I made a game, it has penguins in it. It's pay what you like on Gumroad.

    Currently Ebaying Nothing at all but I might do in the future.
  • Options
    baronfelbaronfel Would you say I have a _plethora_?Registered User regular
    edited February 2012
    Haha! Hilarity ensues. Turns out that for my i18n issues, the implementers had done a good job of making sure that all user-facing, localized format strings were translated into appropriate strings for use in a ToString() call, as expected. Except for one tiny issue:
    public string Format(IVariableDateTime varDateTime, string formatString)
    {
       var standardFormat = LocalizedFormatToNormalizedFormat[formatString] ?? String.Empty();
       if(String.IsNullOrEmpty(standardFormat)) throw new ArgumentException("...");
       return String.Format("0:"+formatString, varDateTime.DateTime);
    }
    
    Yeah, they forgot to use the normalized formatString. I think it was due to the confusing and redundant variable names in the function. Oh well, lesson learned.

    baronfel on
  • Options
    Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    Oh man, and because they were throwing it through a .IsNullOrEmpty(), it didn't even give an unused variable warning. Harsh.

    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • Options
    InfidelInfidel Heretic Registered User regular
    Well, I'm not quite sure what I'm ready to discuss in a blog about making an indie game company, but if anyone here is trying something similar and wants to talk or ask questions, feel free.

    For where it matters keep in mind that I'm in Canada.

    OrokosPA.png
  • Options
    ASimPersonASimPerson Cold... and hard.Registered User regular
    Nightslyr wrote:
    Man, I really need to change my opening blurb that's like two years old.

    Mine's still true! But no one really seems to have C questions any more.

  • Options
    Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    halp. So I'm trying to rewrite some fcgi script I wrote into python, and I think I'm missing something. I've narrowed it down to this: This script works
    #!/usr/bin/python
    # -*- coding: UTF-8 -*-
    
    from time import time
    from flup.server.fcgi import WSGIServer
    
    last = time()
    
    def app(environ, start_response):
        start_response('200 OK', [('Content-Type', 'text/plain; charset=utf-8')])
        yield str(last)
    
    WSGIServer(app).run()
    

    but this one does not
    #!/usr/bin/python
    # -*- coding: UTF-8 -*-
    
    from time import time
    from flup.server.fcgi import WSGIServer
    
    last = time()
    
    def app(environ, start_response):
        start_response('200 OK', [('Content-Type', 'text/plain; charset=utf-8')])
        last += 1
        yield str(last)
    
    WSGIServer(app).run()
    

    This is an oversimplification of what I'm trying to do, but it is similar. The only think I can think is that some sort of exception is being thrown on writing to the global because of threading concerns, but i have no idea where such a stacktrace would be being spit out, so I'm just guessing. Do you think I need to use a queue to deal with this sort of thing?

    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • Options
    Jimmy KingJimmy King Registered User regular
    Yeah, I think you're spot about the global wanging it. If you need to use a global in python then you first have to tell the function that you're accessing a global.

    Broken with stack trace:
    >>> from time import time
    >>> last = time()
    >>> def test():
    ...     last += 1
    ...     print last
    ... 
    >>> test()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<stdin>", line 2, in test
    UnboundLocalError: local variable 'last' referenced before assignment
    >>> def test2():
    ...     global last
    ...     last += 1
    ...     print last
    ... 
    >>> test2()
    1329141817.15
    

    The better route to go is probably to get the time inside your function. As to viewing the stack trace, you can manually run the code within the interpreter like I did above or for actual app logging have a look at the logging moduel

  • Options
    urahonkyurahonky Registered User regular
    Have to re-write the User Guide for my product to include Mac controls. Mainly if it says: Right Click I need to add: Hold CTRL and Click. Wee!

  • Options
    Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    Oh man so it was more fundamental than I thought. I guess I should justify the global then, though there's probably a better way of doing it.

    What I'm wanting is to limit the number of times it is possible for the FCGI script to perform an expensive operation. Basically
    if (it has been more than 5 seconds since this script was called):
        do the expensive lookup and spit out the results
    else:
        just print out whatever we did last time
    

    I might just be paranoid, but since I'm running this for my own convenience on my internet facing router, someone could decide it would be funny to peg the script and bring my router to its knees during some pivotal moment in TF2 or something.

    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • Options
    Jimmy KingJimmy King Registered User regular
    Well, limiting it at the script level isnt going to help your router any. It's already been through the router and to the web server at that point. For the web server performance, if it's just a small hackjob one off script then using the global may be fine, but if it's something semi-serious I'd look into caching the result of the operation to using memcached or an in memory cache or even to a db table instead.

  • Options
    zeenyzeeny Registered User regular
    Quick poll:

    1. Do you still use UML at the workplace?
    2. If yes, which software? If you used it before and now you don't, what did you substitute for?

  • Options
    Alistair HuttonAlistair Hutton Dr EdinburghRegistered User regular
    UMLet is a lovely tool that doesn't try to do to much and is practically command line in its implementation so very friendly for programmers.

    I do miss Together/J though.

    I have a thoughtful and infrequently updated blog about games http://whatithinkaboutwhenithinkaboutgames.wordpress.com/

    I made a game, it has penguins in it. It's pay what you like on Gumroad.

    Currently Ebaying Nothing at all but I might do in the future.
  • Options
    urahonkyurahonky Registered User regular
    We use Artisan at work for our UML designs... But I'm not sure if I like it.

  • Options
    InfidelInfidel Heretic Registered User regular
    I haven't been the one making them so I don't know what they used sorry.

    OrokosPA.png
  • Options
    seabassseabass Doctor MassachusettsRegistered User regular
    edited February 2012
    zeeny wrote:
    Quick poll:

    1. Do you still use UML at the workplace?
    2. If yes, which software? If you used it before and now you don't, what did you substitute for?

    Occasionally I will sketch a particularly complicated system out on paper or a whiteboard. Usually I either take a picture of it with a camera phone, or I replicate the sketch in dia. I don't think dia is designed exclusively for UML though, so it may not gracefully handle the more complicated stuff.

    Generally, we don't use UML, but we don't do production code either, nor do we really build large systems.

    seabass on
    Run you pigeons, it's Robert Frost!
  • Options
    Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited February 2012
    Jimmy King wrote:
    Well, limiting it at the script level isnt going to help your router any. It's already been through the router and to the web server at that point. For the web server performance, if it's just a small hackjob one off script then using the global may be fine, but if it's something semi-serious I'd look into caching the result of the operation to using memcached or an in memory cache or even to a db table instead.

    You make it sound like my router isn't my web server.
    It's not serious stuff. I'm literally the only legitimate user. There might be some way to do this from lighttpd, though. I'll look into it later, thanks.

    Monkey Ball Warrior on
    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • Options
    Jimmy KingJimmy King Registered User regular
    seabass wrote:
    zeeny wrote:
    Quick poll:

    1. Do you still use UML at the workplace?
    2. If yes, which software? If you used it before and now you don't, what did you substitute for?

    Occasionally I will sketch a particularly complicated system out on paper or a whiteboard. Usually I either take a picture of it with a camera phone, or I replicate the sketch in dia. I don't think dia is designed exclusively for UML though, so it may not gracefully handle the more complicated stuff.

    Generally, we don't use UML, but we don't do production code either, nor do we really build large systems.
    That's what we do, too. Get stuff up on a whiteboard, sometime takes a picture, then we'll turn that into proper scrum tasks and diagrams using Dia or Gliffy. We don't do true, to the spec UML, though. Just a chart that's readable so that we know wtf is going on.

  • Options
    GrobianGrobian What's on sale? Pliers!Registered User regular
    Jimmy King wrote:
    seabass wrote:
    zeeny wrote:
    Quick poll:

    1. Do you still use UML at the workplace?
    2. If yes, which software? If you used it before and now you don't, what did you substitute for?

    Occasionally I will sketch a particularly complicated system out on paper or a whiteboard. Usually I either take a picture of it with a camera phone, or I replicate the sketch in dia. I don't think dia is designed exclusively for UML though, so it may not gracefully handle the more complicated stuff.

    Generally, we don't use UML, but we don't do production code either, nor do we really build large systems.
    That's what we do, too. Get stuff up on a whiteboard, sometime takes a picture, then we'll turn that into proper scrum tasks and diagrams using Dia or Gliffy. We don't do true, to the spec UML, though. Just a chart that's readable so that we know wtf is going on.

    Thirded. We "draw" in Visio (*shudder*) or Altovas Umodeler.

  • Options
    JasconiusJasconius sword criminal mad onlineRegistered User regular
    I've been using Javascript, Canvas, with EaselJS over the last several days and it's awesome.

    It bundles all the important Canvas rendering optimizations with state-driven rendering in a very Flash-like API (except much lighter)

    Very easy to use. Hoping to make an HTML5 based RPG with it.

  • Options
    DrunkMcDrunkMc Registered User regular
    I've been having trouble getting back into leisure programming. Nothing is jumping out at me. ANDROID just isnt' catching my imagination. I don't know, I have loved all In Action books, but this Android one just isn't very complelling. They do things in different order hten I do and I find myself jumping around trying to figure out if they assume I'm going to do something on my own or they haven't gotten to it yet. Like they show the code before they do the layout. So the code has TONS of errors and can't auto complete, cause it doesn't know the layout yet. It just feels clunky.

    I love GWT, but there's not much left I can do withit unless I start using 3rd party libraries, but its hard to tell which are interesting and are here to stay and mature. I dunno, in a fun programming rut!! Maybe something this weekend will peek my interest.

  • Options
    bowenbowen How you doin'? Registered User regular
    Jimmy King wrote:
    Well, limiting it at the script level isnt going to help your router any. It's already been through the router and to the web server at that point. For the web server performance, if it's just a small hackjob one off script then using the global may be fine, but if it's something semi-serious I'd look into caching the result of the operation to using memcached or an in memory cache or even to a db table instead.

    You make it sound like my router isn't my web server.
    It's not serious stuff. I'm literally the only legitimate user. There might be some way to do this from lighttpd, though. I'll look into it later, thanks.

    Exchange the heavy operation to a light one. Read a timestamp from a file or some such?

    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
  • Options
    Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    I was thinking about that. I have a bad tendency of overabstracting my problem when I come here for help, so I'm going to instead say exactly what I want.

    I want to check, without ssh'ing in, that all my services are running on my linux box. So I have lighttpd tell me, and this is the fcgi script I'm using right now to do it.

    I've thought about instead just setting up a cron job that just checks every minute or so and keeps the results in a text file, then I can pull the text directly.

    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • Options
    bowenbowen How you doin'? Registered User regular
    If you're trying to avoid checking directly every time, that'd probably be the better option. Some sort of caching mechanism. Maybe once every 5 minutes, because even 1 minute is probably more granularity than you need.

    Give yourself the ability to force it with something like http://kuramori.wireframeninjas.net:8080/?force

    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
  • Options
    bowenbowen How you doin'? Registered User regular
    edited February 2012
    XSucR.jpg
    Thought you guys might appreciate this.

    From the Smithsonian American History Museum. Yeah my camera is terribly fuzzy with that photo for some reason.

    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
  • Options
    Jimmy KingJimmy King Registered User regular
    Jimmy King wrote:
    Well, limiting it at the script level isnt going to help your router any. It's already been through the router and to the web server at that point. For the web server performance, if it's just a small hackjob one off script then using the global may be fine, but if it's something semi-serious I'd look into caching the result of the operation to using memcached or an in memory cache or even to a db table instead.

    You make it sound like my router isn't my web server.
    It's not serious stuff. I'm literally the only legitimate user. There might be some way to do this from lighttpd, though. I'll look into it later, thanks.
    I could be wrong, but in the vast majority of cases it isn't. When you say router I am assuming you mean the little linksys box you picked up at best buy or whatever your isp provided you and the web server is an actual pc behind that running linux or whatnot. Are you using 3rd party firmware and using the web server on the router or something?

  • Options
    Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited February 2012
    Jimmy King wrote:
    Jimmy King wrote:
    Well, limiting it at the script level isnt going to help your router any. It's already been through the router and to the web server at that point. For the web server performance, if it's just a small hackjob one off script then using the global may be fine, but if it's something semi-serious I'd look into caching the result of the operation to using memcached or an in memory cache or even to a db table instead.

    You make it sound like my router isn't my web server.
    It's not serious stuff. I'm literally the only legitimate user. There might be some way to do this from lighttpd, though. I'll look into it later, thanks.
    I could be wrong, but in the vast majority of cases it isn't. When you say router I am assuming you mean the little linksys box you picked up at best buy or whatever your isp provided you and the web server is an actual pc behind that running linux or whatnot. Are you using 3rd party firmware and using the web server on the router or something?
    Nope, I was using a belkin router for about a year but the thing kept crashing on me and was just generally unreliable, so I replaced it with this low power linux box, with 2 ethernet ports (and recently also a wireless card running in AP mode to act as my wireless router). eth0 is hooked directly to my cable modem, and eth1 goes to my switch where my desktop and xbox and all that are hooked up. I've got iptable's masquerading working so I can use the internet from inside my LAN or on the wireless, and am using the ufw filewall script that comes with xubuntu to handle the rest of the iptables rules. It also hosts a samba share and acts as a DHCP server, a web server, and a DNS cache.

    Monkey Ball Warrior on
    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • Options
    EndEnd Registered User regular
    I did pretty much the exact same thing for my own router

    I wish that someway, somehow, that I could save every one of us
    zaleiria-by-lexxy-sig.jpg
  • Options
    NightslyrNightslyr Registered User regular
    Not a programming question per se, but a question about CSS sprites:

    I understand how to use sprites for background images - set a block element's size as the same size as the desired sprite, then set its background to the sprite sheet's filepath, positioned so the correct image on the sprite sheet shows through the 'viewport'.

    How would this work for an image that also is a link? I mean, aren't links and images inline elements? And what about accessibility re: alt tag?

    I guess I'm just asking if there's a standard plan of attack here.

  • Options
    InfidelInfidel Heretic Registered User regular
    edited February 2012
    Nightslyr wrote:
    Not a programming question per se, but a question about CSS sprites:

    I understand how to use sprites for background images - set a block element's size as the same size as the desired sprite, then set its background to the sprite sheet's filepath, positioned so the correct image on the sprite sheet shows through the 'viewport'.

    How would this work for an image that also is a link? I mean, aren't links and images inline elements? And what about accessibility re: alt tag?

    I guess I'm just asking if there's a standard plan of attack here.

    You assign all those kind of properties you normally would to the <img> instead to the <div>, and the div has your width/height/background-position to make it look correct.

    This isn't very clean for accessibility which is why an invisible structure is usually added to give an alternate navigation.

    edit: Actually, it sounds like you could get away with putting this on the <a> tag, which doesn't have the accessibility issues.

    e2: example
    <a id="view_profile" href="/profile/">View Profile</a>
    
    a#view_profile {
      display: block;
      text-indent: -9999px;
      width: 120px;
      height: 20px;
      background: url(sprite.png) no-repeat;
      background-position: -120px 0;
    }
    

    Now your HTML is kosher and text-based, and it is replaced by a sprite image by pure CSS.

    Infidel on
    OrokosPA.png
  • Options
    GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    @Infidel: Is there a Drupal plugin that adds "save draft" functionality to the content system? I'm working on part 2 of my series, but I need to walk away for a bit. My only real option right now is to take my text and paste it in to a text file and come back later, but a simple draft system would be great.

    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
  • Options
    InfidelInfidel Heretic Registered User regular
    See where it says Publishing Options in the tabs near the bottom?

    Uncheck "Published?"

    OrokosPA.png
This discussion has been closed.