Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror

Comment: Re:It's RAID 0 (Score 4, Informative) 221

Based on the commit fixes, it's in a function called raid0_make_request, which is only used in raid0.c
raid 10 is in raid10.c, so it doesn't use this function.

The bug is based on the fact that a macro "sector_div" modifies it's first argument [and returns the remainder]. I've removed the obligatory backslashes for clarity:

# define sector_div(n, b)(
{
        int _res;
        _res = (n) % (b);
        (n) /= (b);
        _res;
}
)

This is used in some fifty files. Some just want the remainder [and they don't want the first arg changed so they do]:

sector_t tmp = sector;
rem = sector_div(tmp,blah);

This is effectively what the code wanted, but the actual fix was to do a restore afterwards:

sector_t sector = myptr->sector;

...
rem = sector_div(sector,blah);

...
sector = myptr->sector;

... // use sector [original value only please ;-)]

The last line to restore sector with the original value was the fix.

They should do a full code audit as their may be other places that could be a problem. I've reviewed half the files that use this macro and while they're not broken, some of the uses are fragile. I paraphrase: "sector_div considered harmful"

What they really need are a few more variants which are pure functions that could be implemented as inlines:
rem = sector_rem_pure(s,n)
s2 = sector_div_pure(s1,n)

Or, a cleaner sector_div macro:
sector_div_both(s,n,sector_return,rem_return)

Comment: Re:North Pole (Score 1) 477

by Forever Wondering (#49747103) Attached to: The Brainteaser Elon Musk Asks New SpaceX Engineers

Yes, they do go on forever. I stopped at 100x for the sake of brevity and slashdot eccentricities (e.g. when I put only one loop per line, /. complained about "lines are too short"). At 100x, the south lat (after going one mile south) is 8 ft, 4 in (99x was 8 ft, 5 in). Eventually, the program would need to use semi-infinite precision math (e.g. double wouldn't be enough). Also, I used a 2D approximation for the distance to pole rather than calculate the arc length [I was too lazy/tired]. Still, pretty close, and good enough for illustration purposes.

#!/usr/bin/perl
# tbin/elon -- elon musk's brain teaser

#pragma pgmlns

master(@ARGV);
exit(0);

# master -- master control
sub master
{
        my(@argv) = @_;

        $fmt_big = "%.12f";

        $M_PI = 3.14159265358979323846;
        $M_PI_2 = $M_PI * 2;

        # circumference of the earth
        $Ce = 24901.0;

        # radius of the earth
        $Re = radius($Ce);

        $deg_per_mile = 90.0 / $Re;

        for ($loopiter = 1; $loopiter <= 100; ++$loopiter) {
                dolat($loopiter);
        }

        {
                last if ($altflg);

                $bf = $out[0];
                @rhs = split(" ",$bf);

                $bf = title($rhs[0],"loop");
                push(@title,$bf);

                $bf = title($rhs[1],"degrees S lat");
                push(@title,$bf);

                $bf = title($rhs[2],"dist to S pole");
                push(@title,$bf);

                $bf = join(" ",@title);
                unshift(@out,$bf);
        }

        foreach $bf (@out) {
                print($bf,"\n");
        }
}

# dolat -- calculate for single latitute
sub dolat
{
        my($loopiter) = @_;

        $Cx = 1.0 / $loopiter;
        $Rx = radius($Cx);

        # distance from southern latitude to equator
        $l = $Re - $Rx;

        $deg_S = ($l / $Re) * 90.0;
        $deg_N = $deg_S - $deg_per_mile;

        $dist_to_pole_S = $Re - $l;
        $dist_to_pole_N = $dist_to_pole_S + 1;

        @lhs = _showdist($dist_to_pole_N * 5280 * 12);
        prtf("%3.3dx ${fmt_big} %s mi, %s ft, %s in\n",
                $loopiter,$deg_N,$lhs[0],$lhs[1],$lhs[2]);
}

# _showdist -- show distance in human readable form
sub _showdist
{
        my($tot,$tag) = @_;
        my($tgb,@elap_tgb);
        my($modlhs);
        my($cur);
        my($bf);
        my(@lhs);

        push(@elap_tgb,5280);
        push(@elap_tgb,12);
        push(@elap_tgb,1);

        while (@elap_tgb > 0) {
                $modlhs = 1;
                foreach $tgb (@elap_tgb) {
                        $modlhs *= $tgb;
                }

                shift(@elap_tgb);

                $cur = $tot / $modlhs;
                $cur = int($cur);
                $tot %= $modlhs;

                $bf = sprintf("%d",$cur);
                push(@lhs,$bf);
        }

        @lhs;
}

sub radius
{
        my($c) = @_;
        my($r);

        $r = $c / $M_PI_2;

        $r;
}

sub square
{
        my($x) = @_;

        $x *= $x;

        $x;
}

sub title
{
        my($val,$sym) = @_;
        my($len);

        $len = length($val);
        while (length($sym) < $len) {
                $sym .= " ";
        }

        $sym;
}

sub prtf
{
        my($fmt);

        $fmt = shift(@_);
        $fmt = sprintf($fmt,@_);
        chomp($fmt);

        push(@out,$fmt);
}

Comment: Re:North Pole (South pole ring data) (Score 1) 477

by Forever Wondering (#49741915) Attached to: The Brainteaser Elon Musk Asks New SpaceX Engineers

Here's the first hundred latitutes [I wrote a perl program--so it could never be wrong ;-) and I had to derive it]

loop degrees S lat dist to S pole
001x 89.973676291007 1 mi, 840 ft, 4 in 002x 89.975483447346 1 mi, 420 ft, 2 in
003x 89.976085832792 1 mi, 280 ft, 1 in 004x 89.976387025515 1 mi, 210 ft, 1 in
005x 89.976567741149 1 mi, 168 ft, 0 in 006x 89.976688218238 1 mi, 140 ft, 0 in
007x 89.976774273302 1 mi, 120 ft, 0 in 008x 89.976838814600 1 mi, 105 ft, 0 in
009x 89.976889013387 1 mi, 93 ft, 4 in 010x 89.976929172417 1 mi, 84 ft, 0 in
011x 89.976962029805 1 mi, 76 ft, 4 in 012x 89.976989410962 1 mi, 70 ft, 0 in
013x 89.977012579633 1 mi, 64 ft, 7 in 014x 89.977032438493 1 mi, 60 ft, 0 in
015x 89.977049649506 1 mi, 56 ft, 0 in 016x 89.977064709142 1 mi, 52 ft, 6 in
017x 89.977077997057 1 mi, 49 ft, 5 in 018x 89.977089808536 1 mi, 46 ft, 8 in
019x 89.977100376702 1 mi, 44 ft, 2 in 020x 89.977109888051 1 mi, 42 ft, 0 in
021x 89.977118493557 1 mi, 40 ft, 0 in 022x 89.977126316745 1 mi, 38 ft, 2 in
023x 89.977133459655 1 mi, 36 ft, 6 in 024x 89.977140007323 1 mi, 35 ft, 0 in
025x 89.977146031178 1 mi, 33 ft, 7 in 026x 89.977151591659 1 mi, 32 ft, 3 in
027x 89.977156740252 1 mi, 31 ft, 1 in 028x 89.977161521089 1 mi, 30 ft, 0 in
029x 89.977165972213 1 mi, 28 ft, 11 in 030x 89.977170126595 1 mi, 28 ft, 0 in
031x 89.977174012953 1 mi, 27 ft, 1 in 032x 89.977177656414 1 mi, 26 ft, 3 in
033x 89.977181079058 1 mi, 25 ft, 5 in 034x 89.977184300371 1 mi, 24 ft, 8 in
035x 89.977187337608 1 mi, 24 ft, 0 in 036x 89.977190206110 1 mi, 23 ft, 4 in
037x 89.977192919558 1 mi, 22 ft, 8 in 038x 89.977195490193 1 mi, 22 ft, 1 in
039x 89.977197929001 1 mi, 21 ft, 6 in 040x 89.977200245868 1 mi, 21 ft, 0 in
041x 89.977202449717 1 mi, 20 ft, 5 in 042x 89.977204548621 1 mi, 20 ft, 0 in
043x 89.977206549902 1 mi, 19 ft, 6 in 044x 89.977208460215 1 mi, 19 ft, 1 in
045x 89.977210285625 1 mi, 18 ft, 8 in 046x 89.977212031670 1 mi, 18 ft, 3 in
047x 89.977213703415 1 mi, 17 ft, 10 in 048x 89.977215305504 1 mi, 17 ft, 6 in
049x 89.977216842202 1 mi, 17 ft, 1 in 050x 89.977218317431 1 mi, 16 ft, 9 in
051x 89.977219734809 1 mi, 16 ft, 5 in 052x 89.977221097672 1 mi, 16 ft, 1 in
053x 89.977222409106 1 mi, 15 ft, 10 in 054x 89.977223671968 1 mi, 15 ft, 6 in
055x 89.977224888909 1 mi, 15 ft, 3 in 056x 89.977226062387 1 mi, 15 ft, 0 in
057x 89.977227194690 1 mi, 14 ft, 8 in 058x 89.977228287949 1 mi, 14 ft, 5 in
059x 89.977229344148 1 mi, 14 ft, 2 in 060x 89.977230365140 1 mi, 14 ft, 0 in
061x 89.977231352657 1 mi, 13 ft, 9 in 062x 89.977232308319 1 mi, 13 ft, 6 in
063x 89.977233233642 1 mi, 13 ft, 4 in 064x 89.977234130049 1 mi, 13 ft, 1 in
065x 89.977234998874 1 mi, 12 ft, 11 in 066x 89.977235841371 1 mi, 12 ft, 8 in
067x 89.977236658719 1 mi, 12 ft, 6 in 068x 89.977237452028 1 mi, 12 ft, 4 in
069x 89.977238222342 1 mi, 12 ft, 2 in 070x 89.977238970646 1 mi, 12 ft, 0 in
071x 89.977239697872 1 mi, 11 ft, 10 in 072x 89.977240404898 1 mi, 11 ft, 8 in
073x 89.977241092552 1 mi, 11 ft, 6 in 074x 89.977241761622 1 mi, 11 ft, 4 in
075x 89.977242412849 1 mi, 11 ft, 2 in 076x 89.977243046939 1 mi, 11 ft, 0 in
077x 89.977243664559 1 mi, 10 ft, 10 in 078x 89.977244266343 1 mi, 10 ft, 9 in
079x 89.977244852891 1 mi, 10 ft, 7 in 080x 89.977245424776 1 mi, 10 ft, 6 in
081x 89.977245982541 1 mi, 10 ft, 4 in 082x 89.977246526701 1 mi, 10 ft, 2 in
083x 89.977247057749 1 mi, 10 ft, 1 in 084x 89.977247576153 1 mi, 10 ft, 0 in
085x 89.977248082359 1 mi, 9 ft, 10 in 086x 89.977248576793 1 mi, 9 ft, 9 in
087x 89.977249059861 1 mi, 9 ft, 7 in 088x 89.977249531950 1 mi, 9 ft, 6 in
089x 89.977249993430 1 mi, 9 ft, 5 in 090x 89.977250444655 1 mi, 9 ft, 4 in
091x 89.977250885963 1 mi, 9 ft, 2 in 092x 89.977251317677 1 mi, 9 ft, 1 in
093x 89.977251740108 1 mi, 9 ft, 0 in 094x 89.977252153550 1 mi, 8 ft, 11 in
095x 89.977252558288 1 mi, 8 ft, 10 in 096x 89.977252954594 1 mi, 8 ft, 9 in
097x 89.977253342729 1 mi, 8 ft, 7 in 098x 89.977253722943 1 mi, 8 ft, 6 in
099x 89.977254095476 1 mi, 8 ft, 5 in 100x 89.977254460558 1 mi, 8 ft, 4 in

Comment: Re:bypass operation must be covered under ACA (Score 1) 118

by Forever Wondering (#49541661) Attached to: Swallowing Your Password

Re: Nixon. Remember the bumper sticker "Don't blame me--I'm from Massachusetts"? I'm still screaming bloody murder about current state surveillance. Some may be necessary, but the amount being done far exceeds what is needed.

Also, 50 years ago, people were screaming about Medicare [with the same arguments about gov't takeover of healthcare]. Now, we recognize the comfort and safety net it has given our senior citizens to have good health care in their declining years when they need it the most.

Comment: bypass operation must be covered under ACA (Score 3, Insightful) 118

by Forever Wondering (#49532221) Attached to: Swallowing Your Password

The heart bypass operation must be covered under the ACA (aka Obamacare). Insurance companies can no longer discriminate based on pre-existing conditions and can no longer impose a lifetime coverage cap.

That is not to say that the implant idea is a good one for a number of other reasons.

Comment: Re:The 777 is unique in its vulnerability (Score 1) 113

I'm not Alanis.

Perhaps, ironic was an unfortunate choice of words, but I didn't mean it in terms of sarcastic/sardonic. There is an alternate definition:

happening in the opposite way to what is expected, and typically causing wry amusement because of this.
"it was ironic that now that everybody had plenty of money for food, they couldn't obtain it because everything was rationed"

(e.g. paradoxical, incongruous)

Shortly after 9/11 when they were first proposing armoring the cockpit doors, I remember thinking: "But, what if you have [a legitimate need] to get in there?". Hence, the irony for me. If the locked out pilot had access through such a maintenance port, he might have been able to override the suicidal co-pilot.

After GermanWings, there are new proposals:
(1) Europe adopting the U.S. policy of two crew members in the cockpit at all times [even if one is a flight attendant].
(2) Aircraft flight systems will [forcibly] take over flying the plane if they detect something [egregiously] unsafe--not merely warn the pilot.
(3) Allow a ground based pilot crew to take over flying the aircraft remotely (like a drone aircraft) if something is unsafe.
(4) Not allowing [as is presently allowed] a single person to disable the cockpit door unlock codes/keys.

Remedies (2) and (3) aren't limited to just a suicidal pilot. Hypoxia may overcome both pilot/co-pilot before they have a chance to switch to oxygen.

But, if people are screaming "beware of hackers" now, just imagine the hoopla surrounding implementation of (3). Although remote drone piloting is used by military drones, there have been some [unconfirmed] reports of nefarious people being able to take over drones.

Comment: Had a fire--Here's what I did (Score 1) 446

I actually experienced the scenario you're talking about: fire in my apartment complex. Fortunately, nobody was hurt but several people lost all their possessions. Lucky for me, the fire only got within 90 feet of my place [while the fire was raging I was sweating bullets]. This was the one day I didn't have my laptop [which was my previous backup in case of fire] with me and I was out at the time.

I now use a 64GB USB stick that I carry on my keyring, so it's always with me. I also have one that's in the trunk of my car [under the spare tire].

Additionally, mailing the the USB stick to a family member or friend [one that you trust]. Also, get a safe deposit box. This can hold a full blown 4GB USB portable drive that can keep a lot more data. Because you stated that you only need 5GB or so, this makes the USB stick the ideal solution.

If you're paranoid, encrypt the backup.

Keep multiple disks of whatever variety and rotate them. That is, backup to disk A on Monday, disk B on Tuesday, etc. That way, if the actual backup process croaks the backup media (e.g. power failure during the backup), you still have other copies. This rotation also applies to trips to the safe deposit box and return mailings from your trusted friend with the older backup drives.

Of course, you can do the encryption yourself locally and send it to the cloud [as others have suggested]. Use multiple vendors in case one goes out of business. Actually, this may not work too well because of ISP datacaps and slow uplink speeds if you have a lot of data, not because of the cloud storage company per se.

Comment: Re:Hell No Hillary (Score 1) 676

by Forever Wondering (#49459495) Attached to: Hillary Clinton Declares 2016 Democratic Presidential Bid

Cute animation, but you actually disprove your own point as one of the top search results was wikipedia. From the wiki entry, http://en.wikipedia.org/wiki/L... the Clinton, Carter, and Ford administrations each had two "scandals" in the executive branch. Most other [recent] republican ones had many more.

BTW, I didn't check the other search results because they appeared to be obscure_website_ive_never_heard_of.com and while wikipedia is far from perfect, I'd trust it [a bit] more than the others. Actually, I'd prefer a truly credible source like Wash. Post, NYT, CNN, LA Times, The Economist, etc.

Comment: Re: Fortran as a systems language (Score 1) 177

by Forever Wondering (#49263503) Attached to: Preferred programming paradigm?

I used to work for Prime [circa 1978] and used their Fortran to do system programming like things. It was fine. They even had an SLR metaparser written in it which we used in their in-house CAD system. IIRC, it was Fortran of the day plus a few intrinsics/assembly routines to be able to hit the hardware.

Comment: Re:Obligatory (Score 1) 161

by Forever Wondering (#48790001) Attached to: Rust Programming Language Reaches 1.0 Alpha

For example,

        Circle * foo() {

                Circle c1(5);

                Circle c2(10);

                return biggestCircle(&c1,&c2);

        }

We know that would be invalid, but a C++ compiler wouldn't see any problem. The Rust compiler, on the other hand, can see that the lifetime of the return object of biggestCircle can be no longer than the lifetime of either parameter.

If Circle is a non-trivial struct (e.g. has 50 elements in it), passing by reference might be done for efficiency [e.g. biggestCircle args are "const Circle *"].

A compiler shouldn't make an assumption because biggestCircle might be defined in a separate .cc file and might clone/dup its return value from its arguments or a combination of arguments. The invocation might be:
    x = foo(); ...
    free(x);

Or biggestCircle might return something only obliquely related to c1/c2. biggestCircle might compare c1/c2 and get the max, but then do a search within "the global list of geometric objects" looking for a match to the max value and return the global/persistent value [which would live on beyond the outer return].

Rust would squash this even though it's perfectly valid [and desired].

Comment: Re:It's in the image (Score 2, Interesting) 187

by Forever Wondering (#48669775) Attached to: Human Eye's Oscillation Rate Determines Smooth Frame Rate

The mayonaise you like is the mayonaise you grew up with ...

Films are shot at 24 fps, but displayed [in theaters] at 48 fps, each frame is displayed twice: f0, black, f0, black, f1, black, f1, black, f2, ...

According to one study, when test audiences were shown true 1-to-1 48 fps film, they actually preferred the 24 fps.

The same is true for audio. Those that grew up on 128 kbps .mp3's preferred that over higher fidelity formats.

The human optic nerve has [surprisingly] low bandwidth. I worked for a company that developed a [now shipping] video product that models the human optic system and removes detail that the human eye would not see. This allows better compression without sacrificing video quality. In A/B testing of original [uncompressed] video sources vs. the detail reduced video, test audiences preferred the detail reduced video. It was considered "cleaner" and "more pleasing".

The Universe is populated by stable things. -- Richard Dawkins

Working...