​
Showing posts with label using. Show all posts
Showing posts with label using. Show all posts

Sunday, 30 July 2017

copy paste in ubuntu unix linux using key board shortcuts commands

copy paste in ubuntu unix linux using key board shortcuts commands





First to copy, select the text that you want to copy using mouse and then press ctrl + shift + c ( This make the text to copy to clip board)

Then simply to paste this content into a file press  ctrl + shift + v
{ Read More }


Friday, 28 July 2017

Creating the Date Dimension using Kettle

Creating the Date Dimension using Kettle


Creating the Date dimension table is perhaps the most important common step to all dimensional modeling projects. According to Ralph Kimball � the author of The Data Warehousing Toolkit


�Data warehouses always need an explicit date dimension table. There are many date attributes not supported by the SQL Date function, including fiscal periods, seasons, holidays, and weekends. Rather than attempting to determine these nonstandard calendar calculations in a query, we should look them up in a date dimension table.�


The first step is to launch Kettle from the desktop. I have GeoKettle installed on my machine, which, for those who dont know, is simply a spatially enabled version of Pentahos Open source ETL platform (Kettle). If you dont have GeoKettle installed, my previous post shows the steps to download and install it on your local machine.


Using the sample Transformation as the starting point.

GeoKettle ships with some sample transformations that allow creation of Date dimensions. We can start with these and augment them based on our needs. The first two dimensions that are needed are Date and Time. According to best practices, Date and Time should be modeled as separate dimensions


Launching GeoKettle

If you have GeoKettle installed, launch it from the Applications menu on your machine.





Once GeoKettle is launched, go to the samples folder under GeoKettle/samples and open the file �General � Populate date dimension.ktr�



The following transformation is loaded on the screen.



Save the file to your local directory for review and possible modification. I saved the transformation with the GenerateDateDimension.ktr under my local work folder.


The default transformation generates dates from 1950 all the way to 2050. I only needed 50 odd years of dates for my purposes, so I needed to modify the start date. Right click and Edit the first step on the transformation to view dialog box for "Generate Rows."



In the dialog box that opens, we can see the default values as follows:



Now lets modify the default values as follows.

Step name: 20000 days: 50+ years
Limit: 20000
Fields > Value: 19900101


Next thing we need to do is to update the Table output parameters to our selected database schema. Right click on the "Table Output" step as shown in the screenshot below.



Define the database connection, by clicking on the "New" button next to the Connection field on the open dialog box.



Select the schema and table name. In my case, it was nydot and dim_date.



Click OK when done. 

The last step is to enable the hop, by right clicking on the arrow connecting to the last step and clicking on �Enable Hop� as shown in the picture below.



Next step is to run the transformation and test to make sure it works correctly. For this we click on the play button on the top menu, as shown in the picture below.



Clicking the button brings up the following dialog box.



Now, click on the Launch button to start the transformation. Once the transformation has executed, we can see the following metrics displayed on the screen.



Open pgAdmin tool to view the data by navigating to the schema and the date_dim table that was just created.



Also, now right clicking and viewing data


.... shows that the table is populated correctly.




We have just seen how to populate a basic Date Dimension table using Kettle open source ETL tool.

{ Read More }


Tuesday, 25 July 2017

Create a live system ISO for your Ubuntu based Linux machines using Systemback

Create a live system ISO for your Ubuntu based Linux machines using Systemback


Jack Wallen introduces you to an easy way to create live ISO images of your currently running Linux system with Systemback.
Systemback
You have that Linux desktop or server precisely how you want it and are interested in either creating a spot-on backup or a live ISO that you can then install on other (similar) hardware. How do you do it? You could go through the process of learning a number of commands to take care of the process, or you could install and use a handy tool called Systemback.
The Systemback tool allows you to create restore points, backups, and live images of a running system. Currently, it only works for Ubuntu derivatives based on 14.04, 14.10, and 15.04. It does, however, work like a champ (and does so quite easily).
I want to show you how to install and quickly make a live image of your current Linux system.

Installation

