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

 



Forgot your password?
typodupeerror
×
User Journal

Journal Journal: Slashdot 2.0 1

I've seen a bunch of complaints lately about the new beta index. Now, I know that it's been in a state of rapid flux in the past few weeks as they try different things -- sometimes the thing doesn't even render right. Of course, this is 'beta', so you take your lumps as they work out the bugs.

Other than the occasional rendering problem and associated weirdness, though, I have to say that I rather like the new interface.

Wha? Why are you all looking at me like that?

Seriously. Listen. Okay, I don't like the green "idle" look very much, either. I personally think it's a bit difficult to read. But, other than that, I think the changes improve the usefulness of the site. Firehose has become more integrated with the main page, for instance. The whole thing is more dynamic, more AJAXy and overall the feel is much faster and much easier to sort through to find what you're looking for.

If you don't like it, you can always use the RSS feeds.

I welcome your opinions and comments, especially opposing viewpoints.

Programming

Journal Journal: Never write another configuration parser -- ever. 1

Okay, so I'm a little slow at jumping on bandwagons. Having written code to parse everything from XML configuration files to Windows-style .INI files, I've always thought that writing code to create and parse configuration files sucked. And that things like ConfigParser and xml.dom.minidom in Python made it suck a little less.

So, having worked with XML, I had heard of JSON as an alternative to XML and always thought "Wow. I'm going to have to write ANOTHER parser? Ugh." Obviously I just didn't get it.

So I wrote a little proggie the other day and needed an object-oriented-type configuration file for it and thought, for some strange reason, they I should do something a little lighter weight than XML. Flat .INIs weren't going to work because, well, they're flat. ;) So I decided to give this JSON thing a try.

I looked at the JSON documentation for Python 2.6 (and simplejson for Python 2.5, which the Python 2.6 json module is based on) and went huh? That's it? That can't be it. I'll need to write more methods than that surely.

As I looked more and more at it, I realized uhhhh...a JSON file looks rather like a Python dictionary (like a hash table in Perl or C) with str and numeric values. And lists! (Values can be lists!) Perfect. And when you parse it, you get exactly that -- a big Python dictionary. Wow! *slaps forehead* How much easier can you make it than that?

So you can have


{
        "window": {
                "width": 150,
                "height": 200
        },
        "bookmarks": [
              {
                  "name": "Slashdot - News for Nerds. Stuff that Matters",
                  "url": "http://slashdot.org" },
              { "name": "Google Docs",
                  "url": "http://docs.google.com" },
        ]
}

(forgive me if Slashdot mangles the indentation as it usually does)

and then you can access the whole shebang via


>>> import json
>>> configFile=open('foo.rc','r')
>>> config=json.load(f)
>>> config['window']['height']
200
>>> for bookmark in config['bookmars']: print bookmark['url'] ...
http://slashdot.org
http://docs.google.com

And the JSON file can be entirely self-documenting: You can put literally anything you want for each of the key:value pairs.

And since writing out the JSON file is just easy (just in reverse), you can easily write a configuration GUI, with the same brand of direct access to the JSON structure.

Now that's easy.

User Journal

Journal Journal: Oh, joy! Moderation abuse! 48

This is an open letter to my friend, the personal troll.

Okay, this is getting old. Someone, who obviously has a couple of sock puppet accounts (and nothing better to do), went and modded a bunch of my posts as trolls today. They must really hate me, because they waited until two of their accounts got mod points, and then blew 8 of their 10 mod points on lil' ol' me.

Probably the same person who's been trolling me for the past couple of weeks.

Whoever you are, if you had some testicular fortitude, you wouldn't hide behind socket puppets and AC trolls. I'm asking you now, as a man (or woman as the case may be), to do the honorable thing and post, not AC, with your real account, right here. Then we can discuss your issue with me, one-on-one via e-mail if you prefer.

I seriously doubt you'll do the honorable thing because you've already shown that you're a coward with no honor.

User Journal

Journal Journal: Best of Slashdot

