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: 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: 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.

User Journal

Journal Journal: APK is a trip 23

Everybody still having fun with APK? I notice that damned near every post I made last week has been responded to, questioning my educational bona fides. The hysterical thing is that some AC responded to his inquiries. Now, to about half of those, he responded, accusing me of being the AC. The really hysterical thing: I haven't visited /. since very early on Wednesday morning.

So APK spent a day or two running around and accusing people of sockpuppetry who had forgotten his existence hours before APK posted. Classic. How long until he goes all Hans Reiser?

PC Games (Games)

Journal Journal: b/g/n router 14

Anyone have any preferences for a b/g/n router? I'd like one so that I can put my nice, modern Apple stuff on the N side of things, and the shitty, legacy crap over on the b/g side. Already have an older Time Capsule that isn't full, so I'm not going that route. (Oh, and I'll probably not give my brother access to the N, cause he pisses me off too much).

Thinking to bridge the connection from that to the Time Capsule, and let the Time Capsule handle the rest of it.

I don't care about off the wall firmware. That doesn't interest me in any way, shape or form. Unless I have to deal with that kind of malarkey to get either my Time Capsule or my tons of BT stuff to work nicely.

PC Games (Games)

Journal Journal: Modpoints for sale

Modpoints for sale. If you have a good one tomorrow (TT) that isn't getting the love, let me know.

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: SFB Updates 5

hello folks. i know i'm not around here much... but i just wanted to drop a quick update.

a new record was just released, 6-song CD "how much more difficult will this get?" its also available through itunes, amazon mp3 (you can also get the CD through amazon), and shortly be available through rhapsody, emusic and amie street.

the record will also come out on vinyl later this spring (colored vinyl of course.)

i'm also working on another sky flying by record as well. this one will be themed, and will come with a collection of short stories written by solemndragon (that accompany the songs).

i've been recording a lot lately and the next record will most likely be tracked partially and mixed (almost completely) at a local studio.

i've also been working on another music project that just started, an actual band. i've been working with a friend of mine, and we've been writing a few things here and there, mostly instrumental post-rock-ish type of stuff. we plan to do some gigging and recording probably this summer.

well, if you are really interested in checking out the latest stuff, just head to my sfb blog (http://www.skyflyingbymusic.org/)

ok, until next time :)

i just wanted to pop in here, i haven't forgotten about the folks here :)

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.

Christmas Cheer

Journal Journal: /Give me one/And I'll buy you a cherry phosphate/

A couple of interesting and timely quotes, plus texttoon. Click on in.

Quote(1):
A friend has placed in our hands numbers of the tracts which the corn-law reformers of England circulate among the people. They are about the size and length of the religious tracts of this country, and are put up in an envelope, which is stamped with neat and appropriate devices. These little publications comprise essays on all the topics involved in the corn-law controversy, sometimes in the form of dialogues, sometimes of tales, and sometimes of extracts from famous books and speeches. The arguments are arranged so as to be easily comprehended by the meanest capacities.

The friend to whom we are indebted for these is well informed on the subject, and says that a more advanced state of opinion prevails among the people of England, in relation to the operation of tariffs, than in this nation generally so much more enlightened. It is a singular spectacle which is thus presented to the eyes of the civilized world.

While the tendency of opinion, under an aristocratic monarchy, is towards the loosening of the restraints under which the labour of the people has long suffered, a large and powerful party in a nation, whose theory of government is nearly a century in advance of the world, is clamouring for their continuance and confirmation.

Monarchical England is struggling to break the chains that an unwise legislation has forged for the limbs of its trade; but democratic America is urged to put on the fetters which older but less liberal nations are throwing off. The nations of Europe are seeking to extend their commercial relations, to expand the sphere of their mutual intercourse, to rivet the market for the various products of their soil and skill, while the "model republic" of the new world is urged to stick to the silly and odious policy of a semi-barbarous age.

We look upon the attempt which is making in Great Britain to procure a revision of the tariff laws, as one of the most important political movements of the age. It is a reform that contemplates benefits, whose effects would not be confined to any single nation, or any period of time. Should it be successful, it would be the beginning of a grand and universal scheme of commercial emancipation. Let England--that nation so extensive in her relations, and so powerful in her influences--let England adopt a more liberal policy, and it would remove the only obstacles now in the way of a complete freedom of industry throughout the globe.

It is the apparent unwillingness of nations to reciprocate the advantages of mutual trade, that has kept back this desirable reform so long. The standing argument of the friends of exclusiveness--their defence under all assaults, their shelter in every emergency--has been that one nation cannot pursue a free system until all others do, or, in other words, that restriction is to be met by restriction. It is a flimsy pretence, but such as it is, has answered the purposes of those who have used it, for many centuries.

The practice of confining trade by the invisible, but potent chains of law, has been a curse wherever it has prevailed. In England, more dependent than other nations on the extent of its commercial intercourse, it may be said to have operated as a scourge. The most terrible inflictions of natural evil, storms, famine, and pestilence, have not produced an equal amount of suffering.

Indeed, it has combined the characteristics of the worst of those evils. It has devastated, like the storm, the busy hives of industry; it has exhausted, like famine, the life and vital principle of trade; and, like the pestilence, it has "walked in the darkness and wasted at noon-day." When we read of thousands of miserable wretches, in all the cities and towns of a great nation, huddled together like so many swine in a pen; in rags, squalor, and want; without work, bread, or hope; dragging out from day to day, by begging, or the petty artifices of theft, an existence which is worthless and a burden; and when, at the same time, we see a system of laws, that has carefully drawn a band of iron around every mode of human exertion; which with lynx-eyed and omniscient vigilance, has dragged every product of industry from its retreat to become the subject of a tax, can we fail in ascribing the effect to its cause, or suppress the utterance of our indignation at a policy so heartless and destructive?

