Difference between Line Termination or Endings in Windows '/r/n' and UNIX '/n'. Different types of Line systems.

Hi Everyone in todays post, I will explore the Line Endings or End of Line (EOL) in different system and how to identify them -

First thing to note is -
0d stands for Carriage Return - CR
0a stands for Line Feed - LF

In Windows System when we press ENTER KEY a new line is represented with Hex control character of 0d and 0a.

In UNIX system, when we press ENTER KEY a new line is represented with Hex control character of 0a.

OS X also uses a single LF character, and classic Mac operating system used a single CR character for line breaks

Here (in Windows) we will use the below Text to create a file
First Line then Enter Key pressed
Second Line then Enter Key pressed


HEXADECIMAL View of Text File Created in WINDOWS system 

HEXADECIMAL View of Text File Created in WINDOWS system
 As we can see, for the file created in Windows system new line is represented by the characters 0d and 0a which is Carriage return and Line Feed

The Story of JavaScript - How did JavaScript originate and evolve

Hi Guys, in this post I will explore how JavaScript came into existence, as we all know, JavaScript is the world's most popular programming language, its good to know its history and it goes as below -

JavaScript is a client side scripting language developed by Brendan Eich of Netscape Corporations under the name Mocha.

Mocha was later renamed to LiveScript, and then finally to JavaScript mainly as was it was influenced by the Java programming language. 

LiveScript was the official name when it first shipped in beta releases of Netscape Navigator 2.0 in September 1995, it was renamed JavaScript in a joint announcement with Sun Microsystems on December 4, 1995 when it was deployed in the Netscape browser version 2.0 .

The change of name from LiveScript to JavaScript coincided with Netscape adding support for Java technology in its Netscape Navigator web browser. 

When to use Xml and when to use JSON

 

XML

JSON

You need message validation

You don't need Messages to be validated

XML transfer is slower then JSON since the file size is relatively compared to JSON.

JSON is a good if you want to transmit data faster from client to server, due to reduced file size

You need to transform the XML i.e. if  using XSLT

You're not transforming messages, or transforming their de serialization is simple

Your messages include a lot of marked-up text

Your messages are mostly data, not marked-up text

You need to interoperate with environments that don't support JSON

The messaging endpoints have good JSON tools

Used when objective is to carry or store data

Used when objective is to display the Data

When there is no concern for reduced file/transfer size.

When there is a requirement for reduced file/transfer size.

Processing is slower since XML has to be parsed with XML parser.

Processing is faster since JSON can be parsed by a standard JavaScript function.

 

Difference between XML and JSON

XML

JSON

XML is more verbose than JSON

JSON is less verbose than XML

XML is tree based

JSON’s data structure is a map

Xml was designed to carry or store data.

JSON was designed to carry and display data.

Xml is based on SGML

JSON is text based following Java Script Object Notation.

Xml supports namespace

JSON doesn’t support any namespace

Xml supports comments

JSON doesn’t supports comments.

Xml supports Start and End Tags

JSON doesn’t support End tags

Xml doesn’t support array

JSON supports array

XML has to be parsed with XML parser.

JSON can be parsed by a standard JavaScript function.

Parsing process -

Fetch an XML document

Use the XML DOM to loop through the document

Extract values and store in variables

Parsing process -

Fetch a JSON string

Parse the JSON string

 

Xml parsing is slower since DOM parsing is slower.

JSON Parsing is faster since its based on format of Javascript object.

Xml message validation is supported using XML schemas

JSON validation is supported using JSON Schema, but it is not comprehensive compared to XSD

Xml can be easily transformed using XSLT

No Transformation is available.

How to Save or Read PDF or any File to or from a varbinary column in Sql Server - simplest C# code

Hi Guys, This post is a continuation to my earlier post where I wrote about searching for text in pdf files, In my earlier post I had shared query to insert the pdf's using Sql Server Open Rowset.

This post will explore saving and retrieving pdf files to or from a database table - In this sample code I have hard coded the values for better understanding, in real time we fetch these values from a database table or an excel.

The below code is for a Console Application -
Here the column "fileContent" is of type varbinary.

How to Search for Text inside PDF Files in SQL Serve part2 – Solution to Syntax error near '' in the full-text search condition '’ in Sql Server

Hi Guys, In my previous post
http://pnsoftwarestudies.blogspot.com/2017/03/how-to-search-for-text-inside-pdf-files.html

