SSIS Export to CSV but start to write at line 3 - ssis-2012

I've tried googling for an answer but have had no luck.
What I need to do is write to a csv file that has a double header row. The columns I need as headers are in row 2 and I can set them using 'Header rows to skip'.
However, I need to start writing data at line 3 and this isn't currently happening.
What's happening is that the header in row 1 is being removed.
Everything else is fine with the package.
Any ideas ?

You can trick your Flat File Target into producing the desired output if you can do without the comfort of automatically creating the column header names from your pipeline metadata:
On your Flat File Connection, uncheck the option "Column names in the first data row"
Open your Flat File Target "Advanced Editor" and switch to the Component Properties tab.
Find the Header property under Custom Properties and edit the text to contain the desired header data ending with \r\n\r\n to produce the desired blank line between your head line and your data.
Setting Header to
column1;column2\r\n\r\n`
your resulting file should look something like this:
column1;column2CRLF
CRLF
val11;val12CRLF
val21,val22CRLF

Related

Legacy Cytoscape Attributes Format not importing

Reading the documentation, section 8.2 here: http://manual.cytoscape.org/en/stable/Node_and_Edge_Column_Data.html
The docs state that the legacy attributes format is still supported in cytoscape 3.8. I have a legacy attribute file in the following format:
LinkerHeats
PKC = 0.05283780217268941
CDKN1B = 0.9230103703466229
RAS = 0.001407567832956147
BRCA1 = 0.0005058090659030887
However when I try to import the file using File -> Import -> Table from file... I cannot find a way for cytoscape to recognize anything but a single column, and it throws an error:
Table must have more than one column. Please check the selected delimeters and columns.
The import dialog is shown:
I can manually convert the file to CSV and import it, but it's a bit annoying to need the conversion utility since the docs suggest this should work.
I'm not sure why, but I was able to import that file by deleting the first line of the file (e.g. the column label) and using "=" as the delimiter. Obviously you have to rename the column before the import, but I was able to get it to work without having to convert it. The documentation is clearly wrong and we'll make sure to remove that comment as I think we removed support for that format several releases ago when we cleaned up our File menu.
-- scooter

No permission to use getFileById in google spreadsheets

I have following problem.
I have two files:
Source file - https://docs.google.com/spreadsheets/d/15zIdIeYFlca-SQ0ryl89oX_tbGjO_6cipqHkkxog7ho/edit#gid=0
Target file - https://docs.google.com/spreadsheets/d/1gGExeO2x8pqNzTPRvel8p-wwe-BDkdF5c6BFA8j_Py0/edit#gid=0
In the source file there is a script (function is named onEdit triggered with onEdit event). When you change the value of R3 cell (Source File) to other "Advisor" whole row should be copied to target file, but sometimes it works, sometimes not. If you change the value of advisor field once and it works try couple of times more and for sure there will be a problem with permission in a while.
When it's not working I get msg that there is problem with permission of executing function called getFileById, which is used in following line:
var file = DriveApp.getFileById('1gGExeO2x8pqNzTPRvel8p-wwe-BDkdF5c6BFA8j_Py0');
Any ideas what to do to solve the problem and why sometimes it works fine ?
Scripts using a 'simple' trigger can modify the file they are bound to, but cannot access other files because that would require authorization.
See here to learn more about the restrictions on simple triggers.
You can make sure you have all the permissions following the next steps:
Open the script project. At the left, click Project Settings
Select the Show "appsscript.json" manifest file in editor checkbox.
At the left, click Editor <>.
At the left, click the appsscript.json file.
Locate the top-level field labeled oauthScopes. If it's not present, you can add it.
The oauthScopes field specifies an array of strings. To set the scopes your project
uses, replace the contents of this array with the scopes you want it to use. For
example:
{"oauthScopes": ["https://www.googleapis.com/auth/spreadsheets.readonly", "https://www.googleapis.com/auth/userinfo.email"], }
Retrieved from: https://developers.google.com/apps-script/concepts/scopes

How to merge multiple plist files into one?

Just to start, I really have no idea what Im doing. I was given this task for an internship, and am really learning as I go. I have multiple plist files, they consist of around 22 items each, and list values of colors. I need to merge all of these files into one, and am really not sure how to go about it. I have a certain structure I need to go by, and really Im not sure how to go about it. I was told to open the plists in texteditor and then paste all of the raw code into one text file, this doesn't seem to work as I only end up getting the values for the first plist I pasted into the text file. Any help would be nice. Thanks.
Assume your from.plist contains keys 1, 2 and to.plist contains 2, 3
Run this:
/usr/libexec/PlistBuddy -x -c "Merge from.plist" to.plist
to.plist will contain 1, 2, 3
There are a number of ways to handle this. By default a plist is a special form of XML file. If you figure out the syntax you can in fact use a text editor to merge the contents of multiple files together, but you need to make sure you get it right.
A plist file has a specific header for the entire file. You could not just copy/paste multiple plists together because then they would have that header repeated.
The next way to do it is programmatically. If you can figure out the type of outer collection these files contain (probably an array or a dictionary) then you could write a few lines of code that read in each of the plists as arrays, combines them using NSArray code (assuming they contain arrays of colors) and then save the combined array back to a new plist. As vadian says you can also use the NSPropertyListSerialization class. Thats a more general-pupose way of handling plist files, but it's also more complex and harder to figure out.
A third way to do it is in Xcode. If you right-click on a plist file and select "open in Xcode" it should give you Xcode's property list editor. You can then copy and paste the contents of the files together and save the results to a new file.
I figured it out!! First create the structure, or use the template given to you. I suggest opening this template/ structure in Xcode, as it makes it easier to switch between viewing the list as a plist and source code. Open your template as a source code. Then open each of your plists in text editor, and copy and paste the code from your plists into the appropriate area in your templates source code, then you can view it in Xcode as a property list to make sure it's correct. The only thing you have to be careful about here is making sure you are getting no errors. Otherwise this works great!!

Skipping header rows - is it possible with Cloud DataFlow?

I've created a Pipeline, which reads from a file in GCS, transforms it, and finally writes to a BQ table. The file contains a header row (fields).
Is there any way to programatically set the "number of header rows to skip" like you can do in BQ when loading in?
This is not currently possible. It sounds like there are two potential requests here:
Specifying presence and skip behavior for header lines for a BigQuery import.
Specifying that a GCS text source should skip a header line.
Future work on this is tracked in https://issues.apache.org/jira/browse/BEAM-123.
Also, in the meantime, you could add a simple filter to your ParDo code to skip headers. Something like this:
PCollection<X> rows = ...;
PCollection<X> nonHeaders =
rows.apply(Filter.by(new MatchIfNonHeader()));

Insert text into existing file

I have a txt file.how can I place some text among that and don't overwrite it? because when I use for example f.puts "aaaaaaaaaaaaaaa" Ruby overwrites my txt file .
thanks
You need to open it in append mode
File.open("file.txt", "a+"){|f| f << "aaaaaaaaaaaaaaaaaaa" }
Check out your previous question
File opening mode in Ruby
If you're asking how to insert text into the middle of an existing file, as below, you can't:
Original file first half, Original File second half
becomes:
Original file first half, Inserted text, Original File second half
You need to make a new file, copy the first half of the original into it, then write the new text, then copy the rest of the original file.
You've got to set the mode for the file when using open on a file.
There are more details here : http://www.ruby-doc.org/core/classes/IO.html#M000889

Resources