You wont find Systemback in the standard repositories, so you must first add the repo with the command:
sudo add-apt-repository -y ppa:nemh/systemback
Now, update apt with the command:
sudo apt-get update
Finally, install Systemback with the command:
sudo apt-get install systemback
Youll have to okay the dependencies before the install will begin. The dependencies will vary, based on what you have installed.
At this point, you should be able to start Systemback from the Unity Dash or your desktop start menu. You can also start Systemback from the command line with:
sudo systemback
You are now ready to create a live ISO.

Usage

Using Systemback is quite easy. From the main window (Figure A), select the location to house the ISO image (by clicking the ... button under Storage Location).
Figure A
Figure A
The Systemback main window.
Click the Live system create button and, in the new window (Figure B), give the live system a name, change the storage location (this location will need to have more than 4 GB of available space), and click Create new. You can optionally include user data files by checking the associated box.
Figure B
Figure B
Creating the live ISO image.
Note: If your .sblive file is larger than 4 GB, the conversion to a ISO is not possible. This is a file system limitation.
Depending on the size of your installation, the process will take some time to complete, so grab a cup of coffee or administer a server or two. After its installed, you should find an .sblive image in the defined storage location ready to convert to ISO. This image can either be written to a USB device or used to create a live ISO image. From the Created Live images window, select the image you want to convert, and then click Convert to ISO. When this process is completed, youll find the .iso file in the storage location ready to be written to disk. With that disk, you can then install the live image on other machines.
The best time to use Systemback is on a close-to-newly installed system. This is simply because of the file system size limitation. If youve installed too many applications on the system, the size will reach beyond 4 GB, and you wont be able to convert it. You can, however, still create restore points for a system. To create a restore point, first make sure youve selected a Storage directory, and then click the Create New button.
Once youve created a restore point, you can then go back to that restore point by simply selecting it from the left side of the window (Figure C) and then clicking System Restore on the right side.
Figure C
Figure C
Restoring from a restore point.
In the resulting window (Figure D), select the type of restore you want to do, if you want to include user configuration files, and click Next. This will begin the restore process.
Figure D
Figure D
Restore point options.
Systemback is a great way to create live images based on a pre-existing system and restore points in case you need to roll a Linux machine backward.
Do you administer or use Linux machines? If so, what do you use for your Linux backup/restore systems? Share your experience in the discussion thread below.

Source: http://www.techrepublic.com/article/create-a-live-system-iso-for-your-ubuntu-based-linux-machines-using-systemback/
{ Read More }


Thursday, 20 July 2017

creating Virtual users on linux server using Proftpd

creating Virtual users on linux server using Proftpd


  ##################################################################
 proftpd FTP server user account creation using commands    ##################################################################

note:- If you have already configured proftpd server and just want to add new user , skip to step 3 direct

////////////////
//  step 1. 
////////////////

install proftpd on system if it is not installed using apt
command is 
apt-get install  proftpd-basic


/////////////////
//  Step 2
/////////////////

enter into directory /etc/proftpd
open file proftpd.conf
uncoment line number 34 (containg text DefaultRoot ~ )
and add this line just below it

AuthUserFile    /etc/proftpd/ftpd.passwd




//////////////
// Step 3
//////////////

now add virtual user to ftp server using command 
ftpasswd --uid <uid> --gid <gid> --name <username> --shell /bin/false --home <path> --passwd

here 

uid is the user id (assign 33 and user will behave like www-data user)
gid is group id (assign 33 to work as www-data)
name is the username which you want to add to ftp server
shell is the name of shell terminal have it /bin/false
home is the directory where user will be directed after successful login
passwd is for password and need not to supply password with command 

for example i want to create a user having name indishell and want to assign /ftp directory to him if user autheticate successfully
uid and gid is 33 
command will be 

ftpasswd --uid 33 --gid 33 --name indishell --shell /bin/false --home /ftp --passwd


press enter and supply new password for the user account


//////////////
// Step 4
////////////// 
now need to chmod and chown the /etc/proftpd/ftpd.passwd and /etc/proftpd/ftpd.group
these files contains FTP server usernames/groups and its password 

chmod 400 /etc/proftpd/ftpd.passwd /etc/proftpd/ftpd.group
chown proftpd.nogroup /etc/proftpd/ftpd.passwd /etc/proftpd/ftpd.group

