问:
Only 14 bytes are uploaded into Google Cloud Storage
I'm trying to upload some files into Google Cloud Storage using PHP. It seems to be partially working, since I'm seeing the files in the web console, however I've noticed that all files are only 14 bytes in size, while the original is much bigger.

This is the code I'm using:

```<code>/**
 *
 */
public static function saveFile($originalFile, $newFilename) {

    $bucket = MyStorage::getBucket();

    if ($bucket == null) {

        // Save locally
        Storage::disk('local')->put(FileController::$FILE_DIR . $newFilename, file_get_contents($originalFile));

    } else {

        // Save to Google Cloud Platform
        $bucket->upload($originalFile->getRealPath(), ['name' => $newFilename]);

    }
}

/**
 *
 */
private static function getBucket() {

    $appEnv = getenv('APP_ENV');

    if ($appEnv == "production" || $appEnv == "test") {

        $GOOGLE_CLOUD_PROJECT_ID = getenv('GOOGLE_PROJECT_ID');
        $GOOGLE_CLOUD_BUCKET_NAME = getenv('GOOGLE_BUCKET_NAME');

        $storage = new StorageClient(['projectId' => $GOOGLE_CLOUD_PROJECT_ID]);
        $bucket = $storage->bucket($GOOGLE_CLOUD_BUCKET_NAME);

        return $bucket;

    } else {

        return null;
    }
}
</code>```

$originalFile->getRealPath() returns something like /tmp/asdfasdfadf and I've verified that that file exists and is a reasonable size. The $newFilename variable name is what I want it to be stored as and this part seems to work as I'm seeing that filename in the web console.

Any ideas what could be happening?

答: Yes for using file upload, you need to read the stream of bytes to send it to remote cloud. fopen will do this job for you, to create stream of bytes.</p>

Body:
I'm trying to upload some files into Google Cloud Storage using PHP. It seems to be partially working, since I'm seeing the files in the web console, however I've noticed that all files are only 14 bytes in size, while the original is much bigger.

This is the code I'm using:

/**
 *
 */
public static function saveFile($originalFile, $newFilename) {

    $bucket = MyStorage::getBucket();

    if ($bucket == null) {

        // Save locally
        Storage::disk('local')->put(FileController::$FILE_DIR . $newFilename, file_get_contents($originalFile));

    } else {

        // Save to Google Cloud Platform
        $bucket->upload($originalFile->getRealPath(), ['name' => $newFilename]);

    }
}

/**
 *
 */
private static function getBucket() {

    $appEnv = getenv('APP_ENV');

    if ($appEnv == "production" || $appEnv == "test") {

        $GOOGLE_CLOUD_PROJECT_ID = getenv('GOOGLE_PROJECT_ID');
        $GOOGLE_CLOUD_BUCKET_NAME = getenv('GOOGLE_BUCKET_NAME');

        $storage = new StorageClient(['projectId' => $GOOGLE_CLOUD_PROJECT_ID]);
        $bucket = $storage->bucket($GOOGLE_CLOUD_BUCKET_NAME);

        return $bucket;

    } else {

        return null;
    }
}

$originalFile->getRealPath() returns something like /tmp/asdfasdfadf and I've verified that that file exists and is a reasonable size. The $newFilename variable name is what I want it to be stored as and this part seems to work as I'm seeing that filename in the web console.

Any ideas what could be happening?


来源: stackexchange

问:
How are RPMs in RHEL Package named?
I see that the RPM packages are named as below , but then I am confused about how a RPM released with new patch named ?
For e.g

```<code> RPM packages typically have file names like foo-1.0-1.i386.rpm.
 The file name includes the package name (foo), version (1.0), release (1),
 and architecture (i386).
</code>```

Now I have a unix odbc installed on my box whose version is unixODBC-2.2.14-12.el6_3.x86_64 . There was a bug in unixodbc which was resolved in 2.2.14p2-1 so I am wondering which unixodbc rpm should I be looking for

does 2.2.14p2-1 means unixODBC-2.2.14-21.el6_3.x86_64 or unixODBC-2.2.14-12.el6_3.x86_64 . I know all RPMs created for el6 with this patch and above will have fix but I see the RHEL has just the below three version unixODBC-2.2.14-12.el6_3.x86_64 , unixODBC-2.2.14-11.el6_3.x86_64 and unixODBC-2.2.14-14.el6_3.x86_64 in its repo .

答:
The usual convention is "version"-"release" with an optional "dot-plus-distribution" as part of the release. The version matches upstream; the release is changed by the packager (each time they add a patch or rebuild for other reasons). See also https://fedoraproject.org/wiki/Packaging:Versioning.

In your example, 2.2.14p2-1 would mean unixODBC's version number is "2.2.14p2" and it is the first time the vendor packaged it. That may or may not be included in 2.2.14-14.el6_3, the 14th release of "2.2.14" for CentOS 6.3. I say "maybe" because the "p2" of the upstream could be indicating a patch that CentOS already applies that the upstream has accepted. Or they just haven't downloaded and built the newest version yet.

ContentLicense: CC BY-SA 3.0

Title: How are RPMs in RHEL Package named?

Body:
I see that the RPM packages are named as below , but then I am confused about how a RPM released with new patch named ?
For e.g

 RPM packages typically have file names like foo-1.0-1.i386.rpm.
 The file name includes the package name (foo), version (1.0), release (1),
 and architecture (i386).

Now I have a unix odbc installed on my box whose version is unixODBC-2.2.14-12.el6_3.x86_64 . There was a bug in unixodbc which was resolved in 2.2.14p2-1 so I am wondering which unixodbc rpm should I be looking for

does 2.2.14p2-1 means unixODBC-2.2.14-21.el6_3.x86_64 or unixODBC-2.2.14-12.el6_3.x86_64 . I know all RPMs created for el6 with this patch and above will have fix but I see the RHEL has just the below three version unixODBC-2.2.14-12.el6_3.x86_64 , unixODBC-2.2.14-11.el6_3.x86_64 and unixODBC-2.2.14-14.el6_3.x86_64 in its repo .


问:
Expression in FOR section of PIVOT
I'm trying to use PIVOT to get the total weight of purchases per product, broken down by year/month in columns. Something like this:

```<code>+------------+--------+--------+--------+
| ProductKey | Jan-14 | Feb-14 | Mar-14 | Etc...
+------------+--------+--------+--------+
|         10 |   5000 |   7000 |   3000 |
|         20 |  10000 |   8000 |   6000 |
|         30 |    250 |    500 |    400 |
+------------+--------+--------+--------+
</code>```

This is my first time trying to use PIVOT, so not sure this is right:

```<code>PIVOT
(
SUM([PO_PurchaseOrderLines].[EstimatedWeight])
FOR
LEFT(DATENAME(MONTH,[PO_Date]),3) & "-" & RIGHT(YEAR([PO_Date]),2)
IN (Jan-14, Feb-14, Mar-14, Apr-14, May-14, Jun-14, Jul-14, Aug-14, Sep-14, Oct-14, Nov-14, Dec-14, Jan-15, Feb-15, Mar-15, Apr-15, May-15, Jun-15, Jul-15, Aug-15, Sep-15, Oct-15, Nov-15, Dec-15, Jan-16, Feb-16, Mar-16, Apr-16, May-16, Jun-16, Jul-16, Aug-16, Sep-16, Oct-16, Nov-16, Dec-16, Jan-17, Feb-17, Mar-17)
) AS POPivot
</code>```

Running this results in:

```<code>[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'LEFT'.
</code>```

Is using an expression like this in the FOR section not possible? Is there something else incorrect?

答:
This is the Requested Dynamic Version</p>

```<code>Declare @SQL varchar(max) = ''
Select  @SQL = Stuff((Select ',' + QuoteName(Col)
                       From (Select Distinct Top 100
                                    Col=format(PO_Date,'MMM-yy')
                                   ,Ord=format(PO_Date,'yyyy-MM')
                              From  YourTable
                              Where PO_Date>=DateAdd(MONTH,-36,DateFromParts(Year(GetDate()),Month(GetDate()),1))   -- Adjust This Value +/-
                              Order By 2
                             ) A  For XML Path('')),1,1,'')

Select  @SQL = '
Select *
From (
        Select ProductKey
              ,Col = format(PO_Date,''MMM-yy'')
              ,EstimatedWeight
         From YourTable A
     ) A
 Pivot (sum(EstimatedWeight) For [Col] in (' + @SQL + ') ) p'
Exec(@SQL);
</code>```

Title: Expression in FOR section of PIVOT

Body:
I'm trying to use PIVOT to get the total weight of purchases per product, broken down by year/month in columns. Something like this:

+------------+--------+--------+--------+
| ProductKey | Jan-14 | Feb-14 | Mar-14 | Etc...
+------------+--------+--------+--------+
|         10 |   5000 |   7000 |   3000 |
|         20 |  10000 |   8000 |   6000 |
|         30 |    250 |    500 |    400 |
+------------+--------+--------+--------+

This is my first time trying to use PIVOT, so not sure this is right:

PIVOT
(
SUM([PO_PurchaseOrderLines].[EstimatedWeight])
FOR
LEFT(DATENAME(MONTH,[PO_Date]),3) & "-" & RIGHT(YEAR([PO_Date]),2)
IN (Jan-14, Feb-14, Mar-14, Apr-14, May-14, Jun-14, Jul-14, Aug-14, Sep-14, Oct-14, Nov-14, Dec-14, Jan-15, Feb-15, Mar-15, Apr-15, May-15, Jun-15, Jul-15, Aug-15, Sep-15, Oct-15, Nov-15, Dec-15, Jan-16, Feb-16, Mar-16, Apr-16, May-16, Jun-16, Jul-16, Aug-16, Sep-16, Oct-16, Nov-16, Dec-16, Jan-17, Feb-17, Mar-17)
) AS POPivot

Running this results in:

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'LEFT'.

Is using an expression like this in the FOR section not possible? Is there something else incorrect?

Body:
This is the Requested Dynamic Version

Declare @SQL varchar(max) = ''
Select  @SQL = Stuff((Select ',' + QuoteName(Col)
                       From (Select Distinct Top 100
                                    Col=format(PO_Date,'MMM-yy')
                                   ,Ord=format(PO_Date,'yyyy-MM')
                              From  YourTable
                              Where PO_Date>=DateAdd(MONTH,-36,DateFromParts(Year(GetDate()),Month(GetDate()),1))   -- Adjust This Value +/-
                              Order By 2
                             ) A  For XML Path('')),1,1,'')

Select  @SQL = '
Select *
From (
        Select ProductKey
              ,Col = format(PO_Date,''MMM-yy'')
              ,EstimatedWeight
         From YourTable A
     ) A
 Pivot (sum(EstimatedWeight) For [Col] in (' + @SQL + ') ) p'
Exec(@SQL);


问:
Trouble Loading thumbnails from XML in Flash as3.0
I have made a gallery script that loads from xml a large image, text, and 3 thumbnails.
I am having trouble getting the thumbnails to load for some reason.
I have it so that the three thumbnails should be the previous image, the current image, and the next image. Except when you click on the current image it should load a random image. The buttons work for this but if I try to load thumbnails. They don't appear.

To load the thumbnails I have created a for loop for the array of thumbnails and the number of the image is recorded by the variable noOfImage.
I then load the other thumbnails by subtracting 1 to noOfImage if the prev button is clicked(mousewheel down or key dwn or key left) and adding 1 to noOfImage if the next button is clicked(wheel and keys...)

When I trace what the variables for the thumbnail number is they seem to be correct at times and other times I am receiving errors.

For ex.
If I load the swf and click next. The previous image is "4294967295" and the next is 1 but it outputs this "Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found."

If the value of nextImage = 1 then I dont see why it isn't loading. And why is it giving a weird number for what should be 0?  I can not tell if the problem is with the if statements I use to handle the noOfImage variables or if it has something to do with the loaders or thumbnail containers... I keep trying everything I can think of. my original version loaded all the thumbs with a for loop and worked but I was having trouble making them into clickable buttons and decided to make it simpler.

here is an example of how far i've gotten with the script.
http://soulseekrecords.org/psysci/portfolio/Portfolio.swf

below is all my code sorry if it is messy or unclear. I try my best.

