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

 



Forgot your password?
typodupeerror
×

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

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) 496

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:Tolls? (Score 1) 837

I will give you the best and most classic example I use for "all taxes are regressive"

In the 90s, under Clinton and the (R) congress, they passed a Luxury tax on Boats, Planes and other high end things. Completely "progressive" in approach.

What happened was, the rich avoided the taxes, by avoiding buying the very things being taxed. It was so bad, that it nearly ruined a number of industries (Boating) that catered to those "rich" people. It was so bad, that it was quickly and quietly repealed. WHY? Because the taxes didn't hurt the people it was designed for, it hurt the guys building the boats etc. The "Progressive" tax was in fact, quite regressive in result.

I understand what people mean by "progressive" and "regressive" but results matter, not the goal.

Comment Re:Tolls? (Score 1) 837

I will give you the best and most classic example I use for "all taxes are regressive"

In the 90s, under Clinton and the (R) congress, they passed a Luxury tax on Boats, Planes and other high end things. Completely "progressive" in approach.

What happened was, the rich avoided the taxes, by avoiding buying the very things being taxed. It was so bad, that it nearly ruined a number of industries (Boating) that catered to those "rich" people. It was so bad, that it was quickly and quietly repealed. WHY? Because the taxes didn't hurt the people it was designed for, it hurt the guys building the boats etc. The "Progressive" tax was in fact, quite regressive in result.

I am not against taxes. Just want people to know that I want taxes to be as minimal as possible.

Comment Streisand Effect (Score 4, Insightful) 379

Dear Principal,

Do you really want to bring this kind of publicity to you and the school you're representing? I'm pretty sure that you won't be able to handle the backlash, and you might actually have to resign or ... get fired.

Unless you have a Board adopted policy, predating the photographs, you're in a really tough position.

Sincerely,
The Internet Community.

Comment Re:At the companies I've worked with... (Score 0) 271

Taking classes or learning on your own doesn't count.

No, but it facilitiates "stretching the truth a bit" - after a few Python Youtube videos, that Perl project could easily become a Python project, and nobody would be the wiser. As for "Some PHP contact" and "major league PHP scoring" - it should be clear from most PHP which is written on most CVs. The HR dept probably can't tell PHP from Baseball anyway. If they can, - well, you just have to apply somewhere else.

And you may need to cut that lawn.

Comment Re:Cost (Score 0) 134

Compare to the Specs on the OnePlus One. And that makes it three times the price of a phone with much better specs, even if it isn't 100% open. The Neo900 is a phone for Tin Foil Hat wearers and unwashed grey beards living in mom's basement. And if you are that paranoid, you probably aren't going to have any phone.

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

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

Slashdot Top Deals

The use of money is all the advantage there is to having money. -- B. Franklin

Working...