I had documented in detail on how to implement search inside pdf files, the full text query shared supported searching for a single word,  but when we try to search with multiple words, we will face below error as -

Msg 7630, Level 15, State 3, Line 40
Syntax error near 'are' in the full-text search condition 'brothers are'.

Syntax error near '' in the full-text search condition

How to Search for Text inside PDF Files in SQL Server – Configuring Adobe PDF iFilter and implementing Full Text Search

Hi Guys,  In this post I will explore the implementation details for searching the contents inside the pdf's,
Writing this post based on a real-time requirement in my project, the requirement was to provide a UI where the user can enter the text to search, and display the results i.e. pdf's in a grid view that contains the search keyword with the option to download the pdf files.

Initial plan was to search by reading the pdf's from physical file system one by one, but since No of pdfs were large we decided to store the pdf files in the database.

Below Third-party libraries options were initially explored for searching pdf 's stored in File system –

Sl No
Library
Type
Remarks
1
iText
Paid

2
BitMiracle
Paid

3
FreeSpire.PDF
Free
Page limit per pdf is limited to 10 Pages in the Free version
4
Spire.PDF
Paid


To Search pdf files a software called as PDF iFilter is provided by Adobe so that we can search for pdf files that was stored and indexed in Sql Server.
Adobe PDFiFilter provides the ability for SQL Server to read the pdf contents.
Adobe PDFiFilter uses the Microsoft iFilter interface and allows third-party indexing tools to extract text from Adobe PDF files.

Below steps will all the configurations steps for configuring the Adobe PDF iFilter -  

Step 1) Full Text Search Installation check -

To check whether Full Text Search is installed or not, query the IsFullTextInstalled parameter.
select serverproperty('IsFullTextInstalled')
It should return 1
If it returns 0, the feature needs to be installed from SQL Server installation. install the Full Text Search in the feature selection page of Sql server installation


Configure or View SharePoint Diagnostic Logging Location in SharePoint Server 2010 2013 2016

As we all know that the Default SharePoint log files are saved at
C:\Program files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS

The Sharepoint LOGS folder contains
log files (.log),
data files (.txt), and
usage files (.usage)

This post explores how to view and modify the Default SharePoint Log Location -

Step 1) Open SharePoint Central Administration for the SharePoint farm, browse to Monitoring in the Central Administration

Configure or View SharePoint Diagnostic Logging Location

Difference between include and import elements in XML Schema - XSD with Example

As we all know that include and import elements in a xsd is used to reference schema components from another schema,
In this post I will explore the difference between them and when to use what with simple examples and how we can use the same in BizTalk Server.

Include element - include refers to declarations or definitions that are from same namespace or a no target namespace.
That is if the Schema being added also contains elements with same namespace then we can directly include it.
XSD Include means Importing types from another schema within the SAME namespace
When we are referring to the declarations or definitions from the same namespaces then we use Include element.

Import element - import refers to declarations or definitions that are from a different target namespace.
The import element is used to add multiple schema's with different target namespace to a document.
XSD Import means Importing types from another schema/namespace
When we are referring to the declarations or definitions from different namespaces then we use Import element.

Different Types of Selectors in CSS. Difference Between Class Selector - ID Selector - Element Selector - Grouped Selector - Universal Sector - Child Selector - Descendant Selector - Adjacent Sibling Selector - General Sibling Selctor in CSS


CSS selectors are used to define the HTML elements to which a set of CSS rules are applied.
That is we have multiple HTML Elements / Tags in HTML page, but if we need to set CSS properties to a set of specific html elements like p tags or set of elements like div tags etc then we go for CSS Selectors,

There are different types of selectors in CSS, This post explores all the CSS Selectors
  1. Class selector (.)
  2. ID selector (#)
  3. Element selector
  4. Grouped selector
  5. Universal selector (*)
  6. Child Selector (>)
  7. Descendant Selector (space)
  8. Adjacent Sibling Selector (+)
  9. General Sibling Selector (~)

1) Class selector (.)

Class selector finds elements with specific class across the HTML page and applies the CSS to the elements that have the respective class value set.

The class selector uses the HTML class attribute, and is defined with a dot i.e. "."
In the example below, all HTML elements with class="center" will be center-aligned:

Syntax - .className { Property: Value }
The CSS style will then be applied to all tags with class names mentioned above.