Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
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);

Social Networks

Journal Journal: Twitter

Err... what? It seems that twitter requires you to have Javascript enabled in order to view 140 characters of someone's worthless drivel. Otherwise you get a blank page. The mind boggles.
Hardware Hacking

Journal Journal: ...and then there was silence

Once you've been around computers for a while, you get to recognise certain sounds. Such as the pop followed by the spinning down of fans, and the ominous silence that emanates from the box that's supposed to be your fileserver. Arse. I was off work yesterday due to a nasty cold, and the last thing I wanted to be doing was rebuilding the server. Fortunately, it turned out to be just the power supply. I'd been worried that it was going to have taken out the motherboard too. It did take a hard drive with it on the way out, but fortunately that wasn't fatal. The RAID rebuild ran OK overnight, and now we're back to normal.
Graphics

Journal Journal: Zooming/panning images for video 2

Does anyone know of a good solution for zooming/panning static images for turning into a video? The so called Ken Burns effect? It must work on Linux, and should ideally be open source. The pan in openshot doesn't seem to work, and the zoom is too jerky to be useful. I can write my own fairly easily if I have to, but I'd rather not reinvent the wheel if I can avoid it.
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: 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: Oops 2

Today I learned that my window manager hotkey to bring the focused window to the front doesn't work when the thing that's obscuring the window in question is a post-it note on the monitor. D'oh!
The Matrix

Journal Journal: The WebM project 2

http://www.webmproject.org

It's what we were all hoping for, and I'm pleased that it's come to pass. It's not perfect, and I don't agree with all of their decisions. However, even an imperfect alternative to the current H.264 situation is a massive improvement. I'm pleased they've gone for a full stack solution of not only VP8 but also Matroska(-ish) and Vorbis, too. If nothing else, it's likely to mean that a) Vorbis will be shipped by default on most platforms[1], and b) hardware support for both VP8 and Vorbis should be widespread in the very near future. Further, there's a commitment to transcode all of the existing videos on YouTube. That's a massive endorsement. Of course, the risk with that is the reduced quality that will come from three or more lossy transforms, but given that they've announced it, they're clearly not too concerned about that. The future's looking very bright indeed.

[1] Or will it? I've yet to see any official response from Microsoft or Apple on this. But it's going to be hard for them to ship something that won't play YouTube videos by default. Of course, in the short and probably medium term, YouTube will continue to offer videos in other formats as well. But we'll see how it plays out in the long term.

Silicon Graphics

Journal Journal: I want a bigger computer 10

I went to an interesting talk by Eng Lim Goh of SGI on Thursday, demonstrating their Ultraviolet systems. Very cool. While there are bigger and faster computers on the planet, they're all technically clusters rather than a single computer. The SGI machines can have 4096 CPUs and 16TB of RAM running under a single Linux kernel. Nice.

Also interesting to see the stats on when their systems were delivered to McLaren and Brawn, and where the performance of those cars was afterwards. I know there's more to F1 than CFD, but it certainly plays a large part these days.

User Journal

Journal Journal: Awesome... 4

Short Flash vid...
http://en.tackfilm.se/?id=1273610622233RA56

User Journal

Journal Journal: iPad pre-orders in Canada enabled, I drink the KoolAid 4

Canadian pre-orders started today.

64 GB WiFi version ordered, should be here by May 28. No need for the 3G version, I can tether with MyWi on the iPhone.

My dad picked up the similar model on a trip to the US last week. Was playing with it on the weekend, awesome device. Perhaps not magical but still most impressive.

Open Source

Journal Journal: About time too 1

The UK's Information Commissioner has ruled that research data must be made public. I have little sympathy for the likes of Keenan. But I have even less sympathy for so called scientists who refuse to make their data available for others to study. This isn't just about climate change, either, but about science in general. The recent spate of falsified results in Chinese and Korean papers should be ample evidence that data needs to be made public so that results can be independently verified. That's what science is all about.

Slashdot Top Deals

The only difference between a car salesman and a computer salesman is that the car salesman knows he's lying.

Working...