Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
User Journal

Journal Journal: fb down?

seems that there's a bit of an outage. happening for you as well?

User Journal

Journal Journal: Circular dependencies in three languages 1

Here are six files for ya, showing a problem in 3 different scripting languages. What will they do?
--------- test1.php:
<?php
require 'test2.php';

define('SOMECONSTANT','hello world');

function foo() {
                return SOMECONSTANT;
}

echo foo(); echo "\n";

--------- test2.php:
<?php
require_once 'test1.php';

echo foo(); echo "\n";
--------- test1.py:
#!/usr/bin/python
import test2

SOMECONSTANT='hello world'

def foo():
                return SOMECONSTANT

print foo()
--------- test2.py:
#!/usr/bin/python
import test1

print test1.foo()
--------- test1.rb:
#!/usr/bin/ruby
require 'test2.rb'

SOMECONSTANT='hello world'

def foo
                SOMECONSTANT
end

puts foo()
--------- test2.rb:
#!/usr/bin/ruby
require 'test1.rb'

puts foo()
---------
Ok, scriptfiends, predict the output of these three commands:
php -q -f test1.php
python test1.py
ruby test1.rb

and then do some pasting and try it out. Match your predictions?

The PHP one bit me pretty hard today.

User Journal

Journal Journal: Star Trek meets Candyland 5


The other day my family was playing Candyland. Our daughter was getting into it so I started playing some classic Star Trek fight music.
The music ends just as she advances to GLORIOUS VICTORY!

YouTube video here

It's awesome, not that I'm biased... :)
User Journal

Journal Journal: One Too Many 2

I have a password written on a post-it note underneath my keyboard. Decades went by without this ever having happened, but now I have one of these. [rationalize]And I'm keeping the post-it, because it'll probably be months or years before I ever need that password again, so there's just no chance I'll be able to remember it (it's actually a pretty well-made password).[/rationalize] OTOH, I suppose I could just throw it away and then the next time I need it, ask someone for it again. [truth]But no, it amuses me that I've entered the ranks of people with passwords on post-its at their desks, so I'm keeping it, for that reason if nothing else.[/truth]

User Journal

Journal Journal: Jmeter Does Not Have Access to Environment Variables?

Maybe not, but if you "set > workspace/job.properties" and pass your Job Path in to jmeter as a property, you can read the damn things back out with a beanshell sampler later on. Handy for grabbing variables from your Hudson parameterized build. Just don't forget to define JobPath as ${__P(JobPath,)} in your user defined variables.

import java.io.BufferedReader;

String response = "";

try {
      BufferedReader in = new BufferedReader(new FileReader("${JobPath}/workspace/job.properties"));
      String nextLine = in.readLine();
      while(null != nextLine) {
              String[] keyval = nextLine.split("=");
              if (2 == keyval.length) {
                    vars.put(keyval[0],${__eval(keyval[1])});
              }
              response = response + nextLine + "\n";
              nextLine = in.readLine();
        }
} catch (java.io.FileNotFoundException e) {
        response = "Unable to locate properties file for environment; using defaults.";
}

SampleResult.setResponseData(response);

Handhelds

Journal Journal: I like this comment

You need to go to a strip club to get over the trauma. And while you're there, just remember that the hand that brings you your drink is the same hand that jacks you off in the back room - the efficient, invisible hand of Ayn Rand!

User Journal

Journal Journal: Thanks for the gift subscription! 6

I just received mail notification that a fellow user has bought me a gift subscription to slashdot. I'm already friends/fans with the person but his email address isn't visible so I can't thank the person off-/. (wimp, change your privacy settings and deal with the spam! :P )
 
Not sure what I did to deserve it, but I thank you!
 

User Journal

Journal Journal: Yo, Tom Hudson 3

Yo, Tom Hudson, I'm real happy for you and I'ma let you finish, but Breitbart is the greatest troll of all TIME!

User Journal

Journal Journal: Emacs ruby-mode font locking

If you want ruby mode to do syntax highlighting, make sure to have (global-font-lock-mode 1) before you load the ruby mode library. This will save much misery.

User Journal

Journal Journal: I'll never empty my freaks list 5

I'll never empty my list of freaks. First of all because Pudge is on there, and for him to un-freak me would require him to change his mind.

But of far more interest than that is my former brother-in-law. I hadn't forgotten that he showed up here when his crazy assed sister left me. Hadn't thought about him in a while. Was looking around some pages and saw his name on my freaks list. Then I remembered he was 'an hero'. And I laughed. I hope it hurt. It probably did, because for it to have been painless it would require him to do something right for once in his miserable life.

Cowardly chickenshit.

Slashdot Top Deals

Living on Earth may be expensive, but it includes an annual free trip around the Sun.

Working...