transform

Why when I try to output a query result to CSV in SSIS instead of decimal numbers I get ones and zeros?

I have created a very simple Data Flow in SSIS that is run inside a loop. I have a simple OLE DB Source control which is connecting to a SQL Server and running quite a complex query to split daily data by 30 minute intervals as shown below. I then have a Flat File Destination control which is taking the output from the OLE DB Sourc...

How can I print single quotes around attribute values instead of double quotes with the javax.xml.transform.Tansformer class?

I have the following function: private static void prettyPrint(Document doc, File destFile) { TransformerFactory tfactory = TransformerFactory.newInstance(); Transformer serializer; try { if( !destFile.getParentFile().exists() ) { destFile.getParentFile().mkdirs(); } serializ...

Transform items from iterable with a sequence of unary functions

I frequently find myself needing to apply a sequence of unary functions to a sequence of of the same length. My first thought is to go with map(), however this only takes a single function to be applied to all items in the sequence. In the following code for example, I wish to apply str.upper() to the first item, and int to the second i...

Converting XML format

We have an issue where we have an XML feed leaving our system and a client needs to be able to import this feed into their system but they require the XML file to be in a different format. For a number of reasons its not possible for either of us to alter our format. I was thinking then that it would make sense for us to build some kind ...

How to get visual corner (eg. topLeft) of rotated displayObject in actionscript 3?

When rotating a display object (around its center) the visual corner of the element moves (the actual x and y of the "box" remains the same). For example with 45 degrees of rotation the x coordinate will have increased and the y coordinate will have decreased as the top left corner is now at the top center of the "box". I've tried to us...

Performing a Flip animation completely through code WPF

I am try to add a flip animation to a user control I built. The user control is simple it has a 87x87 image front and back and some properties. It is suppose to represent a tile in a game I am working on for fun. I am trying to animate a flipping affect of the user picking the tile from the deck. I feel I need to do this through code...

WPF Path Resizing

Hi ! This is my Path: <Style x:Key="MyPath" TargetType="{x:Type Path}"> <Setter Property="SnapsToDevicePixels" Value="true" /> <Setter Property="Stroke" Value="Blue" /> <Setter Property="Data" Value="M0,100 L 80,40 160,100 M 40,80 L 40,160 120,160 120,80" /> </Style> <Pat...

Rotate webpage via code?

I'm hoping that there's a relatively simple way to rotate a webpage a little bit, 30 degrees or so, while still leaving it fully functional and usable. I completely control the page, and can modify it to make this easier if needed. I'd rather not re-write the whole thing in SVG, though, but perhaps javascript and canvas will work? Is ...

Problem when using form-reference in transform/pivot query

Hi! When the query is like this there is no problem This works: TRANSFORM Count(Aktivitet.ID) AS AntalförID SELECT Aktivitet.region, Sum(Aktivitet.antalMän) AS [Antal Män], Sum(Aktivitet.antalKvinnor) AS [Antal Kvinnor] FROM Aktivitet GROUP BY Aktivitet.region PIVOT Aktivitet.aktivitetstyp But when I add this line I get into trouble...

R: Performing binary function to a column in a data frame.

Say I have a data frame with the contents: Trial Person 1 John 2 John 3 John 4 John 1 Bill 2 Bill 3 Bill 4 Bill and I want to transform this to Trial Person Day 1 John 1 2 John 1 3 John 2 4 John 2 1 Bill 1 2 Bill 1 3 Bill 2 4 Bill 2 I can ver...

OpenGL: scale then translate? and how?

Hey all, I've got some 2D geometry. I want to take some bounding rect around my geometry, and then render a smaller version of it somewhere else on the plane. Here's more or less the code I have to do scaling and translation: // source and dest are arbitrary rectangles. float scaleX = dest.width / source.width; float scaleY = dest.heigh...

Matching expression inside of a data section of an xml element using xsl

Hi I am usually programming in c++ so XML/XSL/XPATH is not my strong side, but I need to do a transformation and I cannot seem to find a good way of doing it. We have an xml file that is formatted like this: <outer> <element/> <other_element/> <message pri="info"> [[!CDATA Error: something is not working]] </message> <me...

iPhone image stretching (skew)

Hi, How to skew the image? So, for example, each corner has CGPoint with it coords - p1, p2, p3, p4. Then, I need to set - p4.x+=50, p4.y+=30. So this corner (p4) should be stretched in 2D perspective and the image should be distorted. I tried to use CATransform3D, but it seems that it's cannot be done in such way, since it's only ch...

Python - lexical analysis and tokenization

I'm looking to speed along my discovery process here quite a bit, as this is my first venture into the world of lexical analysis. Maybe this is even the wrong path. First, I'll describe my problem: I've got very large properties files (in the order of 1,000 properties), which when distilled, are really just about 15 important properties...

How to write a text transformer?

Suppose I have a text that I can easily parse. It consists of text and special identifiers. After parsing I get a list of tokens that correspond to text and special identifiers in the text. The problem I am having is how do I transform it from this token list into some other form? I can't understand how to approach this problem. I tri...

Modifying a list from order A to order B using only push and remove operations

Is there any well-known algorithm (or obvious solution) for transforming a list from order A to order B using only push and remove operations? For instance, from a b c d to b c a d could be done using the following operations: remove(a) remove(d) push(a) push(d) Or, from c b a to a b would be remove(c) remove(b) push(b) Or, from a ...

c++ transform with pair go in Segmentation fault

This code works: class Test { public: Test(string name) : _name(name) {}; bool operator()() { cout << "hello " << _name << endl; return true; } string name() { return _name; } private: string _name; }; pair<string, bool> inline execute_test(Test* t) { return pair<string, bool>(t->name(), (*t)()); } int main() { vector<Test...

How to transcribe SQL to LINQ

select * form autor inner join (carte inner join carte_autor using id_carte) using id_autor group by id_autor; How can I write this using LINQ? Thanks. ...

WPF: How do I implement a stretch transform?

I am trying to implement an effect that will stretch a polygon along a line from its center point to the mouse location. I've tried various approaches with a SkewTransform and the planar angle between those two points but that isn't giving me what I want. I am kind of assuming I'll have to go the MatrixTransform route but my linear alge...

Wrapping/warping a CALayer/UIView (or OpenGL) in 3D (iPhone)

I've got a UIView (and thus a CALayer) which I'm trying to warp or bend slightly in 3D space. That is, imagine my UIView is a flat label which I want to partially wrap around a beer bottle (not 360 degrees around, just on one "side"). I figured this would be possible by applying a transform to the view's layer, but as far as I can tell,...