```<code>//import tweening files
import com.greensock.*;
import com.greensock.easing.*;
import flash.display.MovieClip;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFormat;
import fl.controls.UIScrollBar;
import flash.display.Sprite;
import com.greensock.plugins.*;
TweenPlugin.activate([TintPlugin]);

//create sprite background
var backgrnd:Sprite = new Sprite();

//create array of image names
var imageNames:Array = new Array();

//create array of text descriptions
var descText:Array = new Array();

//create array for dice images
var dinames:Array = new Array();

//variable for total number of images
var totalImages:uint = imageNames.length;

//add sprite variables
var thumb:Sprite = new Sprite();
var thumb2:Sprite = new Sprite();
var thumb3:Sprite = new Sprite();

// create loaders
var smImageLoader:Loader = new Loader();
var smImageLoader2:Loader = new Loader();
var smImageLoader3:Loader = new Loader();

//create a variable to load the large image
var bigImageLoader:Loader = new Loader();

//create variables for the image #
var noOfImage:int;
var prevImage:uint;
var nextImage:uint;

//create random number var
var randomNumber:uint;

prevImage = 0;
nextImage = totalImages;

noOfImage = -1;

// add sprite to display list
addChild(thumb);
addChild(thumb2);
addChild(thumb3);
thumb.graphics.beginFill(0xFFFFFF);
thumb.graphics.drawRect(25, 325, 75, 75);
thumb.graphics.endFill();
thumb2.graphics.beginFill(0xFFFFFF);
thumb2.graphics.drawRect(125, 325, 75, 75);
thumb2.graphics.endFill();
thumb3.graphics.beginFill(0xFFFFFF);
thumb3.graphics.drawRect(225, 325, 75, 75);
thumb3.graphics.endFill();
thumb.alpha = 1;
thumb2.alpha = 1;
thumb3.alpha = 1;
thumb.addChild(smImageLoader2);
thumb2.addChild(smImageLoader3);
thumb3.addChild(smImageLoader);
smImageLoader.y = 325;
smImageLoader2.y = 325;
smImageLoader3.y = 325;
smImageLoader.x = 25;
smImageLoader2.x = 125;
smImageLoader3.x = 225;

//Scroll Variables
var scrollBarAdd:Boolean = false;
var scrollBar:UIScrollBar = new UIScrollBar();

var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("portfolio.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);

function processXML(e:Event)
{
    myXML = new XML (e.target.data);
    for(var i:uint = 0; i < myXML.img.length() ; i++)
    {
        imageNames.push(myXML.img[i].text());
        descText.push(myXML.txt[i].text());
        dinames.push(myXML.imgd[i].text());
    }
    totalImages = imageNames.length;
}

//add background color sprite
addChild(backgrnd);
setChildIndex(backgrnd,0);

//add background properties
backgrnd.graphics.beginFill(0xFFFFFF);
backgrnd.graphics.drawRect(0, 0, 900, 500);

//add background image
var backrobe:Loader = new Loader();
addChild(backrobe);
backrobe.x = 0;
backrobe.y = 0;
backrobe.load(new URLRequest("images/background.png"));

//add bigImageLoader to the display list
addChild(bigImageLoader);
bigImageLoader.x = 225;
bigImageLoader.y = 25;

//add buttons fwd and rev
var forward:fwd = new fwd();
var reverse:rev = new rev();
addChild(forward);
addChild(reverse);
forward.x = 155;
forward.y = 365;
reverse.x = 33;
reverse.y = 365;

forward.addEventListener(MouseEvent.MOUSE_OVER, mseovr);
reverse.addEventListener(MouseEvent.MOUSE_OVER, mseovr2);
forward.addEventListener(MouseEvent.MOUSE_OUT, mseout);
reverse.addEventListener(MouseEvent.MOUSE_OUT, mseout2);
function mseovr (event:MouseEvent){
    TweenLite.to(forward, .1, {alpha:.5});
}
function mseovr2 (event:MouseEvent) {
    TweenLite.to(reverse, .1, {alpha:.5});
}
function mseout (event:MouseEvent){
    TweenLite.to(forward, .1, {alpha:1});
}
function mseout2 (event:MouseEvent) {
    TweenLite.to(reverse, .1, {alpha:1});
}

//Variable Key Press Function
var rkey:uint = 39;
var lkey:uint = 37;
var ukey:uint = 38;
var dkey:uint = 40;

//create a textField
var myText:TextField = new TextField();

//add text box to display list
addChild(myText);
myText.width = 200;
myText.height = 340;
myText.x = 5;
myText.y = 5;
myText.wordWrap = true;
myText.multiline = true;
myText.selectable = true;

var format:TextFormat = new TextFormat();
            format.font = "Arial";
            format.color = 0xFFFFFF;
            format.size = 20;
            format.underline = false;
            myText.defaultTextFormat = format;

//add button
var hotSpot:hotspot = new hotspot();

//add button to display list
addChild(hotSpot);

//Set button x and y position
hotSpot.x = 92;
hotSpot.y = 367;
hotSpot.alpha = 0;
hotSpot.width = 50;
hotSpot.height = 50;

//set buttonmode
hotSpot.buttonMode = true;

//make sure all clicks register with the thumb itself (not inner contents)
hotSpot.mouseChildren = false;

//add click listener to the button
hotSpot.addEventListener(MouseEvent.MOUSE_DOWN, buttonClickHandler);
hotSpot.addEventListener(MouseEvent.MOUSE_OVER, mouseoverhotspot);
hotSpot.addEventListener(MouseEvent.MOUSE_OUT, mouseouthotspot);

function mouseoverhotspot(event:MouseEvent){
TweenLite.to(hotSpot, .1, {alpha:.5});
}
function mouseouthotspot(event:MouseEvent){
TweenLite.to(hotSpot, 1, {alpha:0});
}

function buttonClickHandler (event:MouseEvent)
    {
        randomNumber = Math.random()*3;
        noOfImage = randomNumber;
        loadersnlist();

    }

stage.addEventListener(MouseEvent.MOUSE_WHEEL, upmouse);

function upmouse(event:MouseEvent)
    {
        if (event.delta == 3)
        {
            noOfImage = noOfImage + 1;
                if (noOfImage == totalImages)
                    {
                        noOfImage = noOfImage - totalImages;
                    }

        }
            if (event.delta == -3)
                {

                    if (noOfImage == -1 || noOfImage == -2)
                        {
                        noOfImage = totalImages;
                        }
                            if (noOfImage == 0)
                                {
                                    noOfImage = noOfImage + totalImages;
                                }
            noOfImage = noOfImage - 1;
                }
        loadersnlist();

    }

forward.addEventListener(MouseEvent.CLICK, fwdclck);
    function fwdclck (event:MouseEvent)
    {
        noOfImage = noOfImage + 1;
        if (noOfImage == totalImages)
            {
            noOfImage = noOfImage - totalImages;
            }
        loadersnlist();
    }

reverse.addEventListener(MouseEvent.CLICK, revclck);

function revclck(event:MouseEvent)
    {
        if (noOfImage == -1 || noOfImage == -2)
            {
            noOfImage = totalImages;
            }
        if (noOfImage == 0)
            {
            noOfImage = noOfImage + totalImages;
            }
        noOfImage = noOfImage - 1;
        loadersnlist();
    }

//Key Right Arrow Event
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyright);

function keyright(event:KeyboardEvent)
{

    if (event.keyCode==rkey || event.keyCode==ukey)
        {
            noOfImage = noOfImage + 1;
            if (noOfImage == totalImages)
                {
                noOfImage = noOfImage - totalImages;
                }
            loadersnlist();
        }
}

//Key Left Arrow Event
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyleft);

function keyleft(event:KeyboardEvent){

    if (event.keyCode==lkey || event.keyCode==dkey)
        {
            if (noOfImage == -1 || noOfImage == -2)
                {
                noOfImage = totalImages;
                }
    if (noOfImage == 0)
        {
        noOfImage = noOfImage + totalImages;
        }
        noOfImage = noOfImage - 1;
        loadersnlist();
        }
}

function scrollerthing ()
    {
        if (myText.textHeight > myText.height)
        {
            scrollBar.scrollTarget = myText;  //assign the target of the scrollBar to your textfield
            scrollBar.height = myText.height;  //make the height the same as the textfield
            scrollBar.move(myText.x + myText.width, myText.y);  //Move the scrollbar to the righthand side
            addChild(scrollBar);
            scrollBar.update();
            scrollBarAdd = true;
        } else
        {

            if((myText.textHeight < myText.height) && scrollBarAdd == true)
                {
                    scrollBarAdd = false;
                    removeChild(scrollBar);
                }
        }
    }

function loadersnlist ()
    {
        bigImageLoader.load(new URLRequest("images/" + imageNames[noOfImage] ) );
        bigImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, tweenage);
        smImageLoader.load(new URLRequest("thumbs/" + dinames[noOfImage] ) );
        smImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, tweenage2);
        prevImage = noOfImage - 1;
        nextImage = noOfImage + 1;
        if (prevImage <= -1){
            prevImage = totalImages;
        }
        if (nextImage >= totalImages){
            nextImage = 0;
        }
        trace (prevImage);
        trace (nextImage);
        smImageLoader2.load(new URLRequest("thumbs/" + dinames[prevImage] ) );
        smImageLoader2.contentLoaderInfo.addEventListener(Event.COMPLETE, tweenage2);
        smImageLoader3.load(new URLRequest("thumbs/" + dinames[nextImage] ) );
        smImageLoader3.contentLoaderInfo.addEventListener(Event.COMPLETE, tweenage2);
    }

function tweenage(e:Event)
    {
        bigImageLoader.alpha = 0;
        TweenLite.to( bigImageLoader, 5, {alpha:1, ease:Expo.easeOut} );
        myText.alpha = 0;
        TweenLite.to( myText, 5, {alpha:1} );
        myText.text = String (descText[noOfImage]);
        scrollerthing();
    }

function tweenage2 (e:Event)
    {
        //create a variable to load small thumbnail url image
        TweenLite.to( smImageLoader, 5, {scaleX:.6, scaleY:.6, ease:Expo.easeOut} );
        TweenLite.to( smImageLoader2, 5, {scaleX:.6, scaleY:.6, ease:Expo.easeOut} );
        TweenLite.to( smImageLoader3, 5, {scaleX:.6, scaleY:.6, ease:Expo.easeOut} );
    }
</code>```

答:
You're nearly there in tracing out the thumbnail value. My next step would be to trace out the actual url that you are trying to load.

Doing this will show what you are actually referencing. It looks like you are tracking the prevImage, and setting it to the number of images when it is less than 1. The array of thumbnails is zero-based though, so with 3 thumbnails, the thumbs are at 0, 1, and 2 and you are trying to load dinames[3].

Changing the loadersnlist function to
 prevImage = totalImages-1; should fix it.

As an aside, I'd suggest placing all your asset creation code in a layout function, and then once everything has been added to the stage then calling you loader functions to pull in the data.

ContentLicense: CC BY-SA 2.5

Body:
I have made a gallery script that loads from xml a large image, text, and 3 thumbnails.
I am having trouble getting the thumbnails to load for some reason.
I have it so that the three thumbnails should be the previous image, the current image, and the next image. Except when you click on the current image it should load a random image. The buttons work for this but if I try to load thumbnails. They don't appear.

To load the thumbnails I have created a for loop for the array of thumbnails and the number of the image is recorded by the variable noOfImage.
I then load the other thumbnails by subtracting 1 to noOfImage if the prev button is clicked(mousewheel down or key dwn or key left) and adding 1 to noOfImage if the next button is clicked(wheel and keys...)

When I trace what the variables for the thumbnail number is they seem to be correct at times and other times I am receiving errors.

For ex.
If I load the swf and click next. The previous image is "4294967295" and the next is 1 but it outputs this "Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found."

If the value of nextImage = 1 then I dont see why it isn't loading. And why is it giving a weird number for what should be 0?  I can not tell if the problem is with the if statements I use to handle the noOfImage variables or if it has something to do with the loaders or thumbnail containers... I keep trying everything I can think of. my original version loaded all the thumbs with a for loop and worked but I was having trouble making them into clickable buttons and decided to make it simpler.

here is an example of how far i've gotten with the script.
http://soulseekrecords.org/psysci/portfolio/Portfolio.swf

below is all my code sorry if it is messy or unclear. I try my best.

//import tweening files
import com.greensock.*;
import com.greensock.easing.*;
import flash.display.MovieClip;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFormat;
import fl.controls.UIScrollBar;
import flash.display.Sprite;
import com.greensock.plugins.*;
TweenPlugin.activate([TintPlugin]);