and now are done :)
you can login to your ftp account using command
ftp  server_IP



Note:- if you are on ubuntu server, then value of uid and gid should be 33(web server id) else you may face issue in writing files ;)

enjoy >:D<
Thank you


-==[[Love to]]==--
zero Cool ,code breaker ica, root_devil, google_warrior,INX_r0ot,Darkwolf indishell,Baba ,Silent poison India,Magnum sniper,Atul  Dwivedi,ethicalnoob Indishell,Local root indishell,Irfninja indishell,Reborn India,L0rd Crus4d3r,AR AR,Mannu, ViKi, Hardeep singh Bhuppi,Mohit, Ffe, Anju, RR Mam, Acchi bacchi(Jagriti) and DON

{ Read More }


Wednesday, 19 July 2017

Create Your Own URL Shortening Service Using PHP jQuery

Create Your Own URL Shortening Service Using PHP jQuery


I made a URL shortening service a year back using PHP & jQuery. It was pretty simple. You should know the concept of URL Shortening. The concept is simple. When a user sends a request to short a URL, PHP will check if the URL is valid. If its valid then PHP will make a string of 5 or 6 characters. A folder is created with the name of this string and an index.php file with header function code is created in this folder. This will make the folder redirect to the URL the user requested. Since its a folder no extensions will be seen ! So You can make up some pretty good URLs.
Here is the form for URL Shortening :
<form id="subinsbshorter">
  <center>
   <input type="text" id="url" name="url" autocomplete="off" placeholder="Your URL here..."/><br/>
   <input type="submit" value="Short URL !"/><br/>
   Type in a <b>URL</b> and click on <b>Short URL !</b> to start shorting.
  </center>
  <div id="loader" style="display:none;">
   <center><img src="../cdn/load.gif" /></center>
  </div>
  <div id="successDiv" style="display:none;">
   <h2 style="color:green;">Shorting Successful</h2>
   Here is Your Shorted URL : <a href=""></a>
  </div>
  <div id="errorDiv" style="display:none;">
   <h2 style="color:red;">Invalid URL</h2>
  </div>
 </form>
 <style>
  #url{font-family: Droid Sans, Arial;font-size: 15px;font-weight: normal;border-width: 0px;padding: 5px;color: #999999;width: 405px;outline-style: none; outline-width: 0px;
 </style>
We also added a loader div, success div and an error div in the <form> tag. The jQuery code plays a vital role in this process because we are not adding any action attributes in the form, so if jQuery fail to load then the conversion wont work. Here is the jQuery code :
<script>
$(document).ready(function(){
 function isValidUrl(aUrl){var urlregex=new RegExp("^(http://|https://|ftp://){1}([0-9A-Za-z]+.)");return urlregex.test(aUrl);}
 function ser(u){$("#errorDiv,#successDiv,#loader").hide();$("#errorDiv h2").text(u);$("#errorDiv").show();}
 function slo(){$("#errorDiv,#successDiv,#loader").hide();$("#loader").show();}
 function sss(v,s){$("#errorDiv,#successDiv,#loader").hide();$("#successDiv").show();$("#successDiv a").attr("href",v);$("#successDiv a").html("<blockquote>"+v+"</blockquote>");}
 $("#subinsbshorter").on(submit,function(){
  v=$(this).find("#url").val();
  slo();
  if(isValidUrl(v)){
   $.post(add.php,$(this).serialize(),function(d){
   d=JSON.parse(d);
   if(d.stat==1){
    sss(d.url,d.name);
   }else{
    ser("Failed To Short");
   }
   }).error(function(){ser("Failed To Short");});
  }else{
   ser("Invalid URL");
  }
  return false;
 });
});
</script>
Insert the above code anywhere you like. The jQuery will check if the URL is valid and will send a POST request to add.php when user submits the form. If the URL is not valid, then jQuery will show the error div. Here is the add.php file :
<?
header(Content-Type: text/html);
function rantext($length){$chars="abcdefghijklmnopqrstuvwxyzsubinsblogABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";$size=strlen($chars);for($i=0;$i<$length;$i++){$str.=$chars[rand(0,$size-1)];}return $str;}
$dir="/urls/";/*Directory to store URLs. If main folder use "/" */
$url=$_POST[url];
if(!preg_match("/^(http://|https://|ftp://){1}([0-9A-Za-z]+.)/",$url)){
 die({"stat":"0"});
}
$name = rantext(5);
if (file_exists($name)){
 $name = rantext(6);
}else{
 mkdir(..$dir.$name);
 $subinsbshort = fopen(..$dir.$name./index.php, x) or die({"stat":"0"});
}
if(fwrite($subinsbshort,<?header("Location:.$url.");?>)){
 echo {"stat":"1","url":"//demos.subinsb.com/url-shortener.$dir.$name.","name":".$name."};
}else{
 die({"stat":"0"});
}
fclose($subinsbshort);
?>
We also added the Random String Function to the add.php available from here. The Function will generate a string of 5 characters. If the string created is already used, then the script will generate another string of 6 characters. Then the add.php will create a folder with the name of random string. The add.php returns a JSON data to jQuery. jQuery will process the data and if everything is OK, then jQuery will show a success message with the new shorted URL.
If you have any suggestions/problems/feedback say it out in the comments, I will help you.
And Happy Birthday Google.
{ Read More }


