working on it ...

Filters

Explore Public Snippets

Sort by

Found 20 snippets

    public by AndrewJackson  455  0  4  0

    Redmi Y1 Smartphone Specifications & Features Comparison

    https://www.price-hunt.com/	

    public by sherazam  2138  0  5  0

    How to Add Rectangle or Line Object to An Existing PDF File using .NET

    This technical tip shows how .NET developers can add line object to an Existing PDF File inside their .NET applications. Aspose.Pdf for .NET supports the feature to add graph objects (for example graph, line, rectangle etc.) to PDF documents. You also get the leverage to add Line object where you can also specify the dash pattern, color and other f
    // Enter here the actual content of the snippet.   
    //The following code snippet shows how to add a Rectangle object that is filled with color.
    
    //[C# Code]
     
    // Create Document instance
    Document doc = new Document();
    // Add page to pages collection of PDF file
    Page page = doc.Pages.Add();
    // Create Graph instance
    Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(100, 400);             
    // Add graph object to paragraphs collection of page instance
    page.Paragraphs.Add(graph);
    // Create Rectangle instance
    Aspose.Pdf.Drawing.Line line = new Aspose.Pdf.Drawing.Line(new float[]{100, 100, 200, 100});
    // Specify fill color for Graph object
    line.GraphInfo.DashArray = new int[] { 0, 1, 0 };
    line.GraphInfo.DashPhase = 1;
    // Add rectangle object to shapes collection of Graph object
    graph.Shapes.Add(line);
    // Save PDF file
    doc.Save("c:/pdftest/LineAdded.pdf");
    
    //[VB.NET Code]
     
    ' Create Document instance
    Dim doc As Document = New Document()
    ' Add page to pages collection of PDF file
    Dim page As Page = doc.Pages.Add()
    ' Create Graph instance
    Dim graph As Aspose.Pdf.Drawing.Graph = New Aspose.Pdf.Drawing.Graph(100, 400)
    ' Add graph object to paragraphs collection of page instance
    page.Paragraphs.Add(graph)
    ' Create Rectangle instance
    Dim line As Aspose.Pdf.Drawing.Line = New Aspose.Pdf.Drawing.Line(New Single() {100, 100, 200, 100})
    ' Specify fill color for Graph object
    line.GraphInfo.DashArray = New Integer() {0, 1, 0}
    line.GraphInfo.DashPhase = 1
    ' Add rectangle object to shapes collection of Graph object
    graph.Shapes.Add(line)
    ' Save PDF file
    doc.Save("c:/pdftest/LineAdded.pdf")
    
    //DashLengthInBlack and DashLengthInWhite properties for Line object
    
    //[C# Code]
     
     // instantiate Document instance
    Document doc = new Document();
    // add page to pages collection of Document object
    Page page = doc.Pages.Add();
    // create Drawing object with certain dimensions
    Aspose.Pdf.Drawing.Graph canvas = new Aspose.Pdf.Drawing.Graph(100, 400);
    // add drawing object to paragraphs collection of page instance
    page.Paragraphs.Add(canvas);
    // create Line object
    Aspose.Pdf.Drawing.Line line = new Aspose.Pdf.Drawing.Line(new float[] { 100, 100, 200, 100 });
    // set color for Line object
    line.GraphInfo.Color = Aspose.Pdf.Color.Red;
    // specify dash array for line object
    line.GraphInfo.DashArray = new int[] { 0, 1, 0 };
    // set the dash phase for Line instance
    line.GraphInfo.DashPhase = 1;
    // add line to shapes collection of drawing object
    canvas.Shapes.Add(line);
    // save PDF document
    doc.Save("c:/DashLineInBlack.pdf");
    
    //[VB.NET Code]
     
    ' instantiate Document instance
    Dim doc As Document = New Document()
    ' add page to pages collection of Document object
    Dim page As Page = doc.Pages.Add()
    ' create Drawing object with certain dimensions
    Dim canvas As Aspose.Pdf.Drawing.Graph = New Aspose.Pdf.Drawing.Graph(100, 400)
    ' add drawing object to paragraphs collection of page instance
    page.Paragraphs.Add(canvas)
    ' create Line object
    Dim line As Aspose.Pdf.Drawing.Line = New Aspose.Pdf.Drawing.Line(New Single() {100, 100, 200, 100})
    ' set color for Line object
    line.GraphInfo.Color = Aspose.Pdf.Color.Red
    ' specify dash array for line object
    line.GraphInfo.DashArray = New Integer() {0, 1, 0}
    ' set the dash phase for Line instance
    line.GraphInfo.DashPhase = 1
    ' add line to shapes collection of drawing object
    canvas.Shapes.Add(line)
    ' save PDF document
    doc.Save("c:/DashLineInBlack.pdf")
    
    

    public by sherazam  4263  3  5  0

    How to Crop EMF Image using Shifts or Rectangle Approaches in .NET Applications

    This technical tip explains how .NET developers can Crop an EMF Image inside their .NET applications. Image cropping usually refers to the removal of the outer parts of an image to help improve the framing. Cropping may also be used to cut out some portion of an image to increase the focus on a particular area. Aspose.Imaging for .Net API supports
    // Enter here the actual content of the snippet.            // Cropping by Shifts
    
    //[C# Code Sample]
    
    // create an instance of Rasterization options
    EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
    emfRasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke;
    
    // create an instance of PNG options
    PdfOptions pdfOptions = new PdfOptions();
    pdfOptions.VectorRasterizationOptions = emfRasterizationOptions;
    
    //Declare variables to store file paths for input and output images
    string filePath = @"TestEmfBezier.emf";
    string outPath = filePath + ".pdf";
    
    //Load an existing image into an instance of EMF class
    using (Aspose.Imaging.FileFormats.Emf.EmfImage image = (Aspose.Imaging.FileFormats.Emf.EmfImage)Aspose.Imaging.Image.Load(filePath))
    {
      using (FileStream outputStream = new FileStream(outPath, FileMode.Create))
      {
        //Based on the shift values, apply the cropping on image
        //Crop method will shift the image bounds toward the center of image
        image.Crop(30, 40, 50, 60);
    
        // Set height and width
        pdfOptions.VectorRasterizationOptions.PageWidth = image.Width;
        pdfOptions.VectorRasterizationOptions.PageHeight = image.Height;
    
        //Save the results to disk
        image.Save(outputStream, pdfOptions);
      }
    }
     
    //[VB.NET Code Sample]
    
    ' create an instance of Rasterization options
    Dim emfRasterizationOptions As New EmfRasterizationOptions()
    emfRasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke
    
    ' create an instance of PNG options
    Dim pdfOptions As New PdfOptions()
    pdfOptions.VectorRasterizationOptions = emfRasterizationOptions
    
    'Declare variables to store file paths for input and output images
    Dim filePath As String = "TestEmfBezier.emf"
    Dim outPath As String = filePath & Convert.ToString(".pdf")
    
    'Load an existing image into an instance of EMF class
    Using image As Aspose.Imaging.FileFormats.Emf.EmfImage = DirectCast(Aspose.Imaging.Image.Load(filePath), Aspose.Imaging.FileFormats.Emf.EmfImage)
    	Using outputStream As New FileStream(outPath, FileMode.Create)
    		'Based on the shift values, apply the cropping on image
    		'Crop method will shift the image bounds toward the center of image
    		image.Crop(30, 40, 50, 60)
    
    		' Set height and width
    		pdfOptions.VectorRasterizationOptions.PageWidth = image.Width
    		pdfOptions.VectorRasterizationOptions.PageHeight = image.Height
    
    		'Save the results to disk
    		image.Save(outputStream, pdfOptions)
    	End Using
    End Using
    
    // Cropping by Rectangle
    
    //[C# Code Sample]
    
    // create an instance of Rasterization options
    EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
    emfRasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke;
    
    // create an instance of PNG options
    PdfOptions pdfOptions = new PdfOptions();
    pdfOptions.VectorRasterizationOptions = emfRasterizationOptions;
    
    //Declare variables to store file paths for input and output images
    string filePath = @"TestEmfExtPen.emf";
    string outPath = filePath + ".pdf";
    
    //Load an existing image into an instance of EMF class
    using (Aspose.Imaging.FileFormats.Emf.EmfImage image = (Aspose.Imaging.FileFormats.Emf.EmfImage)Aspose.Imaging.Image.Load(filePath))
    {
        using (FileStream outputStream = new FileStream(outPath, FileMode.Create))
        {
            //Create an instance of Rectangle class with desired size
            //Perform the crop operation on object of Rectangle class
            image.Crop(new Aspose.Imaging.Rectangle(30, 50, 100, 150));
    
            // Set height and width
            pdfOptions.VectorRasterizationOptions.PageWidth = image.Width;
            pdfOptions.VectorRasterizationOptions.PageHeight = image.Height;
    
            //Save the results to disk
            image.Save(outputStream, pdfOptions);
        }
    }
    
    //[VB.NET Code Sample]
    
    ' create an instance of Rasterization options
    Dim emfRasterizationOptions As New EmfRasterizationOptions()
    emfRasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke
    
    ' create an instance of PNG options
    Dim pdfOptions As New PdfOptions()
    pdfOptions.VectorRasterizationOptions = emfRasterizationOptions
    
    'Declare variables to store file paths for input and output images
    Dim filePath As String = "TestEmfExtPen.emf"
    Dim outPath As String = filePath & Convert.ToString(".pdf")
    
    'Load an existing image into an instance of EMF class
    Using image As Aspose.Imaging.FileFormats.Emf.EmfImage = DirectCast(Aspose.Imaging.Image.Load(filePath), Aspose.Imaging.FileFormats.Emf.EmfImage)
    	Using outputStream As New FileStream(outPath, FileMode.Create)
    		'Create an instance of Rectangle class with desired size
    		'Perform the crop operation on object of Rectangle class
    		image.Crop(New Aspose.Imaging.Rectangle(30, 50, 100, 150))
    
    		' Set height and width
    		pdfOptions.VectorRasterizationOptions.PageWidth = image.Width
    		pdfOptions.VectorRasterizationOptions.PageHeight = image.Height
    
    		'Save the results to disk
    		image.Save(outputStream, pdfOptions)
    	End Using
    End Using
    
    

    public by sherazam  4172  1  6  0

    How to Combine Two or Multiple Images into a Single Image inside .NET Apps

    This technical tip explains how .NET developers can combine single or multiple images inside their .NET applications. This example uses Graphics class and shows how to combine two or more images into a single complete image. To demonstrate the operation, the example creates a new Image canvas in JPEG format and draw images on the canvas surface us
    // Enter here the actual content of the snippet.            
    // Combining Images using Graphics Class
    
    //[C# Code Sample]
    
    //Create an instance of JpegOptions and set its various properties
    Aspose.Imaging.ImageOptions.JpegOptions ImageOptions = new Aspose.Imaging.ImageOptions.JpegOptions();
    
    //Create an instance of FileCreateSource and assign it to Source property
    ImageOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"two_images_result.jpeg", false);
    
    //Create an instance of Image and define canvas size
    using (var image = Aspose.Imaging.Image.Create(ImageOptions, 600, 600))
    {
          //Create and initialize an instance of Graphics
          var graphics = new Aspose.Imaging.Graphics(image);
    
          //Clear the image surface with white color
          graphics.Clear(Aspose.Imaging.Color.White);
    
          // Draw Image
          graphics.DrawImage(Aspose.Imaging.Image.Load(@"input1.jpg"), 0, 0, 600, 300);
          graphics.DrawImage(Aspose.Imaging.Image.Load(@"input2.jpg"), 0, 300, 600, 300);
                    
          // Call save method to save the resultant image.
          image.Save();
    }
     
    //[VB.NET Code Sample]
    
    'Create an instance of JpegOptions and set its various properties
    Dim ImageOptions As New Aspose.Imaging.ImageOptions.JpegOptions()
    
    'Create an instance of FileCreateSource and assign it to Source property
    ImageOptions.Source = New Aspose.Imaging.Sources.FileCreateSource("two_images_result.jpeg", False)
    
    'Create an instance of Image and define canvas size
    Using image = Aspose.Imaging.Image.Create(ImageOptions, 600, 600)
    	'Create and initialize an instance of Graphics
    	Dim graphics = New Aspose.Imaging.Graphics(image)
    
    	'Clear the image surface with white color
    	graphics.Clear(Aspose.Imaging.Color.White)
    
    	' Draw Image
    	graphics.DrawImage(Aspose.Imaging.Image.Load("input1.jpg"), 0, 0, 600, 300)
    	graphics.DrawImage(Aspose.Imaging.Image.Load("input2.jpg"), 0, 300, 600, 300)
    
    	' Call save method to save the resultant image.
    	image.Save()
    End Using
    
    

    public by sherazam  3053  0  5  0

    How to Add Text with Transparent Color in PDF File using .NET

    // Enter here the actual content of the snippet.      
    //The following code snippet shows how to add text with transparent color.
    
    //C# Code Sample
    
    // create Document instance
    Document doc = new Document();
    // create page to pages collection of PDF file
    Aspose.Pdf.Page page = doc.Pages.Add();
    
    // create Graph object 
    Aspose.Pdf.Drawing.Graph canvas = new Aspose.Pdf.Drawing.Graph(100, 400);
    // create rectangle instance with certain dimensions
    Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(100, 100, 400, 400);
    // create color object from Alpha color channel
    rect.GraphInfo.FillColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.FromArgb(128, System.Drawing.Color.FromArgb(12957183)));
    // add rectanlge to shapes collection of Graph object
    canvas.Shapes.Add(rect);
    // add graph object to paragraphs collection of page object
    page.Paragraphs.Add(canvas);
    // set value to not change position for graph object
    canvas.IsChangePosition = false;
    
    // create TextFragment instance with sample value
    TextFragment text = new TextFragment("transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text ");
    // create color object from Alpha channel
    Aspose.Pdf.Color color = Aspose.Pdf.Color.FromArgb(30, 0, 255, 0);
    // set color information for text instance
    text.TextState.ForegroundColor = color;
    // add text to paragraphs collection of page instance
    page.Paragraphs.Add(text);
    // save PDF file
    doc.Save("c:/Transparent_Text.pdf");
    
    //VB.NET Code Sample
    
    ' create Document instance
    Dim doc As Document = New Document()
    ' create page to pages collection of PDF file
    Dim page As Aspose.Pdf.Page = doc.Pages.Add()
    
    ' create Graph object
    Dim canvas As Aspose.Pdf.Drawing.Graph = New Aspose.Pdf.Drawing.Graph(100, 400)
    ' create rectangle instance with certain dimensions
    Dim rect As Aspose.Pdf.Drawing.Rectangle = New Aspose.Pdf.Drawing.Rectangle(100, 100, 400, 400)
    ' create color object from Alpha color channel
    rect.GraphInfo.FillColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.FromArgb(128, System.Drawing.Color.FromArgb(12957183)))
    ' add rectanlge to shapes collection of Graph object
    canvas.Shapes.Add(rect)
    ' add graph object to paragraphs collection of page object
    page.Paragraphs.Add(canvas)
    ' set value to not change position for graph object
    canvas.IsChangePosition = False
    
    ' create TextFragment instance with sample value
    Dim text As Aspose.Pdf.Text.TextFragment = New TextFragment("transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text transparent text ")
    ' create color object from Alpha channel
    Dim color As Aspose.Pdf.Color = Aspose.Pdf.Color.FromArgb(30, 0, 255, 0)
    ' set color information for text instance
    Text.TextState.ForegroundColor = color
    ' add text to paragraphs collection of page instance
    page.Paragraphs.Add(Text)
    ' save PDF file
    doc.Save("c:/Transparent_Text.pdf")
          

    public by sherazam  2488  0  5  0

    How to Convert GIFF Image Frame to WebP Image inside .NET Applications

    // Enter here the actual content of the snippet.            
    // Converting GIFF Image Frame to WebP Image
    //[C# Code Sample]
    
    // Load GIFF image into the instance of image class.
    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"D:\animation.gif"))
    {
          // Create an instance of GIFF image class.
          Aspose.Imaging.FileFormats.Gif.GifImage gif = image as Aspose.Imaging.FileFormats.Gif.GifImage;
    
          if (gif == null) return;
    
          // Load an existing WebP image into the instance of WebPImage class.
          using (Aspose.Imaging.FileFormats.Webp.WebPImage webp = new Aspose.Imaging.FileFormats.Webp.WebPImage(image.Width, image.Height, null))
          {
                 // Loop through the GIFF frames
                 for (int i = 0; i < gif.Blocks.Length; i++)
                 {
                        // Convert GIFF block to GIFF Frame
                        Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock gifBlock = gif.Blocks[i] as Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock;
                        if (gifBlock == null)
                        {
                                continue;
                        }
    
                        // Create an instance of WebP Frame instance by passing GIFF frame to class constructor.
                        Aspose.Imaging.FileFormats.Webp.WebPFrameBlock block = new Aspose.Imaging.FileFormats.Webp.WebPFrameBlock(gifBlock)
                        {
                                Top = (short)gifBlock.Top,
                                Left = (short)gifBlock.Left,
                               Duration = (short)gifBlock.ControlBlock.DelayTime
                        };
    
                        // Add WebP frame to WebP image block list
                        webp.AddBlock(block);
                }
    
                // Set Properties of WebP image.
                webp.Options.AnimBackgroundColor = 0xff; //black
                webp.Options.AnimLoopCount = 0; //infinity
                webp.Options.Quality = 50;
                webp.Options.Lossless = false;
    
                // Save WebP image.
                webp.Save(@"D:\saveAnimation.webp");
          }
    }
     
    //[VB.NET Code Sample]
    
    ' Load GIFF image into the instance of image class.
    Using image As Aspose.Imaging.Image = Aspose.Imaging.Image.Load("D:\animation.gif")
    
    	' Create an instance of GIFF image class.
    	Dim gif As Aspose.Imaging.FileFormats.Gif.GifImage = TryCast(image, Aspose.Imaging.FileFormats.Gif.GifImage)
    
    	If gif Is Nothing Then
    		Return
    	End If
    
    	' Load an existing WebP image into the instance of WebPImage class.
    	Using webp As New Aspose.Imaging.FileFormats.Webp.WebPImage(image.Width, image.Height, Nothing)
    		' Loop through the GIFF frames
    		For i As Integer = 0 To gif.Blocks.Length - 1
    			' Convert GIFF block to GIFF Frame
    			Dim gifBlock As Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock = TryCast(gif.Blocks(i), Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock)
    			If gifBlock Is Nothing Then
    				Continue For
    			End If
    
    			' Create an instance of WebP Frame instance by passing GIFF frame to class constructor.
    			Dim block As New Aspose.Imaging.FileFormats.Webp.WebPFrameBlock(gifBlock) With { _
    				Key .Top = CShort(gifBlock.Top), _
    				Key .Left = CShort(gifBlock.Left), _
    				Key .Duration = CShort(gifBlock.ControlBlock.DelayTime) _
    			}
       
                            ' Add WebP frame to WebP image block list
    			webp.AddBlock(block)
    		Next
    
    		' Set Properties of WebP image.
    		webp.Options.AnimBackgroundColor = &Hff
    		'black
    		webp.Options.AnimLoopCount = 0
    		'infinity
    		webp.Options.Quality = 50
    		webp.Options.Lossless = False
    
    		' Save WebP image.
    		webp.Save("D:\saveAnimation.webp")
    	End Using
    End Using
    
    

    public by sherazam  2701  0  6  1

    How to Read and Write XMP Data to Images inside .NET Apps

    // Enter here the actual content of the snippet.//Create XMP Metadata, Write It And Read From File
    
    //[C# Code Sample]
    
    // Specify the size of image by defining a Rectangle 
    Aspose.Imaging.Rectangle rect = new Aspose.Imaging.Rectangle(0, 0, 100, 200);
    
    TiffOptions tiffOptions = new TiffOptions(TiffExpectedFormat.TiffJpegRGB);
    tiffOptions.Photometric = TiffPhotometrics.MinIsBlack;
    tiffOptions.BitsPerSample = new ushort[] { 8 };
    
    // create the brand new image just for sample purposes
    using (var image = new TiffImage(new TiffFrame(tiffOptions, rect.Width, rect.Height)))
    {
          // create an instance of XMP-Header
          Aspose.Imaging.Xmp.XmpHeaderPi xmpHeader = new Aspose.Imaging.Xmp.XmpHeaderPi(System.Guid.NewGuid().ToString());
    
          // create an instance of Xmp-TrailerPi 
          Aspose.Imaging.Xmp.XmpTrailerPi xmpTrailer = new Aspose.Imaging.Xmp.XmpTrailerPi(true);
    
          // create an instance of XMPmeta class to set different attributes
          Aspose.Imaging.Xmp.XmpMeta xmpMeta = new Aspose.Imaging.Xmp.XmpMeta();
          xmpMeta.AddAttribute("Author", "Mr Smith");
          xmpMeta.AddAttribute("Description", "The fake metadata value");
    
          // create an instance of XmpPacketWrapper that contains all metadata
          Aspose.Imaging.Xmp.XmpPacketWrapper xmpData = new Aspose.Imaging.Xmp.XmpPacketWrapper(xmpHeader, xmpTrailer, xmpMeta);
    
          // create an instacne of Photoshop package and set photoshop attributes
          Aspose.Imaging.Xmp.Schemas.Photoshop.PhotoshopPackage photoshopPackage = new Aspose.Imaging.Xmp.Schemas.Photoshop.PhotoshopPackage();
          photoshopPackage.SetCity("London");
          photoshopPackage.SetCountry("England");
          photoshopPackage.SetColorMode(Aspose.Imaging.Xmp.Schemas.Photoshop.ColorMode.Rgb);
          photoshopPackage.SetCreatedDate(DateTime.UtcNow);
    
          // add photoshop package into XMP metadata
          xmpData.AddPackage(photoshopPackage);
    
          // create an instacne of DublinCore package and set dublinCore attributes
          Aspose.Imaging.Xmp.Schemas.DublinCore.DublinCorePackage dublinCorePackage = new Aspose.Imaging.Xmp.Schemas.DublinCore.DublinCorePackage();
          dublinCorePackage.SetAuthor("Charles Bukowski");
          dublinCorePackage.SetTitle("Confessions of a Man Insane Enough to Live With the Beasts");
          dublinCorePackage.AddValue("dc:movie", "Barfly");
    
          // add dublinCore Package into XMP metadata
          xmpData.AddPackage(dublinCorePackage);
    
          using (var ms = new MemoryStream())
          {
                        // update XMP metadata into image
                        image.XmpData = xmpData;
    
                        // Save image on the disk or in memory stream
                        image.Save(ms);
    
                        ms.Seek(0, System.IO.SeekOrigin.Begin);
    
                        // Load the image from moemory stream or from disk to read/get the metadata
                        using (var img = (TiffImage)Aspose.Imaging.Image.Load(ms))
                        {
                            // getting the XMP metadata
                            Aspose.Imaging.Xmp.XmpPacketWrapper imgXmpData = img.XmpData;
                            foreach (Aspose.Imaging.Xmp.XmpPackage package in imgXmpData.Packages)
                            {
                                // use package data ...
                            }
                        }
         }
    }
     
    //[VB.NET Code Sample]
    
    ' Specify the size of image by defining a Rectangle 
    Dim rect As New Aspose.Imaging.Rectangle(0, 0, 100, 200)
    
    Dim tiffOptions As New TiffOptions(TiffExpectedFormat.TiffJpegRGB)
    tiffOptions.Photometric = TiffPhotometrics.MinIsBlack
    tiffOptions.BitsPerSample = New UShort() {8}
    
    ' create the brand new image just for sample purposes
    Using image = New TiffImage(New TiffFrame(tiffOptions, rect.Width, rect.Height))
    	' create an instance of XMP-Header
    	Dim xmpHeader As New Aspose.Imaging.Xmp.XmpHeaderPi(System.Guid.NewGuid().ToString())
    
    	' create an instance of Xmp-TrailerPi 
    	Dim xmpTrailer As New Aspose.Imaging.Xmp.XmpTrailerPi(True)
    
    	' create an instance of XMPmeta class to set different attributes
    	Dim xmpMeta As New Aspose.Imaging.Xmp.XmpMeta()
    	xmpMeta.AddAttribute("Author", "Mr Smith")
    	xmpMeta.AddAttribute("Description", "The fake metadata value")
    
    	' create an instance of XmpPacketWrapper that contains all metadata
    	Dim xmpData As New Aspose.Imaging.Xmp.XmpPacketWrapper(xmpHeader, xmpTrailer, xmpMeta)
    
    	' create an instacne of Photoshop package and set photoshop attributes
    	Dim photoshopPackage As New Aspose.Imaging.Xmp.Schemas.Photoshop.PhotoshopPackage()
    	photoshopPackage.SetCity("London")
    	photoshopPackage.SetCountry("England")
    	photoshopPackage.SetColorMode(Aspose.Imaging.Xmp.Schemas.Photoshop.ColorMode.Rgb)
    	photoshopPackage.SetCreatedDate(DateTime.UtcNow)
    
    	' add photoshop package into XMP metadata
    	xmpData.AddPackage(photoshopPackage)
    
    	' create an instacne of DublinCore package and set dublinCore attributes
    	Dim dublinCorePackage As New Aspose.Imaging.Xmp.Schemas.DublinCore.DublinCorePackage()
    	dublinCorePackage.SetAuthor("Charles Bukowski")
    	dublinCorePackage.SetTitle("Confessions of a Man Insane Enough to Live With the Beasts")
    	dublinCorePackage.AddValue("dc:movie", "Barfly")
    
    	' add dublinCore Package into XMP metadata
    	xmpData.AddPackage(dublinCorePackage)
    
    	Using ms = New MemoryStream()
    		' update XMP metadata into image
    		image.XmpData = xmpData
    
    		' Save image on the disk or in memory stream
    		image.Save(ms)
    
    		ms.Seek(0, System.IO.SeekOrigin.Begin)
    
    		' Load the image from moemory stream or from disk to read/get the metadata
    		Using img = DirectCast(Aspose.Imaging.Image.Load(ms), TiffImage)
    			' getting the XMP metadata
    			Dim imgXmpData As Aspose.Imaging.Xmp.XmpPacketWrapper = img.XmpData
    					' use package data ...
    			For Each package As Aspose.Imaging.Xmp.XmpPackage In imgXmpData.Packages
    			Next
    		End Using
    	End Using
    End Using
    
    

    public by romych78  2940  10  5  0

    Check locked session files by PHP

    // script to check stuck php processes because of locked session files
    // to execute use command # lsof -n | awk -f sess_view.awk
    
    
    /sess_/ {
        load_sessions[$9]++;
        if (load_sessions[$9]>max_sess_link_count){
            max_sess_link_count = load_sessions[$9];
            max_sess_link_name = $9;
        };
    
        if ($4 ~ /.*uW$/ ){ locked_id[$9]=$2 };
    }
    
    END {
    
        print max_sess_link_count, max_sess_link_name,locked_id[max_sess_link_name];
    
        if (locked_id[max_sess_link_name] && max_sess_link_count>3) {
            #    r=system("kill "locked_id[max_sess_link_name]);
            #    if (!r) print "Locking process "locked_id[max_sess_link_name]" killed"
            system("ls -al "max_sess_link_name);
        }
    
    }            

    public by marksimon232  2556  1  5  2

    SQL SERVER 2012

    Am migrating sql server 2005 to sql server 2012 . what are all the changes need to be done in stored procedures/ discontinued features in 2012?.Thanks in advance.
    The simplest solution I see is just do follows;
    
    In General guide for upgrading the database.
    
        1) Run upgrade advisor on the databases for the instance you want to upgrade.
        2) If any issues found, talk to your dev team/ Vendor for fixing the same.
        3) If issues fixed proceed with the actual upgrade. -- Do check for the other dependencies on the database which might effect the functionality if the instance gets upgraded or something like that.
        4) Get the downtime for the database.
        5) create a latest full backup of the database -- any other strategy will also work, just make sure you can recover the database.
        6) take a clone of the server if its a virtual server to roll back any changes.
        7) run the upgrade on the sql 2005 instance from the 2012 set up. -- do check the pre-requirements for upgrade to sql 2012.
        8) If everything fine then you have a upgraded instance.
        9) also check the compatibility of the databases.
        10)if all fine then congrats you have upgraded your sql server instance.
    
    When you migrating to SQL 2012, this points needs to be consider first.
    
    - Using the SQL 2012 Upgrade Advisor
    - Reviewing the “breaking changes” section in the Books Online
    - Reviewing the “behavioral changes” section in the Books Online
    - Executing DBCC CHECKDB WITH DATA_PURITY (DBCC CHECKDB WITH DATA_PURITY;)
    - Executing DBCC UPDATEUSAGE command (DBCC UPDATEUSAGE(db_name);)
    - Updating statistics (USE db_name; GO EXEC sp_updatestats;) with full scan (USE db_name; GO EXEC sp_MSforeachtable @command1='UPDATE STATISTICS ? WITH FULLSCAN';)
    - Refreshing your views using sp_refreshview
    - Taking backups
    - Upgrading your hardware (As SQL Server 2012 does not support AWE)
    
    Upgrades are a necessary part of any development lifecycle. The chances of having a successful upgrade increases along with the amount of planning and preparation you invest in building a proper upgrade process.
    

    external by Junze Wu  30  0  1  0

    MainActivity.smali

    MainActivity.smali: MainActivity.smali
    .class public Lcom/example/junze/myapplication/activity/MainActivity;
    .super Landroid/support/v7/app/AppCompatActivity;
    .source "MainActivity.java"
    
    
    # annotations
    .annotation system Ldalvik/annotation/MemberClasses;
        value = {
            Lcom/example/junze/myapplication/activity/MainActivity$MainFragmentAdapter;
        }
    .end annotation
    
    
    # instance fields
    .field private fragments:Ljava/util/List;
        .annotation system Ldalvik/annotation/Signature;
            value = {
                "Ljava/util/List",
                "<",
                "Landroid/support/v4/app/Fragment;",
                ">;"
            }
        .end annotation
    .end field
    
    .field private mAdapter:Lcom/example/junze/myapplication/activity/MainActivity$MainFragmentAdapter;
    
    .field private mToolbarbar:Landroid/support/v7/widget/Toolbar;
    
    .field private mViewPager:Landroid/support/v4/view/ViewPager;
    
    
    # direct methods
    .method public constructor <init>()V
        .locals 0
    
        .prologue
        .line 24
        invoke-direct {p0}, Landroid/support/v7/app/AppCompatActivity;-><init>()V
    
        return-void
    .end method
    
    .method static synthetic access$000(Lcom/example/junze/myapplication/activity/MainActivity;)Ljava/util/List;
        .locals 1
        .param p0, "x0"    # Lcom/example/junze/myapplication/activity/MainActivity;
    
        .prologue
        .line 24
        iget-object v0, p0, Lcom/example/junze/myapplication/activity/MainActivity;->fragments:Ljava/util/List;
    
        return-object v0
    .end method
    
    
    # virtual methods
    .method protected onCreate(Landroid/os/Bundle;)V
        .locals 7
        .param p1, "savedInstanceState"    # Landroid/os/Bundle;
    
        .prologue
        .line 32
        invoke-super {p0, p1}, Landroid/support/v7/app/AppCompatActivity;->onCreate(Landroid/os/Bundle;)V
    
        .line 33
        const v5, 0x7f04001a
    
        invoke-virtual {p0, v5}, Lcom/example/junze/myapplication/activity/MainActivity;->setContentView(I)V
    
        .line 34
        const v5, 0x7f0c0070
    
        invoke-virtual {p0, v5}, Lcom/example/junze/myapplication/activity/MainActivity;->findViewById(I)Landroid/view/View;
    
        move-result-object v5
    
        check-cast v5, Landroid/support/v7/widget/Toolbar;
    
        iput-object v5, p0, Lcom/example/junze/myapplication/activity/MainActivity;->mToolbarbar:Landroid/support/v7/widget/Toolbar;
    
        .line 35
        iget-object v5, p0, Lcom/example/junze/myapplication/activity/MainActivity;->mToolbarbar:Landroid/support/v7/widget/Toolbar;
    
        const v6, 0x7f060016
    
        invoke-virtual {v5, v6}, Landroid/support/v7/widget/Toolbar;->setTitle(I)V
    
        .line 36
        new-instance v4, Ljava/util/ArrayList;
    
        invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V
    
        .line 37
        .local v4, "titles":Ljava/util/List;, "Ljava/util/List<Ljava/lang/String;>;"
        const-string v5, "\u70ed\u95e8"
    
        invoke-interface {v4, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    
        .line 38
        const-string v5, "\u6700\u65b0"
    
        invoke-interface {v4, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    
        .line 39
        const-string v5, "\u8282\u70b9"
    
        invoke-interface {v4, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    
        .line 40
        new-instance v0, Lcom/example/junze/myapplication/fragment/HotTopicFragment;
    
        invoke-direct {v0}, Lcom/example/junze/myapplication/fragment/HotTopicFragment;-><init>()V
    
        .line 41
        .local v0, "hotTopicFragment":Lcom/example/junze/myapplication/fragment/HotTopicFragment;
        new-instance v1, Lcom/example/junze/myapplication/fragment/LatestFragment;
    
        invoke-direct {v1}, Lcom/example/junze/myapplication/fragment/LatestFragment;-><init>()V
    
        .line 42
        .local v1, "latestFragment":Lcom/example/junze/myapplication/fragment/LatestFragment;
        new-instance v2, Lcom/example/junze/myapplication/fragment/NodeFragment;
    
        invoke-direct {v2}, Lcom/example/junze/myapplication/fragment/NodeFragment;-><init>()V
    
        .line 43
        .local v2, "nodeFragment":Lcom/example/junze/myapplication/fragment/NodeFragment;
        new-instance v5, Ljava/util/ArrayList;
    
        invoke-direct {v5}, Ljava/util/ArrayList;-><init>()V
    
        iput-object v5, p0, Lcom/example/junze/myapplication/activity/MainActivity;->fragments:Ljava/util/List;
    
        .line 44
        iget-object v5, p0, Lcom/example/junze/myapplication/activity/MainActivity;->fragments:Ljava/util/List;
    
        invoke-interface {v5, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    
        .line 45
        iget-object v5, p0, Lcom/example/junze/myapplication/activity/MainActivity;->fragments:Ljava/util/List;
    
        invoke-interface {v5, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    
        .line 46
        iget-object v5, p0, Lcom/example/junze/myapplication/activity/MainActivity;->fragments:Ljava/util/List;
    
        invoke-interface {v5, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    
        .line 47
        const v5, 0x7f0c0073
    
        invoke-virtual {p0, v5}, Lcom/example/junze/myapplication/activity/MainActivity;->findViewById(I)Landroid/view/View;
    
        move-result-object v5
    
        check-cast v5, Landroid/support/v4/view/ViewPager;
    
        iput-object v5, p0, Lcom/example/junze/myapplication/activity/MainActivity;->mViewPager:Landroid/support/v4/view/ViewPager;
    
        .line 48
        new-instance v5, Lcom/example/junze/myapplication/activity/MainActivity$MainFragmentAdapter;
    
        invoke-virtual {p0}, Lcom/example/junze/myapplication/activity/MainActivity;->getSupportFragmentManager()Landroid/support/v4/app/FragmentManager;
    
        move-result-object v6
    
        invoke-direct {v5, p0, v6}, Lcom/example/junze/myapplication/activity/MainActivity$MainFragmentAdapter;-><init>(Lcom/example/junze/myapplication/activity/MainActivity;Landroid/support/v4/app/FragmentManager;)V
    
        iput-object v5, p0, Lcom/example/junze/myapplication/activity/MainActivity;->mAdapter:Lcom/example/junze/myapplication/activity/MainActivity$MainFragmentAdapter;
    
        .line 49
        iget-object v5, p0, Lcom/example/junze/myapplication/activity/MainActivity;->mAdapter:Lcom/example/junze/myapplication/activity/MainActivity$MainFragmentAdapter;
    
        invoke-virtual {v5, v4}, Lcom/example/junze/myapplication/activity/MainActivity$MainFragmentAdapter;->setTitles(Ljava/util/List;)V
    
        .line 50
        iget-object v5, p0, Lcom/example/junze/myapplication/activity/MainActivity;->mViewPager:Landroid/support/v4/view/ViewPager;
    
        iget-object v6, p0, Lcom/example/junze/myapplication/activity/MainActivity;->mAdapter:Lcom/example/junze/myapplication/activity/MainActivity$MainFragmentAdapter;
    
        invoke-virtual {v5, v6}, Landroid/support/v4/view/ViewPager;->setAdapter(Landroid/support/v4/view/PagerAdapter;)V
    
        .line 51
        const v5, 0x7f0c0072
    
        invoke-virtual {p0, v5}, Lcom/example/junze/myapplication/activity/MainActivity;->findViewById(I)Landroid/view/View;
    
        move-result-object v3
    
        check-cast v3, Landroid/support/design/widget/TabLayout;
    
        .line 52
        .local v3, "tabLayout":Landroid/support/design/widget/TabLayout;
        iget-object v5, p0, Lcom/example/junze/myapplication/activity/MainActivity;->mViewPager:Landroid/support/v4/view/ViewPager;
    
        invoke-virtual {v3, v5}, Landroid/support/design/widget/TabLayout;->setupWithViewPager(Landroid/support/v4/view/ViewPager;)V
    
        .line 53
        return-void
    .end method
    
    
    
    • Public Snippets
    • Channels Snippets