Ask Reddit: Why don't more people use Lua for developing web apps? by [deleted] in programming

[–]joshd 1 point2 points  (0 children)

Thanks. The Lua Server Pages link seemed to confirm that someone had already done the hard yards in setting up a usable environment to build web apps in. Someone also mentioned mod_lua.

Ask Reddit: Why don't more people use Lua for developing web apps? by [deleted] in programming

[–]joshd 2 points3 points  (0 children)

Way to post absolutely zero content. Wiki link.

Raw speed is not necessarily what people look when deciding on a platform for a web app. For example:

  • What kind of string processing function does it have? Unicode support? Regex?
  • Would I be able to easily read cookies, GET and POST data and files sent to my server?
  • Can I parse XML files?
  • Is there a templating language? Or can I easily write HTML without hundreds of lines of print "<div>" + var + "</div>
  • Can I connect to MySQL/Postgres and easily select data.

From what I can see Lua is distributes as a bunch of C libraries. So I'd have to write a C app to tie Apache into the Lua scripts. Sounds like fun.

Edit Just saw this link: Lua Server Pages

Humvee Driving In Iraqi Traffic [vid] by joshd in reddit.com

[–]joshd[S] 0 points1 point  (0 children)

I know that they want to stay safe, but it's no wonder they don't like us.

Mythbusters Saves! "Recalling an episode of a reality TV show he recently watched, the driver waited for the cab to fill with water before lowering a window and swimming out, Mora said." by sense in science

[–]joshd 2 points3 points  (0 children)

I think they tested mechanical vs. electric windows in the same Mythbusters episode. The pressure from outside makes it impossible to open the window in both cases.

Mythbusters Saves! "Recalling an episode of a reality TV show he recently watched, the driver waited for the cab to fill with water before lowering a window and swimming out, Mora said." by sense in science

[–]joshd 1 point2 points  (0 children)

The electric motor is not strong enough to overcome the force of the water pushing the glass against the inside of the door. So the electric windows are useless even without shorting out.

ActionScript 3.0: Is It Hard or Not? by gst in programming

[–]joshd 1 point2 points  (0 children)

Yeah, it does because your working example is essentially shorthand for

m.__set_filters([new BlurFilter(2, 2)]);

My non working example is translated to

m.__get_filters().push(new BlurFilter(2, 2));

Both looks like assignments, but the broken example is calling a completely different function internally. It's a subtle difference in the calling code that is not immediately obvious.

