Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
ymgve
Jan 2, 2004


:dukedog:
Offensive Clock

This seems sub-optimal. While they switch on verb length, they do if-sequences within each length. They should instead find one or two operations (multiply by a constant or something, then mod) which gives an unique number between 0 and 14 for each HTTP verb, then switch on that, with a final compare in each case. Much faster!

ymgve fucked around with this message at 23:52 on Jan 29, 2013

Adbot
ADBOT LOVES YOU

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Join an array on a string like a boss (well, a Director of something or the other, actually).

php:
<?
function myfunction($v1,$v2)
{
return $v1 . $v2 . ",";
}
$a=$SN;
//print_r(array_reduce($a,"myfunction"));

$SNarraay = (array_reduce($a,"myfunction"));
?>
Why did he do this? Well,

php:
<?
$info = explode(',', $SNarraay);
list($a,$b,$c,$d) = $info;
?>
obviously. 200 lines later he concatenates it into a select, so maybe it's less odd than the first impression might imply.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

ymgve posted:

This seems sub-optimal. While they switch on verb length, they do if-sequences within each length. They should instead find one or two operations (multiply by a constant or something, then mod) which gives an unique number between 0 and 14 for each HTTP verb, then switch on that, with a final compare in each case. Much faster!

Actually couldn't you bit-shift all of those verbs (minus PROPPATCH, which is 9 chars) into longs and switch on that? Think of the wasted cycles!

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

Wheany posted:

But since it is randomized between vm restarts, no non-malicious software relies on specific hash values for things, right? So they could just replace it with SipHash?
SipHash calculates a 64-bit value. No idea how hard it would be to make it gen 32-bit, because I'm not a cryptographer.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Munkeymon posted:

Join an array on a string like a boss (well, a Director of something or the other, actually).

php:
<?
function myfunction($v1,$v2)
{
return $v1 . $v2 . ",";
}
$a=$SN;
//print_r(array_reduce($a,"myfunction"));

$SNarraay = (array_reduce($a,"myfunction"));
?>
Why did he do this? Well,

php:
<?
$info = explode(',', $SNarraay);
list($a,$b,$c,$d) = $info;
?>
obviously. 200 lines later he concatenates it into a select, so maybe it's less odd than the first impression might imply.

So am I correct in thinking the behaviour is the same as

code:
$info = array();
$i = 0;
foreach ($a as $b) {
    if ($i == 1) {
        $info[0] .= $b
    } else {
        $info[] = $b;
    }
    $i++;
}
$info[] = '';
list($a,$b,$c,$d) = $info;
fake edit: actually no, this ignores that the elements of $a might have commas in them.

Also, I'd never seen list() before. It figures the PHP devs would try to implement useful features from Python and do them in a shonky way.

Also "$NSarraay"

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Hammerite posted:

fake edit: actually no, this ignores that the elements of $a might have commas in them.

Also, I'd never seen list() before. It figures the PHP devs would try to implement useful features from Python and do them in a shonky way.

Also "$NSarraay"

That's reasonably unlikely since this is isn't a public page. We're dealing with inventory here, so it's short for stock number, not something transmorgified into PHP from an OSX codebase.

This is the same guy who does this (formatting preserved):
php:
<?
if ($valueAA=="1900"){
$a1900 ="selected='selected'";
} 
elseif ($valueAA=="1971"){
$a1971 ="selected='selected'";
} 
//snipping a shitton of hand-copied PHP because I'm not sure it'd all fit in one post
elseif ($valueAA=="2013"){
$a2013 ="selected='selected'";
} 

if ($valueBB=="1900"){
$b1900 ="selected='selected'";
} 
//and on it goes...
?>
to handle an extremely simple date range because he doesn't 'get' loops. I'm fairly certain he couldn't figure out how to translate example code between languages. At least I hope not.

ToxicFrog
Apr 26, 2008


I don't even know what the gently caress.

