geeksprogrammings

Be The Geek

Import dbf database in sqlserver



Steps For Importing Dbf database into Sql Server

There is no appropriate way or direct way to do that but nothing is impossible so there is workaround that can be done to perform this task . Here is the steps :-

  • First we have to convert the .dbf format data into .csv format data
  • Then depending on table structure Create the Table in database one by one 
  • Then using import bulk options of sql server that accept the data in csv format we can easily insert data in sql server

Convert DBF to CSV

DBF Converter allows you convert a single dbf file or folder with dbf files to csv format from GUI or command line.
1. Select the dbf file or foder with dbf files for batch conversion.
2. Select the output csv file or folder for csv files for batch conversion.

Download Software 
dbf to csv conversion


3. Preview, select options for sorting, filtering data (if necessary)
You can also select/unselect columns, set order for columns.
common options for dbf to csv conversion

4. Select options for csv format:columns delimiter, rows delimiter (if necessary), and click "Finish"

CSV file format options


Import CSV File Into SQL Server Using Bulk Insert


 CSV stands for Comma Separated Values, sometimes also called Comma Delimited Values.

Steps For Importing CSV in Sql server 

  • Create The table whose data we are going to import into database

USE TestData
GO
CREATE TABLE
CSVTest
(ID INT,
FirstName VARCHAR(40),
LastName VARCHAR(40),
BirthDate SMALLDATETIME)
GO


where TestData is database name and CSVTest is table name
  • I assume your .Csv file lies in c:\csvtest.txt and it contains data like this

    1,James,Smith,19750101
    2,Meggie,Smith,19790122
    3,Robert,Smith,20071101
    4,Alex,Smith,20040202




  • Then Run the following script in the query windows of sql server . Make sure your paths given are correct to .csv file

    Code


    BULK
    INSERT
    CSVTest
    FROM 'c:\csvtest.txt'
    WITH
    (
    FIELDTERMINATOR = ',',
    ROWTERMINATOR = '\n'
    )
    GO
    --Check the content of the table.
    SELECT *
    FROM CSVTest
    GO
    --Drop the table to clean up database.
    DROP TABLE CSVTest
    GO

    Snapshot








using git making pull request and troubleshoot errors

Today I am going to share some most simple and easy steps how to use git . 

How we can get a git repository data on our Personal computer 
How to make changes to these files and then how to propose that merging of files to repository from where you have downloaded it 
How to deal or remove some every basic errors that came during this process

So lets start --
  • First of all go to link of directory or as we say repository on github like i am doing this for a MonoWeb Repository on link below
                             https://github.com/mono/webiste
Ths repository is repository of official website of Mono https://www.mono-project.com/ 

  • First of the the thing you must have is gitbash . You can Download and setup gitbash from  here :-
1.  Download Git for Windows here:
I downloaded Git-1.7.6-preview20110708.exe. It contains the  full installer for official Git 1.7.6
2.  Follow the instructions here exactly as it says.
3.  Be sure to select these options:
- Use Git Bash only
- Checkout Windows-style, commit Unix-style line ending

After Succesfully instaling git . You will having gitbash application we will be using it in our futher article 

These steps will also give Solution to error that came during pull or pushing data to git or cloning data from git . follow these simple steps will be answer for that .

Errors like 


not a valid object name 'master'


First go to the website or file on github like i goto github.com/mono/webite and on the top there will something written Fork click on it then website will be forked to your github account like my repository is forked to  https://github.com/bhallaheemanshu/webiste

Step 1first create a directory say website



Step 2
get inside the directory using change directory command as show in image below 

Then clone the directory using following command with url from where you want to clone the data 


Step 3
now again website you are cloned will be cloned inside your website directory get inside it and fire the command to add upstream



Step 4
Now fetch the brancher available using fetch upstream command


Step 5 
Now Make some change to your files all the editing or insertion or new thing yo want to create

Step 6
Now pusht the repository you edited on your personal computer to the online repository to propose the changes
 

Step 7
Now all changes that i want to do are done and saved on my files that i have forked here at github.com/bhallaheemanshu/website

So to do them also on github.com/mono/website Login to your account and go to website repository or website original community like i am going to or goto link like i am going to github.com/mono/website  then click on pull requests then click on create pull request 
Then it choose your branch there and then it will show automatically what changes you are propsing then write the title and some summery and click on create . Now your request for proposing changes to online repository will be done












Setting Up Path Variable windows


Setting Up Path Variables For Ruby 

Setting Up Path Variables For Python

Path variables are must need to setup whenever you are installing some developement platforms like android , java , Python , Ruby .

Today i have some task related to installation of Ruby and using the jekyll for some configuration a website so I decided to taste the task

Here is the Installation procedure for installing Python , Installing Ruby and setting up jekyll

Setting Up Jekyll , Python , Ruby

To set up your path variables you follow these steps


  1. Right on mycomputer 
  2. click on properties 
  3. click on Advanced settings
  4. Click on Environment Variables
  5. Now Search for Path System variable
  6. and hit enter on it
  7. Now in value field fill values for python and ruby installation at end of values already filled

C:\ruby\bin;C:\Python27;C:\Python27\Scripts;


These values will be filled according to where you have installed Ruby and python