Sunday, 16 July 2017

Create your own icons using Windows XP

Create your own icons using Windows XP


Click Start, click All Programs, click Accessories, and then click Paint

On the Image menu, click Attributes

Type 32 for both the Width and Height of the document, and make sure that Pixels is selected under Units

Click OK to create a new 32x32-pixel document: the size of an icon

Now add type, color, or do whatever youd like to your image.

I like to shrink photos (headshots work great) to 32x32 and simply paste them into my Paint document.

When youre finished, open the File menu and click Save As.
Use the dialog box to choose where you want to save your file, then give it a name followed by ".ico" and click Save.

You just created an icon! Now you can change any shortcut or folder to your own icon!

Now you just right click on any icon, click Properties, select change icon.

Select browse and follow the path you set to your newly created ICON
{ Read More }


Friday, 14 July 2017

Converting videos using viDrop

Converting videos using viDrop


Converting videos to different file formats can sometimes be useful when different device only support certain formats. Luckily, there is a handy program for that viDrop transcoder.
Simply install it by running the following commands from terminal:

sudo add-apt-repository "deb http://download.learnfree.eu/repository/skss / #SKSS"
wget http://download.learnfree.eu/repository/skss/repo.pub.asc -q -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install vidrop

Start the program from the Dash and convert your videos by first choosing the video which you want to convert.


Then you can just click convert or choose Advanced settings for further modification, which would look something like this:

Also read my article on converting mp4 to mp3 via ffmpeg.
{ Read More }


Wednesday, 12 July 2017

Create and Run Apache Spark Scala project using Eclipse and SBT

Create and Run Apache Spark Scala project using Eclipse and SBT