Yet, this is the very policy that a certain class of politicians in this country would have us imitate. Misled by the selfish and paltry arguments of British statesmen, but unawed by the terrible experience of the British people, they would fasten upon us a system whose only recommendation, in its best form, is that it enriches a few, at the cost of the lives and happiness of many. They would assist a constrictor in wrapping his folds around us, until our industry shall be completely crushed.
--The Economist(SEPTEMBER 16, 1843, v1i3)

Let us turn our eyes down from such lofty hights and make a visit to a less exaulted view of the lot of man.

Quote(2):
Parson Plaford seemed to be on very intimate terms with his maker. If his little finger ached, the Lord meant something by it. Yet, although he was always ready to be called home, he was still more ready to accept the doctor's advice to take a holiday when he felt unwell. The last sermon I heard him preach was delivered through a sore throat, a chronic malady which he exasperated by bawling. He told us that the work and worry were too much for him, and the doctor had ordered him rest, if he wished to live. He was going away for a week or two to see what the Lord meant to do with him; and I afterwards heard some of the prisoners wonder what the Lord was doing with him. "I speak to you as a dying man," said the chaplain, as he had said several times before when he felt unwell; and as it might be the last time he would ever preach there, he besought somebody, as a special act of gratitude, to get saved that very day.

One of the prisoners offered a different reason for the chaplain's temporary retirement. "He ain't ill, sir. I knows what 'tis. I was down at the front when your friend Mr. Ramsey went out. There was a lot of coaches and people, and the parson looked as white as a ghost. He thinks ther'll be more coaches and people when you goes out, and he's gone off sooner than see 'em."

During the chaplain's absences his locum tenens was usually a gentleman of very opposite characteristics. He was tall, thin, modest, and even diffident. He slipped into your cell, as I said before, with the deferential air of an undertaker. His speech was extremely soft and rapid, although he stuttered a little now and then from nervousness. "I suppose you know," I asked on his first visit, "what I am here for?" "Y-e-s," he stammered, with something like a blush. I said no more, for it was evident he wished to avoid the subject, and I really think he was sorry to see me persecuted in the name of Christ. He had called, he said, to see whether he could do anything for me. Could he lend me any books? I thanked him for the proffered kindness, but I had my own books to read by that time. Mr. Stubbs's sermons were much superior to Mr. Plaford's. They were almost too good for the congregation. He dwelt with fondness on the tender side of Christ's character, and seemed to look forward to a heaven which would ultimately contain everybody.

On one occasion we had a phenomenal old gentleman in the pulpit. He was white-haired but florid. His appearance was remarkably youthful, and his voice sonorous. I heard that he was assistant chaplain at one of the other London prisons. With the most exemplary fidelity he went through the morning service, omitting nothing; unlike Parson Plaford, who shortened it to leave time for his sermon. I wondered whether he would get through it by dinner-time, or whether he would continue it in the afternoon. But he just managed to secure ten minutes for his sermon, which began with these extraordinary words, that were sung out at the top of his voice: "When the philosopher observes zoophyte formations on the tops of mountains, he," etc. How singularly appropriate it was to the congregation. The sermon was not exactly "Greek" to them, but it was all "zoophyte." I heard some of them wonder when that funny old boy was coming again.

The prisoners sit in chapel on backless benches, tier above tier, from the rails in front of the clerk's desk almost to the roof behind. Two corners are boarded off within the rails, one for the F wing and the other for the debtors' wing. Above them is a long gallery, with private boxes for the governor, the doctor and the chief warder, and a pulpit for the chaplain.

Parson Plaford used to make a great noise in closing the heavy door behind the pulpit, leading to the front of the prison; and he rattled the keys as though he loved the sound. He placed them on the desk beside the "sacred volume," and I used to think that the Bible and the keys went well together.

In offering his first private prayer, as well as in his last after the benediction, he always covered his face with the sleeve of his robe, lest, I suppose, the glory of his countenance, while communicating with his maker, should afflict us as the insufferable splendor of the face of Moses afflicted the Jews at Mount Sinai. His audible prayers were made kneeling with clasped hands and upturned face. His eyes were closed tightly, his features were painfully contracted, and his voice was a falsetto squeak. I fancy the Governor must have sighed at the performance. The doctor never troubled to attend it.

The prisoners were supposed to cross their hands in front while in chapel. Several unsuccessful attempts were made to induce me to conform to the regulation. I declined to strike prescribed attitudes. Another rule, pretty rigorously enforced, was that the prisoners should look straight before them. If a head was turned aside, an officer bawled out "Look to your front." I once heard the injunction ludicrously interpolated in the service. "Dearly beloved brethren," said the chaplain. "Look to your front," growled the officer. It was text and comment.

Only once did I see a prisoner impressed. The man sat next to me; his face was red, and he stared at the chaplain with a pair of goggle eyes. Surely, I thought, the parson is producing an effect. As we were marching back to our cells I heard a sigh. Turning round, I saw my harvest-moon-faced friend in an ecstacy. It was Sunday morning, and near dinner time. Raising his hands, while his goggle eyes gleamed like wet pebbles, the fellow ejaculated, "Pudden next."
-- G. W. Foote.

I hope the season has been kind to all of you and I will, no doubt, bend your ear (and mind) again in the coming year. Until then.

Texttoon:
Fumetti : A stock photo of Barack Obama in front of that poduim with blue 'elect' sign. Overlayed speech bubble has him saying; "Riddikulus!" in an ornamental typeface.

User Journal

Journal Journal: Twitter 3

fyi - can't multiply cause of work, so I've become a twitter man... that's where I do my updating... if you twitter, my id is my last name...

Slashdot Top Deals

An authority is a person who can tell you more about something than you really care to know.

Working...