Installing Python and Easy_install


Today i am going to touch the Python . I am having some task regarding configuration of a website so for that i have to use Python . I have never used it . But as a Programmer Saying - 

The More Time We have Spent on First programming language More Fastly we can do other 

Today i am going to test this saying

So Lets get started with the work --

Install Python

  • First of all Go to http://www.python.org/download/
  • Download appropriate version of Python windows installer, e.g. Python 2.7.6 Windows Installer.I prefer to install python 2 as currently python 3 is creating some problem .

Install

  • For Python Installation Set the installation directory (e.g. C:\Python27) to PATH. (How to? See Troubleshooting #1)
  • Verify Python installation

python --version


Example output:

  • If your installation is done properly then it will show message as below .

Python 2.7.6


Install ‘Easy Install’


python “C:\ez_setup.py”


  • Add ‘Python Scripts’ directory (e.g. C:\Python27\Scripts) to PATH.

Install Pygments


  • Verify easy_install is installed properly

easy_install --version

  • Example output:

setuptools 3.1


Install Pygments using “easy_install”


easy_install Pygments

Installing jekyll on windows

Install Ruby

while installation of ruby you may suffer from some errors like

bundle-command-not-found-windows-x64

Following the steps below carefully will be answer to these errors

  • Go to http://rubyinstaller.org/downloads/
  • In RubyInstallers section, click a version to download.
  • For example, Ruby 2.0.0-p451 (x64) is the Windows installer for Ruby 2.0.0 x64 on 64-bit machines. These are installers that i am going to use.
  • Complete the installtion by going through installer that you have downloaded
  • At time of installing Keep the default directory  to C:\Ruby200-x64 if possible, please note installer advises that 'Please avoid any folder name that contains spaces (e.g. My Ruby).'
  • Markt he checkbox saying "Add Ruby executables to your PATH" , so PATH will be updated automatically to avoid headaches.
  • Open up a command prompt window by pressing ctrl + r from your keyword and type in cmd and hit enter this will open command prompt and type in the following command, to see if Ruby has been install correctly or not.

Ruby installtion Setting Up jekyll
Ruby Installation - Installing jekyll
                              

ruby -v                                                                              



Example output:
If ruby is installed correctly it will give you output as -

ruby 2.0.0p451 (2014-02-24) [x64-mingw32]


Install DevKit



  • The DevKit is a toolkit that makes it easy to build and use native C/C++ extensions for Ruby on Windows. 
  • Now first Go to http://rubyinstaller.org/downloads/ again.
  • Download “DEVELOPMENT KIT” installer that matches the Windows architecture and the Ruby version just installed. For instance, DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe is for 64-bit Windows with Ruby 2.0.0 x64. These are versions that i am using

  • Here is a list about how to choose the correct DevKit version:
  1. Ruby 1.8.6 to 1.9.3: DevKit tdm-32-4.5.2
  2. Ruby 2.0.0: DevKit mingw64-32-4.7.2
  3. Ruby 2.0.0 x64: DevKit mingw64-64-4.7.2
  • Run the installer and extract it to a folder, e.g. C:\DevKit.
  • Initialize and create config.yml file. Type in the following commands in command Prompt window:


cd “C:\DevKit”
ruby dk.rb init
notepad config.yml



  • In opened notepad window, add a new line - C:\Ruby200-x64 at the end, SAVEand close.



  • Back to the Command Prompt, review (optional) and install.


ruby dk.rb review

ruby dk.rb install


Install Jekyll



  • Verify that gem has been installed properly


gem -v


Example output:

2.0.14
Install Jekyll gem
gem install jekyll


Install Python

Here is link on my blog about its installation or you can follow steps below
Installing Python and Easy_install
  • First of all Go to http://www.python.org/download/
  • Download appropriate version of Python windows installer, e.g. Python 2.7.6 Windows Installer.I prefer to install python 2 as currently python 3 is creating some problem .


Install

  • For Python Installation Set the installation directory (e.g. C:\Python27) to PATH. (How to? See Troubleshooting #1)
  • verify Python installation

python --version


Example output:

  • If your installation is done properly then it will show message as below .

Python 2.7.6


Install ‘Easy Install’

  • Visit https://pypi.python.org/pypi/setuptools#installation-instructions for detailed installation instructions.
  • For Windows 7 machines, download ez_setup.py and SAVE it, for example, to C:\. Then run it using Python in a command prompt window:

python “C:\ez_setup.py”


  • Add ‘Python Scripts’ directory (e.g. C:\Python27\Scripts) to PATH.

Install Pygments

  • Verify easy_install is installed properly

easy_install --version

  • Example output:

Install Pygments using “easy_install”


easy_install Pygments


Start Jekyll



  • Following the commands on official Jekyll Quick-start guide, a new Jekyll blog should be created and can be browsed at localhost:4000.

jekyll new myblog
cd myblog
jekyll serve


  • Now Everything is done Everytime you want to Start you already built website or new website with jekyll you just start your command prompt navigate to your website's root directory like

cd mywebsite



  • Then type in :-  'jekyll serve' and that's it yout server will be started in few seconds and after that you can navigate to your browser with url as -

http://localhost:4000/

Setting Up Path Variables For Python and Ruby