How to create Trailer Record in Flat File using SSIS - ssis-2012

I am looking for some help on how to create a trailer record in a flat file using SSIS, I have create a SSIS package that creates a custom header and loads other record from the database into the flat file, it is a fixed width flat file. Now at the end of the file I want to create a Trailer Record along with some static text and Record count. I tried looking on to google but could not get any good example. Any help is much appreciated.

Use a Script Task. Take the file path of the fixed width flat file that you have obtained as a input variable. Once withing the script task use the .Net coding to append the data that you need. I have written a post on it - https://karbimantras.wordpress.com/2016/08/12/adding-record-count-to-flat-file/

Related

Joern:how to use ast's csv file to make cpg's csv file by joern?

As we all know,joern can easily analysis project written by c/c++,and it will generate CPG(code property graph).
Now I hava 2 csv file(nodes.csv and rels.csv),the 2 csv file can build AST(abstract syntax code)by neo4j and it can be shown in neo4j.But AST is not enough for me,what i need is CPG.How could i use the 2 csv file to build a CPG and show it in neo4j.I wanna to know how to use joern to make my ast'csv file become cpg'csv file.Or you hava other ways to make me do this.
I relly need your help,please.Thank you very much.

update database with a ruby function

I have a series of folders that all have files I need linked to the database (via there file path). One option I could do is manually insert all the file paths into my database, however, this can be painful as the number of folders will keep increasing and manual uploading will take too much time.
Is there a way to write a ruby helper function that will search these folders and automatically add the path to the files into a column in my database?
All the file paths have a recognizable pattern, for example:
Tel/a_1/poi1/names.csv
Tel/a_2/poi1/names.csv
Tel/a_3/poi1/names.csv
I need a function that will occupy a field in my database with the path of each of these names.csv files. Very new to ruby and rails, so any help is greatly appreciated. Also, please let me know if anything is unclear.
Something like this should give u all the filenames in the folder, for you to manipulate:
Dir["Tel/**/**/*.csv].each do |file|
* update attribute of your model with the path of the file
end
Read about the Dir object too.
Thats a example to get all files.
Dir["Tel/a_*/poi1/names.csv"] return a Array with path about all files.

Read data from External data sheet - eggPlant

Is there a way to read data from an external data sheet like excel, Text file etc. in eggPlant?
When running the same script for various set of Input parameters this would prove useful for me instead of hardcoding the values..
-Siva
Since this is the most viewed Eggplant question, I'll give it a more robust answer.
Yes! Using data from a data file is a fantastic way to parameterize your test without hardcoding!
Saving Data
To do so, you have to save your data in .csv or .txt format, within the Suite's Resources directory. This allows you to open and interact it from within Eggplant Functional.
Importing Data
In your script, you can reference these data files with just their filename, for example,
put ResourcePath("myData.txt") into FilePath
will save the entire file myData.txt from the Resources directory into a variable FilePath.
Accessing Data
You can then access each row of that file like any other file.
put line 1 of file FilePath into Name
put line 2 of file FilePath into DOB
If you save your data as a .csv, you can specify a row and column of a specific piece of data.
put item 2 in line 1 of file FilePath into Last_Name
Read more about reading files in the Eggplant Documentation!
For more complicated resource files, read this page in the Eggplant Documentation!
1. Enter the data in the excel sheet and save it as a CSV file.
2. Piece of code:
repeat with theData= each line of file "D:\TestData.csv"
log item 1 of theData
end repeat

filename..extension // Paperclip reprocess

Some kind of problem I can't resolveā€¦
In some app, a method called on :before_create was prefixing the file's extension with a double-dot (ex. /images/13402/medium/hey-1..jpg)
The problem is fixed for the new ones, but nothing occurs when I apply a reprocess! on the old ones; and I'd like to know if anyone could help about it
Reprocess / refresh only takes your original image and recreates the defined styles in your model class. So if your original image contains a file path with double dots in it, these are also applied to the generated styles. You have to clean up your original files and the stored file paths in your model records.
The only way I know would be to write a little script to modify this. Basically
foreach image
strip out double dots from original file name
rename file
store new file path in model record
end
And then rake paperclip:refresh

Rendering HTML in rails without actually displaying it

My current project requires me to assemble a .zip file containing HTML and text-only templates for a user to download, for importing into an email marketing program.
I've inherited this project, and currently the code uses a "fake" model (that is a model that does not directly correlate to a database table), in which it stores the entire template in a string, using dynamic variables to populate certain areas. The "fake" model then has a method for creating a zip file.
It seems to me that there has to be a better way to do this. I was wondering if there was a way to move the template into a .erb/haml file, and then write a method that would populate the file in preparation for being zipped up? Basically, is there a way to render an HTML and text file, without actually having to display them?
Thanks for any help.
Just write the action and view to render the html and text as normal then use the render_to_string method to assign the content to strings
http://apidock.com/rails/ActionController/Base/render_to_string
Then you can run the Model method (hopefully a Class method) to create the zip file using the content you now have in instance variables
Please have a look at the cells plugin.

Resources