I'm working on a bit of code to launch VLC with a user-configured video file on windows. All I've got to work with is os.execute (which itself is a wrapper around system), but even with windows's whackass quoting rules this shouldn't be too hard, right?

code:
> os.execute('C:/Program Files (x86)/VideoLAN/VLC/vlc.exe -f --play-and-exit M:/video/test.avi')
error: C:/Program: file not found
Oh, of course. %PROGRAMFILES% has spaces in it so I need quotes. Mea culpa. Let's fix that.

code:
> os.execute('"C:/Program Files (x86)/VideoLAN/VLC/vlc.exe" -f --play-and-exit M:/video/test.avi')
It works! Except for the bit where VLC opens and does nothing.

Further investigation reveals that having forward slashes in the file path causes VLC to think it's been passed an empty command line. I don't know if this is some problem with system() (despite handling the forward slashes in the path to VLC just fine), or if VLC itself is loving up. What definitely is a VLC problem, however, is the fact that if you don't pass any valid paths to vlc --play-and-exit, it stays open forever rather than exiting immediately.

Ok, so backslashes it is:

code:
> os.execute('"C:/Program Files (x86)/VideoLAN/VLC/vlc.exe" -f --play-and-exit M:\\video\\test.avi')
And it works! But hang on - at some point the user may want to open a file with spaces in the name. Better quote that fucker too.

code:
> os.execute('"C:/Program Files (x86)/VideoLAN/VLC/vlc.exe" -f --play-and-exit "M:\\video\\test 2.avi"')
error: C:/Program: file not found
:wtc:

Much googling later:

code:
> os.execute('""C:/Program Files (x86)/VideoLAN/VLC/vlc.exe" -f --play-and-exit "M:\\video\\test 2.avi"')
This works fine.

:wtc::psyduck:

Yes, having double quotes later in the command line causes the double quotes surrounding the actual command to stop working. The solution is to start the command with double double quotes (yes, leaving the quotes unbalanced) and then continue as normal.

Why would it work this way

nielsm
Jun 1, 2009



