transformation

How do I transform a List<T> into a DataSet?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 10:24:13
问题 Given a list of objects, I am needing to transform it into a dataset where each item in the list is represented by a row and each property is a column in the row. This DataSet will then be passed to an Aspose.Cells function in order to create an Excel document as a report. Say I have the following: public class Record { public int ID { get; set; } public bool Status { get; set; } public string Message { get; set; } } Given a List records, how do I transform it into a DataSet as follows: ID

DCT using integer only

三世轮回 提交于 2019-12-13 21:21:49
问题 I need to implement DCT transform, but i can't use float or double types. There is a lot of implementations on the internet, but all of them use float. Does anyone know any source with DCT on integers? P.S I need it to implement Color Layout Descriptor. 回答1: I found a blog post that describes the integer based DCT and IDCT here and gives an implementation in Matlab. The code he used is on GitHub, available here. I used the method bink_dct_B2.m. This calculates a scaled 1D-DCT transform, so if

Rotate Bitmap pixels

泄露秘密 提交于 2019-12-13 20:29:09
问题 I'm trying to rotate a Bitmap where the pixels are stored in an Array int pixels[] . I got the following method: public void rotate(double angle) { double radians = Math.toRadians(angle); double cos, sin; cos = Math.cos(radians); sin = Math.sin(radians); int[] pixels2 = pixels; for (int x = 0; x < width; x++) for (int y = 0; y < height; y++) { int centerx = this.width / 2, centery = this.height / 2; int m = x - centerx; int n = y - centery; int j = (int) (m * cos + n * sin); int k = (int) (n

Copy all xml elements excluding matched element root name using xslt

你离开我真会死。 提交于 2019-12-13 19:24:27
问题 Input XML: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:VendorMessageRequest xmlns:ns2="http://order.com.company.com"> <ns2:purchaseOrder> <assignedTo> <firstName>firstnm</firstName> <lastName>lstnm</lastName> </assignedTo> </ns2:purchaseOrder> </ns2:VendorMessageRequest> using XSLT as: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns2="http://www.company.com/services/entity/v1" xmlns:ns3="http://www.company.com/services/dataobject/v1"

CanvasRenderingContext2D flip transformation

心已入冬 提交于 2019-12-13 19:11:12
问题 I found this CanvasRenderingContext2D and i played around a little bit with it. I was able to scale and to rotate my Image using this context: crop: function () { var canvas = document.createElement("canvas"); var context = canvas.getContext("2d"); canvas.width = this.options.width / this.scale; canvas.height = this.options.height / this.scale; var currWidth = this.imgWidth * this.scale; var currHeight = this.imgHeight * this.scale; var correctX = (currWidth - this.imgWidth) / 2; var correctY

Switch column to row in a data.frame

喜你入骨 提交于 2019-12-13 18:50:14
问题 I ran into an R problem, which seems to be a little bit tricky. I have a data.frame that looks like this: Ident | A1 | ... | An | Z1 | ... | Zn 1 | 1 | ... | 1 | 1 | ... | 0 2 | 6 | ... | 4 | 0 | ... | 1 3 | 4 | ... | 4 | 1 | ... | 0 4 | 1 | ... | 4 | 0 | ... | 0 Now, what I want is to transform the original data.frame to the following structure: Z | A1 | ... | An Z1 | 1 | ... | 1 Zn | 6 | ... | 4 Z1 | 4 | ... | 4 Only rows are taken into the resulting data if any of the rows Z's is 1. Any

Calculate transformation which is needed to transform a rectangle into its perspective form

白昼怎懂夜的黑 提交于 2019-12-13 09:54:52
问题 I have the same rectangle in an untransformed form and in a perspective form. Both, the coordinates from the untransformed form as well as from the perspective form are in the untransformed coordinate system. Is there a way to reconstruct the transformation matrix which leads to this transformation? I think it should be possible to do that by solving the 4 equations given by the 4 corners but I am not sure where to start. // Edit: It looks like I am victim of a xy problem here. All answers

How to calculate transformation using coordinates of rectangle?

梦想与她 提交于 2019-12-13 08:16:30
问题 Hello friends I am working on a project and I have a problem. See Images below This purple rectangle is my main region which I want to rotate and transform. I have rotated this using Qtransform rotate at 30 degrees and has size(180,173). I have calculated the cords of inner region and pass those to paint event and when I resize outer Rectangle this inner rectangle is drawn using painterpath see image below Now this purple region in img 2 looks like transformed because I have drawn only cords

(NetLogo: re-) transformation of turtle xcor/ycor to real-world coords

跟風遠走 提交于 2019-12-13 06:50:05
问题 I have a well functioning NetLogo model of pedestrians in a generic, urban environment loaded from shapefiles - including projection/transformation (See selected code lines below). How do I export the xcor's and ycors of turtles to text files, projected/transformed into the original projection system? Thanks in advance code examples... gis:load-coordinate-system (word "../data/testLines_2.prj") set ODLines gis:load-dataset "../data/testLines_2.shp" setUpEnvelopeExtented ODLines 10 回答1: maybe

Need help in generating text output from XML file

半世苍凉 提交于 2019-12-13 03:14:50
问题 Need help with building an XSL version 2.0 file in converting XML file to text output. Below is the XML file. For all the elements that have field as "Checked = 'Y'" we need a "[X]" concatenated before the text output. Tab spaces should be based on the level of ansestor-tags. <Review> <Assignment/> <Authorization/> <Criteria> <Components/> <OrganizationalPolicy/> <DecisionPoints/> <Notes/> <QualityIndicators/> <Responses> <Response CPID="AISD01590403010101" Checked="Y"/> <Response CPID=