//create sprite background
var backgrnd:Sprite = new Sprite();

//create array of image names
var imageNames:Array = new Array();

//create array of text descriptions
var descText:Array = new Array();

//create array for dice images
var dinames:Array = new Array();

//variable for total number of images
var totalImages:uint = imageNames.length;

//add sprite variables
var thumb:Sprite = new Sprite();
var thumb2:Sprite = new Sprite();
var thumb3:Sprite = new Sprite();

// create loaders
var smImageLoader:Loader = new Loader();
var smImageLoader2:Loader = new Loader();
var smImageLoader3:Loader = new Loader();

//create a variable to load the large image
var bigImageLoader:Loader = new Loader();

//create variables for the image #
var noOfImage:int;
var prevImage:uint;
var nextImage:uint;

//create random number var
var randomNumber:uint;

prevImage = 0;
nextImage = totalImages;

noOfImage = -1;

// add sprite to display list
addChild(thumb);
addChild(thumb2);
addChild(thumb3);
thumb.graphics.beginFill(0xFFFFFF);
thumb.graphics.drawRect(25, 325, 75, 75);
thumb.graphics.endFill();
thumb2.graphics.beginFill(0xFFFFFF);
thumb2.graphics.drawRect(125, 325, 75, 75);
thumb2.graphics.endFill();
thumb3.graphics.beginFill(0xFFFFFF);
thumb3.graphics.drawRect(225, 325, 75, 75);
thumb3.graphics.endFill();
thumb.alpha = 1;
thumb2.alpha = 1;
thumb3.alpha = 1;
thumb.addChild(smImageLoader2);
thumb2.addChild(smImageLoader3);
thumb3.addChild(smImageLoader);
smImageLoader.y = 325;
smImageLoader2.y = 325;
smImageLoader3.y = 325;
smImageLoader.x = 25;
smImageLoader2.x = 125;
smImageLoader3.x = 225;

//Scroll Variables
var scrollBarAdd:Boolean = false;
var scrollBar:UIScrollBar = new UIScrollBar();

var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("portfolio.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);

function processXML(e:Event)
{
    myXML = new XML (e.target.data);
    for(var i:uint = 0; i < myXML.img.length() ; i++)
    {
        imageNames.push(myXML.img[i].text());
        descText.push(myXML.txt[i].text());
        dinames.push(myXML.imgd[i].text());
    }
    totalImages = imageNames.length;
}

//add background color sprite
addChild(backgrnd);
setChildIndex(backgrnd,0);

//add background properties
backgrnd.graphics.beginFill(0xFFFFFF);
backgrnd.graphics.drawRect(0, 0, 900, 500);

//add background image
var backrobe:Loader = new Loader();
addChild(backrobe);
backrobe.x = 0;
backrobe.y = 0;
backrobe.load(new URLRequest("images/background.png"));

//add bigImageLoader to the display list
addChild(bigImageLoader);
bigImageLoader.x = 225;
bigImageLoader.y = 25;

//add buttons fwd and rev
var forward:fwd = new fwd();
var reverse:rev = new rev();
addChild(forward);
addChild(reverse);
forward.x = 155;
forward.y = 365;
reverse.x = 33;
reverse.y = 365;

forward.addEventListener(MouseEvent.MOUSE_OVER, mseovr);
reverse.addEventListener(MouseEvent.MOUSE_OVER, mseovr2);
forward.addEventListener(MouseEvent.MOUSE_OUT, mseout);
reverse.addEventListener(MouseEvent.MOUSE_OUT, mseout2);
function mseovr (event:MouseEvent){
    TweenLite.to(forward, .1, {alpha:.5});
}
function mseovr2 (event:MouseEvent) {
    TweenLite.to(reverse, .1, {alpha:.5});
}
function mseout (event:MouseEvent){
    TweenLite.to(forward, .1, {alpha:1});
}
function mseout2 (event:MouseEvent) {
    TweenLite.to(reverse, .1, {alpha:1});
}

//Variable Key Press Function
var rkey:uint = 39;
var lkey:uint = 37;
var ukey:uint = 38;
var dkey:uint = 40;

//create a textField
var myText:TextField = new TextField();

//add text box to display list
addChild(myText);
myText.width = 200;
myText.height = 340;
myText.x = 5;
myText.y = 5;
myText.wordWrap = true;
myText.multiline = true;
myText.selectable = true;

var format:TextFormat = new TextFormat();
            format.font = "Arial";
            format.color = 0xFFFFFF;
            format.size = 20;
            format.underline = false;
            myText.defaultTextFormat = format;

//add button
var hotSpot:hotspot = new hotspot();

//add button to display list
addChild(hotSpot);

//Set button x and y position
hotSpot.x = 92;
hotSpot.y = 367;
hotSpot.alpha = 0;
hotSpot.width = 50;
hotSpot.height = 50;

//set buttonmode
hotSpot.buttonMode = true;

//make sure all clicks register with the thumb itself (not inner contents)
hotSpot.mouseChildren = false;

//add click listener to the button
hotSpot.addEventListener(MouseEvent.MOUSE_DOWN, buttonClickHandler);
hotSpot.addEventListener(MouseEvent.MOUSE_OVER, mouseoverhotspot);
hotSpot.addEventListener(MouseEvent.MOUSE_OUT, mouseouthotspot);

function mouseoverhotspot(event:MouseEvent){
TweenLite.to(hotSpot, .1, {alpha:.5});
}
function mouseouthotspot(event:MouseEvent){
TweenLite.to(hotSpot, 1, {alpha:0});
}

function buttonClickHandler (event:MouseEvent)
    {
        randomNumber = Math.random()*3;
        noOfImage = randomNumber;
        loadersnlist();

    }

stage.addEventListener(MouseEvent.MOUSE_WHEEL, upmouse);

function upmouse(event:MouseEvent)
    {
        if (event.delta == 3)
        {
            noOfImage = noOfImage + 1;
                if (noOfImage == totalImages)
                    {
                        noOfImage = noOfImage - totalImages;
                    }

        }
            if (event.delta == -3)
                {

                    if (noOfImage == -1 || noOfImage == -2)
                        {
                        noOfImage = totalImages;
                        }
                            if (noOfImage == 0)
                                {
                                    noOfImage = noOfImage + totalImages;
                                }
            noOfImage = noOfImage - 1;
                }
        loadersnlist();

    }

forward.addEventListener(MouseEvent.CLICK, fwdclck);
    function fwdclck (event:MouseEvent)
    {
        noOfImage = noOfImage + 1;
        if (noOfImage == totalImages)
            {
            noOfImage = noOfImage - totalImages;
            }
        loadersnlist();
    }

reverse.addEventListener(MouseEvent.CLICK, revclck);

function revclck(event:MouseEvent)
    {
        if (noOfImage == -1 || noOfImage == -2)
            {
            noOfImage = totalImages;
            }
        if (noOfImage == 0)
            {
            noOfImage = noOfImage + totalImages;
            }
        noOfImage = noOfImage - 1;
        loadersnlist();
    }

//Key Right Arrow Event
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyright);

function keyright(event:KeyboardEvent)
{

    if (event.keyCode==rkey || event.keyCode==ukey)
        {
            noOfImage = noOfImage + 1;
            if (noOfImage == totalImages)
                {
                noOfImage = noOfImage - totalImages;
                }
            loadersnlist();
        }
}

//Key Left Arrow Event
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyleft);

function keyleft(event:KeyboardEvent){

    if (event.keyCode==lkey || event.keyCode==dkey)
        {
            if (noOfImage == -1 || noOfImage == -2)
                {
                noOfImage = totalImages;
                }
    if (noOfImage == 0)
        {
        noOfImage = noOfImage + totalImages;
        }
        noOfImage = noOfImage - 1;
        loadersnlist();
        }
}

function scrollerthing ()
    {
        if (myText.textHeight > myText.height)
        {
            scrollBar.scrollTarget = myText;  //assign the target of the scrollBar to your textfield
            scrollBar.height = myText.height;  //make the height the same as the textfield
            scrollBar.move(myText.x + myText.width, myText.y);  //Move the scrollbar to the righthand side
            addChild(scrollBar);
            scrollBar.update();
            scrollBarAdd = true;
        } else
        {

            if((myText.textHeight < myText.height) && scrollBarAdd == true)
                {
                    scrollBarAdd = false;
                    removeChild(scrollBar);
                }
        }
    }

function loadersnlist ()
    {
        bigImageLoader.load(new URLRequest("images/" + imageNames[noOfImage] ) );
        bigImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, tweenage);
        smImageLoader.load(new URLRequest("thumbs/" + dinames[noOfImage] ) );
        smImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, tweenage2);
        prevImage = noOfImage - 1;
        nextImage = noOfImage + 1;
        if (prevImage <= -1){
            prevImage = totalImages;
        }
        if (nextImage >= totalImages){
            nextImage = 0;
        }
        trace (prevImage);
        trace (nextImage);
        smImageLoader2.load(new URLRequest("thumbs/" + dinames[prevImage] ) );
        smImageLoader2.contentLoaderInfo.addEventListener(Event.COMPLETE, tweenage2);
        smImageLoader3.load(new URLRequest("thumbs/" + dinames[nextImage] ) );
        smImageLoader3.contentLoaderInfo.addEventListener(Event.COMPLETE, tweenage2);
    }

function tweenage(e:Event)
    {
        bigImageLoader.alpha = 0;
        TweenLite.to( bigImageLoader, 5, {alpha:1, ease:Expo.easeOut} );
        myText.alpha = 0;
        TweenLite.to( myText, 5, {alpha:1} );
        myText.text = String (descText[noOfImage]);
        scrollerthing();
    }

function tweenage2 (e:Event)
    {
        //create a variable to load small thumbnail url image
        TweenLite.to( smImageLoader, 5, {scaleX:.6, scaleY:.6, ease:Expo.easeOut} );
        TweenLite.to( smImageLoader2, 5, {scaleX:.6, scaleY:.6, ease:Expo.easeOut} );
        TweenLite.to( smImageLoader3, 5, {scaleX:.6, scaleY:.6, ease:Expo.easeOut} );
    }


问:
Is there a way to define a dynamic query in Kibana dashboard?
A somewhat similar question has been asked here but there's no answer for that yet. That question relates to an older version of Kibana so I hope you can help me.

I'm trying to setup some predefined queries in the Kibana dashboard. I'm using Kibana 5.1. The purpose of those queries is filtering some logs based on multiple different parameters.

Let's see a query I'd like to execute:

```<code>{
  "index": "${index_name}",
  "query": {
    "query_string": {
      "query": "message:(+\"${LOG_LEVEL}\")",
      "analyze_wildcard": true
    }
  }
}
</code>```

I know I can query directly in the dashboard something like "message:(+"ERROR")" and manually change the ERROR to WARN for example, but I don't want that - imagine that this query might be more complex and contain multiple fields.

Note that the data stored in the message is not structured - think of the message as a whole log line. This means I don't have fields like LOG_LEVEL which I could filter directly.

Is there any way I can set the index_name and LOG_LEVEL dynamically from the Kibana Discover dashboard?

答:
You should go to discover, open one document and click over this button in any of the fields. After this, a filter will appear under the search bar and you can edit it and put any custom query. If you want add more filters with more custom queries you can repeat the same action with a different document or field or you can do to Settings (or Management), Saved Objects, go to the Search you saved and to the JSON representation and copy and paste the elements inside the filter array field as many times you want.

And remember that in order to apply one of the filters, you probably should disable the enabled ones (otherwise it will filter by all the enabled filters in your dashboard).

Body:
A somewhat similar question has been asked here but there's no answer for that yet. That question relates to an older version of Kibana so I hope you can help me.

I'm trying to setup some predefined queries in the Kibana dashboard. I'm using Kibana 5.1. The purpose of those queries is filtering some logs based on multiple different parameters.

Let's see a query I'd like to execute:

{
  "index": "${index_name}",
  "query": {
    "query_string": {
      "query": "message:(+\"${LOG_LEVEL}\")",
      "analyze_wildcard": true
    }
  }
}

I know I can query directly in the dashboard something like "message:(+"ERROR")" and manually change the ERROR to WARN for example, but I don't want that - imagine that this query might be more complex and contain multiple fields.

Note that the data stored in the message is not structured - think of the message as a whole log line. This means I don't have fields like LOG_LEVEL which I could filter directly.