I'm guessing that it Python.
Why would you use os.execute (which I can't even find in the docs?) rather than something like os.spawnl which takes each argument to the command line as a separate parameter to the function call?

No Safe Word
Feb 26, 2005

Or subprocess, which is supposed to replace all that crud because it sucks.

KaneTW
Dec 2, 2011

The horror here is using the functional equivalent of system()

Master_Odin
Apr 15, 2010

My spear never misses its mark...

ladies

Munkeymon posted:

Join an array on a string like a boss (well, a Director of something or the other, actually).

php:
<?
function myfunction($v1,$v2)
{
return $v1 . $v2 . ",";
}
$a=$SN;
//print_r(array_reduce($a,"myfunction"));

$SNarraay = (array_reduce($a,"myfunction"));
?>
I'm still kind of hung up on this. How is this not just implode(",",$a)? Like, he knows that explode exists, but then just hand-rolls his own implode? Or am I being the dumb one here?

The entire if loop could also be fixed by using variable variables, which makes me wonder how this guy learned PHP as he knows array_reduce and explode, but then not other stuff like implode and $$.

ToxicFrog
Apr 26, 2008


nielsm posted:

I'm guessing that it Python.
Why would you use os.execute (which I can't even find in the docs?) rather than something like os.spawnl which takes each argument to the command line as a separate parameter to the function call?

It's Lua, not Python. If it were I'd be using subprocess.

KaneTW posted:

The horror here is using the functional equivalent of system()

Lua itself is ANSI C and thus only gets system(), and the program I'm using doesn't make bindings to anything more advanced available. This has been enough of a pain in the rear end that I'm considering patching it with my own binding to spawnv and using that instead, though.

Even taking into account the fact that system() is terrible, though, it seems exceptionally terrible on windows.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

ToxicFrog posted:

Lua itself is ANSI C and thus only gets system(), and the program I'm using doesn't make bindings to anything more advanced available. This has been enough of a pain in the rear end that I'm considering patching it with my own binding to spawnv and using that instead, though.


Yeah, this sorry state of affairs prompted a coworker of mine to write low level bindings for unixy systems, since it's easier to work with fork and exec than system.
http://www.rjek.com/software.html

quote:


Even taking into account the fact that system() is terrible, though, it seems exceptionally terrible on windows.
I've heard this is because windows leaves argument parsing to every program, rather than everything getting an argument list, but I don't have any proof of this.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
It looks like trying to launch a separate process and interact with it is a horror in any language. Well, it's more a runtime/library issue, but it's still a huge pain in the rear end. There's a longstanding bug with the .NET runtime that I just ran into with their Process stuff. Basically, you're going to get burned if you use the default streams. The read calls will block even if they shouldn't. Peek will block. So you have to use the data received event handlers.

nielsm
Jun 1, 2009



Edison was a dick posted:

I've heard this is because windows leaves argument parsing to every program, rather than everything getting an argument list, but I don't have any proof of this.

Yeah, DOS passed the parameters as a single string (in a fixed size block) and Windows inherited that model, although the block is now dynamically sized. But the actual program name is a separate argument to the CreateProcess() function in Win32.
Windows NT (W2k or maybe earlier) also added a CommandLineToArgvW() function that parses that command line string into an argc/argv pair for you. It only works on Unicode strings, but you should be using those anyway.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Master_Odin posted:

I'm still kind of hung up on this. How is this not just implode(",",$a)? Like, he knows that explode exists, but then just hand-rolls his own implode? Or am I being the dumb one here?

The entire if loop could also be fixed by using variable variables, which makes me wonder how this guy learned PHP as he knows array_reduce and explode, but then not other stuff like implode and $$.

You're giving him far too much credit when you assume he actually understands what he's writing/copy+pasting rather than aping examples he finds online.

Freakus
Oct 21, 2000

Rocko Bonaparte posted:

It looks like trying to launch a separate process and interact with it is a horror in any language. Well, it's more a runtime/library issue, but it's still a huge pain in the rear end. There's a longstanding bug with the .NET runtime that I just ran into with their Process stuff. Basically, you're going to get burned if you use the default streams. The read calls will block even if they shouldn't. Peek will block. So you have to use the data received event handlers.
http://bugs.sun.com/view_bug.do?bug_id=4784692

The primary bug is in the documentation - the javadoc makes no mention of requiring you to call .destroy() or to close every stream (even if you didn't use them) to properly clean up a Process.

Admiral H. Curtiss
May 11, 2010

I think there are a bunch of people who can create trailing images. I know some who could do this as if they were just going out for a stroll.

Freakus posted:

http://bugs.sun.com/view_bug.do?bug_id=4784692

The primary bug is in the documentation - the javadoc makes no mention of requiring you to call .destroy() or to close every stream (even if you didn't use them) to properly clean up a Process.

Am I reading this right? This is a ten year old request to clarify the documentation but still not in the doc?

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

ToxicFrog posted:

I don't even know what the gently caress.

I'm working on a bit of code to launch VLC with a user-configured video file on windows. All I've got to work with is os.execute (which itself is a wrapper around system), but even with windows's whackass quoting rules this shouldn't be too hard, right?

code:
> os.execute('C:/Program Files (x86)/VideoLAN/VLC/vlc.exe -f --play-and-exit M:/video/test.avi')
error: C:/Program: file not found
Oh, of course. %PROGRAMFILES% has spaces in it so I need quotes. Mea culpa. Let's fix that.

code:
> os.execute('"C:/Program Files (x86)/VideoLAN/VLC/vlc.exe" -f --play-and-exit M:/video/test.avi')
It works! Except for the bit where VLC opens and does nothing.

Further investigation reveals that having forward slashes in the file path causes VLC to think it's been passed an empty command line. I don't know if this is some problem with system() (despite handling the forward slashes in the path to VLC just fine), or if VLC itself is loving up. What definitely is a VLC problem, however, is the fact that if you don't pass any valid paths to vlc --play-and-exit, it stays open forever rather than exiting immediately.

Ok, so backslashes it is:

code:
> os.execute('"C:/Program Files (x86)/VideoLAN/VLC/vlc.exe" -f --play-and-exit M:\\video\\test.avi')
And it works! But hang on - at some point the user may want to open a file with spaces in the name. Better quote that fucker too.

code:
> os.execute('"C:/Program Files (x86)/VideoLAN/VLC/vlc.exe" -f --play-and-exit "M:\\video\\test 2.avi"')
error: C:/Program: file not found
:wtc:

Much googling later:

code:
> os.execute('""C:/Program Files (x86)/VideoLAN/VLC/vlc.exe" -f --play-and-exit "M:\\video\\test 2.avi"')
This works fine.

:wtc::psyduck:

Yes, having double quotes later in the command line causes the double quotes surrounding the actual command to stop working. The solution is to start the command with double double quotes (yes, leaving the quotes unbalanced) and then continue as normal.

Why would it work this way

Okay, so you're using Lua. These problems are somewhat understandable on a cross-platform language.

But loving Windows Poweshell. How in the gently caress can executing programs from under Program Files be so loving difficult in a shell designed for Windows.

I was tearing my hair out with the equivalent of "c:\Program Files\ImageMagick-6.8.2-Q16\convert.exe" "C:\Users\My Username\Pictures\some file with spaces 1.png" -resize 50% "some file with spaces 1.gif"

Where the number in the file name came from a loop index variable.

Scaevolus
Apr 16, 2007

Admiral H. Curtiss posted:

Am I reading this right? This is a ten year old request to clarify the documentation but still not in the doc?

There are two other bugs referencing the same issue in the last decade, surely one of them has progress?

http://bugs.sun.com/view_bug.do?bug_id=4801027
http://bugs.sun.com/view_bug.do?bug_id=6462165

...they're not fixed either.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Wheany posted:

Okay, so you're using Lua. These problems are somewhat understandable on a cross-platform language.

But loving Windows Poweshell. How in the gently caress can executing programs from under Program Files be so loving difficult in a shell designed for Windows.

I was tearing my hair out with the equivalent of "c:\Program Files\ImageMagick-6.8.2-Q16\convert.exe" "C:\Users\My Username\Pictures\some file with spaces 1.png" -resize 50% "some file with spaces 1.gif"

Where the number in the file name came from a loop index variable.

Try setting up a PS script to run as a job in the scheduler. There's so much security bullshit around it that the one time I tried it, I gave up and wrote a program in C# with notepad and compiled it with csc.exe instead. It took less time than I had wasted trying to get an already working script to run as a job and worked the first time.

delta534
Sep 2, 2011

Wheany posted:

Okay, so you're using Lua. These problems are somewhat understandable on a cross-platform language.

But loving Windows Poweshell. How in the gently caress can executing programs from under Program Files be so loving difficult in a shell designed for Windows.

I was tearing my hair out with the equivalent of "c:\Program Files\ImageMagick-6.8.2-Q16\convert.exe" "C:\Users\My Username\Pictures\some file with spaces 1.png" -resize 50% "some file with spaces 1.gif"

Where the number in the file name came from a loop index variable.

You could try c:\'Program Files'\ImageMagick-6.8.2-Q16\convert.exe "C:\Users\My Username\Pictures\some file with spaces $i.png" -resize 50% "some file with spaces $i.gif" where i is the loop variable.

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

Wheany posted:

Okay, so you're using Lua. These problems are somewhat understandable on a cross-platform language.

But loving Windows Poweshell. How in the gently caress can executing programs from under Program Files be so loving difficult in a shell designed for Windows.

I was tearing my hair out with the equivalent of "c:\Program Files\ImageMagick-6.8.2-Q16\convert.exe" "C:\Users\My Username\Pictures\some file with spaces 1.png" -resize 50% "some file with spaces 1.gif"

Where the number in the file name came from a loop index variable.
I've been using Powershell pretty heavily for about a year now. I have no idea how to call an executable that isn't in the current path, so when I have to do so, I just give up and Set-Alias.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Munkeymon posted:

Try setting up a PS script to run as a job in the scheduler. There's so much security bullshit around it that the one time I tried it, I gave up and wrote a program in C# with notepad and compiled it with csc.exe instead. It took less time than I had wasted trying to get an already working script to run as a job and worked the first time.

Oh yeah, and by default, powershell won't run any scripts. Okay, I get that Microsoft was burned pretty bad in the XP/IE6 days, but still.

Zombywuf
Mar 29, 2008

Zhentar posted:

Any browser code path that is traveled by SunSpider (and I'm guessing that one is hit quite a bit) has been profiled and thoroughly analyzed about 17,000 times.

I don't know why they don't just store hashes by partially evaluating a prefix tree.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Master_Odin posted:

I'm still kind of hung up on this. How is this not just implode(",",$a)? Like, he knows that explode exists, but then just hand-rolls his own implode? Or am I being the dumb one here?

The entire if loop could also be fixed by using variable variables, which makes me wonder how this guy learned PHP as he knows array_reduce and explode, but then not other stuff like implode and $$.

It's not implode. His array-reduce function puts the comma after the two arguments rather than in between them.

Also, yes a loop should be used, but an array is the correct approach, not variables named $a1971 through $a2070 or whatever.

Pilsner
Nov 23, 2002

Wheany posted:

Oh yeah, and by default, powershell won't run any scripts. Okay, I get that Microsoft was burned pretty bad in the XP/IE6 days, but still.
There might be good reasons, but that just seemed so absurd to me when I tried it a few months ago, executing a .ps1 script I wrote via the command line. Oh, you just installed a scripting framework and are trying to execute a script? PERMISSION DENIED. :smug:

EssOEss
Oct 23, 2006
128-bit approved

Jethro posted:

I've been using Powershell pretty heavily for about a year now. I have no idea how to call an executable that isn't in the current path, so when I have to do so, I just give up and Set-Alias.

The same way as you would normally? Or have you found some problematic scenario I have not discovered yet in my mere three months?

code:
PS C:\Users\essoess> c:\tee\tf.cmd help
Team Explorer Everywhere Command Line Client (version 11.0.0.201207250346)

 Available commands and their options:

The Gripper
Sep 14, 2004
i am winner

Jethro posted:

I've been using Powershell pretty heavily for about a year now. I have no idea how to call an executable that isn't in the current path, so when I have to do so, I just give up and Set-Alias.
Well, for calling executables directly in the current local directory you need the .\ prefix, anything else is assumed to be on the environment path and won't search locally. I assume it's designed to prevent someone dumping malicious binaries in the local directory that override system executables.

I don't really know how that makes anything more secure since it seems like if you could dump a binary with execute rights in the local directory you could just as easily modify the script directly, but hey, I'm no security analyst.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

Admiral H. Curtiss posted:

Am I reading this right? This is a ten year old request to clarify the documentation but still not in the doc?
There are a lot of really old open bugs/comments that have not and never will be touched. I also like the TODO comment in floating-point parsing: "Construct, Scale, iterate. Some day, we'll write a stopping test that takes account of the asymmetry of the spacing of floating-point numbers below perfect powers of 2. 26 Sept 96 is not that day."

As a sidenote, not reading/closing Process streams caused me to spend a few hours trying to figure out why my program when hang with 0% CPU usage forever when using them. Fun.

ymgve
Jan 2, 2004


:dukedog:
Offensive Clock
http://sourceware.org/ml/glibc-cvs/2013-q1/msg00115.html

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

The Gripper posted:

I don't really know how that makes anything more secure since it seems like if you could dump a binary with execute rights in the local directory you could just as easily modify the script directly, but hey, I'm no security analyst.

I would imagine that the protection is primarily for the interactive shell, since it's relatively trivial to get someone to execute dir in a directory where you've placed a malicious dir.exe. Scripts are just subject to it for consistency.

The Gripper
Sep 14, 2004
i am winner

Jabor posted:

I would imagine that the protection is primarily for the interactive shell, since it's relatively trivial to get someone to execute dir in a directory where you've placed a malicious dir.exe. Scripts are just subject to it for consistency.
I didn't really think about that. dir is probably a bad example on Windows since it's a cmd.exe/powershell builtin and isn't over-ridden by locals, but for anything else that makes sense.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug
Just stumbled across this in some code a client got from some other consultant:

C# code:
try 
{
	DoSomething();
}
catch (Exception ex)
{
	if (typeof(WorkspaceExistsException) == ex.GetType())
	{
		DoSomeLoggingStuff();
	}
	else
		throw ex;
	}
}
:waycool:

I can sort of forgive the throw ex;, that's a pretty common mistake. The other thing is unforgivably stupid, though.

I almost want to email them and say "Hey guys, you know you can do this, right?"
C# code:
try 
{
	DoSomething();
}
catch (WorkspaceExistsException ex)
{
	DoSomeLoggingStuff();
}

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

EssOEss posted:

The same way as you would normally? Or have you found some problematic scenario I have not discovered yet in my mere three months?

code:
PS C:\Users\essoess> c:\tee\tf.cmd help
Team Explorer Everywhere Command Line Client (version 11.0.0.201207250346)

 Available commands and their options:
Well, the problem scenario occurrs when running an executable with a space in the path. I have just now done some research and discovered that the call operator "&" isn't just for running scripts.

code:
PS C:\Users\Jethro> C:\Program Files\Something\program.exe
The term 'C:\Program' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:11
+ C:\Program <<<<  Files\Something\program.exe
    + CategoryInfo          : ObjectNotFound: (C:\Program:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\Jethro> "C:\Program Files\Something\program.exe"
C:\Program Files\Something\program.exe
PS C:\Users\Jethro> &"C:\Program Files\Something\program.exe"
I am a program that does a thing
So I feel a bit silly. The point still stands that Powershell can be a bit obtuse, even if the design reasons behind that obtuseness often make sense. But I guess this thread is for alternating between feeling silly and feeling smugly superior.

fritz
Jul 26, 2003

The Gripper posted:

Well, for calling executables directly in the current local directory you need the .\ prefix, anything else is assumed to be on the environment path and won't search locally. I assume it's designed to prevent someone dumping malicious binaries in the local directory that override system executables.

"." is usually not in the default path of lots of shells in lots of unix variants these days for the same reason.

Thern
Aug 12, 2006

Say Hello To My Little Friend
If I remember correctly, the "." in Unix is actually just an alias to your current working directory without a trailing slash. That's why you need to add the slash to it, so that you essentially pass the absolute path to the command line.

Bunny Cuddlin
Dec 12, 2004
This isn't a huge horror but http://www.minethings.com/app/webroot/forums/viewtopic.php?p=122960#p122960

Basically, he had his sessions set to expire in 25 years. Well, unix time + 25 years overflows MAX_INT this month. I guess these problems are going to start ramping up now.

Bunny Cuddlin
Dec 12, 2004

Thern posted:

If I remember correctly, the "." in Unix is actually just an alias to your current working directory without a trailing slash. That's why you need to add the slash to it, so that you essentially pass the absolute path to the command line.

He's saying that the current directory isn't in the path by default to prevent people dropping in malicious scripts with the name of common programs.

Adbot
ADBOT LOVES YOU

Deus Rex
Mar 5, 2005

http://peej.github.com/tonic/

Annotate routes and method conditions in comments!

PHP code:
<?php
  
/**
 * @uri /hello
 * @uri /hello/:name
 */
class Hello extends Tonic\Resource {

    /**
     * @method GET
     * @provides text/html
     */
    function sayHello($name = 'World') {
        return 'Hello '.$name;
    }
}

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply