Dissecting others' code is so fun
Sunday, 7. June 2009, 23:51:34
$lollerskates = $db->sql_query($rofl); if($roflcopter = $db->sql_fetchrow($lollerskates))
return @entries;
Sunday, 7. June 2009, 23:51:34
$lollerskates = $db->sql_query($rofl); if($roflcopter = $db->sql_fetchrow($lollerskates))
Saturday, 25. April 2009, 12:26:36
<form method="post" action="">
<!-- some lines here about something useful //-->
<input type="submit" value="Submit" onclick="if(!confirm('Do you really want to submit?')) return false;" />
</form>
Tuesday, 21. April 2009, 13:49:21
[Tue Apr 21 13:58:28 2009] [error] Missing required parameter 'token' at /usr/lib/perl5/site_perl/5.8.8/Net/OAuth/Message.pm line 74.so I gave it up. But I still managed to do something. The script can be tried out at http://robert.leep.no/perl/twitter.pl!
Thursday, 19. March 2009, 20:24:41
sub getPost
{
my %_POST, $r, @parts;
%_POST = ();
read( STDIN, $r, $ENV{ "CONTENT_LENGTH" } );
@parts = split( /\&/, $r);
foreach my $p (@parts)
{
my($n, $v) = split( /\=/, $p);
$v = uri_decode($v);
$_POST{ "$n" } = $v;
}
return %_POST;
}
$_POST{"a"} = "something"
$_POST{"b"} = "somethingelse"
$_POST{"c"} = "somethingelseagain"
#!/usr/bin/perl
package HTTPerl;
use base 'Exporter';
our sub getPost
{
my %_POST, $r, @parts;
%_POST = ();
read( STDIN, $r, $ENV{ "CONTENT_LENGTH" } );
@parts = split( /\&/, $r);
foreach my $p (@parts)
{
my($n, $v) = split( /\=/, $p);
$v = uri_decode($v);
$_POST{ "$n" } = $v;
}
return %_POST;
}
our @EXPORT_OK = ('getPost');
our @EXPORT = {'getPost');
1;
#!/usr/bin/perl -I .
use HTTPerl 'getPost';
%_POST = getPost();
print "content-type: text/html\n\n";
print "<html><head><title>Testing the script</title></head>";
print "<style type=\"text/css\">* { font-family: Verdana; font-size: 10px; } h1 { font-size: 16px; }</style>";
print "<body><h1>Using the information</h1>";
printf("<p>Hello %s!<br />You're %d years old and you just said: '%s'.</p>", $_POST{"name"}, $_POST{"age"}, $_POST{"text"});
print "</body></html>";
Tuesday, 17. March 2009, 15:07:01
Sunday, 15. March 2009, 14:59:46
Monday, 15. December 2008, 22:25:21
Monday, 15. December 2008, 18:23:14
Wednesday, 24. September 2008, 21:05:29
Tuesday, 9. September 2008, 22:56:25

// ...
JPanel panel = new JPanel();
JLabel label = new JLabel("");
JTextField text = new JTextField(15);
JButton button = new JButton("Press me!");
panel.setLayout(new GridLayout(3, 1)); // A grid with 3 rows, 1 column.
panel.add(text);
panel.add(button);
panel.add(label);
getContentPane().add(panel);
validate(); // To refresh the frame making changes to it visible

JButton button;
JLabel nc, n, a, p;
JTextField numbercode, name, amount, price;
JPanel behind, panel;
behind = new JPanel();
panel = new JPanel();
button = new JButton("Display receipt");
button.addActionListener(new Listener()); // I won't add the code for this class
nc = new JLabel("Number code: ");
n = new JLabel("Name: ");
a = new JLabel("Amount: ");
p = new JLabel("Price: ");
numbercode = new JTextField(10);
name = new JTextField(50);
amount = new JTextField(3);
price = new JTextField(7);
behind.setLayout(new GridLayout(2, 1));
panel.setLayout(new GridLayout(4, 2));
panel.setBorder(BorderFactory.createEmptyBorder(30,30,10,30)); // A cute border
// Let the fun begin
panel.add(nc);
panel.add(numbercode);
panel.add(n);
panel.add(name);
panel.add(a);
panel.add(amount);
panel.add(p);
panel.add(price);
behind.add(panel);
behind.add(knapp);
getContentPane().add(behind);
validate();

Showing posts 1 - 10 of 16.

What device are you using to visit this blog?
Total: 23 votes
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
|
| ||||||
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | ||||||