Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



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: 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: Define normal 4

I have never met a single person who is normal. I have never met a single person who was raised in a normal family. Yet I have met many people who insist, often to such a degree that it causes them a great deal of anxiety and stress, that everyone else, with them being the sole exception, is a normal person who was raised in a normal household.

I am not worried, dismayed, or upset by people who are crazy. We are all crazy. What I can't stand is people who insist on always holding themselves up to some idealized abstraction that they call normal.

Where I am from, being of mixed race is normal. Never going to church is normal. Recycling is normal. In the house I grew up in, worrying if there would be enough money to pay the bills next month was normal. A happy joyous Christmas was normal. My father getting up at 6:30am to fry me a steak for breakfast was normal.

Not knowing if my father was going to live tomorrow.

Normal.

Not knowing who my birth mother is.

Normal.

Cursing her every day for forcing me to live with the consequences and end effects of her behavior?

Normal.

Knowing I have a loving family to go home to, no matter how psychologically messed up or near death they may be on any given day?

Normal.

The things we take for granted, the things we, personally, in our hearts, believe to be universal truths that are beyond any doubt, make up what we consider to be normal.

To live a happier life, do not take for granted any of the positives blessings that you have received in life, no matter how few they may be. Be thankful, truly grateful to the world, for all the good that has come your way. Look at everything good in your life that you take for granted, all the positives that you assume are normal, and love them with all your heart. That which you assume is normal are things many others cannot take for granted. Food on the table. A safe bed to sleep in at night. A shoulder to cry on. A place to run away to when your home has become too crazy. Whatever it is in your life, love it and hold it dear.

Come to the understanding that everything wrong, everything negative in life that you take for granted, does not have to be that way. If you are unloved, do not assume that is normal. Do not take it for granted that no one will ever love you. If you saw your parents addicted to drugs, do not assume that you too must become a drug addict. If you saw your father beat your mother, do not assume that you must beat your wife or be beaten by your husband.

The beautiful thing about normal, is that it can, it does, everyday, change meaning. We define it. You and I define it for ourselves, and for the world as a whole.

Do not strive for normal. Strive for joy. Strive for happiness. Strive for a better future, for yourself, and for all of us. Make that the new normal.

User Journal

Journal Journal: Just testing out some journal submission changes 8

I don't actually have anything to say. Kathleen is due any day, and I'm looking forward to a few weeks of staying home, getting poor sleep, and changing diapers.
But mostly I'm testing to see if journal saving works properly.

User Journal

Journal Journal: Updates to Journal System 13

We've made some significant updates to the submission/journal system. Visiting Submissions and Journals yields a new form that allows stuff like tags to the data types. There are a number of annoying bugs, but for the most part the dust is starting to settle. More notes will be coming, but this journal entry is really just me putting the final test on the new Journal form.

User Journal

Journal Journal: a return which is long overdue (plus achievements!) 17

I've lurked at /. without posting for ages, mostly because I just don't have the time to interact like I used to.

But I've been clicking through the old RSS feed more and more lately, and when I saw the PAX Plague thread today, I came over to comment, since I'm kind of affected by the whole damn thing. I thought I'd take a look around since I haven't been here in awhile, and I saw that there are freaking ACHIEVEMENTS associated with our accounts. It's silly, and I'm sure it's been here forever, but I thought it was awesome and I was delighted when I read it.

I didn't realize how much I missed Slashdot until I spent some time here today, and I bet that anyone who joined in the last 2 years doesn't even give a shit about my stupid comments or anything, but it felt good to come back here, and feel safely among my people again.

User Journal

Journal Journal: Seven Dead Men 1

I have released my first feature, Seven Dead Men, under a creative commons license. Feel free to download it off of LegalTorrents. If you would like to buy a copy, order it though google checkout and use the coupon code "slashdot" for a discount. The path to get to this point has been a long and circuitous one. If you have any questions about the process, ask away and I'll do my best to answer them.

Java

Journal Journal: Tech Interviewing someone higher up than you? 9

First of all, I don't want this published to the frontpage...
Having said that, I have a quick question. I'm a Java guy that manages a few younger java guys. I have been asked to tech a .net guy that (according to his resume) has managed over 30 developers. How do I tech a guy like that? Do I just stick with OO/patterns questions? I know how to tech a java guy, but one that has more experience than me is a daunting task...
User Journal

Journal Journal: twittin 6

twittin as Blackneto now.
stalk me.

Television

Journal Journal: multicast video: someone's finally doing it 1

I've long advocated that the future of video delivery should either be multicast, or old-school protocols like HTTP combined with caching at the ISP. (Why all ISPs don't run transparent Squids, I still don't understand.) Bittorrent just isn't the right way to do it.

Thanks to Freedom To Tinker I've just learned that someone is using multicast to deliver TV.

Except it's not available in my area, and still requires propriety DVRs/STBs, which I assume means that it probably uses DRM and therefore has massive interoperability problems.

But it's a start. I hadn't heard of anyone actually doing it, before now.

Programming

Journal Journal: I can't believe this happened. I miss .. Pascal?! 1

I was writing a function in PHP4 and it kept getting bigger. It could use some splitting up for readability/testing/debugging purposes, although it didn't really need that to work. But then I realized I needed to reuse some sections of code, and since I hate duplicating code, those parts needed to be pulled out into their own functions.

But they needed access to the working set of local variables of the big function. Oh great.. do I pass all those vars by reference, making the argument list really long? Do I move all those variables into a struct (well, an associative array) and pass that?

These are, like, Programming 101 issues. Experienced programmers don't normally have to think about this stuff, because the right thing to do is just .. obvious.

Then I remembered that Pascal has the unusual (and rarely(*) needed) feature of nested procedures, where the sub-procedures can directly access the outer scope's local variables. It dawned on me: that would be incredibly convenient (and readable) in this case.

I wussed out and put everything into a class. It's not really oop (all this class does, is return a result) but that looked like the best way to deal, except now I have an ugly this-> in front of everything.

(*) I haven't programmed in Pascal (or anything like it) in over 20 years. Never really missed that feature until today.

Slashdot Top Deals

Get hold of portable property. -- Charles Dickens, "Great Expectations"

Working...