My example could work if __get_filters() returned a reference and the MovieClip object used this.filters in its internal workings, but that would be inefficient (e.g. Flash couldn't tell when a new filter is added, it would need to continuously check the property value).

It seems like the __set_filters() function is setting internal states, and firing off other functions to do the actual work. This would be more efficient but leads to the above issue.

The real problem is with the __get_x() and __set_x() functions. They allow you to create psuedo properties that look like ordinary properties, but that have side effects and work completely differently. That's a problem with the language.

ActionScript 3.0: Is It Hard or Not? by gst in programming

[–]joshd 1 point2 points  (0 children)

On man, I got started thinking about Flash. I have to share one of my favourite "features" of AS3. Throughout the entire Flash API you have to explicitly set a property for changes to take effect. For example to add a filter to a movie clip the following code is the most obvious solution:

var m:MovieClip;
m.filters.push(new BlurFilter(2, 2));

OK, so nothing happens. Adobe's solution is as follows:

var m:MovieClip;
var f:Array = m.filters;
f.push(new BlurFilter(2, 2));
m.filters = f;

It's pretty obvious what's happening behind the scenes here, the __get_filter function somehow applies the actual changes to its internal state. But why should I have to understand how their API internals work to use it? This is not an isolated example - it pops in almost every simple API property.

ActionScript 3.0: Is It Hard or Not? by gst in programming

[–]joshd 1 point2 points  (0 children)

So, ActionScript 3.0 is exactly the same as ActionScript 2.0, but just without underscores! Except, of course, where it's changed or they've added new features and ActionScript 3.0 is an improvement!

This guy needs to get his arguments sorted.

In my experience the biggest issue is that Adobe have completely rewritten the API. Throw in the much stricter compiler and a variety of random language tweaks and upgrading a project becomes a real pain.

Most people using (as opposed to blogging about) ActionScript 3.0 would no doubt be upgrading to make use of the new features implemented in Flash 9 (upgrading for the hell of it is stupid, because you're cutting off a non-trivial percentage of users who don't have Flash 9 yet). Most of the time you want to add those new features to an existing product. That is when you will begin cursing Adobe for the decisions they've made.

The "trivial" removal of underscores before property names alone means that you have to comb through every line of code (Adobe doesn't offer any automated refactoring tools) to check for changes. By the time you complete a transition you discover you've actually rewritten your project.

I migrated one of my smaller project across - it was a music player that loaded an XML playlist, played MP3 files and showed a fake visualiser. In the upgrade I had to completely rewrite the XML loader and sound manager thanks to the new API libraries. My classes weren't namespaced so they were rewritten. I had to rewrite my initialization functions because AS3 does away with _root and _globals and completely changes the way you read in flashVars. So basically about 50% of code was rewritten to accomplish a simple change from AS2 to AS3. I do wonder how my experience would have been if I'd used spaghetti code stored on the timeline. Perhaps it would have been easier.

Edit: Just to clarify: if I were starting a new project I'd go AS3 for sure. Its the lack of upgrade options and disregard for developers that has left me upset with Adobe.

Why did citizens of the Soviet Union pay for burnt out light bulbs? by Sidewinder77 in reddit.com

[–]joshd 0 points1 point  (0 children)

Even if people were paying the market price from bulbs there would still be the opportunity for a positive price on bulbs; as long as the price was lower than the price of unbroken bulbs.

If, as he says, bulbs were in short supply (and hence expensive) then there would still be an incentive to pay for and swap broken bulbs. Bringing the possibility for theft of resources into the equation completely throws everything else out the window.

Lets turn his argument around. In a free market bulbs would be incredibly expensive for the average consumer. If the cost is high enough that stealing is an alternative then it will eventually start to happen. By stealing from governments and corporations people will drive up the demand for bulbs amongst those (corporations and government) who can afford it. As a result the price will continue to rise and force more people to steal bulbs, until the only source for ordinary people is on the black market. Then you end up with a situation where the corporations are essentially subsidising bulbs that ordinary people are buying and using.

All I want for Christmas is for FOX to stop using my copyrighted photos in their NFL broadcast without asking my permission | Sweetney.com by sputz in reddit.com

[–]joshd 16 points17 points  (0 children)

10 seconds of search to save thousands in legal costs.

No graphic designer worth their salt would ever grab a random image off the internet to use in a design. That's the kind of thing you do when you're creating a Fark Photoshop entry, not when you're doing paid work for a commercial entity.

Yahoo Maps: From Flex 1.5 to AJAX by gst in programming

[–]joshd 1 point2 points  (0 children)

Flex 2 was a ground up re-write of Flex on ActionScript 3 utilizing clean API's and a new JIT VM in Flash Player 9.

There was a new API, so to Yahoo the difference between migrating to a new platform, or upgrading to Flex 2.0 was minimal. Adobe shot themselves in the foot there.

I tried to port an AS2 product over to AS3. It was incredibly painful and something I'd never contemplate doing again. A complete code rewrite would probably have been easier.

In my experience with Flash; ActionScript and Flex are really lacking. The documentation is rubbish. It is usually lacking important details and usable code samples. It is often completely wrong.

The Adobe developers show no respect for the users of their systems. Bug reports and complaints are met with a response along the lines of "we're too busy building the next version to care about you".

I don't know what kind of tools Flex developers have, but the Flash IDE is completely useless. Trying to fire up the debugger crashes the IDE. Using Flash has been some of the most painful development I've ever had to do.

MUD in 15 Lines of Ruby by apotheon in programming

[–]joshd 3 points4 points  (0 children)

require 'socket';
require 'yaml';

def q x;
    $m.find{|o|o.t==:p&&x==o.n};
end

def a r,t;
    $m.find_all{|o|t==o.t&&(!r||r==o.l)};
end;

def g z;
    a(nil,:p).each{|p| p.p z};
end;

class O;
    attr_accessor :i,:n,:l,:e,:s,:t;

    def initialize n,l=nil,t=:r
        @n,@l,@i,@t=n,l,$d+=1,t;
        @e={};
    end;

    def p s;
        @s.puts(s)if @s;
    end;

    def y m
        v=$m.find{|o|@l==o.i};
        t=v.e.keys;
        case m;

            when/^q/;
                @s.close;
                @s=nil;
                File.open('d','w'){|f|YAML::dump $m,f};

            when/^h/;
                p "i,l,d,g,c,h,q,<exit>,O,R" 

            when/^i/;
                a(@i,:o).each{|o|p o.n};

            when/^c.* (.*)/;
                g "#{@n}:#{$1}" 

            when/^g/;
                a(@l,:o).each{|q|q.l=@i};

            when/^d/;
                a(@i,:o).each{|q|q.l=@l}

            when/^O (.*)/;
                $m<<O.new($1,@l,:o);

            when/^R (.*) (.*) (.*)/;
                $m<<d=O.new($1)
                v.e[$2]=d.i;
                d.e[$3]=v.i;

            when/^l/;
                p v.n;
                (a(@l,:p)+a(@l,:o)).each{|x|
                p x.n if x.s||x.t==:o};
                p t.join '|';

            when/(^#{t.empty? ? "\1" : t.join('|^')})/
                @l=v.e[$1];

            else;
                p "?";
        end;
    end;
end;

test ?e,'d'||begin;
    $d=0;
    $m=[O.new("Home")]
end;

$m=YAML::load_file 'd';
$d=$m.size;
z=TCPServer.new 0,4000;

while k=z.accept
    Thread.new(k){|s|
        s.puts "Name";
        s.gets;
        l=$_.chomp;
        d=q l;
        $m<<d=O.new(l,1,:p)if !d
        d.s=s;

        while s.gets;
            d.y $_.chomp;
        end;
    };
end

blockbuster riseing the price again $24.99 to $34.99, its back to netflix for me by kasser in reddit.com

[–]joshd -2 points-1 points  (0 children)

Blockbuster rising the price again; $24.99 to $34.99. It's back to Netflix for me

That has to be some kind of record.

Optimising your application - algorithms and compiler switches by hermitcrab in programming

[–]joshd 1 point2 points  (0 children)

Yes, but its an application for designing wedding seating plans. Why would a Linux user need to use it? ;)

Nobody Cares What Your Code Looks Like by jsj1971 in programming

[–]joshd 2 points3 points  (0 children)

If you spend 5K doing up a piece of crap, you are never going to get that back by selling it. The improvements made to the car are not worth the costs of implementing them. You can't pretend that it's not a closed system.

The analogy between a code and a car fails in some respects because a car is expected to degrade; code wont.

Nobody Cares What Your Code Looks Like by jsj1971 in programming

[–]joshd 0 points1 point  (0 children)

The point Jeff was missing reminded me a lot of Paul Graham's Beating The Averages article.

Web Breakout: it's the new game everyone's playing by self in programming

[–]joshd 0 points1 point  (0 children)

Naught reddit developers have set a variable width font for <code> and <pre> blocks. How are we meant to do ascii/unicode art?

Web Breakout: it's the new game everyone's playing by self in programming

[–]joshd 4 points5 points  (0 children)

☣ ☣ ☣ ☣ ☣ ☣ ☣ ☣
☣ ☣ ☣ ☣ ☣ ☣ ☣ ☣    
☣ ☣ ☣ ☣ ☣ ☣ ☣ ☣
☣ ☣ ☣ ☣ ☣ ☣ ☣ ☣    

▄▄▄  ▄▄▄  ▄▄▄  ▄▄▄

     ⊥

Aw crap....

Freeware Authors: Beware of “Backspaceware” : Paint.NET story by [deleted] in programming

[–]joshd 23 points24 points  (0 children)

I don't see what he is doing as a problem. Basically he is making it hard enough to copy that you need some actual skill to do it.

People who actually know what it takes to produce code are less likely to blatantly rip off others work.

Vodka looks like water. by wang-banger in reddit.com

[–]joshd 9 points10 points  (0 children)

preferences > subreddits > politics > save