Is there any way I can set the index_name and LOG_LEVEL dynamically from the Kibana Discover dashboard?


问:
time cakephp 3 save in the database with different value
well I'm working receiving time but when this save in the database is different, if I send 8:00 pm in the database save with 12:00 am, for all cases with +4 hours.

Receiving data from a form I get this from the console:

```<code>Thu Jan 01 1970 08:00:00 GMT-0400 (Hora estándar oeste, Sudamérica)
</code>```

I'm working with angular js backend with cakephp 3:

```<code> public function add()
        {
            $data = ['result' => 'fail', 'id' => 'null'];
            $errors = $this->Shifts->validator()->errors($this->request->getData());
            if(empty($errors))
            {
                $shifts = $this->Shifts->newEntity($this->request->getData());
                $date_entrada = strtotime($this->request->getData('hora_entrada'));
                $date_salida = strtotime($this->request->getData('hora_salida'));
                $shifts->hora_entrada = date('H:i:s', $date_entrada);
                $shifts->hora_salida = date('H:i:s', $date_salida);
                if ($this->Shifts->save($shifts))
                {
                    $data = ['result' => 'success', 'id' => $shifts->id];
                }
            } else {

                $data['error'] = $errors;
            }
            $this->set(compact('data'));
            $this->set('_serialize', ['data']);
        }
</code>```

答:
in your config/bootsrap.php add the following...

```<code>/*
 * Set server timezone to UTC. You can change it to another timezone of your
 * choice but using UTC makes time calculations / conversions easier.
 */
date_default_timezone_set('America/New_York');
</code>```

check in this list where is the time zone you want to set...

http://php.net/manual/en/timezones.america.php

Regards

Body:
well I'm working receiving time but when this save in the database is different, if I send 8:00 pm in the database save with 12:00 am, for all cases with +4 hours.

Receiving data from a form I get this from the console:

Thu Jan 01 1970 08:00:00 GMT-0400 (Hora estándar oeste, Sudamérica)

I'm working with angular js backend with cakephp 3:

 public function add()
        {
            $data = ['result' => 'fail', 'id' => 'null'];
            $errors = $this->Shifts->validator()->errors($this->request->getData());
            if(empty($errors))
            {
                $shifts = $this->Shifts->newEntity($this->request->getData());
                $date_entrada = strtotime($this->request->getData('hora_entrada'));
                $date_salida = strtotime($this->request->getData('hora_salida'));
                $shifts->hora_entrada = date('H:i:s', $date_entrada);
                $shifts->hora_salida = date('H:i:s', $date_salida);
                if ($this->Shifts->save($shifts))
                {
                    $data = ['result' => 'success', 'id' => $shifts->id];
                }
            } else {

                $data['error'] = $errors;
            }
            $this->set(compact('data'));
            $this->set('_serialize', ['data']);
        }

Body:
in your config/bootsrap.php add the following...

/*
 * Set server timezone to UTC. You can change it to another timezone of your
 * choice but using UTC makes time calculations / conversions easier.
 */
date_default_timezone_set('America/New_York');

check in this list where is the time zone you want to set...

http://php.net/manual/en/timezones.america.php

Regards


问:
JS: ERROR: "Promise { <pending> }" with Sockets
I'm having a problem with a Promise, when I try to retrieve the data it says Promise { <pending> } I already looked for some information about that but I cannot understand how to end it.
If anyone can help me I would be appreciated.

Thanks in advance

```<code>    /bucket.js
    'use strict'

    const   connection  = require('../server/models'),
            oracledb    = require('oracledb'),
            conexion    = oracledb.getConnection(connection)

    oracledb.outFormat  = oracledb.OBJECT

    module.exports  = (data) => {
      console.log("RES: ", filter(data));
      return filter(data)
    }

    const filter  = (value) =>  {
        return conexion
        .then(con =>  {
          return con.execute(
            `SELECT id_application, name, description, creation_date ` +
            `FROM application `
          ).then(bucket =>  {
            return con.execute(
              `SELECT id_definition, id_application, field_name_original,
               field_name_new, column_name, position, id_type_data,
               field_size, creation_date, description, filter, visible ` +
              `FROM definition ` +
              `WHERE id_application in (${getApp(value.data)}) ` +
              `AND ${value['search']} = '${value['value']}' `
            ).then(definitions => { return creaJSON(bucket, definitions) } )
             .catch(error =>  { return {"error": error} })
          })
           .catch(error =>  { return {"error": error} })
        })
        .catch(error =>  { return {"error": error} })
    }

    const getApp = (value) =>  {
      return value.map(obj =>  {
        return `'${obj.ID_APPLICATION}'`
      })
    }

    const creaJSON = (buckets, definitions)  => {
      var df = new Array()
      buckets['rows'].map(obj =>  {
        definitions['rows'].map(def =>  {
          if(obj['ID_APPLICATION'] == def['ID_APPLICATION']) df.push(def)
        })
        obj['Definitions'] = df
        df = []
      })
      return buckets.rows
    }
</code>```

UPDATED

My error wasnt only in the code above. I'm using sockets and also with the Bergi answer I couldn't had my response in the client. I had the next code:

```<code>socket.on('bucketVisibleT', (data)  =>  {
  buckets = {data:data,search:'VISIBLE',value:'T'}
  io.sockets.emit('bucketVisibleFs', require('./bucket')(buckets))
})
</code>```

so I had to change with the next one, and now I have my response in my client.

```<code>socket.on('bucketVisibleT', (data)  =>  {
  buckets = {data:data,search:'VISIBLE',value:'T'}
  require('./bucket')(buckets).then(res => {
    io.sockets.emit('bucketVisibleTs', res)
  })
})
</code>```

I apologise because I didn't give a good explanation of my problem but I thought it was in my first code

答:
filter returns a promise, so like with the other promise-returning functions you need to chain a then call to it if you want to do something with the result:

```<code>module.exports = (data) =>
  filter(data).then(res => {
    console.log("RES: ", res);
    return res;
  });
</code>```

Body:
I'm having a problem with a Promise, when I try to retrieve the data it says Promise { <pending> } I already looked for some information about that but I cannot understand how to end it.
If anyone can help me I would be appreciated.

Thanks in advance

    /bucket.js
    'use strict'

    const   connection  = require('../server/models'),
            oracledb    = require('oracledb'),
            conexion    = oracledb.getConnection(connection)

    oracledb.outFormat  = oracledb.OBJECT

    module.exports  = (data) => {
      console.log("RES: ", filter(data));
      return filter(data)
    }

    const filter  = (value) =>  {
        return conexion
        .then(con =>  {
          return con.execute(
            `SELECT id_application, name, description, creation_date ` +
            `FROM application `
          ).then(bucket =>  {
            return con.execute(
              `SELECT id_definition, id_application, field_name_original,
               field_name_new, column_name, position, id_type_data,
               field_size, creation_date, description, filter, visible ` +
              `FROM definition ` +
              `WHERE id_application in (${getApp(value.data)}) ` +
              `AND ${value['search']} = '${value['value']}' `
            ).then(definitions => { return creaJSON(bucket, definitions) } )
             .catch(error =>  { return {"error": error} })
          })
           .catch(error =>  { return {"error": error} })
        })
        .catch(error =>  { return {"error": error} })
    }

    const getApp = (value) =>  {
      return value.map(obj =>  {
        return `'${obj.ID_APPLICATION}'`
      })
    }

    const creaJSON = (buckets, definitions)  => {
      var df = new Array()
      buckets['rows'].map(obj =>  {
        definitions['rows'].map(def =>  {
          if(obj['ID_APPLICATION'] == def['ID_APPLICATION']) df.push(def)
        })
        obj['Definitions'] = df
        df = []
      })
      return buckets.rows
    }

UPDATED

My error wasnt only in the code above. I'm using sockets and also with the Bergi answer I couldn't had my response in the client. I had the next code:

socket.on('bucketVisibleT', (data)  =>  {
  buckets = {data:data,search:'VISIBLE',value:'T'}
  io.sockets.emit('bucketVisibleFs', require('./bucket')(buckets))
})

so I had to change with the next one, and now I have my response in my client.

socket.on('bucketVisibleT', (data)  =>  {
  buckets = {data:data,search:'VISIBLE',value:'T'}
  require('./bucket')(buckets).then(res => {
    io.sockets.emit('bucketVisibleTs', res)
  })
})

I apologise because I didn't give a good explanation of my problem but I thought it was in my first code

Body:
filter returns a promise, so like with the other promise-returning functions you need to chain a then call to it if you want to do something with the result:

module.exports = (data) =>
  filter(data).then(res => {
    console.log("RES: ", res);
    return res;
  });


问:
How can I pause setInterval() functions?
How do I pause and resume the setInterval() function using Javascript?

For example, maybe I have a stopwatch to tell you the number of seconds that you have been looking at the webpage. There is a 'Pause' and 'Resume' button. The reason why clearInterval() would not work here is because if the user clicks on the 'Pause' button at the 40th second and 800th millisecond, when he clicks on the 'Resume' button, the number of seconds elapsed must increase by 1 after 200 milliseconds. If I use the clearInterval() function on the timer variable (when the pause button is clicked) and then using the setInterval() function on the timer variable again (when the resume button is clicked), the number of seconds elapsed will increase by 1 only after 1000 milliseconds, which destroys the accuracy of the stopwatch.

So how do I do that?

答:
While @Jonas Giuro is right when saying that:

You cannot PAUSE the setInterval function, you can either STOP it (clearInterval), or let it run

On the other hand this behavior can be simulated with approach @VitaliyG suggested:

You shouldn't measure time in interval function. Instead just save time when timer was started and measure difference when timer was stopped/paused. Use setInterval only to update displayed value.

var output = $('h1');
var isPaused = false;
var time = new Date();
var offset = 0;
var t = window.setInterval(function() {
  if(!isPaused) {
    var milisec = offset + (new Date()).getTime() - time.getTime();
    output.text(parseInt(milisec / 1000) + "s " + (milisec % 1000));
  }
}, 10);

//with jquery
$('.toggle').on('click', function(e) {
  e.preventDefault();
  isPaused = !isPaused;
  if (isPaused) {
    offset += (new Date()).getTime() - time.getTime();
  } else {
    time = new Date();
  }

});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>h1 {
    font-family: Helvetica, Verdana, sans-serif;
    font-size: 12px;
}</code>```

Seconds: 0

<button class="toggle">Toggle</button>```

ContentLicense: CC BY-SA 4.0

Body:
While @Jonas Giuro is right when saying that:

You cannot PAUSE the setInterval function, you can either STOP it (clearInterval), or let it run

On the other hand this behavior can be simulated with approach @VitaliyG suggested:

You shouldn't measure time in interval function. Instead just save time when timer was started and measure difference when timer was stopped/paused. Use setInterval only to update displayed value.

var output = $('h1');
var isPaused = false;
var time = new Date();
var offset = 0;
var t = window.setInterval(function() {
  if(!isPaused) {
    var milisec = offset + (new Date()).getTime() - time.getTime();
    output.text(parseInt(milisec / 1000) + "s " + (milisec % 1000));
  }
}, 10);

//with jquery
$('.toggle').on('click', function(e) {
  e.preventDefault();
  isPaused = !isPaused;
  if (isPaused) {
    offset += (new Date()).getTime() - time.getTime();
  } else {
    time = new Date();
  }

});