Re:Bullshit (Score:2)
by girlintraining (1395911) Foe of a Friend on Wednesday December 17, @05:23PM (#26153681)

>If you go see the shuttle up close and your first thought is that it has a bad paint job, maybe you should just stick to playing with dolls.

Or maybe you should be less of a douchebag. The fact that something is an engineering marvel doesn't mean much to some people, but that doesn't mean that lessens the impact it has for them. Who hasn't looked up at a bird in the sky and wanted to journey? Who hasn't seen the stars and wished upon them? When I look at the shuttle, I don't see an engineering marvel. I see the realization of over twenty thousand years of human beings dreaming of having their own wings and flying through the heavens. And you know what -- I think I'm allowed to say it does have a bad paint job, and I could care less about the mechanical guts of it. That's not why it's beautiful.

Tanks, bombers, subs, and all that jazz you like--You can love them if you want, call them awesome. They're not special to me, they're just made so some people can kill other people. I'll stick with my dolls, and if you don't mind terribly, I'll be doing it in that badly painted bird over there that was built with hopes and dreams, instead of fears and insecurities.
--
All difficult things have their origin in that which is easy, and great things in that which is small. ~ Lao Tzu

User Journal

Journal Journal: Slashdot known astroturfers list #2

In the coming days I will be documenting known Microsoft astroturfers, together with evidence that paints them as such. Do what you will with this information. I will try to list only actual astroturfers, not fanboys, but I can't be 100% certain who-is-who. So, I will gladly accept any exceptions/modifications in the comments below. If you are the person in question, don't feel bad if I label you an astroturfer and you are not -- but you will be required to prove that you are not an astroturfer in order to be removed from the list.

Note: this list is hardly complete and will be issued in its entirety about once per week.

Update: thanks to those who have submitted updates and comments!

freddy_dreddy
Defcon79
ThinkFr33ly
Julie188 (her blog, linked in her sig currently), plus looking at her posting record, only posts in stories that are of interest to Microsoft.
Thaad.Isolas (to this date, this is his ONLY post, and the account is older than that)
PoiBoy evidence evidence

See this journal entry for evidence links for the other posters.

User Journal

Journal Journal: Korean DMZ 4

New JonesBlog entry on a visit to the Korean DMZ here.

This is a glimpse at an environment that hopefully will be rapidly changing, but with North Korea going through a spasm of Communist retrenching and the uncertainty of Kim Jong Il's health (or even if he is still alive), things in the DMZ appear to be just as tense as they have been for years.

Programming

Journal Journal: Python 3.0 Review 3

(Also titled, 'Python 3.0: the good, the bad, and the ugly)

Here's my review of the changes in Python 3.0. I've been writing stuff in Python since 2.1 or so, and I tend to like Python's 'new' object system. I hate Lisp and I hate functional programming(*), so that makes me a bit of an oddball in the Python community I guess.

Good: The print statement has been replaced with a print() function, with keyword arguments to replace most of the special syntax of the old print statement (PEP 3105).

Maybe I just spent too many years writing C and Borland Pascal/Delphi code, but when I first started coding in Python, I often made the mistake of writing

print('Hello world')

rather than

print 'Hello world'

Now it's the way it should have been all along. Things are more consistent this way.

Additionally, the sep= keyword argument makes life easier. No longer do you have put the separator repeatedly in your quoted string especially if the separator is not a space!

Bad: The dict methods dict.keys(), dict.items() and dict.values() return "views" instead of lists. For example, this no longer works: k = d.keys(); k.sort(). Use k = sorted(d) instead (this works in Python 2.5 too and is just as efficient).

Why did they change this? I make use of dict.keys() rather a lot. *sniff*

Ugly: range() now behaves like xrange() used to behave, except it works with values of arbitrary size. The latter no longer exists.

It seems like they changed this just to be pedantic. Tell me what the improvement is in making range work like xrange and then removing xrange? Why not just keep both?

Bad: The ordering comparison operators (=, >) raise a TypeError exception when the operands don't have a meaningful natural ordering. Thus, expressions like 1 None or len are no longer valid, and e.g. None raises TypeError instead of returning False. A corollary is that sorting a heterogeneous list no longer makes sense - all the elements must be comparable to each other. Note that this does not apply to the == and != operators: objects of different incomparable types always compare unequal to each other.

Some of my favorite stupid Python tricks rely on the fact 'None' in fact does not raise a TypeError and instead causes an expression to return False. Oh well. Guess I'll be using a ton more exceptions. :-/

Ugly: PEP 0237: Essentially, long renamed to int. That is, there is only one built-in integral type, named int; but it behaves mostly like the old long type.

So if you're going to only have one type, instead of no longer accepting 'long', make 'long' an alias for 'int'. Now that wasn't too hard was it?

Good: PEP 0238: An expression like 1/2 returns a float

About fscking time. Damn, you have no idea how many times I looked at expressions like 1/2 and went "Huh? Whadya mean 0?"

Good, Bad and Ugly: Python 3.0 uses the concepts of text and (binary) data instead of Unicode strings and 8-bit strings. All text is Unicode; however encoded Unicode is represented as binary data. The type used to hold text is str, the type used to hold data is bytes. The biggest difference with the 2.x situation is that any attempt to mix text and data in Python 3.0 raises TypeError, whereas if you were to mix Unicode and 8-bit strings in Python 2.x, it would work if the 8-bit string happened to contain only 7-bit (ASCII) bytes, but you would get UnicodeDecodeError if it contained non-ASCII values. This value-specific behavior has caused numerous sad faces over the years.

I agree, but changing it is going to be a real pain for a WHOLE lot of programs. Specifically 2to3 and -3 isn't able to fix a lot of these differences.

Meh: PEP 3107: Function argument and return value annotations. This provides a standardized way of annotating a function's parameters and return value. There are no semantics attached to such annotations except that they can be introspected at runtime using the __annotations__ attribute. The intent is to encourage experimentation through metaclasses, decorators or frameworks.

Okay, but we're already doing this throw DOC strings. Why change it now?

Good: PEP 3102: Keyword-only arguments. Named parameters occurring after *args in the parameter list must be specified using keyword syntax in the call. You can also use a bare * in the parameter list to indicate that you don't accept a variable-length argument list, but you do have keyword-only arguments.

Okay, this is more consistent with how arguments work...

Meh: PEP 3104: nonlocal statement. Using nonlocal x you can now assign directly to a variable in an outer (but non-global) scope. nonlocal is a new reserved word.

If you're going to explicitly change the scope of a variable, you might as well make it global, huh? Some people are just too pedantical.

Good: PEP 3132: Extended Iterable Unpacking. You can now write things like a, b, *rest = some_sequence. And even *rest, a = stuff. The rest object is always a (possibly empty) list; the right-hand side may be any iterable. Example:

(a, *rest, b) = range(5)

This sets a to 0, b to 4, and *rest to [1, 2, 3].

Oh, goody! No more writing a, b, dummy1, dummy2 = function()

Good: Dictionary comprehensions: {k: v for k, v in stuff} means the same thing as dict(stuff) but is more flexible. (This is PEP 0274 vindicated. :-)

and ...

Set literals, e.g. {1, 2}. Note that {} is an empty dictionary; use set() for an empty set. Set comprehensions are also supported; e.g., {x for x in stuff} means the same thing as set(stuff) but is more flexible.

I always thought there should be a way to do this...

Ugly: New octal literals, e.g. 0o720 (already in 2.6). The old octal literals (0720) are gone.

But the old way was consistent with Unix...

Good: Change from except exc, var to except exc as var. See PEP 3110.

I hated the old way. To me, there isn't a lot of difference between except (exc, exc): and except exc, var: so I was always getting confused.

Ugly: PEP 3113: Tuple parameter unpacking removed. You can no longer write def foo(a, (b, c)): .... Use def foo(a, b_c): b, c = b_c instead.

Why? I mean, I read the PEP and understand the introspection issues, but um, if you don't like it, just don't use it.

This and the rest of the removed syntax: These seem like silly, pedantic political issues.

Bad: Library changes: why change the names of libraries without leaving aliases to the old names? You're just being pedantical again. Stop it.

Ugly: String template changes and the '%' string operator

I never saw anything wrong with the '%' operator.

The Rest

'file' is already an alias for 'open'. Again, why rename something in a destructive way? What's wrong with just leaving the damn alias there?

(*) More accurately, I hate programming purism. I tend to mix and match various techniques and metaphors and 'use what works' rather than get all uppity about things like how a function should never modify a global variable. Sometimes that's just the best way to do it.

The Media

Journal Journal: PC Magazine calls it quits 1

I just heard on Pacifica's "Democracy Now!" that PC Magazine is calling it quits after nearly 30 years. Kind of a sad day, really. I remember PC Magazine was one of the first publications to have an online presence -- they had their own BBS in the 1980s and by the 1990s they added PCMagNet, their own forum on CompuServe (or CI$ as it was known back then ;).

I used to look forward to PC Magazine for their new utilities every month, their "how to" and "tips and tricks" columns, Alfred Poor's computer fixes column, and, of course, my favorite, 'Abort, Retry, Fail?', which was a humor column that highlighted the funniest typos, goofy ads and PC-related photos from around the country. Even John C. Dvorak had a clue at one time -- when he first encountered Linux in the early 90s, he was flabbergasted that you could get the source code to an entire OS on a CD. And he even predicted that Linux would go places one day. Really. :)

Farewell, PC Mag!

What do you guys remember?

User Journal

Journal Journal: Slashdot known Microsoft astroturfers list #1 5

In the coming days I will be documenting known Microsoft astroturfers, together with evidence that paints them as such. Do what you will with this information. I will try to list only actual astroturfers, not fanboys, but I can't be 100% certain who-is-who. So, I will gladly accept any exceptions/modifications in the comments below. If you are the person in question, don't feel bad if I label you an astroturfer and you are not -- but you will be required to prove that you are not an astroturfer in order to be removed from the list.

Note: this list is hardly complete and will be issued in its entirety about once per week.

Update: thanks to those who have submitted updates and comments!

freddy_dreddy evidence
Defcon79 evidence
ThinkFr33ly evidence
Julie188 evidence (her blog, linked in her sig currently), plus looking at her posting record, only posts in stories that are of interest to Microsoft.
Thaad.Isolas evidence (to this date, this is his ONLY post, and the account is older than that)

Education

Journal Journal: Religion vs Religion 2

So I'm sick, and instead of sleeping like a normal person I'm roaming the web because apparently that's in some way intelligent or something.

And I run across this poll by the economist, and I'd never seen this exact poll before, but I've seen about a thousand like it...It's basically a contrast of the American groupthink vs the European groupthink. In this case, it's the Brits.

First section is "Religion" and the third question is:

"Which explains the origin of the Earth?"
~30% of Americans and ~65% of the Brits said "Evolution"
~40% of Americans and ~10% of the Brits said "The Bible"
~20% of Americans and ~18% of the Brits said "Intelligent Design"

Now, to me there is only one right answer to that question: The fucking Bible.

Evolution is ..."the changes seen in the inherited traits of a population from one generation to the next. These changes are relatively minor from one generation to the next, but accumulate with each subsequent generation and can eventually cause substantial changes in the organisms." It's go no fucking thing what-so-ever to do with the origin of Earth or life on Earth.

Intelligent Design is too stupid and intellectually bankrupt to even rate a place on the list, so that leaves only the Bible, which, imho, is wrong, but the question doesn't say anything about accuracy so it remains the only thing on the list that correctly answers the question.

So, on the one hand, we have a bunch of people who think the sky fairy made everything. On the other hand, we have a bunch of people who think Evolution has something to do with the origin of fucking life!

Part of me hopes that the 10% or so who actually knew that the poll was horseshit hung up, or answered "Evolution" as a short-hand way of saying "Whatever scientific theory of abiogenesis has the most evidence behind it today." But in the end, the only thing the poll really says is that the cult of the jewish sheepfarmers is less popular in Britain than the cult of the toaster oven...And that 20% of both population groups believe whatever you tell 'em.

I guess I should take comfort in the fact that at least they're more secular over there, but all it really does is drive home the fact that, of any group of humans, the vast majority are completely ignorant at any given time, and that science can be just as irrationally religious as any religion.

Slashdot Top Deals

Never trust a computer you can't repair yourself.

Working...