This post shows a simple way to create and run a apache spark scala project using eclipse and SBT. Following this post at link (http://czcodezone.blogspot.sg/2015/11/create-scala-project-using-scala-ide.html) to create a SBT-compatiable scala project in Scala IDE, open the build.sbt in the project and add the following line towards the end of the file.

libraryDependencies += "org.apache.spark" %% "spark-core" % "1.5.1"

Further more, since Spark needs to run a spark cluster in a jar, a sbt plugin must be added for the packaging. Create a file named "assembly.sbt" in the "project" folder under the root directory and put the following content:

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")


Now in the command line, navigate to the project root directory and run "sbt compile", "sbt package" command after you put in your spark scala code, then "sbt run" or "spark-submit" depending on whether you want to run it locally or submit to spark cluster
{ Read More }


Monday, 3 July 2017

Create Falling Matrix Code Effect using Notepad

Create Falling Matrix Code Effect using Notepad



In this post im gonna teach you how to create falling Matrix code effect using notepad. I think that all of you know and seen a falling green text or numbers. And as you know hackers use that, green font color in black background terminals. OK lets do that.

Open notepad and type in text given below.


@echo off
color a
:start
echo %random% %random% %random% %random% %random% %random% %random% %random% %random% %random%
goto start


And now from File menu choose Save as, and set file name to matrix.bat ( .bat is important ) and save it. Now open it and see the result. Now you can make it fullscreen by pressing Alt+Enter  keyboard combination.
{ Read More }


Saturday, 1 July 2017

Create your Basic Program by using QBasic 4 5 Full Programming language

Create your Basic Program by using QBasic 4 5 Full Programming language




QuickBASIC Program run mainly in MS-DOS 5 mode and can create a simple application in DOS environment. QB is an Integrated Development Environment (or IDE) and compiler for the BASIC programming language that was developed by Microsoft.

QuickBASIC continues to be used in some schools, usually as part of an introduction to programming, though it is fast becoming replaced by more popular compilers.It also has an unofficial community of hobby programmers who use the compiler to write games, GUIs and utilities in DOS Mode. But Nowadays, Programmers often use DOS emulators, such as DOSBox, to run QuickBASIC on Linux and on modern hardware that no longer supports the compiler

Recently, a set of TCP/IP routines for QuickBASIC v4.5 and 7.1 has revitalized some interest in the software. In particular, the vintage computer hobbyist community has been able to write software for old computers that run DOS, allowing these machines to access other computers through a LAN or the internet. This has allowed systems even as old as an 8088 to serve new functions, such as acting as a Web server or using IRC Internet Relay Chat our best example client is mIRC.

Microsofts Visual Basic was the successor of QuickBASIC. Other compilers, like PowerBASIC and FreeBASIC, have varying degrees of compatibility. QB64, a multiplatform QuickBASIC compiler, is being developed and aims to be 100% compatible according to wikipedia.

If you want to try or use this program you need to know the basics of QBasic programming. The QBasic language is made of instructions called statements. The statements must be written according to what is called "QBasic syntax rules". You can visit the Help section of QBasic for further information on how to write a proper syntax or see live samples with a basic guide on how to use this program. Here

Sample QBasic Command.
Open DOS Prompt in C: Directory, Type QBASIC and Press Enter.
Type the following 3 line statement below.

CLS
COLOR 1
PRINT "QBasic test Hello World"

Note: Make sure you have QBasic installed in your computer before do the following.

1. The CLS statement tells the computer to Clear The Screen
2. The COLOR statement tells the computer to Set a Color Attributes of Console Output
3. While PRINT statement tell the computer what text to display on the screen.

Download Qbasic_v4.5: Here

Note: You can Post your Sample Basic Program as comment for our beginners..


More Tags: Angry Bird, Blogger, Fate , Plants Vs Zombie, Special Force, Point Blank, Ai Maps, Deep Freeze UnFreezer, Ninja Saga, Deep Freeze, Samsung SGH, Guitar Pro, USB XP Install, Yahoo 443 Problem, Turtle Odyssey, GTA San-Andreas, PlayStation, Tips Tweaks Tricks, HTML, Facebook, Animated JPG, Counter-Strike, USB Windows Format, Screensaver, USB Security.
{ Read More }


Friday, 30 June 2017

Create Simple Login Form Using PHP Basic

Create Simple Login Form Using PHP Basic


Hello...
How are you.....

The post before, the writter has sharing How to Create Simple Comment Form Using PHP. That posting has been implemented the lesson of input output using PHP MySQL. For the next lesson, the writter will be share how to Create Simple Login Form Using PHP. This lesson is basic of login method in website.

Okay, prepare in this lesson is, Web Server and MySQL, you can use XAMPP on this condition.

Lets go to the Lesson,

First, you could create a Database on MySQL and one table. There are 3 field on the table. Follow this tutorial for simple Lesson.
Now, the writter create a Database with name is blog. Than create table with the name is user. Next, there are 3 fields on the user table, it is a id_user as Primary Key,  username char(32), and password char(32). For detail, look at below.


Thats a structure of Fields on the user table. After you create a Database, Table, And Fields. Now you must fiil the Fields. For expample look at below.


Okay, now we just need a 2 (Two) Pages, 1 (one) for Login Page, dan 1 (one) again for Checking Page.

Lets create a Login Page, this page we will give the name is login.html. Below is the simple script on login page.

<html>
<head>
<title>Login Form</title>
</head>
<body>
<h2>Login Form</h2>
<br>
<form method="POST" action="check.php">
<table>
<tr>
<td>Username</td>
<td><input type="text" name="user" size="20"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="pass" size="20"</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="submit" value="Login">&nbsp;<input type="reset" name="reset" value="Reset"></td>
</tr>
</table>
</form>
</body>
And than, create the checking page with the name is check.php. Below is the simple script on checking page.

<?php

##### Connection to database #####
$hostname = "localhost";
$username = "root";
$password = "";
$dbname = "blog";
$link = mysql_connect($hostname,$username,$password) or die("Error Connection");
mysql_select_db($dbname,$link);
##### End #####

##### Receive Input #####
$user = $_POST[user];
$pass = $_POST[pass];
##### End #####

##### Checking input in table within database #####
$sql = "select * from user where username = $user AND password = $pass";
$hasil = mysql_query($sql) or die("wrong");
$row = mysql_fetch_array($hasil);
if($row == "0") {
echo "<h2>Sorry, username and password does not match</h2>";
}
elseif($row != "0"){
echo "<h2>Login is Successful....</h2>";
}
##### End #####

?>
If all scripts was created. The simple login form was already to use.
The explain of that script is below.

$hostname = "localhost";
$username = "root";
$password = "";
$dbname = "blog";
$link = mysql_connect($hostname,$username,$password) or die("Error Connection");
mysql_select_db($dbname,$link);

its script, are use to create connection between page to database.

$user = $_POST[user];
$pass = $_POST[pass];
its use to receive a input from html page (input username and password). After receive, the value will be include in the variables ($user and $pass).

$sql = "select * from user where username = $user AND password = $pass";
$hasil = mysql_query($sql) or die("wrong");
$row = mysql_fetch_array($hasil);
its use to checking value of $user and $pass on the Database. The basic of this process is on the query syntax. And than the query is executed with mysql_query(); syntax. And than will processed with mysql_fetch_array(); syntax. The result of it will be included on the $row variable. The value of the $row variable is one or zero.


if($row == "0") {
echo "<h2>Sorry, username and password does not match</h2>";
}
elseif($row != "0"){
echo "<h2>Login is Successful....</h2>";
}

Its to use to checking a value of the $row variable, is the value zero or one. If zero means username and password does not match. And if one means username and password does match.



Lets try it.
First. open the login.html page.

Than, fill username and password, than click "Login"
If, success you will look like below


if username and password does not match, you will look at below

Okay, that is Basic of Login Form Using PHP.
On the next time, the writter will share for Advanced Login Form Using PHP.

Happy Paper 4share !!
{ Read More }


Thursday, 29 June 2017

Create an executable JAR file using eclipse

Create an executable JAR file using eclipse



  1. Right click on your project
  2. Select export from the context menu


3. Select the Runnable JAR file
4.Provide the destination path and launch configuration as mail class of the programme


{ Read More }


Friday, 23 June 2017

Create Your Own Website Using Wix com

Create Your Own Website Using Wix com


While we still love using Google sites, Wix also displays an easy, innovated way to create webpages. Need to promote an event or raise awareness for a campaign? What better way to do so then by using wix.com. It has a variety of templates for different events. Below is an example of a site I created for IndoPak.  Check it out!


http://gandhireema.wix.com/indopak-night



By Reema Gandhi
Tech Leader

{ Read More }


Creating DDL scripts from Excel Model using Pentaho Data Integration

Creating DDL scripts from Excel Model using Pentaho Data Integration


What this post is about

In this post, I will walk through an ETL transformation that takes a data model defined in spreadsheets into a DDL script that can be executed to create tables on PostgreSQL. I am using Pentaho Data Integration Community Edition for this exercise.

Creating Data Models in Spreadsheets

While creating data models, it is usually easier to create a data model using spreadsheets. I typically use multiple sheets in the spreadsheet for each table, list the column names and data types as descriptions.

The structure I use is as follows, with one sample row of data

ID AttributeName DataType DataWidth Description Dimension SourceColumns ExtractionMethod
1 W_ATTRIB_1 Numeric 4




Here is a sample fact table shown in Excel



Here is a Dimension table (its the same structure except the name ends in "_D" instead of "_F" based on naming conventions.


The problem with Spreadsheets

The problem with spreadsheets is of course creating the final SQL script is not straightforward. For this reason, I am creating the transformation in an ETL tool, so that it can be maintained and used over and over again.

Lets walk through the high level steps for the transformation.

High level steps

The high level steps in the ETL transformation are as follows.

1. Read all the spreadsheet(s) sitting in one folder, and read all the sheets in the spreadsheet.
2. Filter the sheets to be processed.
3. Add constants
4. Concatenate Fields
5. Sorting the rows
6. Denormalizing the rows
7. Concatenating the final SQL
8. Outputting to a text file

Here is a picture of the transformation



Reading all the spreadsheets in the folder

The first step is to read all the spreadsheets in a folder, as well as all sheets in each spreadsheet file. Since this step is an important and big enough step, I have posted it as a separate post on my blog.

Filter the sheets to be processed by the transformation

Since I may have multiple sheets in each spreadsheet, and only some may be relevant in the model, I added a step to Filter Rows. Filter Rows is available under the Flow group of transformers on the Design tab.


Click on Edit Step to configure this step. As you can see, I have added two filters to only allow sheets in each file that either end with _D or _F.


Adding some constants

Next step was to add some constants that I need at multiple places in the transformation to fully form the SQL. The Add Constants step can be found under the "Transform" group of steps under the Design tab.


The constants I added were the following:


#Constant NameValue
1.TableColumnKey TabColKey
2.OpenParanthesis (
3.ClosedParanthesis)
4.CreateTable CREATE TABLE
5.Semicolon ;
6.Space




Click Ok to continue. Next step is to concatenate fields to form column definitions.

Concatenating Fields to form Column Definitions

I used the "Concat Fields" step under the Transform group of steps on the Design tab as shown below.



After dragging and connecting it to the previous step, right click and select Edit Step. Enter the following details on the dialog box

1. TargetFieldName: TableColumnDefinition
2. Separator: or blank

Here are the input columns I concatenated, in the following order.

1. AttributeName
2. Space
3. DataType
4. OpenParanthesis
5. DataWidth
6. ClosedParanthesis

 This will create a column called TableColumnDefinition concatenating all the above fields in listed order.


Next we need to prepare to flatten the rows. Prior to feeding the rows into the Denormalizer, we need to sort these.

Sorting the definitions by Table name

The Sort Rows step is also present under the Transform group of steps. Drag and connect it to the previous step.


Right click and Edit step to make the following entries. The fields need to be in the order listed below.

1. TableName
2. ID

This will sort the input rows accordingly. Click Ok to continue.



Denormalizing the rows.

This is the most important step in this entire transformation. Drag and connect the Row Denormalizer step present under Transform steps, to the previous steps.

Right-Click and select Edit Step to continue.



On this dialog box, we will enter the following details

1. The Key Field: TableColumnKey (This is the constant we introduced in previous steps and is same for all input rows)

2. GroupField: TableName (We want to select all rows having the same TableName to be merged into a single row)

3. Target Fields: (We will enter only one target field with the following values)

a. TargetFieldName: AllColumns (Each output row will now have this additional column)

b. ValueFieldName: TableColumnDefinition (This is the concatenated column we created in a previous step)

c. Length: 5000 (We need space for long table statements)

d. Aggregation: Concatenate strings separated by , (This will take individual column definitions for a given table name, and concatenate them with comma separations, creating a list of column definitions)

Click Ok to continue.



Constructing the Full SQL


The last step before writing to file is to construct the full SQL. We will concatenate the following with a space between them. Enter the following details

1. TargetFieldName: FullSQL
2. Length of Target Field: 5000
3. Separator: " " (Single Space)
4. Fields:
a. CreateTable
b. TableName
c. OpenParanthesis
d. AllColumns
e. ClosedParanthesis
f. SemiColon



Writing to file

Last step in this transformation is writing to file. Drag and connect a Text File Output step from the Output group of steps.


Enter the following

1. Name of file: Your choice
2. Extension: sql



On the Content tab, I made no changes.


Finally on the Fields tab, we only need one output column with following details

1. Name: FullSQL
2. Length: 5000


Thats it. Save the tranformation and execute.


{ Read More }