h1 {
    font-family: Helvetica, Verdana, sans-serif;
    font-size: 12px;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h1>Seconds: 0</h1>
<button class="toggle">Toggle</button>


问:
Reshape from wide to long, but receiving "Erro: Each variable must have a unique name."
I'm trying to reshape this sort of dat from wide to long, but I'm consistently receiving an error message. What am I doing wrong?

The following is the command I'm using and next is a snippet of my data.

```dat <- gather(data, key = "Discriminação", value = "Valor", 2:25)

 data =  structure(list(Discriminação = c("I. RECEITA TOTAL", "I.1 -  Receita Administrada pela RFB",
"I.1.1    Imposto de Importação", "I.1.2    IPI", "I.1.2.1    IPI - Fumo",
"I.1.2.2    IPI - Bebidas", "I.1.2.3    IPI - Automóveis", "I.1.2.4    IPI - Vinculado a importação",
"I.1.2.5    IPI - Outros", "I.1.3    Imposto de Renda", "I.1.3.1  I.R. - Pessoa Física",
"I.1.3.2  I.R. - Pessoa Jurídica", "I.1.3.3  I.R. - Retido na Fonte",
"I.1.3.3.1    IRRF - Rendimentos do Trabalho", "I.1.3.3.2    IRRF - Rendimentos do Capital",
"I.1.3.3.3    IRRF - Remessas ao Exterior", "I.1.3.3.4    IRRF - Outros Rendimentos",
"I.1.4    IOF", "I.1.5    COFINS", "I.1.6    PIS/PASEP", "I.1.7    CSLL",
"I.1.8    CPMF", "I.1.9    CIDE  Combustíveis", "I.1.10  Outras",
"I.2 -  Incentivos Fiscais", "I.3 -  Arrecadação Líquida para o RGPS",
"I.3.1    Urbana", "I.3.2    Rural", "I.4 -  Receitas Não Administradas pela RFB",
"I.4.1  Concessões e Permissões", "I.4.2  Dividendos e Participações",
"I.4.3  Contr. Plano de Seguridade Social do Servidor", "I.4.4  CotaParte de Compensações Financeiras",
"I.4.5  Receitas Próprias (fontes 50, 81 e 82)", "I.4.6  Contribuição do Salário Educação",
"I.4.7  Complemento para o FGTS (LC nº 110/01)", "I.4.8  Operações com Ativos",
"I.4.9  Demais Receitas", "II. TRANSF. POR REPARTIÇÃO DE RECEITA ²",
"II.1  FPM / FPE / IPI-EE", "II.2  Fundos Constitucionais", "II.2.1  Repasse Total",
"II.2.2  Superávit dos Fundos", "II.3  Contribuição do Salário Educação",
"II.4  Compensações Financeiras", "II.5  CIDE - Combustíveis",
"II.6  Demais ", "III. RECEITA LÍQUIDA  (I-II)"), `35431` = c("12290.48402097",
"7771.686318", "308.33310599999999", "1154.2698489999998", "239.76640076000001",
"0", "0", "0", "914.50344823999978", "3078.6463939999999", "94.157627899999994",
"746.44417759999999", "2193.4616628099998", "1021.97845", "933.9063329999999",
"141.84613899999999", "95.73074081", "286.14657599999998", "1609.839849",
"633.52791100000013", "566.52460299999996", "0", "0", "134.39803000000001",
"-43.786000000000001", "3558.9", "n.d.", "n.d.", "1003.6837029700005",
"0", "1.018E-3", "143.91146118", "0", "0", "219.19327398999999",
"0", "0", "640.57794980000051", "2501.2770794613334", "2219.0989999999997",
"142.74600000000001", "n.d.", "n.d.", "116.90307946133339", "0",
"0", "22.529000000000423", "9789.2069415086662"), `35462` = c("11596.253605349999",
"7412.7677630000007", "373.71706499999999", "1370.349948", "265.70880774",
"0", "0", "0", "1104.6411402599999", "2289.4818289999998", "96.123338219999994",
"878.31575730999998", "1251.9269735099997", "832.32662199999993",
"217.02893699999998", "98.032178000000002", "104.53923650999977",
"224.96925100000001", "1484.127166", "593.81305099999997", "487.84078900000003",
"517.02352699999994", "0", "71.445137000000003", "-54.344999999999999",
"3328.8999999999996", "n.d.", "n.d.", "908.93084234999878", "0",
"79.841385000000002", "106.13582145999999", "0", "0", "223.46032242999999",
"0", "0", "499.49331345999883", "1931.8750075993335", "1699.558",
"106.44", "n.d.", "n.d.", "119.17883862933338", "0", "0", "6.6981689700000828",
"9664.378597750665"), `35490` = c("13069.057196370002", "8772.0905360000015",
"392.20991500000002", "1333.5901859999999", "224.42094527999998",
"0", "0", "0", "1109.1692407199998", "3109.7138089999999", "88.046134890000005",
"1602.69746854", "1359.1085645200001", "912.31195400000001",
"256.197971", "84.837182999999996", "105.76145652000002", "248.65517800000001",
"1433.108508", "548.6668360000001", "1075.9043630000001", "566.18171600000005",
"0", "64.06002500000001", "0", "3321.2", "n.d.", "n.d.", "975.76666037000086",
"0", "43.971899000000001", "105.09224094999998", "0", "0", "220.03384943999998",
"0", "0", "606.66867098000091", "1770.4347517780002", "1550.672",
"97.075999999999993", "n.d.", "n.d.", "117.35138636800005", "0",
"0", "5.3353654100000796", "11298.622444592002"), `35521` = c("13388.171682420005",
"9102.386582000001", "425.32219399999997", "1359.284204", "238.45872682999999",
"0", "0", "0", "1120.8254771700001", "3362.6831529999995", "639.58441151",
"1077.2064527799998", "1572.6546193000001", "1027.6666290000001",
"329.77585899999997", "103.102914", "112.10921730000024", "292.27561700000001",
"1535.004101", "590.17022700000007", "811.20736099999999", "668.49842200000001",
"0", "57.941302999999998", "-29", "3398.1", "n.d.", "n.d.", "916.68510042000389",
"0", "6.4229659999999997", "134.95704977", "0", "0", "215.71615711000001",
"0", "0", "559.58892754000385", "2164.2085945553331", "1925.537",
"121.738", "n.d.", "n.d.", "115.04861712533341", "0", "0", "1.8849774299998217",
"11223.963087864669"), `35551` = c("12508.213110380002", "8007.4372199999998",
"382.67831999999999", "1361.4987289999999", "227.75285596999998",
"0", "0", "0", "1133.74587303", "2629.7056899999998", "330.61697849000001",
"788.03873327000008", "1449.82330075", "929.57523800000001",
"280.78663299999999", "117.78514399999999", "121.67628575000002",
"312.07559699999996", "1581.3016440000001", "608.18087200000002",
"479.33566099999996", "594.38239399999998", "0", "58.278313000000004",
"-45", "3473.2309999999998", "n.d.", "n.d.", "1072.5448903800025",
"0", "232.28614400000001", "126.14749049", "0", "0", "218.42420874999999",
"0", "0", "495.68704714000251", "2203.5913893333332", "1961.6490000000003",
"124.236", "n.d.", "n.d.", "116.4929113333334", "0", "0", "1.2134779999995544",
"10304.621721046669"), `35582` = c("11824.056829910003", "7705.8808960000006",
"423.258465", "1404.9834140000003", "235.48867934", "0", "0",
"0", "1169.4947346600002", "2172.5273669999997", "283.86115847000002",
"869.88687890000006", "950.12790891999998", "421.46072599999997",
"308.02626100000003", "112.414507", "108.22641492000001", "341.44264300000003",
"1615.697032", "609.43273999999997", "498.90150299999999", "575.47173999999995",
"0", "64.165992000000003", "-155.38499999999999", "3473.1", "n.d.",
"n.d.", "800.46093391000204", "0", "4.4937019999999999", "92.34258797999999",
"0", "0", "219.36043831000001", "0", "0", "484.26420562000203",
"1687.9608151974346", "1553.1890000000001", "17.047952182101312",
"n.d.", "n.d.", "116.9922337653334", "0", "0", "0.73162924999984114",
"10136.096014712566"), `35612` = c("13248.000809469999", "8486.7798770000009",
"451.13639899999998", "1307.0941879999998", "205.0856119", "0",
"0", "0", "1102.0085760999998", "2775.5193640000002", "281.91281991",
"1036.98037765", "1386.13954515", "680.54449199999988", "453.92956500000003",
"122.309729", "129.35575915000018", "401.24825700000002", "1561.7878549999998",
"602.17614700000001", "572.1337769999999", "756.63713199999995",
"0", "59.046757999999997", "-55", "3592.21", "n.d.", "n.d.",
"1224.0109324699997", "135.4", "134.364631", "124.67114504",
"0", "0", "206.50295422000002", "0", "0", "623.07220220999966",
"1830.6459670304512", "1652.61", "64.672273503117964", "n.d.",
"n.d.", "110.13490891733339", "0", "0", "3.22878460999992", "11417.354842439549"
), `35643` = c("13393.354350400001", "7696.924801000001", "445.56037600000002",
"1414.2827909999999", "239.13283902000001", "0", "0", "0", "1175.1499519799997",
"2159.3157150000002", "258.32754231000001", "850.98628030999998",
"962.61133146999998", "434.42924499999998", "316.82622800000001",
"88.554198", "122.80166047", "346.66533199999998", "1592.6949499999998",
"627.44175500000006", "471.95965699999999", "581.04766600000005",
"0", "57.956559000000006", "-145.59299999999999", "3575.68",
"n.d.", "n.d.", "2266.3425494000007", "1381.2222220000001", "1.8461559999999999",
"100.41527470000001", "0", "0", "227.72102355999999", "0", "0",
"555.13787314000047", "1896.733564378198", "1735.5420000000001",
"36.422213802864533", "n.d.", "n.d.", "121.45121256533339", "0",
"0", "3.3181380099999558", "11496.620786021802"), `35674` = c("12771.906180679995",
"8172.117729999999", "456.30073599999997", "1496.796775", "254.93903693999999",
"0", "0", "0", "1241.85773806", "2394.323832", "260.72712253999998",
"954.72709888999998", "1078.19987674", "534.580421", "312.35145399999999",
"118.588047", "112.67995473999999", "349.10860300000002", "1670.110428",
"650.45497", "522.62379299999998", "577.63895000000002", "0",
"54.759643000000004", "0", "3646.326", "n.d.", "n.d.", "953.46245067999553",
"0", "47.531815000000002", "75.947586709999996", "0", "0", "226.17218356000001",
"0", "0", "603.81086540999559", "1958.5167068121268", "1790.6486545400003",
"44.919080286793402", "n.d.", "n.d.", "120.62516456533339", "0",
"0", "2.3238074199998948", "10813.389473867868"), `35704` = c("13497.085229590002",
"8948.6852589999999", "488.582157", "1398.1782039999998", "206.50459298999999",
"0", "0", "0", "1191.6736110099998", "2957.9442980000003", "113.77742537",
"1079.4770321900003", "1706.64245218", "850.165255", "416.97395700000004",
"296.84378900000002", "142.65945117999999", "405.07523200000003",
"1651.783981", "645.21165999999994", "606.19046400000002", "718.54235500000004",
"0", "77.176907999999997", "-60", "3667.1550000000002", "n.d.",
"n.d.", "941.24497059000214", "0", "65.990613999999994", "94.702495609999986",
"0", "0", "223.29663748000002", "0", "0", "557.2552235000021",
"1994.2202348010032", "1829.7845294900003", "42.376053231670284",
"n.d.", "n.d.", "119.0915399893334", "0", "0", "2.9681120899993942",
"11502.864994788999"), `35735` = c("12991.686654489999", "8542.9044609999983",
"491.13259999999997", "1506.5236199999999", "249.40052285000002",
"0", "0", "0", "1257.1230971499999", "2572.6663779999999", "101.30243606000001",
"775.02217561999998", "1639.9796805200001", "838.34985800000004",
"523.13488100000006", "163.304834", "115.19010752", "275.934732",
"1674.904131", "698.08664899999997", "606.70254", "654.10314800000003",
"0", "62.850663000000004", "-30", "3639.81", "n.d.", "n.d.",
"838.97219349000034", "0.1", "35.594844999999999", "66.410481389999987",
"0", "0", "221.62905022999999", "0", "0", "515.23781687000042",
"2208.9495432265444", "2022.8302456900001", "66.091460943877934",
"n.d.", "n.d.", "118.20216012266673", "0", "0", "1.8256764699997916",
"10782.737111263456"), `35765` = c("18434.105477189998", "11091.329897",
"497.02492599999999", "1445.887154", "252.60338658000001", "0",
"0", "0", "1193.28376742", "4517.476138", "118.61851373", "1553.6552950299999",
"2692.67334127", "1621.9819199999999", "660.90716099999997",
"230.42196300000001", "179.36229726999997", "300.42980699999998",
"1702.6105639999998", "775.21188100000006", "989.49197099999992",
"699.83304799999996", "0", "163.364408", "-130", "5586.1449999999995",
"n.d.", "n.d.", "1886.6305801899971", "0.47", "170.00148999999999",
"129.11397820000002", "0", "0", "353.95662580000004", "0", "0",
"1233.088486189997", "2095.2077072981447", "1859.46607189", "44.97314204481151",
"n.d.", "n.d.", "188.77686709333346", "0", "0", "1.9916262700000402",
"16338.89776989185"), `35796` = c("15390.441466870003", "10906.728187999999",
"510.74404200000004", "1194.96523", "241.5020207", "0", "0",
"0", "953.46320930000002", "5012.6352479999996", "115.06900131",
"1117.4747719700001", "3712.0042102699999", "1234.072263", "2185.9418620000001",
"173.76347000000001", "118.22661527", "339.24859900000001", "1615.2497609999998",
"652.59278400000005", "714.61072799999988", "740.71939499999996",
"0", "125.962401", "-127.514", "3701.1030000000005", "n.d.",
"n.d.", "910.12427887000149", "0.48799999999999955", "0.40454600000000002",
"126.33518565", "0", "0", "208.55596287", "0", "0", "574.34058435000156",
"2712.2949299640004", "2523.3347943799999", "39.034000000000006",
"n.d.", "n.d.", "111.22984686400005", "0", "0", "38.69628872000024",
"12678.146536906002"), `35827` = c("13199.191340049998", "9024.2133329999997",
"412.09669500000001", "1429.5953810000001", "271.21373493999999",
"0", "0", "0", "1158.3816460600001", "3459.7957259999994", "87.531837190000005",
"1022.9946357300001", "2286.7400979599997", "1111.0554549999999",
"930.38229699999999", "130.980435", "114.32191096", "344.51977299999999",
"1437.4495529999999", "567.04374699999994", "702.27485899999999",
"595.18275700000004", "0", "76.254841999999996", "-80.305999999999997",
"3562.4070000000002", "n.d.", "n.d.", "692.87700704999952", "8.9999999999999993E-3",
"2.6236839999999999", "98.956290799999991", "0", "0", "226.58065503999998",
"0", "0", "364.70737720999955", "1832.2064870213333", "1672.6220356900001",
"37.439", "n.d.", "n.d.", "120.84301602133338", "0", "0", "1.3024353099997796",
"11366.984853028665"), `35855` = c("17814.424200450001", "10507.180350000001",
"556.83885999999995", "1289.0359209999999", "191.71630832", "0",
"0", "0", "1097.3196126799999", "4680.9593180000002", "102.51073916",
"2297.39701212", "2171.3930839099999", "1193.0520549999999",
"698.44958599999995", "165.79492000000002", "114.09652291", "325.52037000000001",
"1403.5725430000002", "592.41761300000007", "998.07398899999998",
"579.60433399999999", "0", "81.157402000000005", "-42.335999999999999",
"3591.8740000000003", "n.d.", "n.d.", "3757.7058504500005", "2453.0899109999991",
"8.6000000000000003E-5", "147.64468979", "0", "0", "177.76331181",
"0", "0", "979.20785185000159", "2710.8970393320005", "2554.4266379299997",
"51.35199999999999", "n.d.", "n.d.", "94.807099632000046", "0",
"0", "10.311301770000512", "15103.527161118"), `35886` = c("15669.699987049993",
"9697.2334009999977", "543.17575299999999", "1384.5818419999998",
"206.25575233000001", "0", "0", "0", "1178.3260896699999", "3798.6548489999996",
"731.94820131000006", "1010.5392300899998", "1976.5378851699998",
"1131.250996", "583.61334599999998", "127.85935900000001", "133.81418416999975",
"380.929104", "1547.962796", "634.12534000000005", "581.09353999999996",
"733.48923600000001", "0", "93.220940999999996", "-189.21700000000001",
"3507.9589999999998", "n.d.", "n.d.", "2653.724586049997", "1588.588086",
"71.025681000000006", "96.704806160000018", "0", "0", "174.58019000000002",
"0", "0", "722.82582288999674", "2548.3244588966663", "2418.5344674899998",
"27.272000000000006", "n.d.", "n.d.", "93.109434666666729", "0",
"0", "9.4085567399998808", "13121.37552815333"), `35916` = c("13517.95185123",
"8287.8721819999992", "527.16130199999998", "1382.4197120000001",
"194.20041621999999", "0", "0", "0", "1188.21929578", "2777.997081",
"336.04507410999997", "600.85284999999999", "1769.0233771999999",
"1055.4177319999999", "450.46854500000001", "150.51565199999999",
"112.6214482", "344.744125", "1586.856053", "588.91645799999992",
"383.520757", "624.449523", "0", "71.807171000000011", "-15.87",
"3781.4029999999998", "n.d.", "n.d.", "1464.546669230001", "4.4999999999999998E-2",
"620.02518599999996", "85.884310259999978", "0", "0", "188.65096781999998",
"0", "0", "569.94120515000111", "2404.2200649639999", "2245.1003144799993",
"57.012999999999977", "n.d.", "n.d.", "100.61384950400003", "0",
"0", "1.4929009800005986", "11113.731786266002"), `35947` = c("12474.79400794",
"7781.8275079999994", "547.44252399999993", "1405.8066799999999",
"202.18905785999999", "0", "0", "0", "1203.6176221399999", "2228.9695919999999",
"304.28720045", "711.52925444000005", "1146.5436723399998", "418.26559699999984",
"474.34253999999999", "138.20045400000001", "115.73508133999999",
"319.93960700000002", "1568.9624999999999", "597.44099800000004",
"428.17352", "608.87003700000002", "0", "76.22205000000001",
"-4.2290000000000001", "3698.5410000000002", "n.d.", "n.d.",
"998.65449994000028", "0.127", "14.089185000000001", "99.603259739999999",
"0", "0", "191.22834881", "0", "0", "693.60670639000023", "1799.9533043886668",
"1633.1986809599998", "64.704999999999998", "n.d.", "n.d.", "101.98845269866671",
"0", "0", "6.1170730000426943E-2", "10674.840703551334"), `35977` = c("13744.352905719999",
"9314.9829399999999", "602.00114299999996", "1301.0499579999998",
"191.66142134999998", "0", "0", "0", "1109.3885366499999", "3571.6331800000003",
"291.87405825000002", "1041.6974843400001", "2176.7482178400001",
"656.95766700000001", "1187.0872080000001", "182.94085100000001",
"149.76249184", "333.40006599999998", "1538.635389", "593.24546199999997",
"583.62730299999998", "744.16292399999998", "0", "47.227515000000004",
"-8.4049999999999994", "3516.94", "n.d.", "n.d.", "920.83496571999922",
"1.0000000227373675E-8", "1.8897000000000001E-2", "98.918544499999996",
"0", "0", "180.22764240000001", "0", "0", "641.6698818099992",
"2002.1530154710001", "1700.2066716500001", "184.12799999999999",
"n.d.", "n.d.", "96.121409280000051", "0", "0", "21.696934540999948",
"11742.199890249"), `36008` = c("20363.908730990996", "9491.7670990000006",
"532.44559100000004", "1255.758163", "202.99178824999998", "0",
"0", "0", "1052.7663747500001", "3343.0776089999995", "276.18249539999999",
"1022.08258251", "1961.6721877899997", "420.04024099999992",
"1246.2563829999999", "166.29924700000001", "129.07631678999979",
"218.80991200000003", "1778.316544", "730.92296799999997", "944.90770600000008",
"639.83471799999995", "0", "47.693888000000001", "-39.756", "3836.82",
"n.d.", "n.d.", "7075.0776319909965", "5280.5060000000003", "35.319625000000002",
"100.25867321", "0", "0", "196.93138944999998", "0", "0", "1462.0619443309961",
"2349.9023974233332", "2181.8995128999995", "61.953000000000003",
"n.d.", "n.d.", "105.03007437333339", "0", "0", "1.0198101500006658",
"18014.00633356766"), `36039` = c("13435.942530931001", "9043.5347969999984",
"620.245408", "1281.376839", "189.17177395000002", "0", "0",
"0", "1092.20506505", "3407.3325839999998", "280.56836007999999",
"556.81379308999999", "2422.4623104299999", "1027.6085089999999",
"1028.889269", "206.15454600000001", "159.80998642999998", "250.16541800000002",
"1555.7040529999999", "608.96577200000002", "414.17261899999994",
"817.87920399999996", "0", "87.692900000000009", "-90.122", "3656.6120000000001",
"n.d.", "n.d.", "825.91773393100266", "8.9999999999999993E-3",
"1.2554110000000001", "102.92880083000001", "0", "0", "189.64963",
"0", "0", "532.07489210100266", "2293.9131594733331", "2119.3795910200001",
"63.349000000000018", "n.d.", "n.d.", "101.14646933333339", "0",
"0", "10.038099119999572", "11142.029371457671"), `36069` = c("13112.173313491001",
"8605.6747770000002", "581.04622000000006", "1262.7125250000001",
"218.05608486", "0", "0", "0", "1044.6564401400001", "3035.8049339999998",
"111.58819786000001", "1009.1560925299999", "1855.7209905100001",
"712.06523600000003", "815.09957099999997", "207.83347499999999",
"120.72270851000022", "231.51679700000003", "1558.218462", "635.39972299999999",
"602.15865999999994", "632.05329099999994", "0", "66.764164999999991",
"-43.186", "3660.4500000000003", "n.d.", "n.d.", "889.2345364910002",
"1.7999999999999999E-2", "0.73397500000000004", "101.15300791999999",
"0", "0", "192.68519298000001", "0", "0", "594.64436059100012",
"1997.6991413460003", "1815.94290972", "66.417000000000002",
"n.d.", "n.d.", "102.76543625600006", "0", "0", "12.573795370000141",
"11114.474172145001"), `36100` = c("14546.424079400998", "8271.4698059999992",
"552.079069", "1329.2215070000002", "216.73742215999999", "0",
"0", "0", "1112.4840848400002", "2915.1926709999998", "97.490908919999995",
"718.42489679000005", "2049.97595443", "1031.2093519999999",
"788.53030999999999", "116.21842700000001", "114.01786543", "200.31148099999999",
"1542.4363979999998", "618.21667400000001", "393.66905400000007",
"604.80808300000001", "0", "115.534869", "-70.058000000000007",
"3396.9250000000002", "n.d.", "n.d.", "2948.087273400999", "9.9999818101059656E-10",
"673.09786199999996", "95.509254430000027", "0", "0", "201.91575975000001",
"0", "0", "1977.5643972199991", "2088.5287821700003", "1945.0284024399998",
"27.867999999999995", "n.d.", "n.d.", "107.68840520000006", "9.8328539999999993",
"0", "-1.8888794699998801", "12457.895297230998"), `36130` = c("20246.899803710003",
"10819.927981999999", "545.67627000000005", "1307.5069079999998",
"209.52541955999999", "0", "0", "0", "1097.9814884399998", "4679.404368999999",
"109.12242667999999", "729.15418846", "3763.7645197899997", "1888.1224129999998",
"1538.4220789999999", "174.47774799999999", "162.74227978999997",
"244.74447899999998", "1564.0219519999998", "662.73690399999998",
"933.86233600000014", "796.99911500000007", "0", "84.975649000000004",
"-59", "6372.7683211399999", "n.d.", "n.d.", "3113.2035005700018",
"34.838333949999999", "951.95829967999998", "111.91725922000001",
"0", "0", "331.04459944000001", "0", "0", "1683.445008280002",
"2416.2152400913333", "1952.7175891500001", "195.54700000000003",
"n.d.", "n.d.", "176.55711970133345", "58.419996359999999", "0",
"32.973534880000088", "17830.684563618666")), .Names = c("Discriminação",
"35431", "35462", "35490", "35521", "35551", "35582", "35612",
"35643", "35674", "35704", "35735", "35765", "35796", "35827",
"35855", "35886", "35916", "35947", "35977", "36008", "36039",
"36069", "36100", "36130"), row.names = c(NA, -48L), class = c("tbl_df",
"tbl", "data.frame"))
```

答:
It's because you've told gather to keep the Discriminação column, and also to create a new Discriminação (which will be the column names).

Instead, try:

```<code>dat <- gather(data, key = "column_names", value = "Valor", 2:25)
</code>```

Body:
I'm trying to reshape this sort of dat from wide to long, but I'm consistently receiving an error message. What am I doing wrong?

The following is the command I'm using and next is a snippet of my data.

dat <- gather(data, key = "Discriminação", value = "Valor", 2:25)

 data =  structure(list(Discriminação = c("I. RECEITA TOTAL", "I.1 -  Receita Administrada pela RFB",
"I.1.1    Imposto de Importação", "I.1.2    IPI", "I.1.2.1    IPI - Fumo",
"I.1.2.2    IPI - Bebidas", "I.1.2.3    IPI - Automóveis", "I.1.2.4    IPI - Vinculado a importação",
"I.1.2.5    IPI - Outros", "I.1.3    Imposto de Renda", "I.1.3.1  I.R. - Pessoa Física",
"I.1.3.2  I.R. - Pessoa Jurídica", "I.1.3.3  I.R. - Retido na Fonte",
"I.1.3.3.1    IRRF - Rendimentos do Trabalho", "I.1.3.3.2    IRRF - Rendimentos do Capital",
"I.1.3.3.3    IRRF - Remessas ao Exterior", "I.1.3.3.4    IRRF - Outros Rendimentos",
"I.1.4    IOF", "I.1.5    COFINS", "I.1.6    PIS/PASEP", "I.1.7    CSLL",
"I.1.8    CPMF", "I.1.9    CIDE  Combustíveis", "I.1.10  Outras",
"I.2 -  Incentivos Fiscais", "I.3 -  Arrecadação Líquida para o RGPS",
"I.3.1    Urbana", "I.3.2    Rural", "I.4 -  Receitas Não Administradas pela RFB",
"I.4.1  Concessões e Permissões", "I.4.2  Dividendos e Participações",
"I.4.3  Contr. Plano de Seguridade Social do Servidor", "I.4.4  CotaParte de Compensações Financeiras",
"I.4.5  Receitas Próprias (fontes 50, 81 e 82)", "I.4.6  Contribuição do Salário Educação",
"I.4.7  Complemento para o FGTS (LC nº 110/01)", "I.4.8  Operações com Ativos",
"I.4.9  Demais Receitas", "II. TRANSF. POR REPARTIÇÃO DE RECEITA ²",
"II.1  FPM / FPE / IPI-EE", "II.2  Fundos Constitucionais", "II.2.1  Repasse Total",
"II.2.2  Superávit dos Fundos", "II.3  Contribuição do Salário Educação",
"II.4  Compensações Financeiras", "II.5  CIDE - Combustíveis",
"II.6  Demais ", "III. RECEITA LÍQUIDA  (I-II)"), `35431` = c("12290.48402097",
"7771.686318", "308.33310599999999", "1154.2698489999998", "239.76640076000001",
"0", "0", "0", "914.50344823999978", "3078.6463939999999", "94.157627899999994",
"746.44417759999999", "2193.4616628099998", "1021.97845", "933.9063329999999",
"141.84613899999999", "95.73074081", "286.14657599999998", "1609.839849",
"633.52791100000013", "566.52460299999996", "0", "0", "134.39803000000001",
"-43.786000000000001", "3558.9", "n.d.", "n.d.", "1003.6837029700005",
"0", "1.018E-3", "143.91146118", "0", "0", "219.19327398999999",
"0", "0", "640.57794980000051", "2501.2770794613334", "2219.0989999999997",
"142.74600000000001", "n.d.", "n.d.", "116.90307946133339", "0",
"0", "22.529000000000423", "9789.2069415086662"), `35462` = c("11596.253605349999",
"7412.7677630000007", "373.71706499999999", "1370.349948", "265.70880774",
"0", "0", "0", "1104.6411402599999", "2289.4818289999998", "96.123338219999994",
"878.31575730999998", "1251.9269735099997", "832.32662199999993",
"217.02893699999998", "98.032178000000002", "104.53923650999977",
"224.96925100000001", "1484.127166", "593.81305099999997", "487.84078900000003",
"517.02352699999994", "0", "71.445137000000003", "-54.344999999999999",
"3328.8999999999996", "n.d.", "n.d.", "908.93084234999878", "0",
"79.841385000000002", "106.13582145999999", "0", "0", "223.46032242999999",
"0", "0", "499.49331345999883", "1931.8750075993335", "1699.558",
"106.44", "n.d.", "n.d.", "119.17883862933338", "0", "0", "6.6981689700000828",
"9664.378597750665"), `35490` = c("13069.057196370002", "8772.0905360000015",
"392.20991500000002", "1333.5901859999999", "224.42094527999998",
"0", "0", "0", "1109.1692407199998", "3109.7138089999999", "88.046134890000005",
"1602.69746854", "1359.1085645200001", "912.31195400000001",
"256.197971", "84.837182999999996", "105.76145652000002", "248.65517800000001",
"1433.108508", "548.6668360000001", "1075.9043630000001", "566.18171600000005",
"0", "64.06002500000001", "0", "3321.2", "n.d.", "n.d.", "975.76666037000086",
"0", "43.971899000000001", "105.09224094999998", "0", "0", "220.03384943999998",
"0", "0", "606.66867098000091", "1770.4347517780002", "1550.672",
"97.075999999999993", "n.d.", "n.d.", "117.35138636800005", "0",
"0", "5.3353654100000796", "11298.622444592002"), `35521` = c("13388.171682420005",
"9102.386582000001", "425.32219399999997", "1359.284204", "238.45872682999999",
"0", "0", "0", "1120.8254771700001", "3362.6831529999995", "639.58441151",
"1077.2064527799998", "1572.6546193000001", "1027.6666290000001",
"329.77585899999997", "103.102914", "112.10921730000024", "292.27561700000001",
"1535.004101", "590.17022700000007", "811.20736099999999", "668.49842200000001",
"0", "57.941302999999998", "-29", "3398.1", "n.d.", "n.d.", "916.68510042000389",
"0", "6.4229659999999997", "134.95704977", "0", "0", "215.71615711000001",
"0", "0", "559.58892754000385", "2164.2085945553331", "1925.537",
"121.738", "n.d.", "n.d.", "115.04861712533341", "0", "0", "1.8849774299998217",
"11223.963087864669"), `35551` = c("12508.213110380002", "8007.4372199999998",
"382.67831999999999", "1361.4987289999999", "227.75285596999998",
"0", "0", "0", "1133.74587303", "2629.7056899999998", "330.61697849000001",
"788.03873327000008", "1449.82330075", "929.57523800000001",
"280.78663299999999", "117.78514399999999", "121.67628575000002",
"312.07559699999996", "1581.3016440000001", "608.18087200000002",
"479.33566099999996", "594.38239399999998", "0", "58.278313000000004",
"-45", "3473.2309999999998", "n.d.", "n.d.", "1072.5448903800025",
"0", "232.28614400000001", "126.14749049", "0", "0", "218.42420874999999",
"0", "0", "495.68704714000251", "2203.5913893333332", "1961.6490000000003",
"124.236", "n.d.", "n.d.", "116.4929113333334", "0", "0", "1.2134779999995544",
"10304.621721046669"), `35582` = c("11824.056829910003", "7705.8808960000006",
"423.258465", "1404.9834140000003", "235.48867934", "0", "0",
"0", "1169.4947346600002", "2172.5273669999997", "283.86115847000002",
"869.88687890000006", "950.12790891999998", "421.46072599999997",
"308.02626100000003", "112.414507", "108.22641492000001", "341.44264300000003",
"1615.697032", "609.43273999999997", "498.90150299999999", "575.47173999999995",
"0", "64.165992000000003", "-155.38499999999999", "3473.1", "n.d.",
"n.d.", "800.46093391000204", "0", "4.4937019999999999", "92.34258797999999",
"0", "0", "219.36043831000001", "0", "0", "484.26420562000203",
"1687.9608151974346", "1553.1890000000001", "17.047952182101312",
"n.d.", "n.d.", "116.9922337653334", "0", "0", "0.73162924999984114",
"10136.096014712566"), `35612` = c("13248.000809469999", "8486.7798770000009",
"451.13639899999998", "1307.0941879999998", "205.0856119", "0",
"0", "0", "1102.0085760999998", "2775.5193640000002", "281.91281991",
"1036.98037765", "1386.13954515", "680.54449199999988", "453.92956500000003",
"122.309729", "129.35575915000018", "401.24825700000002", "1561.7878549999998",
"602.17614700000001", "572.1337769999999", "756.63713199999995",
"0", "59.046757999999997", "-55", "3592.21", "n.d.", "n.d.",
"1224.0109324699997", "135.4", "134.364631", "124.67114504",
"0", "0", "206.50295422000002", "0", "0", "623.07220220999966",
"1830.6459670304512", "1652.61", "64.672273503117964", "n.d.",
"n.d.", "110.13490891733339", "0", "0", "3.22878460999992", "11417.354842439549"
), `35643` = c("13393.354350400001", "7696.924801000001", "445.56037600000002",
"1414.2827909999999", "239.13283902000001", "0", "0", "0", "1175.1499519799997",
"2159.3157150000002", "258.32754231000001", "850.98628030999998",
"962.61133146999998", "434.42924499999998", "316.82622800000001",
"88.554198", "122.80166047", "346.66533199999998", "1592.6949499999998",
"627.44175500000006", "471.95965699999999", "581.04766600000005",
"0", "57.956559000000006", "-145.59299999999999", "3575.68",
"n.d.", "n.d.", "2266.3425494000007", "1381.2222220000001", "1.8461559999999999",
"100.41527470000001", "0", "0", "227.72102355999999", "0", "0",
"555.13787314000047", "1896.733564378198", "1735.5420000000001",
"36.422213802864533", "n.d.", "n.d.", "121.45121256533339", "0",
"0", "3.3181380099999558", "11496.620786021802"), `35674` = c("12771.906180679995",
"8172.117729999999", "456.30073599999997", "1496.796775", "254.93903693999999",
"0", "0", "0", "1241.85773806", "2394.323832", "260.72712253999998",
"954.72709888999998", "1078.19987674", "534.580421", "312.35145399999999",
"118.588047", "112.67995473999999", "349.10860300000002", "1670.110428",
"650.45497", "522.62379299999998", "577.63895000000002", "0",
"54.759643000000004", "0", "3646.326", "n.d.", "n.d.", "953.46245067999553",
"0", "47.531815000000002", "75.947586709999996", "0", "0", "226.17218356000001",
"0", "0", "603.81086540999559", "1958.5167068121268", "1790.6486545400003",
"44.919080286793402", "n.d.", "n.d.", "120.62516456533339", "0",
"0", "2.3238074199998948", "10813.389473867868"), `35704` = c("13497.085229590002",
"8948.6852589999999", "488.582157", "1398.1782039999998", "206.50459298999999",
"0", "0", "0", "1191.6736110099998", "2957.9442980000003", "113.77742537",
"1079.4770321900003", "1706.64245218", "850.165255", "416.97395700000004",
"296.84378900000002", "142.65945117999999", "405.07523200000003",
"1651.783981", "645.21165999999994", "606.19046400000002", "718.54235500000004",
"0", "77.176907999999997", "-60", "3667.1550000000002", "n.d.",
"n.d.", "941.24497059000214", "0", "65.990613999999994", "94.702495609999986",
"0", "0", "223.29663748000002", "0", "0", "557.2552235000021",
"1994.2202348010032", "1829.7845294900003", "42.376053231670284",
"n.d.", "n.d.", "119.0915399893334", "0", "0", "2.9681120899993942",
"11502.864994788999"), `35735` = c("12991.686654489999", "8542.9044609999983",
"491.13259999999997", "1506.5236199999999", "249.40052285000002",
"0", "0", "0", "1257.1230971499999", "2572.6663779999999", "101.30243606000001",
"775.02217561999998", "1639.9796805200001", "838.34985800000004",
"523.13488100000006", "163.304834", "115.19010752", "275.934732",
"1674.904131", "698.08664899999997", "606.70254", "654.10314800000003",
"0", "62.850663000000004", "-30", "3639.81", "n.d.", "n.d.",
"838.97219349000034", "0.1", "35.594844999999999", "66.410481389999987",
"0", "0", "221.62905022999999", "0", "0", "515.23781687000042",
"2208.9495432265444", "2022.8302456900001", "66.091460943877934",
"n.d.", "n.d.", "118.20216012266673", "0", "0", "1.8256764699997916",
"10782.737111263456"), `35765` = c("18434.105477189998", "11091.329897",
"497.02492599999999", "1445.887154", "252.60338658000001", "0",
"0", "0", "1193.28376742", "4517.476138", "118.61851373", "1553.6552950299999",
"2692.67334127", "1621.9819199999999", "660.90716099999997",
"230.42196300000001", "179.36229726999997", "300.42980699999998",
"1702.6105639999998", "775.21188100000006", "989.49197099999992",
"699.83304799999996", "0", "163.364408", "-130", "5586.1449999999995",
"n.d.", "n.d.", "1886.6305801899971", "0.47", "170.00148999999999",
"129.11397820000002", "0", "0", "353.95662580000004", "0", "0",
"1233.088486189997", "2095.2077072981447", "1859.46607189", "44.97314204481151",
"n.d.", "n.d.", "188.77686709333346", "0", "0", "1.9916262700000402",
"16338.89776989185"), `35796` = c("15390.441466870003", "10906.728187999999",
"510.74404200000004", "1194.96523", "241.5020207", "0", "0",
"0", "953.46320930000002", "5012.6352479999996", "115.06900131",
"1117.4747719700001", "3712.0042102699999", "1234.072263", "2185.9418620000001",
"173.76347000000001", "118.22661527", "339.24859900000001", "1615.2497609999998",
"652.59278400000005", "714.61072799999988", "740.71939499999996",
"0", "125.962401", "-127.514", "3701.1030000000005", "n.d.",
"n.d.", "910.12427887000149", "0.48799999999999955", "0.40454600000000002",
"126.33518565", "0", "0", "208.55596287", "0", "0", "574.34058435000156",
"2712.2949299640004", "2523.3347943799999", "39.034000000000006",
"n.d.", "n.d.", "111.22984686400005", "0", "0", "38.69628872000024",
"12678.146536906002"), `35827` = c("13199.191340049998", "9024.2133329999997",
"412.09669500000001", "1429.5953810000001", "271.21373493999999",
"0", "0", "0", "1158.3816460600001", "3459.7957259999994", "87.531837190000005",
"1022.9946357300001", "2286.7400979599997", "1111.0554549999999",
"930.38229699999999", "130.980435", "114.32191096", "344.51977299999999",
"1437.4495529999999", "567.04374699999994", "702.27485899999999",
"595.18275700000004", "0", "76.254841999999996", "-80.305999999999997",
"3562.4070000000002", "n.d.", "n.d.", "692.87700704999952", "8.9999999999999993E-3",
"2.6236839999999999", "98.956290799999991", "0", "0", "226.58065503999998",
"0", "0", "364.70737720999955", "1832.2064870213333", "1672.6220356900001",
"37.439", "n.d.", "n.d.", "120.84301602133338", "0", "0", "1.3024353099997796",
"11366.984853028665"), `35855` = c("17814.424200450001", "10507.180350000001",
"556.83885999999995", "1289.0359209999999", "191.71630832", "0",
"0", "0", "1097.3196126799999", "4680.9593180000002", "102.51073916",
"2297.39701212", "2171.3930839099999", "1193.0520549999999",
"698.44958599999995", "165.79492000000002", "114.09652291", "325.52037000000001",
"1403.5725430000002", "592.41761300000007", "998.07398899999998",
"579.60433399999999", "0", "81.157402000000005", "-42.335999999999999",
"3591.8740000000003", "n.d.", "n.d.", "3757.7058504500005", "2453.0899109999991",
"8.6000000000000003E-5", "147.64468979", "0", "0", "177.76331181",
"0", "0", "979.20785185000159", "2710.8970393320005", "2554.4266379299997",
"51.35199999999999", "n.d.", "n.d.", "94.807099632000046", "0",
"0", "10.311301770000512", "15103.527161118"), `35886` = c("15669.699987049993",
"9697.2334009999977", "543.17575299999999", "1384.5818419999998",
"206.25575233000001", "0", "0", "0", "1178.3260896699999", "3798.6548489999996",
"731.94820131000006", "1010.5392300899998", "1976.5378851699998",
"1131.250996", "583.61334599999998", "127.85935900000001", "133.81418416999975",
"380.929104", "1547.962796", "634.12534000000005", "581.09353999999996",
"733.48923600000001", "0", "93.220940999999996", "-189.21700000000001",
"3507.9589999999998", "n.d.", "n.d.", "2653.724586049997", "1588.588086",
"71.025681000000006", "96.704806160000018", "0", "0", "174.58019000000002",
"0", "0", "722.82582288999674", "2548.3244588966663", "2418.5344674899998",
"27.272000000000006", "n.d.", "n.d.", "93.109434666666729", "0",
"0", "9.4085567399998808", "13121.37552815333"), `35916` = c("13517.95185123",
"8287.8721819999992", "527.16130199999998", "1382.4197120000001",
"194.20041621999999", "0", "0", "0", "1188.21929578", "2777.997081",
"336.04507410999997", "600.85284999999999", "1769.0233771999999",
"1055.4177319999999", "450.46854500000001", "150.51565199999999",
"112.6214482", "344.744125", "1586.856053", "588.91645799999992",
"383.520757", "624.449523", "0", "71.807171000000011", "-15.87",
"3781.4029999999998", "n.d.", "n.d.", "1464.546669230001", "4.4999999999999998E-2",
"620.02518599999996", "85.884310259999978", "0", "0", "188.65096781999998",
"0", "0", "569.94120515000111", "2404.2200649639999", "2245.1003144799993",
"57.012999999999977", "n.d.", "n.d.", "100.61384950400003", "0",
"0", "1.4929009800005986", "11113.731786266002"), `35947` = c("12474.79400794",
"7781.8275079999994", "547.44252399999993", "1405.8066799999999",
"202.18905785999999", "0", "0", "0", "1203.6176221399999", "2228.9695919999999",
"304.28720045", "711.52925444000005", "1146.5436723399998", "418.26559699999984",
"474.34253999999999", "138.20045400000001", "115.73508133999999",
"319.93960700000002", "1568.9624999999999", "597.44099800000004",
"428.17352", "608.87003700000002", "0", "76.22205000000001",
"-4.2290000000000001", "3698.5410000000002", "n.d.", "n.d.",
"998.65449994000028", "0.127", "14.089185000000001", "99.603259739999999",
"0", "0", "191.22834881", "0", "0", "693.60670639000023", "1799.9533043886668",
"1633.1986809599998", "64.704999999999998", "n.d.", "n.d.", "101.98845269866671",
"0", "0", "6.1170730000426943E-2", "10674.840703551334"), `35977` = c("13744.352905719999",
"9314.9829399999999", "602.00114299999996", "1301.0499579999998",
"191.66142134999998", "0", "0", "0", "1109.3885366499999", "3571.6331800000003",
"291.87405825000002", "1041.6974843400001", "2176.7482178400001",
"656.95766700000001", "1187.0872080000001", "182.94085100000001",
"149.76249184", "333.40006599999998", "1538.635389", "593.24546199999997",
"583.62730299999998", "744.16292399999998", "0", "47.227515000000004",
"-8.4049999999999994", "3516.94", "n.d.", "n.d.", "920.83496571999922",
"1.0000000227373675E-8", "1.8897000000000001E-2", "98.918544499999996",
"0", "0", "180.22764240000001", "0", "0", "641.6698818099992",
"2002.1530154710001", "1700.2066716500001", "184.12799999999999",
"n.d.", "n.d.", "96.121409280000051", "0", "0", "21.696934540999948",
"11742.199890249"), `36008` = c("20363.908730990996", "9491.7670990000006",
"532.44559100000004", "1255.758163", "202.99178824999998", "0",
"0", "0", "1052.7663747500001", "3343.0776089999995", "276.18249539999999",
"1022.08258251", "1961.6721877899997", "420.04024099999992",
"1246.2563829999999", "166.29924700000001", "129.07631678999979",
"218.80991200000003", "1778.316544", "730.92296799999997", "944.90770600000008",
"639.83471799999995", "0", "47.693888000000001", "-39.756", "3836.82",
"n.d.", "n.d.", "7075.0776319909965", "5280.5060000000003", "35.319625000000002",
"100.25867321", "0", "0", "196.93138944999998", "0", "0", "1462.0619443309961",
"2349.9023974233332", "2181.8995128999995", "61.953000000000003",
"n.d.", "n.d.", "105.03007437333339", "0", "0", "1.0198101500006658",
"18014.00633356766"), `36039` = c("13435.942530931001", "9043.5347969999984",
"620.245408", "1281.376839", "189.17177395000002", "0", "0",
"0", "1092.20506505", "3407.3325839999998", "280.56836007999999",
"556.81379308999999", "2422.4623104299999", "1027.6085089999999",
"1028.889269", "206.15454600000001", "159.80998642999998", "250.16541800000002",
"1555.7040529999999", "608.96577200000002", "414.17261899999994",
"817.87920399999996", "0", "87.692900000000009", "-90.122", "3656.6120000000001",
"n.d.", "n.d.", "825.91773393100266", "8.9999999999999993E-3",
"1.2554110000000001", "102.92880083000001", "0", "0", "189.64963",
"0", "0", "532.07489210100266", "2293.9131594733331", "2119.3795910200001",
"63.349000000000018", "n.d.", "n.d.", "101.14646933333339", "0",
"0", "10.038099119999572", "11142.029371457671"), `36069` = c("13112.173313491001",
"8605.6747770000002", "581.04622000000006", "1262.7125250000001",
"218.05608486", "0", "0", "0", "1044.6564401400001", "3035.8049339999998",
"111.58819786000001", "1009.1560925299999", "1855.7209905100001",
"712.06523600000003", "815.09957099999997", "207.83347499999999",
"120.72270851000022", "231.51679700000003", "1558.218462", "635.39972299999999",
"602.15865999999994", "632.05329099999994", "0", "66.764164999999991",
"-43.186", "3660.4500000000003", "n.d.", "n.d.", "889.2345364910002",
"1.7999999999999999E-2", "0.73397500000000004", "101.15300791999999",
"0", "0", "192.68519298000001", "0", "0", "594.64436059100012",
"1997.6991413460003", "1815.94290972", "66.417000000000002",
"n.d.", "n.d.", "102.76543625600006", "0", "0", "12.573795370000141",
"11114.474172145001"), `36100` = c("14546.424079400998", "8271.4698059999992",
"552.079069", "1329.2215070000002", "216.73742215999999", "0",
"0", "0", "1112.4840848400002", "2915.1926709999998", "97.490908919999995",
"718.42489679000005", "2049.97595443", "1031.2093519999999",
"788.53030999999999", "116.21842700000001", "114.01786543", "200.31148099999999",
"1542.4363979999998", "618.21667400000001", "393.66905400000007",
"604.80808300000001", "0", "115.534869", "-70.058000000000007",
"3396.9250000000002", "n.d.", "n.d.", "2948.087273400999", "9.9999818101059656E-10",
"673.09786199999996", "95.509254430000027", "0", "0", "201.91575975000001",
"0", "0", "1977.5643972199991", "2088.5287821700003", "1945.0284024399998",
"27.867999999999995", "n.d.", "n.d.", "107.68840520000006", "9.8328539999999993",
"0", "-1.8888794699998801", "12457.895297230998"), `36130` = c("20246.899803710003",
"10819.927981999999", "545.67627000000005", "1307.5069079999998",
"209.52541955999999", "0", "0", "0", "1097.9814884399998", "4679.404368999999",
"109.12242667999999", "729.15418846", "3763.7645197899997", "1888.1224129999998",
"1538.4220789999999", "174.47774799999999", "162.74227978999997",
"244.74447899999998", "1564.0219519999998", "662.73690399999998",
"933.86233600000014", "796.99911500000007", "0", "84.975649000000004",
"-59", "6372.7683211399999", "n.d.", "n.d.", "3113.2035005700018",
"34.838333949999999", "951.95829967999998", "111.91725922000001",
"0", "0", "331.04459944000001", "0", "0", "1683.445008280002",
"2416.2152400913333", "1952.7175891500001", "195.54700000000003",
"n.d.", "n.d.", "176.55711970133345", "58.419996359999999", "0",
"32.973534880000088", "17830.684563618666")), .Names = c("Discriminação",
"35431", "35462", "35490", "35521", "35551", "35582", "35612",
"35643", "35674", "35704", "35735", "35765", "35796", "35827",
"35855", "35886", "35916", "35947", "35977", "36008", "36039",
"36069", "36100", "36130"), row.names = c(NA, -48L), class = c("tbl_df",
"tbl", "data.frame"))

Body:
It's because you've told gather to keep the Discriminação column, and also to create a new Discriminação (which will be the column names).

Instead, try:

dat <- gather(data, key = "column_names", value = "Valor", 2:25)